Skip to content

Commit

Permalink
ripper: Fix opassign when assignment to backref variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed May 12, 2024
1 parent a1fb6cc commit 5695c5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion parse.y
Expand Up @@ -3382,7 +3382,7 @@ command_asgn : lhs '=' lex_ctxt command_rhs
rb_backref_error(p, $1);
/*% %*/
$$ = NEW_ERROR(&@$);
/*% ripper[error]: backref_error(p, $1, assign!(var_field(p, get_value($:1)), $:4)) %*/
/*% ripper[error]: backref_error(p, $1, opassign!(var_field(p, get_value($:1)), $:2, $:4)) %*/
}
;

Expand Down
2 changes: 1 addition & 1 deletion test/ripper/test_parser_events.rb
Expand Up @@ -289,7 +289,7 @@ def test_assign_error_backref
result =
parse('$& += cmd 1, 2', :on_assign_error) {thru_assign_error = true}
assert_equal true, thru_assign_error
assert_equal '[assign_error(assign(var_field($&),command(cmd,[1,2])))]', result
assert_equal '[assign_error(opassign(var_field($&),+=,command(cmd,[1,2])))]', result
end

def test_assign_error_const_qualified
Expand Down

0 comments on commit 5695c5d

Please sign in to comment.