summaryrefslogtreecommitdiff
path: root/compile.c
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
commit38c62063c085ddf592461435bfa379de91851e65 (patch)
treea035fb1f593f07c04e8c9cad8eca3b92d1d60398 /compile.c
parent92b81dc5972607f745d26b8a7a83166ff0fa354b (diff)
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 'compile.c')
-rw-r--r--compile.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/compile.c b/compile.c
index e7fd0a0201..2255486175 100644
--- a/compile.c
+++ b/compile.c
@@ -1227,7 +1227,7 @@ new_child_iseq(rb_iseq_t *iseq, const NODE *const node,
rb_ast_body_t ast;
ast.root = node;
- ast.reserved = 0;
+ ast.compile_option = 0;
debugs("[new_child_iseq]> ---------------------------------------\n");
ret_iseq = rb_iseq_new_with_opt(&ast, name,
@@ -7098,26 +7098,6 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
break;
}
- case NODE_PRELUDE:{
- const rb_compile_option_t *orig_opt = ISEQ_COMPILE_DATA(iseq)->option;
- rb_compile_option_t new_opt = *orig_opt;
- if (node->nd_compile_option) {
- rb_iseq_make_compile_option(&new_opt, node->nd_compile_option);
- ISEQ_COMPILE_DATA(iseq)->option = &new_opt;
- }
- if (!new_opt.coverage_enabled) ISEQ_COVERAGE_SET(iseq, Qfalse);
- CHECK(COMPILE_POPPED(ret, "prelude", node->nd_head));
- CHECK(COMPILE_(ret, "body", node->nd_body, popped));
- ISEQ_COMPILE_DATA(iseq)->option = orig_opt;
- /* Do NOT restore ISEQ_COVERAGE!
- * If ISEQ_COVERAGE is not false, finish_iseq_build function in iseq.c
- * will initialize the counter array of line coverage.
- * We keep ISEQ_COVERAGE as nil to disable this initialization.
- * This is not harmful assuming that NODE_PRELUDE pragma does not occur
- * in NODE tree except the root.
- */
- break;
- }
case NODE_LAMBDA:{
/* compile same as lambda{...} */
const rb_iseq_t *block = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);