diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-12 13:45:01 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | a8d992ac000d4cc8f8fe691d22c45e5b8db95f2d (patch) | |
tree | 19e605275a3773a27f818a55e37297e9a283ea34 /compile.c | |
parent | aa2cb7f7228baa5a5fffab733f3960546c852aa5 (diff) |
compile_call: 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 'compile.c')
-rw-r--r-- | compile.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -7290,16 +7290,10 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co if (bf == NULL) { if (strcmp("cstmt!", builtin_func) == 0 || strcmp("cexpr!", builtin_func) == 0) { - inlinec:; - int inline_index = GET_VM()->builtin_inline_index++; - snprintf(inline_func, 0x20, "_bi%d", inline_index); - builtin_func = inline_func; - args_node = NULL; - goto retry; + // ok } else if (strcmp("cconst!", builtin_func) == 0) { cconst = true; - goto inlinec; } else if (strcmp("cinit!", builtin_func) == 0) { // ignore @@ -7311,14 +7305,19 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co iseq->body->builtin_inline_p = true; return COMPILE_OK; } - - if (1) { + else if (1) { rb_bug("can't find builtin function:%s", builtin_func); } else { COMPILE_ERROR(ERROR_ARGS "can't find builtin function:%s", builtin_func); + return COMPILE_NG; } - return COMPILE_NG; + + int inline_index = GET_VM()->builtin_inline_index++; + snprintf(inline_func, 0x20, "_bi%d", inline_index); + builtin_func = inline_func; + args_node = NULL; + goto retry; } if (cconst) { |