From 9eed7444de6d407dee6757485d9cc48f5f9384b0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 28 Jun 2021 01:44:58 +0200 Subject: LibJS: Implement the CreateUnmappedArgumentsObject abstract operation --- Userland/Libraries/LibJS/Runtime/VM.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Userland/Libraries/LibJS/Runtime/VM.cpp') diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index e97845629e..e80d6da9ff 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -369,10 +369,16 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object) if (possible_match.has_value()) return possible_match.value().value; if (!context.arguments_object) { - context.arguments_object = Array::create(global_object); - context.arguments_object->put(names.callee, context.function); - for (auto argument : context.arguments) { - context.arguments_object->indexed_properties().append(argument); + if (context.function->is_strict_mode()) { + context.arguments_object = create_unmapped_arguments_object(global_object, context.arguments); + } else { + // FIXME: This code path is completely ad-hoc. + context.arguments_object = Array::create(global_object); + context.arguments_object->put(names.callee, context.function); + + for (auto argument : context.arguments) { + context.arguments_object->indexed_properties().append(argument); + } } } return context.arguments_object; -- cgit v1.2.3