summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-17 06:23:57 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-17 06:23:57 (GMT)
commit640c3dbfa1a0f7eb908fd8f378f3caa42076a704 (patch)
tree4fa5b16f6cf9c337657c8ec6d2dde2034ca230d1 /iseq.c
parentedb8b498f9c8f9dbe1018daef87b92bbcbeb0c4a (diff)
iseq.c: flatten TS_NUM operand conditions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/iseq.c b/iseq.c
index 20ad68e..5c67e1c 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1534,21 +1534,24 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
break;
case TS_NUM: /* ULONG */
- {
- const char *type_str;
- if (insn == BIN(branchiftype) && (type_str = rb_type_str((enum ruby_value_type)op)) != NULL) {
- ret = rb_str_new_cstr(type_str);
+ if (insn == BIN(defined) && op_no == 0) {
+ enum defined_type deftype = (enum defined_type)op;
+ if (deftype == DEFINED_FUNC) {
+ ret = rb_fstring_cstr("func"); break;
}
- else if (insn == BIN(defined) && op_no == 0 &&
- ((enum defined_type)op == DEFINED_FUNC ? (ret = rb_fstring_cstr("func"), 1) :
- (enum defined_type)op == DEFINED_REF ? (ret = rb_fstring_cstr("ref"), 1) :
- (ret = rb_iseq_defined_string((enum defined_type)op)) != 0)) {
- /* ok */
+ if (deftype == DEFINED_REF) {
+ ret = rb_fstring_cstr("ref"); break;
}
- else {
- ret = rb_sprintf("%"PRIuVALUE, op);
+ ret = rb_iseq_defined_string((enum defined_type)op);
+ if (ret) break;
+ }
+ else if (insn == BIN(branchiftype) && op_no == 0) {
+ const char *type_str = rb_type_str((enum ruby_value_type)op);
+ if (type_str) {
+ ret = rb_str_new_cstr(type_str); break;
}
}
+ ret = rb_sprintf("%"PRIuVALUE, op);
break;
case TS_LINDEX:{