summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-09 13:29:42 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-09 13:29:42 +0000
commite55b415c2fa001bd91d8706c5492d2cb28393f88 (patch)
tree3c6ff13a260dcf54803fa67936a52baa445206fe /compile.c
parent12474f034730c2832e5785a2b2e3eeaaa181d743 (diff)
merge revision(s) 59202: [Backport #13690]
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/branches/ruby_2_3@59553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index d6eda2f553..0aea3acd92 100644
--- a/compile.c
+++ b/compile.c
@@ -28,6 +28,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))
@@ -5489,7 +5491,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
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));