Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Re-land typed descriptors and printer #2511

Closed
11 changes: 7 additions & 4 deletions src/methods/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,9 @@ export class PropertiesImplementation {
// same value as the corresponding field in current when compared using the SameValue algorithm.
let identical = true;
for (let field in Desc) {
if (Desc[field] === undefined) {
continue;
}
if ((current: any)[field] === undefined) {
identical = false;
} else {
Expand Down Expand Up @@ -1003,8 +1006,8 @@ export class PropertiesImplementation {
// Preserve the existing values of the converted property's [[Configurable]] and [[Enumerable]] attributes and set the rest of the property's attributes to their default values.
if (O !== undefined) {
invariant(P !== undefined);
delete current.writable;
delete current.value;
current.writable = undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I didn't think to search for delete.

current.value = undefined;
current.get = realm.intrinsics.undefined;
current.set = realm.intrinsics.undefined;
}
Expand All @@ -1013,8 +1016,8 @@ export class PropertiesImplementation {
// i. If O is not undefined, convert the property named P of object O from an accessor property to a data property. Preserve the existing values of the converted property's [[Configurable]] and [[Enumerable]] attributes and set the rest of the property's attributes to their default values.
if (O !== undefined) {
invariant(P !== undefined);
delete current.get;
delete current.set;
current.get = undefined;
current.set = undefined;
current.writable = false;
current.value = realm.intrinsics.undefined;
}
Expand Down