ruby-changes:43804
From: nobu <ko1@a...>
Date: Fri, 12 Aug 2016 12:29:55 +0900 (JST)
Subject: [ruby-changes:43804] nobu:r55877 (trunk): parse.y: const_decl_gen
nobu 2016-08-12 12:29:50 +0900 (Fri, 12 Aug 2016) New Revision: 55877 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55877 Log: parse.y: const_decl_gen * parse.y (const_decl_gen): extract as a function as well as ripper. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 55876) +++ parse.y (revision 55877) @@ -488,9 +488,8 @@ static NODE *new_const_op_assign_gen(str https://github.com/ruby/ruby/blob/trunk/parse.y#L488 #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_pa https://github.com/ruby/ruby/blob/trunk/parse.y#L10231 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/