From 38c62063c085ddf592461435bfa379de91851e65 Mon Sep 17 00:00:00 2001 From: mame Date: Fri, 5 Jan 2018 08:59:23 +0000 Subject: 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 --- node.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'node.c') diff --git a/node.c b/node.c index 072f4f57b3..042d4724f6 100644 --- a/node.c +++ b/node.c @@ -101,37 +101,6 @@ struct add_option_arg { st_index_t count; }; -static int -add_option_i(VALUE key, VALUE val, VALUE args) -{ - struct add_option_arg *argp = (void *)args; - VALUE buf = argp->buf; - VALUE indent = argp->indent; - - A_INDENT; - A("+- "); - AR(rb_sym2str(key)); - A(": "); - A_LIT(val); - A("\n"); - return ST_CONTINUE; -} - -static void -dump_option(VALUE buf, VALUE indent, VALUE opt) -{ - struct add_option_arg arg; - - if (!RB_TYPE_P(opt, T_HASH)) { - A_LIT(opt); - return; - } - arg.buf = buf; - arg.indent = indent; - arg.count = 0; - rb_hash_foreach(opt, add_option_i, (VALUE)&arg); -} - static void dump_node(VALUE, VALUE, int, const NODE *); static const char default_indent[] = "| "; @@ -960,19 +929,6 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node) F_NODE(nd_args, "arguments"); return; - case NODE_PRELUDE: - ANN("pre-execution"); - ANN("format: BEGIN { [nd_head] }; [nd_body]"); - ANN("example: bar; BEGIN { foo }"); - F_NODE(nd_head, "prelude"); - if (!node->nd_compile_option) LAST_NODE; - F_NODE(nd_body, "body"); - if (node->nd_compile_option) { - LAST_NODE; - F_OPTION(nd_compile_option, "compile_option"); - } - return; - case NODE_LAMBDA: ANN("lambda expression"); ANN("format: -> [nd_body]"); -- cgit v1.2.3