From a733a30373a8c8f271e702df8b110d7a054fcbed Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 14 Jun 2021 09:33:10 +0200 Subject: [PATCH] LibJS: Write computed function default arguments into the call frame Previously, default argument values would only show up when accessing the argument by parameter name. This patch makes us write them back into the call frame so they can be accessed via VM::argument() as well. --- Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp index d69cf52578..433e6cd807 100644 --- a/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp @@ -144,6 +144,9 @@ Value ScriptFunction::execute_function_body() argument_value = js_undefined(); } + if (i >= call_frame_args.size()) + call_frame_args.resize(i + 1); + call_frame_args[i] = argument_value; vm.assign(param, argument_value, global_object(), true, vm.current_scope()); });