Skip to content

Commit 39dfb41

Browse files
adjust location tracking when manifesting arrays to JSON
1 parent 2f47ccc commit 39dfb41

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
@@ -3270,15 +3270,16 @@ class Interpreter {
32703270
const auto thunk = arr->elements[f.elementId];
32713271
const auto loc = f.location;
32723272
const int indentLevel = (f.indentLevel == 0) ? 0 : f.indentLevel + 1;
3273-
// Add a call frame for the JSON conversion, used to apply depth limit.
3274-
stack.newCall(thunk->body ? thunk->body->location : LocationRange("unknown"), arr, nullptr, 0, BindingFrame{});
3275-
stack.newFrame(FRAME_TO_JSON, loc);
3273+
const LocationRange tloc = thunk ? thunk->body->location : loc;
3274+
// Add an explicit call frame for the JSON conversion, used to apply depth limit.
3275+
stack.newCall(tloc, arr, nullptr, 0, BindingFrame{});
3276+
stack.newFrame(FRAME_TO_JSON, tloc);
32763277
stack.top().indentLevel = indentLevel;
32773278
if (thunk->filled) {
32783279
scratch = thunk->content;
32793280
goto replaceframe;
32803281
} else {
3281-
stack.newCall(loc, thunk, thunk->self, thunk->offset, thunk->upValues);
3282+
stack.newCall(tloc, thunk, thunk->self, thunk->offset, thunk->upValues);
32823283
ast_ = thunk->body;
32833284
goto recurse;
32843285
}

0 commit comments

Comments
 (0)