Commit af73a740 authored by take_cheeze's avatar take_cheeze

check file debug info is appended correctly

parent 8c738e34
......@@ -1111,12 +1111,14 @@ static void
codegen(codegen_scope *s, node *tree, int val)
{
int nt;
mrb_irep_debug_info_file const *finished_file;
if (!tree) return;
if (s->irep && s->pc > 0 && s->filename_index != tree->filename) {
s->irep->filename = mrb_parser_get_filename(s->parser, s->filename_index);
mrb_debug_info_append_file(s->mrb, s->irep, s->debug_start_pos, s->pc);
finished_file = mrb_debug_info_append_file(s->mrb, s->irep, s->debug_start_pos, s->pc);
mrb_assert(finished_file);
s->debug_start_pos = s->pc;
s->filename_index = tree->filename;
s->filename = mrb_parser_get_filename(s->parser, tree->filename);
......@@ -2434,6 +2436,7 @@ scope_finish(codegen_scope *s)
mrb_irep *irep = s->irep;
size_t fname_len;
char *fname;
mrb_irep_debug_info_file const *finished_file;
irep->flags = 0;
if (s->iseq) {
......@@ -2450,7 +2453,8 @@ scope_finish(codegen_scope *s)
irep->syms = (mrb_sym *)codegen_realloc(s, irep->syms, sizeof(mrb_sym)*irep->slen);
if (s->filename) {
s->irep->filename = mrb_parser_get_filename(s->parser, s->filename_index);
mrb_debug_info_append_file(mrb, s->irep, s->debug_start_pos, s->pc);
finished_file = mrb_debug_info_append_file(mrb, s->irep, s->debug_start_pos, s->pc);
mrb_assert(finished_file);
fname_len = strlen(s->filename);
fname = codegen_malloc(s, fname_len + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment