diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-08 07:06:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-08 07:06:37 +0000 |
commit | b4ac19f743a8cb40814b14d777b0ae9f23e2b76e (patch) | |
tree | 6c759a5ecabbe1b6ea3968d4d7364b5b547aa1c1 /parse.y | |
parent | 470564331d2aadee9b045949c187e28f6a193d78 (diff) | |
download | ruby-b4ac19f743a8cb40814b14d777b0ae9f23e2b76e.tar.gz |
parse.y: named caputre into match_op_gen
* parse.y (match_op_gen): move making named capture assignment
nodes. remove repeated conditions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -2259,12 +2259,6 @@ arg : lhs '=' arg_rhs { /*%%%*/ $$ = match_op($1, $3); - if (nd_type($1) == NODE_LIT) { - VALUE lit = $1->nd_lit; - if (RB_TYPE_P(lit, T_REGEXP)) { - $$->nd_args = reg_named_capture_assign(lit); - } - } /*% $$ = dispatch3(binary, $1, ID2SYM(idEqTilde), $3); %*/ @@ -8975,7 +8969,10 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2) case NODE_LIT: if (RB_TYPE_P(node1->nd_lit, T_REGEXP)) { - return NEW_MATCH2(node1, node2); + const VALUE lit = node1->nd_lit; + NODE *match = NEW_MATCH2(node1, node2); + match->nd_args = reg_named_capture_assign(lit); + return match; } } } |