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

Line number information in a compiled file was wrong.
parent 7e3e8d8e
...@@ -156,7 +156,10 @@ emit_B(codegen_scope *s, uint32_t pc, uint8_t i) ...@@ -156,7 +156,10 @@ emit_B(codegen_scope *s, uint32_t pc, uint8_t i)
} }
} }
if (s->lines) { 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; s->iseq[pc] = i;
} }
......
...@@ -133,6 +133,10 @@ cons_gen(parser_state *p, node *car, node *cdr) ...@@ -133,6 +133,10 @@ cons_gen(parser_state *p, node *car, node *cdr)
c->cdr = cdr; c->cdr = cdr;
c->lineno = p->lineno; c->lineno = p->lineno;
c->filename_index = p->current_filename_index; 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; return c;
} }
#define cons(a,b) cons_gen(p,(a),(b)) #define cons(a,b) cons_gen(p,(a),(b))
......
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