feat: add tests
This commit is contained in:
@@ -285,11 +285,10 @@ pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
|
||||
node.callee = this.parseNoCallExpr();
|
||||
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
|
||||
} else if (this.eat(tt.questionDot)) {
|
||||
base.optional = true;
|
||||
|
||||
if (this.eat(tt.bracketL)) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.object = base;
|
||||
node.optional = true;
|
||||
node.property = this.parseExpression();
|
||||
node.computed = true;
|
||||
this.expect(tt.bracketR);
|
||||
@@ -298,6 +297,7 @@ pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.object = base;
|
||||
node.property = this.parseIdentifier(true);
|
||||
node.optional = true;
|
||||
node.computed = false;
|
||||
base = this.finishNode(node, "MemberExpression");
|
||||
}
|
||||
@@ -312,7 +312,6 @@ pp.parseSubscripts = function (base, startPos, startLoc, noCalls) {
|
||||
node.object = base;
|
||||
node.property = this.parseExpression();
|
||||
node.computed = true;
|
||||
delete node.nullPropagation;
|
||||
this.expect(tt.bracketR);
|
||||
base = this.finishNode(node, "MemberExpression");
|
||||
} else if (!noCalls && this.match(tt.parenL)) {
|
||||
|
||||
Reference in New Issue
Block a user