1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57: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

@ -317,10 +317,8 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::eval)
auto& caller_frame = vm.call_stack().at(vm.call_stack().size() - 2);
TemporaryChange scope_change(vm.call_frame().scope, caller_frame->scope);
vm.interpreter().execute_statement(global_object, program);
if (vm.exception())
return {};
return vm.last_value().value_or(js_undefined());
auto& interpreter = vm.interpreter();
return interpreter.execute_statement(global_object, program).value_or(js_undefined());
}
// 19.2.6.1.1 Encode ( string, unescapedSet )