Skip to content

Commit

Permalink
[PRISM] Allow rest parameter to be *
Browse files Browse the repository at this point in the history
Prior to this commit, if a rest parameters was `*`, we did not add
it to the locals table correctly. This commit fixes that.
  • Loading branch information
jemmaissroff committed Dec 12, 2023
1 parent f61df27 commit 68753e4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion prism_compile.c
Expand Up @@ -4448,9 +4448,16 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,

pm_constant_id_t name = ((pm_rest_parameter_node_t *)parameters_node->rest)->name;
if (name) {
// def foo(a, (b, *c, d), e = 1, *f, g, (h, *i, j), k:, l: 1, **m, &n)
// ^^
pm_insert_local_index(name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
local_index++;
}
else {
// def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n)
// ^
local_table_for_iseq->ids[local_index] = idMULT;
}
local_index++;
}
}

Expand Down

0 comments on commit 68753e4

Please sign in to comment.