diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-12 03:29:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-12 03:29:50 +0000 |
commit | 9e909c3e8440a78cbfe4da06492af0bb2c0cca75 (patch) | |
tree | e4390ff5752c2eb306fbe05eb18f37166c66bbf1 /parse.y | |
parent | 96f5fe099d14c6e87550c57e695aa95cd7d17bb5 (diff) | |
download | ruby-9e909c3e8440a78cbfe4da06492af0bb2c0cca75.tar.gz |
parse.y: const_decl_gen
* parse.y (const_decl_gen): extract as a function as well as
ripper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -488,9 +488,8 @@ static NODE *new_const_op_assign_gen(struct parser_params *parser, NODE *lhs, ID #define const_path_field(w, n) NEW_COLON2(w, n) #define top_const_field(n) NEW_COLON3(n) -#define const_decl(path) ( \ - ((in_def || in_single) ? yyerror("dynamic constant assignment") : (void)0), \ - NEW_CDECL(0, 0, (path))) +static NODE *const_decl_gen(struct parser_params *parser, NODE* path); +#define const_decl(path) const_decl_gen(parser, path) #define var_field(n) (n) #define backref_assign_error(n, a) (rb_backref_error(n), NEW_BEGIN(0)) @@ -10232,6 +10231,15 @@ new_const_op_assign_gen(struct parser_params *parser, NODE *lhs, ID op, NODE *rh fixpos(asgn, lhs); return asgn; } + +static NODE * +const_decl_gen(struct parser_params *parser, NODE *path) +{ + if (in_def || in_single) { + yyerror("dynamic constant assignment"); + } + return NEW_CDECL(0, 0, (path)); +} #else static VALUE new_op_assign_gen(struct parser_params *parser, VALUE lhs, VALUE op, VALUE rhs) |