Skip to content

Commit 585a29f

Browse files
adjust location tracking when manifesting arrays to JSON
1 parent d07cc3f commit 585a29f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

core/vm.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,15 +3357,16 @@ class Interpreter {
33573357
const auto thunk = arr->elements[f.elementId];
33583358
const auto loc = f.location;
33593359
const int indentLevel = (f.indentLevel == 0) ? 0 : f.indentLevel + 1;
3360-
// Add a call frame for the JSON conversion, used to apply depth limit.
3361-
stack.newCall(thunk->body ? thunk->body->location : LocationRange("unknown"), arr, nullptr, 0, BindingFrame{});
3362-
stack.newFrame(FRAME_TO_JSON, loc);
3360+
const LocationRange tloc = thunk ? thunk->body->location : loc;
3361+
// Add an explicit call frame for the JSON conversion, used to apply depth limit.
3362+
stack.newCall(tloc, arr, nullptr, 0, BindingFrame{});
3363+
stack.newFrame(FRAME_TO_JSON, tloc);
33633364
stack.top().indentLevel = indentLevel;
33643365
if (thunk->filled) {
33653366
scratch = thunk->content;
33663367
goto replaceframe;
33673368
} else {
3368-
stack.newCall(loc, thunk, thunk->self, thunk->offset, thunk->upValues);
3369+
stack.newCall(tloc, thunk, thunk->self, thunk->offset, thunk->upValues);
33693370
ast_ = thunk->body;
33703371
goto recurse;
33713372
}

0 commit comments

Comments
 (0)