[PRISM] Add anon_* flags for iseqs with anonymous * and **
This commit is contained in:
parent
0a9f771e19
commit
1a18b03ee7
Notes:
git
2024-07-24 16:02:52 +00:00
@ -8765,6 +8765,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||||||
else {
|
else {
|
||||||
// def foo(a, (b, *c, d), e = 1, *, g, (h, *i, j), k:, l: 1, **m, &n)
|
// 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);
|
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 {
|
else {
|
||||||
|
body->param.flags.anon_kwrest = true;
|
||||||
pm_insert_local_special(idPow, local_index, index_lookup_table, local_table_for_iseq);
|
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: {
|
case PM_FORWARDING_PARAMETER_NODE: {
|
||||||
if (!ISEQ_BODY(iseq)->param.flags.forwardable) {
|
if (!ISEQ_BODY(iseq)->param.flags.forwardable) {
|
||||||
|
// Add the anonymous *
|
||||||
body->param.rest_start = local_index;
|
body->param.rest_start = local_index;
|
||||||
body->param.flags.has_rest = true;
|
body->param.flags.has_rest = true;
|
||||||
|
body->param.flags.anon_rest = true;
|
||||||
// Add the leading *
|
|
||||||
pm_insert_local_special(idMULT, local_index++, index_lookup_table, local_table_for_iseq);
|
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);
|
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_kw = false;
|
||||||
body->param.flags.has_kwrest = true;
|
body->param.flags.has_kwrest = true;
|
||||||
|
body->param.flags.anon_kwrest = true;
|
||||||
body->param.keyword = keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1);
|
body->param.keyword = keyword = ZALLOC_N(struct rb_iseq_param_keyword, 1);
|
||||||
|
|
||||||
keyword->rest_start = local_index;
|
keyword->rest_start = local_index;
|
||||||
|
|
||||||
pm_insert_local_special(idPow, local_index++, index_lookup_table, local_table_for_iseq);
|
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.block_start = local_index;
|
||||||
body->param.flags.has_block = true;
|
body->param.flags.has_block = true;
|
||||||
|
|
||||||
pm_insert_local_special(idAnd, local_index++, index_lookup_table, local_table_for_iseq);
|
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);
|
pm_insert_local_special(idDot3, local_index++, index_lookup_table, local_table_for_iseq);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user