diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-06-08 16:49:06 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-08 15:31:46 +0100 |
commit | af58779def630d58c677c8a845623ac575c51da0 (patch) | |
tree | a82694c6ef1b51319b142ac681a9f481300572cc /Userland/Libraries/LibJS/Runtime | |
parent | 98897ff6769d8858a4ddc40c21e5ae53c71b301a (diff) | |
download | serenity-af58779def630d58c677c8a845623ac575c51da0.zip |
LibJS: Return undefined from a with statement if no value was generated
Co-authored-by: Linus Groh <mail@linusgroh.de>
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/GlobalObject.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
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 ) |