[Bug #20417] Block local variables do not need to warn about unused
This commit is contained in:
parent
5d9fd674c9
commit
207788466e
4
parse.y
4
parse.y
@ -13814,6 +13814,10 @@ new_bv(struct parser_params *p, ID name)
|
|||||||
}
|
}
|
||||||
if (!shadowing_lvar_0(p, name)) return;
|
if (!shadowing_lvar_0(p, name)) return;
|
||||||
dyna_var(p, name);
|
dyna_var(p, name);
|
||||||
|
ID *vidp = 0;
|
||||||
|
if (dvar_defined_ref(p, name, &vidp)) {
|
||||||
|
if (vidp) *vidp |= LVAR_USED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1232,6 +1232,12 @@ dummy
|
|||||||
EXP
|
EXP
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_unused_block_local_variable
|
||||||
|
assert_warning('') do
|
||||||
|
RubyVM::AbstractSyntaxTree.parse(%{->(; foo) {}})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def assert_error_tolerant(src, expected, keep_tokens: false)
|
def assert_error_tolerant(src, expected, keep_tokens: false)
|
||||||
begin
|
begin
|
||||||
verbose_bak, $VERBOSE = $VERBOSE, false
|
verbose_bak, $VERBOSE = $VERBOSE, false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user