summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-19 00:32:52 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-19 00:32:52 (GMT)
commitc6e50e513c9e2270beab92c204db9bec6e9f7e69 (patch)
tree47df41359c0723ba8c7cce93a7c059849dcfab01 /iseq.c
parentaffd2b76c8652fe2e1baaf39d6597700176ce41a (diff)
iseq.c: append local var index to name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/iseq.c b/iseq.c
index 3dcc223..72e713b 100644
--- a/iseq.c
+++ b/iseq.c
@@ -1498,18 +1498,24 @@ local_var_name(const rb_iseq_t *diseq, VALUE level, VALUE op)
VALUE i;
VALUE name;
ID lid;
+ int idx;
for (i = 0; i < level; i++) {
diseq = diseq->body->parent_iseq;
}
- lid = diseq->body->local_table[diseq->body->local_table_size - op - 1];
+ idx = diseq->body->local_table_size - (int)op - 1;
+ lid = diseq->body->local_table[idx];
name = rb_id2str(lid);
if (!name) {
- name = rb_sprintf("?%d", diseq->body->local_table_size - (int)op);
+ name = rb_str_new_cstr("?");
}
else if (!rb_str_symname_p(name)) {
name = rb_str_inspect(name);
}
+ else {
+ name = rb_str_dup(name);
+ }
+ rb_str_catf(name, "@%d", idx);
return name;
}