diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-16 17:36:47 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-16 17:36:47 +0900 |
| commit | f89215c7d20bb305cc22a504cbb931f8ec9114cf (patch) | |
| tree | d7a3adcd47495bb72442dd0f6ddebe81b5e7f0ed | |
| parent | c3aa1c4703ecb84228754ce37aa20188b1329858 (diff) | |
| download | mruby-f89215c7d20bb305cc22a504cbb931f8ec9114cf.tar.gz mruby-f89215c7d20bb305cc22a504cbb931f8ec9114cf.zip | |
parser_dump: local variable dump condition updated
| -rw-r--r-- | src/parse.y | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/parse.y b/src/parse.y index 91853fe5b..4c9f88889 100644 --- a/src/parse.y +++ b/src/parse.y @@ -5050,13 +5050,14 @@ parser_dump(mrb_state *mrb, node *tree, int offset) { node *n2 = tree->car; - if (n2) { + if (n2 && (n2->car || n2->cdr)) { dump_prefix(offset+1); printf("local variables:\n"); - while (n2) { - dump_prefix(offset+2); - printf("%s ", mrb_sym2name(mrb, (mrb_sym)n2->car)); + if (n2->car) { + dump_prefix(offset+2); + printf("%s ", mrb_sym2name(mrb, (mrb_sym)n2->car)); + } n2 = n2->cdr; } printf("\n"); @@ -5391,16 +5392,21 @@ parser_dump(mrb_state *mrb, node *tree, int offset) dump_prefix(offset+1); printf("%s\n", mrb_sym2name(mrb, (mrb_sym)tree->car)); tree = tree->cdr; - dump_prefix(offset+1); - printf("local variables:\n"); { node *n2 = tree->car; - while (n2) { - dump_prefix(offset+2); - if (n2->car) - printf("%s\n", mrb_sym2name(mrb, (mrb_sym)n2->car)); - n2 = n2->cdr; + if (n2 && (n2->car || n2->cdr)) { + dump_prefix(offset+1); + printf("local variables:\n"); + + while (n2) { + if (n2->car) { + dump_prefix(offset+2); + printf("%s ", mrb_sym2name(mrb, (mrb_sym)n2->car)); + } + n2 = n2->cdr; + } + printf("\n"); } } tree = tree->cdr; |
