1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 07:33:01 +00:00

Make source mapping use byte offset instead of line and col

for better debugging support in repl. Add debug module for better
debugging support.
This commit is contained in:
Calvin Rose
2018-12-13 18:46:53 -05:00
parent 4b01409d2d
commit e8c0dcd14e
16 changed files with 400 additions and 187 deletions

View File

@@ -234,8 +234,8 @@ static void marshal_one_def(MarshalState *st, JanetFuncDef *def, int flags) {
if (def->flags & JANET_FUNCDEF_FLAG_HASSOURCEMAP) {
for (int32_t i = 0; i < def->bytecode_length; i++) {
JanetSourceMapping map = def->sourcemap[i];
pushint(st, map.line);
pushint(st, map.column);
pushint(st, map.start);
pushint(st, map.end);
}
}
}
@@ -740,8 +740,8 @@ static const uint8_t *unmarshal_one_def(
JANET_OUT_OF_MEMORY;
}
for (int32_t i = 0; i < bytecode_length; i++) {
def->sourcemap[i].line = readint(st, &data);
def->sourcemap[i].column = readint(st, &data);
def->sourcemap[i].start = readint(st, &data);
def->sourcemap[i].end = readint(st, &data);
}
} else {
def->sourcemap = NULL;