/*
* call-seq:
* Node.compile_string(str) => Node
*
* Compile a string into a node.
*/
static VALUE node_compile_string(int argc, VALUE * argv, VALUE self)
{
NODE * node;
VALUE str = Qnil, file = Qnil, line = Qnil;
rb_scan_args(argc, argv, "12", &str, &file, &line);
file = NIL_P(file) ? rb_str_new2("(compiled)") : file;
line = NIL_P(line) ? INT2NUM(1) : line;
node = rb_compile_string(STR2CSTR(file), str, NUM2INT(line));
#ifdef RUBY_HAS_YARV
if(!node)
{
rb_exc_raise(GET_THREAD()->errinfo);
}
#else
if(ruby_nerrs > 0)
{
ruby_nerrs = 0;
compile_error(0);
}
#endif
return wrap_node(node);
}