diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-02-27 12:42:07 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-02-27 18:00:43 +0000 |
| commit | e14a68a1bf2fa1350deae169eb9a90e95f839b3c (patch) | |
| tree | 021c68fd6881e00b0243feb9276c1a75eead1c53 | |
| parent | 11f121364ab0b113bcc721ed375a321148e0e8f5 (diff) | |
[ruby/prism] Disallow it implicit in eval
https://github.com/ruby/prism/commit/6fcb8fc974
| -rw-r--r-- | prism/prism.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/prism/prism.c b/prism/prism.c index 0c24681a5b..d6a8d50680 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -6668,6 +6668,7 @@ pm_node_check_it(pm_parser_t *parser, pm_node_t *node) { if ( (parser->version != PM_OPTIONS_VERSION_CRUBY_3_3_0) && !parser->current_scope->closed && + (parser->current_scope->numbered_parameters != PM_SCOPE_NUMBERED_PARAMETERS_DISALLOWED) && pm_node_is_it(parser, node) ) { pm_local_variable_read_node_t *read = pm_local_variable_read_node_create_it(parser, &parser->previous); @@ -14299,7 +14300,12 @@ parse_pattern_primitive(pm_parser_t *parser, pm_diagnostic_id_t diag_id) { pm_node_t *variable = (pm_node_t *) parse_variable(parser); if (variable == NULL) { - if (parser->version != PM_OPTIONS_VERSION_CRUBY_3_3_0 && pm_token_is_it(parser->previous.start, parser->previous.end)) { + if ( + (parser->version != PM_OPTIONS_VERSION_CRUBY_3_3_0) && + !parser->current_scope->closed && + (parser->current_scope->numbered_parameters != PM_SCOPE_NUMBERED_PARAMETERS_DISALLOWED) && + pm_token_is_it(parser->previous.start, parser->previous.end) + ) { pm_local_variable_read_node_t *read = pm_local_variable_read_node_create_it(parser, &parser->previous); if (read == NULL) read = pm_local_variable_read_node_create(parser, &parser->previous, 0); variable = (pm_node_t *) read; |
