Fixed a bug in continuous read of target files; ref
Line number information in a compiled file was wrong.
MODIFY
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
@@ -156,7 +156,10 @@ emit_B(codegen_scope *s, uint32_t pc, uint8_t i)
}
}
if (s->lines) {
+ if (s->lineno > 0 || pc == 0)
s->lines[pc] = s->lineno;
+ else
+ s->lines[pc] = s->lines[pc-1];
}
s->iseq[pc] = i;
}

MODIFY
mrbgems/mruby-compiler/core/parse.y
mrbgems/mruby-compiler/core/parse.y
@@ -133,6 +133,10 @@ cons_gen(parser_state *p, node *car, node *cdr)
c->cdr = cdr;
c->lineno = p->lineno;
c->filename_index = p->current_filename_index;
+ /* beginning of next partial file; need to point the previous file */
+ if (p->lineno == 0 && p->current_filename_index > 0) {
+ c->filename_index-- ;
+ }
return c;
}
#define cons(a,b) cons_gen(p,(a),(b))

Fixed a bug in continuous read of target files; ref #4138

Line number information in a compiled file was wrong.