Remove private field shorthand
There seems to be tentative agreement to remove the private field shorthand given the added confusion and edge cases involved with the shorthand. Refs: https://github.com/tc39/proposal-class-fields/issues/21
This commit is contained in:
@@ -331,14 +331,12 @@ export default class ExpressionParser extends LValParser {
|
||||
|
||||
if (arg.type === "Identifier") {
|
||||
this.raise(node.start, "Deleting local variable in strict mode");
|
||||
} else if (this.hasPlugin("classPrivateProperties")) {
|
||||
if (
|
||||
arg.type === "PrivateName" ||
|
||||
(arg.type === "MemberExpression" &&
|
||||
arg.property.type === "PrivateName")
|
||||
) {
|
||||
this.raise(node.start, "Deleting a private field is not allowed");
|
||||
}
|
||||
} else if (
|
||||
this.hasPlugin("classPrivateProperties") &&
|
||||
arg.type === "MemberExpression" &&
|
||||
arg.property.type === "PrivateName"
|
||||
) {
|
||||
this.raise(node.start, "Deleting a private field is not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,13 +745,6 @@ export default class ExpressionParser extends LValParser {
|
||||
this.takeDecorators(node);
|
||||
return this.parseClass(node, false);
|
||||
|
||||
case tt.hash:
|
||||
if (this.hasPlugin("classPrivateProperties")) {
|
||||
return this.parseMaybePrivateName();
|
||||
} else {
|
||||
throw this.unexpected();
|
||||
}
|
||||
|
||||
case tt._new:
|
||||
return this.parseNew();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user