mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fixed a bug in continuous read of target files; ref #4138
Line number information in a compiled file was wrong.
This commit is contained in:
@@ -156,7 +156,10 @@ emit_B(codegen_scope *s, uint32_t pc, uint8_t i)
|
||||
}
|
||||
}
|
||||
if (s->lines) {
|
||||
s->lines[pc] = s->lineno;
|
||||
if (s->lineno > 0 || pc == 0)
|
||||
s->lines[pc] = s->lineno;
|
||||
else
|
||||
s->lines[pc] = s->lines[pc-1];
|
||||
}
|
||||
s->iseq[pc] = i;
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user