From 0a11abfc7ec92fcf4eb9e973c68588f079fdb60d Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 29 Jun 2017 04:01:30 +0000 Subject: compile.c: disallow next in once * compile.c (iseq_compile_each0): turned dregx context in "once" into "guarded" type from "block" type, to disallow `next`, `break`, `redo` as well as outside "once". [ruby-core:81805] [Bug #13690] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index f0c7499723..3fa98e5d7d 100644 --- a/compile.c +++ b/compile.c @@ -29,6 +29,8 @@ #undef RUBY_UNTYPED_DATA_WARNING #define RUBY_UNTYPED_DATA_WARNING 0 +#define ISEQ_TYPE_ONCE_GUARD ISEQ_TYPE_DEFINED_GUARD + #define FIXNUM_INC(n, i) ((n)+(INT2FIX(i)&~FIXNUM_FLAG)) #define FIXNUM_OR(n, i) ((n)|INT2FIX(i)) @@ -5966,7 +5968,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp 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), ISEQ_TYPE_BLOCK, line); + const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(block_node, make_name_for_block(iseq), + ISEQ_TYPE_ONCE_GUARD, line); ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index)); -- cgit v1.2.3