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:
nobu 2017-10-21 01:06:25 +00:00
Родитель 1d80b1926c
Коммит 342e9ae38a
2 изменённых файлов: 6 добавлений и 10 удалений

Просмотреть файл

@ -6226,11 +6226,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp
} }
break; break;
} }
case NODE_DREGX_ONCE:{ case NODE_SCOPE:{
int ic_index = iseq->body->is_size++; int ic_index = iseq->body->is_size++;
NODE *dregx_node = NEW_NODE(NODE_DREGX, node->u1.value, node->u2.value, node->u3.value); const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(node, make_name_for_block(iseq),
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),
ISEQ_TYPE_ONCE_GUARD, line); ISEQ_TYPE_ONCE_GUARD, line);
ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index)); ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));

Просмотреть файл

@ -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)); node = NEW_NODE(NODE_DSTR, STR_NEW0(), 1, new_list(node, column));
nd_set_column(node, column); nd_set_column(node, column);
case NODE_DSTR: 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; node->nd_cflag = options & RE_OPTION_MASK;
if (!NIL_P(node->nd_lit)) reg_fragment_check(node->nd_lit, options); if (!NIL_P(node->nd_lit)) reg_fragment_check(node->nd_lit, options);
for (list = (prev = node)->nd_next; list; list = list->nd_next) { 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); nd_set_type(node, NODE_LIT);
node->nd_lit = reg_compile(src, options); node->nd_lit = reg_compile(src, options);
} }
if (options & RE_OPTION_ONCE) {
node = NEW_NODE(NODE_SCOPE, 0, node, 0);
}
break; break;
} }
return node; return node;