mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
&. is not allowed inside LHS of massign
https://hackerone.com/reports/605262
This commit is contained in:
parent
42ac8890ef
commit
140b8117bd
2 changed files with 11 additions and 0 deletions
6
parse.y
6
parse.y
|
@ -1787,6 +1787,9 @@ mlhs_node : user_variable
|
||||||
}
|
}
|
||||||
| primary_value call_op tIDENTIFIER
|
| primary_value call_op tIDENTIFIER
|
||||||
{
|
{
|
||||||
|
if ($2 == tANDDOT) {
|
||||||
|
yyerror1(&@2, "&. inside LHS of multiple assignment");
|
||||||
|
}
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = attrset(p, $1, $2, $3, &@$);
|
$$ = attrset(p, $1, $2, $3, &@$);
|
||||||
/*% %*/
|
/*% %*/
|
||||||
|
@ -1801,6 +1804,9 @@ mlhs_node : user_variable
|
||||||
}
|
}
|
||||||
| primary_value call_op tCONSTANT
|
| primary_value call_op tCONSTANT
|
||||||
{
|
{
|
||||||
|
if ($2 == tANDDOT) {
|
||||||
|
yyerror1(&@2, "&. inside LHS of multiple assignment");
|
||||||
|
}
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = attrset(p, $1, $2, $3, &@$);
|
$$ = attrset(p, $1, $2, $3, &@$);
|
||||||
/*% %*/
|
/*% %*/
|
||||||
|
|
|
@ -976,6 +976,11 @@ eom
|
||||||
assert_valid_syntax("a\n.:foo")
|
assert_valid_syntax("a\n.:foo")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_safe_call_in_massign_lhs
|
||||||
|
assert_syntax_error("*a&.x=0", /LHS/)
|
||||||
|
assert_syntax_error("a&.x,=0", /LHS/)
|
||||||
|
end
|
||||||
|
|
||||||
def test_no_warning_logop_literal
|
def test_no_warning_logop_literal
|
||||||
assert_warning("") do
|
assert_warning("") do
|
||||||
eval("true||raise;nil")
|
eval("true||raise;nil")
|
||||||
|
|
Loading…
Add table
Reference in a new issue