1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:12:08 +00:00

LibJS: Pass GlobalObject& to AST node execute() functions

More work towards supporting multiple global objects.
This commit is contained in:
Andreas Kling 2020-06-08 20:57:54 +02:00
parent 92392398a2
commit 25f2a29d84
5 changed files with 178 additions and 179 deletions

View file

@ -65,7 +65,7 @@ Value Interpreter::run(const Statement& statement, ArgumentVector arguments, Sco
}
if (!statement.is_scope_node())
return statement.execute(*this);
return statement.execute(*this, global_object());
auto& block = static_cast<const ScopeNode&>(statement);
enter_scope(block, move(arguments), scope_type);
@ -74,7 +74,7 @@ Value Interpreter::run(const Statement& statement, ArgumentVector arguments, Sco
m_last_value = js_undefined();
for (auto& node : block.children()) {
m_last_value = node.execute(*this);
m_last_value = node.execute(*this, global_object());
if (should_unwind()) {
if (should_unwind_until(ScopeType::Breakable, block.label()))
stop_unwind();