summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2023-12-12 09:40:16 -0500
committerJemma Issroff <jemmaissroff@gmail.com>2023-12-12 13:45:21 -0500
commit68753e44083f7d4d171f66aa092b35ccb41a66f6 (patch)
tree19451edd7724dcd7b7e0f167b68a94bb5df7797c
parentf61df27b4ca73a31401ebe0357a3b7de947128e8 (diff)
[PRISM] Allow rest parameter to be `*`
Prior to this commit, if a rest parameters was `*`, we did not add it to the locals table correctly. This commit fixes that.
-rw-r--r--prism_compile.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c
index e355d0567f..e2045e3303 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -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++;
}
}