aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-12 05:43:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-12 05:43:00 +0000
commit257fd90166f62943ff767e5cd7b0624c12074a8b (patch)
tree47b645d087c434771e89ff04093b03dcab4fb5e0
parent58935eb8bdad1a42ce35efd0e0b0a9d7d43df299 (diff)
downloadruby-257fd90166f62943ff767e5cd7b0624c12074a8b.tar.gz
compile.c: invalid yield in main
* compile.c (iseq_compile_each): yield cannot be in the main context as well as a top context. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 3bcd1fc5ea..9b0fbfa986 100644
--- a/compile.c
+++ b/compile.c
@@ -5530,7 +5530,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe
struct rb_call_info_kw_arg *keywords = NULL;
INIT_ANCHOR(args);
- if (iseq->body->type == ISEQ_TYPE_TOP) {
+ if (iseq->body->type == ISEQ_TYPE_TOP ||
+ iseq->body->type == ISEQ_TYPE_MAIN) {
COMPILE_ERROR(ERROR_ARGS "Invalid yield");
goto ng;
}