diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-19 15:25:42 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-19 15:25:42 +0900 |
| commit | 87ffab5713a49cef7133eeff7085b9c6a6a427fb (patch) | |
| tree | ef1b442ee891951530310bb44c914030f0cda3d8 /src/codedump.c | |
| parent | 9516731329a9d43b4aab57a19fb9cfc1b62f11e8 (diff) | |
| download | mruby-87ffab5713a49cef7133eeff7085b9c6a6a427fb.tar.gz mruby-87ffab5713a49cef7133eeff7085b9c6a6a427fb.zip | |
Adjust codedump output format; ref #4166
Diffstat (limited to 'src/codedump.c')
| -rw-r--r-- | src/codedump.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codedump.c b/src/codedump.c index 7d1950f75..4d56fd427 100644 --- a/src/codedump.c +++ b/src/codedump.c @@ -17,6 +17,7 @@ print_r(mrb_state *mrb, mrb_irep *irep, size_t n) if (irep->lv[i].r == n) { mrb_sym sym = irep->lv[i].name; printf(" R%d:%s", (int)n, mrb_sym2name(mrb, sym)); + break; } } } @@ -81,8 +82,9 @@ codedump(mrb_state *mrb, mrb_irep *irep) printf("local variable names:\n"); for (i = 1; i < irep->nlocals; ++i) { - char const *n = mrb_sym2name(mrb, irep->lv[i - 1].name); - printf(" R%d:%s\n", irep->lv[i - 1].r, n? n : ""); + char const *s = mrb_sym2name(mrb, irep->lv[i - 1].name); + int n = irep->lv[i - 1].r ? irep->lv[i - 1].r : i; + printf(" R%d:%s\n", n, s ? s : ""); } } |
