1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

LibJS: Return undefined from a with statement if no value was generated

Co-authored-by: Linus Groh <mail@linusgroh.de>
This commit is contained in:
Idan Horowitz 2021-06-08 16:49:06 +03:00 committed by Linus Groh
parent 98897ff676
commit af58779def
3 changed files with 9 additions and 15 deletions

View file

@ -302,7 +302,7 @@ Value WithStatement::execute(Interpreter& interpreter, GlobalObject& global_obje
auto* with_scope = interpreter.heap().allocate<WithScope>(global_object, *object, interpreter.vm().call_frame().scope);
TemporaryChange<ScopeObject*> scope_change(interpreter.vm().call_frame().scope, with_scope);
return interpreter.execute_statement(global_object, m_body);
return interpreter.execute_statement(global_object, m_body).value_or(js_undefined());
}
Value WhileStatement::execute(Interpreter& interpreter, GlobalObject& global_object) const