mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:57:44 +00:00
LibJS: Implement temporal AO SnapshotOwnProperties
This commit is contained in:
parent
107fa1fdb8
commit
d2710ad73f
2 changed files with 18 additions and 0 deletions
|
@ -487,6 +487,23 @@ ThrowCompletionOr<void> Object::copy_data_properties(VM& vm, Value source, HashT
|
|||
return {};
|
||||
}
|
||||
|
||||
// 14.7 SnapshotOwnProperties ( source, proto [ , excludedKeys [ , excludedValues ] ] ), https://tc39.es/proposal-temporal/#sec-snapshotownproperties
|
||||
ThrowCompletionOr<NonnullGCPtr<Object>> Object::snapshot_own_properties(VM& vm, GCPtr<Object> prototype, HashTable<PropertyKey> const& excluded_keys, HashTable<Value> const& excluded_values)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 1. Let copy be OrdinaryObjectCreate(proto).
|
||||
auto copy = Object::create(realm, prototype);
|
||||
|
||||
// 2. If excludedKeys is not present, set excludedKeys to « ».
|
||||
// 3. If excludedValues is not present, set excludedValues to « ».
|
||||
// 4. Perform ? CopyDataProperties(copy, source, excludedKeys, excludedValues).
|
||||
TRY(copy->copy_data_properties(vm, Value { this }, excluded_keys, excluded_values));
|
||||
|
||||
// 5. Return copy.
|
||||
return copy;
|
||||
}
|
||||
|
||||
// 7.3.27 PrivateElementFind ( O, P ), https://tc39.es/ecma262/#sec-privateelementfind
|
||||
PrivateElement* Object::private_element_find(PrivateName const& name)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue