mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
0d87198c92
When mrbc compiles multiple input files (e.g. `mrbc -g -o out.mrb a.rb b.rb`), the bison parser's one-token lookahead can buffer the final token of one file before partial_hook switches to the next. By the time bison reduces that token into an AST node, `mrb_parser_set_filename` has already reset `p->lineno` to 0, so init_var_header recorded lineno=0 for the previous file's last statement and codegen propagated the previous instruction's line. Save the lineno into `prev_file_lineno` immediately before the reset so init_var_header can restore the correct value when it detects the lookahead edge case (lineno==0 && filename_index>0). close #1316 Co-authored-by: Claude <noreply@anthropic.com>