feat: add tests

This commit is contained in:
Sven SAULEAU
2017-04-17 13:33:00 +02:00
parent 0927e24ac6
commit b2fdd944fe
9 changed files with 108 additions and 577 deletions

View File

@@ -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)) {