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

ruby-changes:61993

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 29 Jun 2020 11:06:47 +0900 (JST)
Subject: [ruby-changes:61993] cf29de7e6e (master): compile_next: do not goto into a branch

https://git.ruby-lang.org/ruby.git/commit/?id=cf29de7e6e

From cf29de7e6e92497c31ef08b567fcfe1b72bfaff7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Fri, 12 Jun 2020 12:48:28 +0900
Subject: compile_next: do not goto into a branch

I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.

diff --git a/compile.c b/compile.c
index 5bf72e1..a17323e 100644
--- a/compile.c
+++ b/compile.c
@@ -6651,11 +6651,6 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L6651
 	    ADD_INSN(ret, line, putnil);
 	}
     }
-    else if (iseq->body->type == ISEQ_TYPE_EVAL) {
-      next_in_eval:
-	COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with next");
-	return COMPILE_NG;
-    }
     else {
 	const rb_iseq_t *ip = iseq;
 
@@ -6674,7 +6669,8 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L6669
 		break;
 	    }
 	    else if (ip->body->type == ISEQ_TYPE_EVAL) {
-		goto next_in_eval;
+                COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with next");
+                return COMPILE_NG;
 	    }
 
 	    ip = ip->body->parent_iseq;
-- 
cgit v0.10.2


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

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