summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 08:12:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 08:12:18 +0000
commit46603a78afde1386f92b38f9b16ca86daa93ad88 (patch)
treef3594fecc31b6f210f95143c7a20c2ea55ae68ce /iseq.c
parenta0d50fa3c494ea5afb98c05be049a0cde6fde28d (diff)
downloadruby-46603a78afde1386f92b38f9b16ca86daa93ad88.tar.gz
* include/ruby/{intern,ruby}.h, compile.[ch], error.c, eval.c,
eval_load.c, gc.c, iseq.c, main.c, parse.y, re.c, ruby.c, yarvcore.[ch] (ruby_eval_tree, ruby_sourcefile, ruby_sourceline, ruby_nerrs): purge global variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/iseq.c b/iseq.c
index 7e1b40c5fb..55ff9952b3 100644
--- a/iseq.c
+++ b/iseq.c
@@ -192,13 +192,13 @@ static VALUE
cleanup_iseq_build(rb_iseq_t *iseq)
{
struct iseq_compile_data *data = iseq->compile_data;
+ VALUE err = data->err_info;
iseq->compile_data = 0;
compile_data_free(data);
- if (ruby_nerrs > 0) {
- VALUE str = rb_str_buf_new2("compile error");
- ruby_nerrs = 0;
- rb_exc_raise(rb_exc_new3(rb_eSyntaxError, str));
+ if (RTEST(err)) {
+ rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->filename);
+ rb_exc_raise(err);
}
return Qtrue;
}
@@ -375,7 +375,11 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
}
if (st_lookup(type_map, type, &iseq_type) == 0) {
- rb_raise(rb_eTypeError, "unsupport type: %p", type);
+ const char *typename = rb_id2name(type);
+ if (typename)
+ rb_raise(rb_eTypeError, "unsupport type: :%s", typename);
+ else
+ rb_raise(rb_eTypeError, "unsupport type: %p", (void *)type);
}
if (parent == Qnil) {
@@ -404,11 +408,11 @@ iseq_s_load(int argc, VALUE *argv, VALUE self)
static NODE *
compile_string(VALUE str, VALUE file, VALUE line)
{
- NODE *node;
- node = rb_compile_string(StringValueCStr(file), str, NUM2INT(line));
+ VALUE parser = rb_parser_new();
+ NODE *node = rb_parser_compile_string(parser, StringValueCStr(file),
+ str, NUM2INT(line));
- if (ruby_nerrs > 0) {
- ruby_nerrs = 0;
+ if (!node) {
rb_exc_raise(GET_THREAD()->errinfo); /* TODO: check err */
}
return node;
@@ -822,7 +826,7 @@ ruby_iseq_disasm(VALUE self)
return str;
}
-char *
+const char *
ruby_node_name(int node)
{
switch (node) {