@@ -339,15 +339,19 @@ class Stack {
339339
340340 if (name == " " )
341341 name = " anonymous" ;
342+
342343 if (dynamic_cast <const HeapObject *>(e)) {
343344 return " object <" + name + " >" ;
345+ } else if (dynamic_cast <const HeapArray *>(e)) {
346+ return " array <" + name + " >" ;
344347 } else if (auto *thunk = dynamic_cast <const HeapThunk *>(e)) {
345348 if (thunk->name == nullptr ) {
346349 return " " ; // Argument of builtin, or root (since top level functions).
347350 } else {
348351 return " thunk <" + encode_utf8 (thunk->name ->name ) + " >" ;
349352 }
350353 } else {
354+ assert (dynamic_cast <const HeapClosure *>(e));
351355 const auto *func = static_cast <const HeapClosure *>(e);
352356 if (func->body == nullptr ) {
353357 return " builtin function <" + func->builtinName + " >" ;
@@ -3267,7 +3271,7 @@ class Interpreter {
32673271 const auto loc = f.location ;
32683272 const int indentLevel = (f.indentLevel == 0 ) ? 0 : f.indentLevel + 1 ;
32693273 // Add a call frame for the JSON conversion, used to apply depth limit.
3270- stack.newCall (thunk->body -> location , arr, nullptr , 0 , BindingFrame{});
3274+ stack.newCall (thunk->body ? thunk-> body -> location : LocationRange ( " unknown " ) , arr, nullptr , 0 , BindingFrame{});
32713275 stack.newFrame (FRAME_TO_JSON, loc);
32723276 stack.top ().indentLevel = indentLevel;
32733277 if (thunk->filled ) {
0 commit comments