aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-05 08:59:23 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-05 08:59:23 +0000
commit4616152f55ece5806733955d824dafedb3b429c0 (patch)
treea035fb1f593f07c04e8c9cad8eca3b92d1d60398 /parse.y
parentd0c6bd5624941d65eb30bb3e15fd330480971d59 (diff)
downloadruby-4616152f55ece5806733955d824dafedb3b429c0.tar.gz
node.h: remove NODE_PRELUDE
NODE_PRELUDE contains a `BEGIN` node, a main node, and compile_option. This node is assumed that it must be located immediately under the root NODE_SCOPE, but this strange assumption is not so good, IMO. This change removes the assumtion; it integrates the former two nodes by block_append, and moves compile_option into rb_ast_body_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 6 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index 6df4a3b2ca..69632a49cd 100644
--- a/parse.y
+++ b/parse.y
@@ -5646,7 +5646,7 @@ yycompile0(VALUE arg)
mesg = rb_class_new_instance(0, 0, rb_eSyntaxError);
}
rb_set_errinfo(mesg);
- return 0;
+ return FALSE;
}
tree = ruby_eval_tree;
if (!tree) {
@@ -5658,12 +5658,14 @@ yycompile0(VALUE arg)
NODE *body = parser_append_options(parser, tree->nd_body);
if (!opt) opt = rb_obj_hide(rb_ident_hash_new());
rb_hash_aset(opt, rb_sym_intern_ascii_cstr("coverage_enabled"), cov);
- prelude = NEW_PRELUDE(ruby_eval_tree_begin, body, opt);
+ prelude = block_append(ruby_eval_tree_begin, body, &body->nd_loc /* dummy location */);
add_mark_object(opt);
prelude->nd_loc = body->nd_loc;
tree->nd_body = prelude;
+ parser->ast->body.compile_option = opt;
}
- return (VALUE)tree;
+ parser->ast->body.root = tree;
+ return TRUE;
}
static rb_ast_t *
@@ -5675,7 +5677,7 @@ yycompile(VALUE vparser, struct parser_params *parser, VALUE fname, int line)
ruby_sourceline = line - 1;
parser->ast = ast = rb_ast_new();
- ast->body.root = (NODE *)rb_suppress_tracing(yycompile0, (VALUE)parser);
+ rb_suppress_tracing(yycompile0, (VALUE)parser);
parser->ast = 0;
RB_GC_GUARD(vparser); /* prohibit tail call optimization */