summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/VM.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-28 01:44:58 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-28 02:00:46 +0200
commit9eed7444de6d407dee6757485d9cc48f5f9384b0 (patch)
treec8da7df57b7ea716cb031575593417346446cbf7 /Userland/Libraries/LibJS/Runtime/VM.cpp
parent63a12753780b6330d7ca6b6e80f1dde9b07bd973 (diff)
downloadserenity-9eed7444de6d407dee6757485d9cc48f5f9384b0.zip
LibJS: Implement the CreateUnmappedArgumentsObject abstract operation
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/VM.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp14
1 files changed, 10 insertions, 4 deletions
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;