summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-22 11:00:31 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit6e67b30503f2931d9538d439545c3b1cff51fc80 (patch)
tree2ff71b46b5280739246c0edfc03ca5d04f0066c6
parentedb1680a0549b64347518e90c6c083cb76f48521 (diff)
method_missing: 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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3247
-rw-r--r--vm_eval.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vm_eval.c b/vm_eval.c
index b90ff37c3a..98352ba545 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -820,8 +820,7 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missin
ec->method_missing_reason = call_status;
if (id == idMethodMissing) {
- missing:
- raise_method_missing(ec, argc, argv, obj, call_status | MISSING_MISSING);
+ goto missing;
}
nargv = ALLOCV_N(VALUE, work, argc + 1);
@@ -845,6 +844,8 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, enum method_missin
result = rb_vm_call_kw(ec, obj, idMethodMissing, argc, argv, me, kw_splat);
if (work) ALLOCV_END(work);
return result;
+ missing:
+ raise_method_missing(ec, argc, argv, obj, call_status | MISSING_MISSING);
}
#ifndef MJIT_HEADER