mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
moved node generation for dregex_once to parse.y
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1d80b1926c
commit
342e9ae38a
2 changed files with 6 additions and 10 deletions
|
@ -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));
|
||||
|
|
8
parse.y
8
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);
|
||||
}
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue