summaryrefslogtreecommitdiff
path: root/prism_compile.c
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-09-16 11:03:38 -0400
committerKevin Newton <[email protected]>2024-09-16 14:31:01 -0400
commit2beb4c6e878dd519b82a96e10838e5da69e942f5 (patch)
treecbd85570b44077f32c2bffdb2ddee0636f051b99 /prism_compile.c
parent6c4ce72609396cff8970c0fdebbfa190ec75ece1 (diff)
[PRISM] Assume an eval context for RubyVM::ISEQ compile
Fixes [Bug #20741]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11632
Diffstat (limited to 'prism_compile.c')
-rw-r--r--prism_compile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 9ea89d64e1..03aff09259 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -6705,6 +6705,14 @@ pm_compile_scope_node(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_nod
}
switch (body->type) {
+ case ISEQ_TYPE_PLAIN: {
+ RUBY_ASSERT(PM_NODE_TYPE_P(scope_node->ast_node, PM_INTERPOLATED_REGULAR_EXPRESSION_NODE));
+
+ const pm_interpolated_regular_expression_node_t *cast = (const pm_interpolated_regular_expression_node_t *) scope_node->ast_node;
+ pm_compile_regexp_dynamic(iseq, (const pm_node_t *) cast, &cast->parts, &location, ret, popped, scope_node);
+
+ break;
+ }
case ISEQ_TYPE_BLOCK: {
LABEL *start = ISEQ_COMPILE_DATA(iseq)->start_label = NEW_LABEL(0);
LABEL *end = ISEQ_COMPILE_DATA(iseq)->end_label = NEW_LABEL(0);
@@ -8474,7 +8482,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
pm_scope_node_t next_scope_node;
pm_scope_node_init(node, &next_scope_node, scope_node);
- block_iseq = NEW_CHILD_ISEQ(&next_scope_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, location.line);
+ block_iseq = NEW_CHILD_ISEQ(&next_scope_node, make_name_for_block(iseq), ISEQ_TYPE_PLAIN, location.line);
pm_scope_node_destroy(&next_scope_node);
ISEQ_COMPILE_DATA(iseq)->current_block = block_iseq;