diff options
author | 卜部昌平 <[email protected]> | 2020-06-16 11:27:30 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-06-29 11:05:41 +0900 |
commit | 2390a8bd2ef197faf94b5251ee9a0ea582ff6fb4 (patch) | |
tree | 9e87d437fc12a2183870c8e1c9e01d3c8e34be28 /proc.c | |
parent | 82ed66a75a7abbf3b6e18be962ed9c11029b6722 (diff) |
bind_local_variable_get: 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
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -541,14 +541,14 @@ bind_local_variable_get(VALUE bindval, VALUE sym) GetBindingPtr(bindval, bind); env = VM_ENV_ENVVAL_PTR(vm_block_ep(&bind->block)); - if ((ptr = get_local_variable_ptr(&env, lid)) == NULL) { - sym = ID2SYM(lid); - undefined: - rb_name_err_raise("local variable `%1$s' is not defined for %2$s", - bindval, sym); + if ((ptr = get_local_variable_ptr(&env, lid)) != NULL) { + return *ptr; } - return *ptr; + sym = ID2SYM(lid); + undefined: + rb_name_err_raise("local variable `%1$s' is not defined for %2$s", + bindval, sym); } /* |