mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
LibJS: Add the CreateMappedArgumentsObject abstract operation
This patch adds a new ArgumentsObject class to represent what the spec calls "Arguments Exotic Objects" These are constructed by the new CreateMappedArgumentsObject when the `arguments` identifier is resolved in a callee context. The implementation is incomplete and doesn't yet support mapping of the parameter variables to the indexed properties of `arguments`.
This commit is contained in:
parent
a55cf08ef9
commit
2d4eb40f59
8 changed files with 95 additions and 10 deletions
|
@ -372,13 +372,7 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object)
|
|||
if (context.function->is_strict_mode() || !context.function->has_simple_parameter_list()) {
|
||||
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);
|
||||
}
|
||||
context.arguments_object = create_mapped_arguments_object(global_object, *context.function, verify_cast<OrdinaryFunctionObject>(context.function)->parameters(), context.arguments, *lexical_environment());
|
||||
}
|
||||
}
|
||||
return context.arguments_object;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue