1
0
Fork 0
forked from fun/fun

Fixed bug with wrong line numbers in error messages. Fixed permissions on examples. (0.39.14)

This commit is contained in:
Johannes Findeisen 2026-03-30 19:10:29 +02:00
commit 53ccdbda10
26 changed files with 274 additions and 116 deletions

View file

@ -20,6 +20,9 @@
#include "value.h"
#include "vm.h"
/* include mapping helper from parser_utils.c */
extern int map_expanded_line_to_include_path(const char *path, int line, char *out_path, size_t out_path_cap, int *out_line);
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -1662,6 +1665,13 @@ int fun_run_repl(VM *vm) {
if (ins.op == OP_LINE) line = ins.operand;
}
const char *path = f->fn->source_file;
/* Map to included file if the current line belongs to an included chunk */
char mapped_path[1024];
int mapped_line = line;
if (map_expanded_line_to_include_path(path, line, mapped_path, sizeof(mapped_path), &mapped_line)) {
path = mapped_path;
line = mapped_line;
}
size_t flen = 0;
char *src = read_entire_file(path, &flen);
if (!src) {