mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
LibJS: Make the AST reference-counted
This allows function objects to outlive the original parsed program without their ScopeNode disappearing.
This commit is contained in:
parent
d98fbd192e
commit
ddd69e3660
8 changed files with 138 additions and 130 deletions
|
@ -100,10 +100,10 @@ Value WhileStatement::execute(Interpreter& interpreter) const
|
|||
|
||||
Value ForStatement::execute(Interpreter& interpreter) const
|
||||
{
|
||||
OwnPtr<BlockStatement> wrapper;
|
||||
RefPtr<BlockStatement> wrapper;
|
||||
|
||||
if (m_init->is_variable_declaration() && static_cast<const VariableDeclaration*>(m_init.ptr())->declaration_type() != DeclarationType::Var) {
|
||||
wrapper = make<BlockStatement>();
|
||||
wrapper = create_ast_node<BlockStatement>();
|
||||
interpreter.enter_scope(*wrapper, {}, ScopeType::Block);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue