Skip to content

Commit 398453c

Browse files
committed
[PRISM] Fix param names for repeated splats
1 parent c78cebb commit 398453c

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/prism.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
timeout-minutes: 40
9393
env:
9494
GNUMAKEFLAGS: ''
95-
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"'
95+
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"'
9696
RUN_OPTS: ${{ matrix.run_opts }}
9797

9898
- name: make test-prism-spec

prism_compile.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3559,17 +3559,22 @@ pm_compile_destructured_param_locals(const pm_multi_target_node_t *node, st_tabl
35593559

35603560
if (rest->expression != NULL) {
35613561
RUBY_ASSERT(PM_NODE_TYPE_P(rest->expression, PM_REQUIRED_PARAMETER_NODE));
3562-
pm_insert_local_index(((const pm_required_parameter_node_t *) rest->expression)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
3563-
local_index++;
3562+
3563+
if (!PM_NODE_FLAG_P(rest->expression, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
3564+
pm_insert_local_index(((const pm_required_parameter_node_t *) rest->expression)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
3565+
local_index++;
3566+
}
35643567
}
35653568
}
35663569

35673570
for (size_t index = 0; index < node->rights.size; index++) {
35683571
const pm_node_t *right = node->rights.nodes[index];
35693572

35703573
if (PM_NODE_TYPE_P(right, PM_REQUIRED_PARAMETER_NODE)) {
3571-
pm_insert_local_index(((const pm_required_parameter_node_t *) right)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
3572-
local_index++;
3574+
if (!PM_NODE_FLAG_P(right, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
3575+
pm_insert_local_index(((const pm_required_parameter_node_t *) right)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
3576+
local_index++;
3577+
}
35733578
}
35743579
else {
35753580
RUBY_ASSERT(PM_NODE_TYPE_P(right, PM_MULTI_TARGET_NODE));

0 commit comments

Comments
 (0)