added check to disallow super.private variable access and test case added (#10472)

* 🚀 added check to disallow super.private variable access and test case added

* ♻️ change the other linting change back to how it was

* ♻️ change the other linting change back to how it was

* ♻️ added newline at the end test output.json file

* ♻️ changed the linting style to the way it was

* ♻️ updated error message, removed super private member access test cases from whitelist of flow and test 262 suite

* ♻️ added newline in output.json
This commit is contained in:
Vivek Nayyar
2019-09-21 03:52:37 +05:30
committed by Nicolò Ribaudo
parent 46c70ad734
commit b7333ea97a
5 changed files with 19 additions and 5 deletions

View File

@@ -655,6 +655,12 @@ export default class ExpressionParser extends LValParser {
node.object = base;
node.property = this.parseMaybePrivateName();
node.computed = false;
if (
node.property.type === "PrivateName" &&
node.object.type === "Super"
) {
this.raise(startPos, "Private fields can't be accessed on super");
}
if (state.optionalChainMember) {
node.optional = false;
return this.finishNode(node, "OptionalMemberExpression");