Remove duplicate value checks on mrhs
which always has the value
This commit is contained in:
parent
80e2242da6
commit
8057129da6
5
parse.y
5
parse.y
@ -1586,7 +1586,6 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
|
|||||||
| lhs '=' lex_ctxt mrhs
|
| lhs '=' lex_ctxt mrhs
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
value_expr($4);
|
|
||||||
$$ = node_assign(p, $1, $4, $3, &@$);
|
$$ = node_assign(p, $1, $4, $3, &@$);
|
||||||
/*% %*/
|
/*% %*/
|
||||||
/*% ripper: assign!($1, $4) %*/
|
/*% ripper: assign!($1, $4) %*/
|
||||||
@ -1595,7 +1594,6 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
|
|||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
YYLTYPE loc = code_loc_gen(&@5, &@6);
|
YYLTYPE loc = code_loc_gen(&@5, &@6);
|
||||||
value_expr($4);
|
|
||||||
$$ = node_assign(p, $1, NEW_RESCUE($4, NEW_RESBODY(0, remove_begin($6), 0, &loc), 0, &@$), $3, &@$);
|
$$ = node_assign(p, $1, NEW_RESCUE($4, NEW_RESBODY(0, remove_begin($6), 0, &loc), 0, &@$), $3, &@$);
|
||||||
/*% %*/
|
/*% %*/
|
||||||
/*% ripper: massign!($1, rescue_mod!($4, $6)) %*/
|
/*% ripper: massign!($1, rescue_mod!($4, $6)) %*/
|
||||||
@ -2861,6 +2859,7 @@ opt_block_arg : ',' block_arg
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* value */
|
||||||
args : arg_value
|
args : arg_value
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
@ -2891,10 +2890,12 @@ args : arg_value
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* value */
|
||||||
mrhs_arg : mrhs
|
mrhs_arg : mrhs
|
||||||
| arg_value
|
| arg_value
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* value */
|
||||||
mrhs : args ',' arg_value
|
mrhs : args ',' arg_value
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
|
@ -1231,10 +1231,12 @@ x = __ENCODING__
|
|||||||
assert_valid_syntax('let () { m(a) do; end }')
|
assert_valid_syntax('let () { m(a) do; end }')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_void_value_in_command_rhs
|
def test_void_value_in_rhs
|
||||||
w = "void value expression"
|
w = "void value expression"
|
||||||
ex = assert_syntax_error("x = return 1", w)
|
["x = return 1", "x = return, 1", "x = 1, return", "x, y = return"].each do |code|
|
||||||
assert_equal(1, ex.message.scan(w).size, "same #{w.inspect} warning should be just once")
|
ex = assert_syntax_error(code, w)
|
||||||
|
assert_equal(1, ex.message.scan(w).size, ->{"same #{w.inspect} warning should be just once\n#{w.message}"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def eval_separately(code)
|
def eval_separately(code)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user