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
This commit is contained in:
parent
470564331d
commit
b4ac19f743
11
parse.y
11
parse.y
@ -2259,12 +2259,6 @@ arg : lhs '=' arg_rhs
|
|||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = match_op($1, $3);
|
$$ = 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);
|
$$ = dispatch3(binary, $1, ID2SYM(idEqTilde), $3);
|
||||||
%*/
|
%*/
|
||||||
@ -8975,7 +8969,10 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2)
|
|||||||
|
|
||||||
case NODE_LIT:
|
case NODE_LIT:
|
||||||
if (RB_TYPE_P(node1->nd_lit, T_REGEXP)) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user