diff options
author | Kevin Newton <[email protected]> | 2024-07-24 10:54:32 -0400 |
---|---|---|
committer | Kevin Newton <[email protected]> | 2024-07-24 12:02:33 -0400 |
commit | 1a18b03ee7b14771eae9eafa3c85a6bf5ccd9502 (patch) | |
tree | 523edbb8855327293e019ca6d63c4e9cb8d4bc78 /prism_compile.c | |
parent | 0a9f771e19cc472651a3ab66d916bb8f65aab11a (diff) |
[PRISM] Add anon_* flags for iseqs with anonymous * and **
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11236
Diffstat (limited to 'prism_compile.c')
-rw-r--r-- | prism_compile.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/prism_compile.c b/prism_compile.c index 6768e00718..14cf016f16 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -8765,6 +8765,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, else { // def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n) // ^ + body->param.flags.anon_rest = true; pm_insert_local_special(idMULT, local_index, index_lookup_table, local_table_for_iseq); } @@ -8944,6 +8945,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } } else { + body->param.flags.anon_kwrest = true; pm_insert_local_special(idPow, local_index, index_lookup_table, local_table_for_iseq); } @@ -8954,30 +8956,28 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, // ^^^ case PM_FORWARDING_PARAMETER_NODE: { if (!ISEQ_BODY(iseq)->param.flags.forwardable) { + // Add the anonymous * body->param.rest_start = local_index; body->param.flags.has_rest = true; - - // Add the leading * + body->param.flags.anon_rest = true; pm_insert_local_special(idMULT, local_index++, index_lookup_table, local_table_for_iseq); - // Add the kwrest ** + // Add the anonymous ** RUBY_ASSERT(!body->param.flags.has_kw); - - // There are no keywords declared (in the text of the program) - // but the forwarding node implies we support kwrest (**) body->param.flags.has_kw = false; body->param.flags.has_kwrest = true; + body->param.flags.anon_kwrest = true; body->param.keyword = keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1); - keyword->rest_start = local_index; - pm_insert_local_special(idPow, local_index++, index_lookup_table, local_table_for_iseq); + // Add the anonymous & body->param.block_start = local_index; body->param.flags.has_block = true; - pm_insert_local_special(idAnd, local_index++, index_lookup_table, local_table_for_iseq); } + + // Add the ... pm_insert_local_special(idDot3, local_index++, index_lookup_table, local_table_for_iseq); break; } |