[PRISM] Fix param names for repeated splats

This commit is contained in:
Kevin Newton 2024-05-02 10:45:46 -04:00
Родитель c78cebb469
Коммит 398453c3c0
2 изменённых файлов: 10 добавлений и 5 удалений

2
.github/workflows/prism.yml поставляемый
Просмотреть файл

@ -92,7 +92,7 @@ jobs:
timeout-minutes: 40 timeout-minutes: 40
env: env:
GNUMAKEFLAGS: '' GNUMAKEFLAGS: ''
RUBY_TESTOPTS: '-q --tty=no --excludes-dir="../src/test/.excludes-prism" --exclude="error_highlight/test_error_highlight.rb" --exclude="prism/encoding_test.rb" --exclude="prism/locals_test.rb" --exclude="prism/newline_test.rb"' RUBY_TESTOPTS: '-q --tty=no --excludes-dir="../src/test/.excludes-prism" --exclude="error_highlight/test_error_highlight.rb" --exclude="prism/encoding_test.rb" --exclude="prism/newline_test.rb"'
RUN_OPTS: ${{ matrix.run_opts }} RUN_OPTS: ${{ matrix.run_opts }}
- name: make test-prism-spec - name: make test-prism-spec

Просмотреть файл

@ -3559,8 +3559,11 @@ pm_compile_destructured_param_locals(const pm_multi_target_node_t *node, st_tabl
if (rest->expression != NULL) { if (rest->expression != NULL) {
RUBY_ASSERT(PM_NODE_TYPE_P(rest->expression, PM_REQUIRED_PARAMETER_NODE)); RUBY_ASSERT(PM_NODE_TYPE_P(rest->expression, PM_REQUIRED_PARAMETER_NODE));
pm_insert_local_index(((const pm_required_parameter_node_t *) rest->expression)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
local_index++; if (!PM_NODE_FLAG_P(rest->expression, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
pm_insert_local_index(((const pm_required_parameter_node_t *) rest->expression)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
local_index++;
}
} }
} }
@ -3568,8 +3571,10 @@ pm_compile_destructured_param_locals(const pm_multi_target_node_t *node, st_tabl
const pm_node_t *right = node->rights.nodes[index]; const pm_node_t *right = node->rights.nodes[index];
if (PM_NODE_TYPE_P(right, PM_REQUIRED_PARAMETER_NODE)) { if (PM_NODE_TYPE_P(right, PM_REQUIRED_PARAMETER_NODE)) {
pm_insert_local_index(((const pm_required_parameter_node_t *) right)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node); if (!PM_NODE_FLAG_P(right, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
local_index++; pm_insert_local_index(((const pm_required_parameter_node_t *) right)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
local_index++;
}
} }
else { else {
RUBY_ASSERT(PM_NODE_TYPE_P(right, PM_MULTI_TARGET_NODE)); RUBY_ASSERT(PM_NODE_TYPE_P(right, PM_MULTI_TARGET_NODE));