aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compile.c6
-rw-r--r--parse.y10
2 files changed, 6 insertions, 10 deletions
diff --git a/compile.c b/compile.c
index 46a853709f..2691ec8633 100644
--- a/compile.c
+++ b/compile.c
@@ -6226,11 +6226,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp
}
break;
}
- case NODE_DREGX_ONCE:{
+ case NODE_SCOPE:{
int ic_index = iseq->body->is_size++;
- NODE *dregx_node = NEW_NODE(NODE_DREGX, node->u1.value, node->u2.value, node->u3.value);
- NODE *block_node = NEW_NODE(NODE_SCOPE, 0, dregx_node, 0);
- const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(block_node, make_name_for_block(iseq),
+ const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(node, make_name_for_block(iseq),
ISEQ_TYPE_ONCE_GUARD, line);
ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));
diff --git a/parse.y b/parse.y
index 310a1dc59b..7aef9630a9 100644
--- a/parse.y
+++ b/parse.y
@@ -9267,12 +9267,7 @@ new_regexp_gen(struct parser_params *parser, NODE *node, int options, int column
node = NEW_NODE(NODE_DSTR, STR_NEW0(), 1, new_list(node, column));
nd_set_column(node, column);
case NODE_DSTR:
- if (options & RE_OPTION_ONCE) {
- nd_set_type(node, NODE_DREGX_ONCE);
- }
- else {
- nd_set_type(node, NODE_DREGX);
- }
+ nd_set_type(node, NODE_DREGX);
node->nd_cflag = options & RE_OPTION_MASK;
if (!NIL_P(node->nd_lit)) reg_fragment_check(node->nd_lit, options);
for (list = (prev = node)->nd_next; list; list = list->nd_next) {
@@ -9303,6 +9298,9 @@ new_regexp_gen(struct parser_params *parser, NODE *node, int options, int column
nd_set_type(node, NODE_LIT);
node->nd_lit = reg_compile(src, options);
}
+ if (options & RE_OPTION_ONCE) {
+ node = NEW_NODE(NODE_SCOPE, 0, node, 0);
+ }
break;
}
return node;