1
0
Fork 0
forked from fun/fun

Added line numbers to debug and error output.

This commit is contained in:
Johannes Findeisen 2025-09-16 11:23:42 +02:00
commit 6b14c2776e
6 changed files with 52 additions and 3 deletions

View file

@ -1736,6 +1736,13 @@ static void parse_block(Bytecode *bc, const char *src, size_t len, size_t *pos,
}
/* at same indent -> parse statement */
/* Insert a line marker for better runtime error reporting */
{
int stmt_line = 1, stmt_col = 1;
calc_line_col(src, len, line_start, &stmt_line, &stmt_col);
bytecode_add_instruction(bc, OP_LINE, stmt_line);
}
if (starts_with(src, len, *pos, "fun")) {
/* parse header: fun name(arg, ...) */
*pos += 3;