1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2018-03-19 00:32:52 +00:00
parent affd2b76c8
commit c6e50e513c

10
iseq.c
View file

@ -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;
}