Handle private access chained on an optional chain (#11248)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
This commit is contained in:
committed by
Nicolò Ribaudo
parent
852520eff5
commit
bda759ac3d
@@ -502,7 +502,8 @@ export default class ExpressionParser extends LValParser {
|
||||
if (arg.type === "Identifier") {
|
||||
this.raise(node.start, Errors.StrictDelete);
|
||||
} else if (
|
||||
arg.type === "MemberExpression" &&
|
||||
(arg.type === "MemberExpression" ||
|
||||
arg.type === "OptionalMemberExpression") &&
|
||||
arg.property.type === "PrivateName"
|
||||
) {
|
||||
this.raise(node.start, Errors.DeletePrivateField);
|
||||
@@ -616,8 +617,6 @@ export default class ExpressionParser extends LValParser {
|
||||
node.object = base;
|
||||
node.property = computed
|
||||
? this.parseExpression()
|
||||
: optional
|
||||
? this.parseIdentifier(true)
|
||||
: this.parseMaybePrivateName(true);
|
||||
node.computed = computed;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user