[前][次][番号順一覧][スレッド一覧]

ruby-changes:45239

From: nobu <ko1@a...>
Date: Thu, 12 Jan 2017 14:43:06 +0900 (JST)
Subject: [ruby-changes:45239] nobu:r57312 (trunk): compile.c: invalid yield in main

nobu	2017-01-12 14:43:00 +0900 (Thu, 12 Jan 2017)

  New Revision: 57312

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57312

  Log:
    compile.c: invalid yield in main
    
    * compile.c (iseq_compile_each): yield cannot be in the main
      context as well as a top context.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 57311)
+++ compile.c	(revision 57312)
@@ -5530,7 +5530,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L5530
 	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;
 	}

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]