1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

LibJS: Keep track of current AST node inside the call stack

This commit is contained in:
Jean-Baptiste Boric 2021-02-28 10:45:26 +01:00 committed by Andreas Kling
parent 0039ecb189
commit 6172cb3599
5 changed files with 10 additions and 1 deletions

View file

@ -62,6 +62,7 @@ Value Interpreter::run(GlobalObject& global_object, const Program& program)
VM::InterpreterExecutionScope scope(*this);
CallFrame global_call_frame;
global_call_frame.current_node = &program;
global_call_frame.this_value = &global_object;
static FlyString global_execution_context_name = "(global execution context)";
global_call_frame.function_name = global_execution_context_name;
@ -140,6 +141,7 @@ void Interpreter::exit_scope(const ScopeNode& scope_node)
void Interpreter::enter_node(const ASTNode& node)
{
vm().call_frame().current_node = &node;
vm().push_ast_node(node);
}