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

ruby-changes:62039

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 29 Jun 2020 11:08:18 +0900 (JST)
Subject: [ruby-changes:62039] 2b636dc81d (master): make_exception: early return

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

From 2b636dc81dcc2540e0548c856ac495722fcd3959 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: Wed, 24 Jun 2020 11:04:19 +0900
Subject: make_exception: early return

The rb_exc_new3() result is already ready to be returned.  No need to
fall through the switch.

diff --git a/eval.c b/eval.c
index e4d6699..03a1972 100644
--- a/eval.c
+++ b/eval.c
@@ -816,7 +816,7 @@ make_exception(int argc, const VALUE *argv, int isstr) https://github.com/ruby/ruby/blob/trunk/eval.c#L816
         if (isstr &&! NIL_P(exc)) {
 	    mesg = rb_check_string_type(exc);
 	    if (!NIL_P(mesg)) {
-		mesg = rb_exc_new3(rb_eRuntimeError, mesg);
+                return rb_exc_new3(rb_eRuntimeError, mesg);
 	    }
 	}
 
-- 
cgit v0.10.2


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

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