mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibJS: Finish implementing mapped arguments exotic objects :^)
Now that the Object rewrite is in place, we have enough tools to implement the mapped `arguments` propreties according to spec. The basic mechanism is that the `arguments` object installs a hidden parameter mapping object that property accesses get filtered through. This is how accessing numeric properties on `arguments` are proxied to the named identifier in the function scope. When `arguments` is instantiated, getters and setters are created for all the numeric properties on the object that correspond to function arguments. These getters and setters can be deleted from the object. This is all pretty intricate, so refer to the spec for details. Note that the `arguments` object itself is still lazily instantiated on first access within a function. This is non-conforming, and we'll have to revisit this once we get around to improving function calls.
This commit is contained in:
parent
36cc011ae4
commit
77fa33e61a
4 changed files with 224 additions and 12 deletions
|
@ -1023,7 +1023,9 @@ bool Object::define_native_accessor(PropertyName const& property_name, Function<
|
|||
{
|
||||
auto& vm = this->vm();
|
||||
String formatted_property_name;
|
||||
if (property_name.is_string()) {
|
||||
if (property_name.is_number()) {
|
||||
formatted_property_name = property_name.to_string();
|
||||
} else if (property_name.is_string()) {
|
||||
formatted_property_name = property_name.as_string();
|
||||
} else {
|
||||
formatted_property_name = String::formatted("[{}]", property_name.as_symbol()->description());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue