From af58779def630d58c677c8a845623ac575c51da0 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 8 Jun 2021 16:49:06 +0300 Subject: LibJS: Return undefined from a with statement if no value was generated Co-authored-by: Linus Groh --- Userland/Libraries/LibJS/Runtime/GlobalObject.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Userland/Libraries/LibJS/Runtime') diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 855bbdac40..bbef7109d9 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -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 ) -- cgit v1.2.3