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
This commit is contained in:
mame 2018-01-05 08:59:23 +00:00
parent 92b81dc597
commit 38c62063c0
7 changed files with 14 additions and 77 deletions

5
node.h
View file

@ -216,8 +216,6 @@ enum node_type {
#define NODE_DSYM NODE_DSYM
NODE_ATTRASGN,
#define NODE_ATTRASGN NODE_ATTRASGN
NODE_PRELUDE,
#define NODE_PRELUDE NODE_PRELUDE
NODE_LAMBDA,
#define NODE_LAMBDA NODE_LAMBDA
NODE_LAST
@ -458,7 +456,6 @@ typedef struct RNode {
#define NEW_PREEXE(b) NEW_SCOPE(b)
#define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
#define NEW_PRELUDE(p,b,o) NEW_NODE(NODE_PRELUDE,p,b,o)
#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
#define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
@ -469,7 +466,7 @@ typedef struct node_buffer_struct node_buffer_t;
/* T_IMEMO/ast */
typedef struct rb_ast_body_struct {
const NODE *root;
VALUE reserved;
VALUE compile_option;
} rb_ast_body_t;
typedef struct rb_ast_struct {
VALUE flags;