diff options
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 56 |
1 files changed, 50 insertions, 6 deletions
@@ -3807,7 +3807,12 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) break; case Op_K_do: - print_func(fp, "[doloop_cond = %p] [target_break = %p]\n", (pc+1)->doloop_cond, pc->target_break); + print_func(fp, "[doloop_cond = %p] [target_break = %p]", (pc+1)->doloop_cond, pc->target_break); + if (pc->comment) + print_func(fp, " [comment = %p]", pc->comment); + print_func(fp, "\n"); + if (pc->comment) + print_instruction(pc->comment, print_func, fp, in_dump); break; case Op_K_for: @@ -3815,15 +3820,44 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) /* fall through */ case Op_K_arrayfor: print_func(fp, "[forloop_body = %p] ", (pc+1)->forloop_body); - print_func(fp, "[target_break = %p] [target_continue = %p]\n", pc->target_break, pc->target_continue); + print_func(fp, "[target_break = %p] [target_continue = %p]", pc->target_break, pc->target_continue); + if (pc->comment != NULL) { + print_func(fp, " [comment = %p]\n", (pc)->comment); + print_instruction(pc->comment, print_func, fp, in_dump); + } else + print_func(fp, "\n"); break; case Op_K_switch: + { + bool need_newline = false; print_func(fp, "[switch_start = %p] [switch_end = %p]\n", (pc+1)->switch_start, (pc+1)->switch_end); + if (pc->comment || (pc+1)->switch_end->comment) + print_func(fp, "%*s", noffset, ""); + if (pc->comment) { + print_func(fp, "[start_comment = %p]", pc->comment); + need_newline = true; + } + if ((pc+1)->switch_end->comment) { + print_func(fp, "[end_comment = %p]", (pc + 1)->switch_end->comment); + need_newline = true; + } + if (need_newline) + print_func(fp, "\n"); + if (pc->comment) + print_instruction(pc->comment, print_func, fp, in_dump); + if ((pc+1)->switch_end->comment) + print_instruction((pc+1)->switch_end->comment, print_func, fp, in_dump); + } break; case Op_K_default: - print_func(fp, "[stmt_start = %p] [stmt_end = %p]\n", pc->stmt_start, pc->stmt_end); + print_func(fp, "[stmt_start = %p] [stmt_end = %p]", pc->stmt_start, pc->stmt_end); + if (pc->comment) { + print_func(fp, " [comment = %p]\n", pc->comment); + print_instruction(pc->comment, print_func, fp, in_dump); + } else + print_func(fp, "\n"); break; case Op_var_update: @@ -3915,8 +3949,13 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) break; case Op_K_case: - print_func(fp, "[target_jmp = %p] [match_exp = %s]\n", + print_func(fp, "[target_jmp = %p] [match_exp = %s]", pc->target_jmp, (pc + 1)->match_exp ? "true" : "false"); + if (pc->comment) { + print_func(fp, " [comment = %p]\n", pc->comment); + print_instruction(pc->comment, print_func, fp, in_dump); + } else + print_func(fp, "\n"); break; case Op_arrayfor_incr: @@ -4032,9 +4071,14 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) case Op_comment: print_memory(pc->memory, func, print_func, fp); - print_func(fp, " [comment_type = %s]\n", + print_func(fp, " [comment_type = %s]", pc->memory->comment_type == EOL_COMMENT ? - "EOL" : "FULL"); + "EOL" : "BLOCK"); + if (pc->comment) { + print_func(fp, " [comment = %p]\n", pc->comment); + print_instruction(pc->comment, print_func, fp, in_dump); + } else + print_func(fp, "\n"); break; case Op_push_i: |