summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-24 03:01:35 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-24 03:01:35 +0000
commit04aa6a8168463c00560a819f6fa85a309558d63c (patch)
tree59c3b4118aefb4526aa8d518800a3cc2179282c9 /vm.c
parent1a3bca1dd6c43d4b6ec638d9b0987c0488af6fae (diff)
merge revision(s) 60024: [Backport #13945]
vm.c: fetch retval iff necessary * vm.c (rb_vm_make_jump_tag_but_local_jump): get rid of fetching retval when it is not used. it is necessary for local jump state only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/vm.c b/vm.c
index e44f7d824d..47011d665c 100644
--- a/vm.c
+++ b/vm.c
@@ -1398,33 +1398,33 @@ rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
VALUE
rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
{
- VALUE result = Qnil;
+ const char *mesg;
- if (val == Qundef) {
- val = GET_THREAD()->tag->retval;
- }
switch (state) {
- case 0:
- break;
case TAG_RETURN:
- result = make_localjump_error("unexpected return", val, state);
+ mesg = "unexpected return";
break;
case TAG_BREAK:
- result = make_localjump_error("unexpected break", val, state);
+ mesg = "unexpected break";
break;
case TAG_NEXT:
- result = make_localjump_error("unexpected next", val, state);
+ mesg = "unexpected next";
break;
case TAG_REDO:
- result = make_localjump_error("unexpected redo", Qnil, state);
+ mesg = "unexpected redo";
+ val = Qnil;
break;
case TAG_RETRY:
- result = make_localjump_error("retry outside of rescue clause", Qnil, state);
+ mesg = "retry outside of rescue clause";
+ val = Qnil;
break;
default:
- break;
+ return Qnil;
}
- return result;
+ if (val == Qundef) {
+ val = GET_THREAD()->tag->retval;
+ }
+ return make_localjump_error(mesg, val, state);
}
void