1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

parse.y: new_attr_op_assign in ripper needs symbol

* parse.y (command_asgn, arg): new_attr_op_assign in ripper
  expects a Symbol VALUE as the operator, not an ID, so convert
  literal IDs to Symbols.  [ruby-core:78069] [Bug #12916]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-11-10 07:47:44 +00:00
parent 25aeeca5b7
commit 04a4fd8957

View file

@ -741,6 +741,8 @@ static VALUE parser_heredoc_dedent(struct parser_params*,VALUE);
#define FIXME 0
#else
#define ripper_id2sym(id) id
#endif /* RIPPER */
#ifndef RIPPER
@ -1366,7 +1368,7 @@ command_asgn : lhs '=' command_rhs
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
{
value_expr($5);
$$ = new_attr_op_assign($1, idCOLON2, $3, $4, $5);
$$ = new_attr_op_assign($1, ripper_id2sym(idCOLON2), $3, $4, $5);
}
| backref tOP_ASGN command_rhs
{
@ -2051,7 +2053,7 @@ arg : lhs '=' arg_rhs
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
{
value_expr($5);
$$ = new_attr_op_assign($1, idCOLON2, $3, $4, $5);
$$ = new_attr_op_assign($1, ripper_id2sym(idCOLON2), $3, $4, $5);
}
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
{