Skip to content

Commit

Permalink
Disable legacy comprehensions
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Oct 7, 2017
1 parent 1a4cade commit 6e257e5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
15 changes: 0 additions & 15 deletions src/parser/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,6 @@ pp.parseExprAtom = function (refShorthandDefaultPos) {
}
node = this.startNode();
this.next();
if (this.hasPlugin("lightscript") && this.match(tt._for)) {
return this.parseArrayComprehension(node);
}
node.elements = this.parseExprList(tt.bracketR, true, refShorthandDefaultPos);
this.toReferencedList(node.elements);
return this.finishNode(node, "ArrayExpression");
Expand Down Expand Up @@ -1053,18 +1050,6 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
node.properties = [];
this.next();

// `for` keyword begins an object comprehension.
if (
this.hasPlugin("lightscript") &&
!this.hasPlugin("splatComprehension") &&
this.match(tt._for)
) {
// ...however, `{ for: x }` is a legal JS object.
if (this.lookahead().type !== tt.colon) {
return this.parseObjectComprehension(node);
}
}

let firstRestLocation = null;

while (!this.eat(tt.braceR)) {
Expand Down
17 changes: 0 additions & 17 deletions src/plugins/lightscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,6 @@ pp.expectParenFreeBlockStart = function (node) {
}
};

// XXX: legacy
// [for ...: stmnt]
pp.parseArrayComprehension = function (node) {
const loop = this.startNode();
node.loop = this.parseForStatement(loop);
this.expect(tt.bracketR);
return this.finishNode(node, "ArrayComprehension");
};

// XXX: legacy
pp.parseObjectComprehension = function(node) {
const loop = this.startNode();
node.loop = this.parseForStatement(loop);
this.expect(tt.braceR);
return this.finishNode(node, "ObjectComprehension");
};

pp.parseInlineWhiteBlock = function(node) {
if (this.state.type.startsExpr) return this.parseMaybeAssign();
// oneline statement case
Expand Down

0 comments on commit 6e257e5

Please sign in to comment.