diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-11 14:50:51 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-11 14:50:51 +0900 |
| commit | 8f020f28c6b5b9c64cbd66db8369f89809b20d0a (patch) | |
| tree | 1302c1a0cbc608ba87c9630a8c6b508ad8709cf5 /src/parse.y | |
| parent | dd550ca0d494e35efc60142606976a5a41acd5be (diff) | |
| download | mruby-8f020f28c6b5b9c64cbd66db8369f89809b20d0a.tar.gz mruby-8f020f28c6b5b9c64cbd66db8369f89809b20d0a.zip | |
parser_dump: no print "local variables" if no local variables
Diffstat (limited to 'src/parse.y')
| -rw-r--r-- | src/parse.y | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/parse.y b/src/parse.y index 495954538..3f542a3b3 100644 --- a/src/parse.y +++ b/src/parse.y @@ -5050,15 +5050,19 @@ parser_dump(mrb_state *mrb, node *tree, int offset) case NODE_SCOPE: printf("NODE_SCOPE:\n"); - dump_prefix(offset+1); - printf("local variables:\n"); { node *n2 = tree->car; - while (n2) { - dump_prefix(offset+2); - printf("%s\n", mrb_sym2name(mrb, (mrb_sym)n2->car)); - n2 = n2->cdr; + if (n2) { + dump_prefix(offset+1); + printf("local variables:\n"); + + while (n2) { + dump_prefix(offset+2); + printf("%s ", mrb_sym2name(mrb, (mrb_sym)n2->car)); + n2 = n2->cdr; + } + printf("\n"); } } tree = tree->cdr; |
