-
-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Object.hasOwn and improve Object.prototype.hasOwnProperty #1639
Conversation
@@ -54,7 +54,7 @@ impl BuiltIn for Object { | |||
.name(Self::NAME) | |||
.length(Self::LENGTH) | |||
.inherit(JsValue::null()) | |||
.method(Self::has_own_property, "hasOwnProperty", 0) | |||
.method(Self::has_own_property, "hasOwnProperty", 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, test/built-ins/Object/prototype/hasOwnProperty
conformance is now 100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect similar bugs are present elsewhere, e.g. propertyIsEnumerable
below. I don't make the change here, though, since I think it's quite unrelated with the changes made in this PR.
Test262 conformance changes:
Fixed tests (118):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! Just a small change I'd like to have to cover all cases of get_or_undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good. Great job!
This Pull Request partially fixes/closes #1580. The last unimplemented method from #1580, i.e.
Object.fromEntries
, will be implemented in a separate PR.In addition to implementing
Object.hasOwn
, I decided to also make some changes to improve the existingObject.prototype.hasOwnProperty
implementation (in the same PR since it is nearly identical toObject.hasOwn
).It changes the following:
Object.hasOwn
.Object.hasOwn
.Object.prototype.hasOwnProperty
.Object.prototype.hasOwnProperty
.Object.prototype.hasOwnProperty
's'length'
property.