1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

LibJS: Implement the CreateUnmappedArgumentsObject abstract operation

This commit is contained in:
Andreas Kling 2021-06-28 01:44:58 +02:00
parent 63a1275378
commit 9eed7444de
4 changed files with 46 additions and 5 deletions

View file

@ -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;