[Bug #19549] Check for variables to be interpolated
This commit is contained in:
parent
05aaff2191
commit
bd046764e3
Notes:
git
2023-09-07 06:07:58 +00:00
18
parse.y
18
parse.y
@ -5432,24 +5432,10 @@ string_dend : tSTRING_DEND
|
|||||||
| END_OF_INPUT
|
| END_OF_INPUT
|
||||||
;
|
;
|
||||||
|
|
||||||
string_dvar : tGVAR
|
string_dvar : nonlocal_var
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_GVAR($1, &@$);
|
if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
|
||||||
/*% %*/
|
|
||||||
/*% ripper: var_ref!($1) %*/
|
|
||||||
}
|
|
||||||
| tIVAR
|
|
||||||
{
|
|
||||||
/*%%%*/
|
|
||||||
$$ = NEW_IVAR($1, &@$);
|
|
||||||
/*% %*/
|
|
||||||
/*% ripper: var_ref!($1) %*/
|
|
||||||
}
|
|
||||||
| tCVAR
|
|
||||||
{
|
|
||||||
/*%%%*/
|
|
||||||
$$ = NEW_CVAR($1, &@$);
|
|
||||||
/*% %*/
|
/*% %*/
|
||||||
/*% ripper: var_ref!($1) %*/
|
/*% ripper: var_ref!($1) %*/
|
||||||
}
|
}
|
||||||
|
@ -1443,6 +1443,11 @@ x = __ENCODING__
|
|||||||
assert_equal(expected, obj.arg)
|
assert_equal(expected, obj.arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_ungettable_gvar
|
||||||
|
assert_syntax_error('$01234', /not valid to get/)
|
||||||
|
assert_syntax_error('"#$01234"', /not valid to get/)
|
||||||
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
def test_past_scope_variable
|
def test_past_scope_variable
|
||||||
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
|
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user