function() {
var i = 0;
return function() {
return i++;
};
};
: Frame
i: 0
var counter = function() {
var i = 0;
return function() {
return i++;
};
};
var mycounter = counter();
mycounter();
: Frame
counter: fun()
mycounter: fun()
outer scope
outer scope
lexical scope
function
return function() {
return i++;
};
mycounter : Function
Sequence(
Return(
PostOp(
Variable(i)
++
)
)
)
: ASTFunction
AST
Disconnected
Debugging with Source Code Instrumentation - Example Stack
One unsolved problem of the simulated stack is that a complete stack trace
is not a linear list of frames but more a DAG (directed acyclic graph).
Capturing the stack also needs to capture the complete graph structure,
including shared inner nodes.