mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibJS: Handle "for" statements with empty initializer and updater
This commit is contained in:
parent
30d24af54a
commit
6c9d2cfa5e
3 changed files with 26 additions and 2 deletions
|
@ -126,7 +126,7 @@ Value ForStatement::execute(Interpreter& interpreter) const
|
|||
{
|
||||
RefPtr<BlockStatement> wrapper;
|
||||
|
||||
if (m_init->is_variable_declaration() && static_cast<const VariableDeclaration*>(m_init.ptr())->declaration_type() != DeclarationType::Var) {
|
||||
if (m_init && m_init->is_variable_declaration() && static_cast<const VariableDeclaration*>(m_init.ptr())->declaration_type() != DeclarationType::Var) {
|
||||
wrapper = create_ast_node<BlockStatement>();
|
||||
interpreter.enter_scope(*wrapper, {}, ScopeType::Block);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue