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
added check to disallow super.private variable access and test case added #10472
Merged
nicolo-ribaudo
merged 7 commits into
babel:master
from
vivek12345:disallow-super-private-access
Sep 20, 2019
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4c4f7ac
:rocket: added check to disallow super.private variable access and te…
vivek12345 2309738
:recycle: change the other linting change back to how it was
vivek12345 5df46b6
:recycle: change the other linting change back to how it was
vivek12345 a40173c
:recycle: added newline at the end test output.json file
vivek12345 762e92b
:recycle: changed the linting style to the way it was
vivek12345 4cd44fa
:recycle: updated error message, removed super private member access …
vivek12345 65f596a
:recycle: added newline in output.json
vivek12345 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
.../test/fixtures/experimental/class-private-properties/super-private-member-access/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class A extends B { | ||
#x; | ||
|
||
method() { | ||
super.#x; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...t/fixtures/experimental/class-private-properties/super-private-member-access/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": [ | ||
"classPrivateProperties" | ||
], | ||
"throws": "super is not allowed to be called on a private identifier of a class (5:4)" | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Well, in this case
super
is not being called (it's notsuper(#x)
).What about
Private fields can't be accessed on super?
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.
Yes that message makes more sense. I will make the changes accordingly and also update the tests. Thank you