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

ruby-changes:62076

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

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

From edb1680a0549b64347518e90c6c083cb76f48521 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: Mon, 22 Jun 2020 10:59:19 +0900
Subject: rb_method_call_status: 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/vm_eval.c b/vm_eval.c
index 8265091..b90ff37 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -632,8 +632,7 @@ rb_method_call_status(rb_execution_context_t *ec, const rb_callable_method_entry https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L632
     rb_method_visibility_t visi;
 
     if (UNDEFINED_METHOD_ENTRY_P(me)) {
-      undefined:
-	return scope == CALL_VCALL ? MISSING_VCALL : MISSING_NOENTRY;
+        goto undefined;
     }
     if (me->def->type == VM_METHOD_TYPE_REFINED) {
 	me = rb_resolve_refined_method_callable(Qnil, me);
@@ -667,6 +666,8 @@ rb_method_call_status(rb_execution_context_t *ec, const rb_callable_method_entry https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L666
     }
 
     return MISSING_NONE;
+  undefined:
+    return scope == CALL_VCALL ? MISSING_VCALL : MISSING_NOENTRY;
 }
 
 
-- 
cgit v0.10.2


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

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