[Bug #19025] Numbered parameter names are always local variables

This commit is contained in:
Nobuyoshi Nakada 2023-05-14 22:16:15 +09:00
parent bdaa491565
commit 91c004885f
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
Notes: git 2023-05-14 14:24:46 +00:00
2 changed files with 2 additions and 1 deletions

View File

@ -9749,7 +9749,7 @@ parse_ident(struct parser_params *p, int c, int cmd_state)
if (result == tCONSTANT && is_local_id(ident)) result = tIDENTIFIER;
if (!IS_lex_state_for(last_state, EXPR_DOT|EXPR_FNAME) &&
(result == tIDENTIFIER) && /* not EXPR_FNAME, not attrasgn */
lvar_defined(p, ident)) {
(lvar_defined(p, ident) || NUMPARAM_ID_P(ident))) {
SET_LEX_STATE(EXPR_END|EXPR_LABEL);
}
return result;

View File

@ -1672,6 +1672,7 @@ eom
}
assert_valid_syntax("proc {def foo(_);end;_1}")
assert_valid_syntax("p { [_1 **2] }")
end
def test_value_expr_in_condition