-
-
Notifications
You must be signed in to change notification settings - Fork 476
Implement proposal nonextensible-applies-to-private #4511
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
base: main
Are you sure you want to change the base?
Implement proposal nonextensible-applies-to-private #4511
Conversation
Test262 conformance changes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4511 +/- ##
==========================================
+ Coverage 47.24% 57.10% +9.85%
==========================================
Files 476 503 +27
Lines 46892 57464 +10572
==========================================
+ Hits 22154 32812 +10658
+ Misses 24738 24652 -86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4e040c4 to
2540fb2
Compare
2540fb2 to
e010f53
Compare
HalidOdat
left a comment
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.
Looks great! Just some minor nitpicks 😄
| ) -> JsResult<()> { | ||
| // 1. If the host is a web browser, then | ||
| // a. Perform ? HostEnsureCanAddPrivateElement(O). | ||
| if !self.extensible() { |
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.
Suggestion: It would be nice if we added the spec step to know where this came from. 😄
| if !self.extensible() { | |
| // 1. If O.[[Extensible]] is false, throw a TypeError exception. | |
| // | |
| // NOTE: From <https://tc39.es/proposal-nonextensible-applies-to-private/#sec-privatefieldadd> | |
| if !self.extensible() { |
| (false, false) | ||
| }; | ||
|
|
||
| if !self.extensible() { |
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.
Suggestion: Same here:
| if !self.extensible() { | |
| // 2. If O.[[Extensible]] is false, throw a TypeError exception. | |
| // | |
| // NOTE: From <https://tc39.es/proposal-nonextensible-applies-to-private/#sec-privatemethodoraccessoradd> | |
| if !self.extensible() { |
| return if getter || setter { | ||
| Err(js_error!( | ||
| TypeError: "cannot add private accessor to non-extensible class instance" | ||
| )) | ||
| } else { | ||
| Err(js_error!( | ||
| TypeError: "cannot add private method to non-extensible class instance" | ||
| )) | ||
| }; |
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.
Praise: I really like the error message Improvement 😄
Implements the
nonextensible-applies-to-privateproposal.Since it's such a small change and it's already on stage 3, I decided to not gate this behind the experimental feature.