Skip to content

Commit 6e257e5

Browse files
committed
Disable legacy comprehensions
1 parent 1a4cade commit 6e257e5

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/parser/expression.js

-15
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,6 @@ pp.parseExprAtom = function (refShorthandDefaultPos) {
734734
}
735735
node = this.startNode();
736736
this.next();
737-
if (this.hasPlugin("lightscript") && this.match(tt._for)) {
738-
return this.parseArrayComprehension(node);
739-
}
740737
node.elements = this.parseExprList(tt.bracketR, true, refShorthandDefaultPos);
741738
this.toReferencedList(node.elements);
742739
return this.finishNode(node, "ArrayExpression");
@@ -1053,18 +1050,6 @@ pp.parseObj = function (isPattern, refShorthandDefaultPos) {
10531050
node.properties = [];
10541051
this.next();
10551052

1056-
// `for` keyword begins an object comprehension.
1057-
if (
1058-
this.hasPlugin("lightscript") &&
1059-
!this.hasPlugin("splatComprehension") &&
1060-
this.match(tt._for)
1061-
) {
1062-
// ...however, `{ for: x }` is a legal JS object.
1063-
if (this.lookahead().type !== tt.colon) {
1064-
return this.parseObjectComprehension(node);
1065-
}
1066-
}
1067-
10681053
let firstRestLocation = null;
10691054

10701055
while (!this.eat(tt.braceR)) {

src/plugins/lightscript.js

-17
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,6 @@ pp.expectParenFreeBlockStart = function (node) {
120120
}
121121
};
122122

123-
// XXX: legacy
124-
// [for ...: stmnt]
125-
pp.parseArrayComprehension = function (node) {
126-
const loop = this.startNode();
127-
node.loop = this.parseForStatement(loop);
128-
this.expect(tt.bracketR);
129-
return this.finishNode(node, "ArrayComprehension");
130-
};
131-
132-
// XXX: legacy
133-
pp.parseObjectComprehension = function(node) {
134-
const loop = this.startNode();
135-
node.loop = this.parseForStatement(loop);
136-
this.expect(tt.braceR);
137-
return this.finishNode(node, "ObjectComprehension");
138-
};
139-
140123
pp.parseInlineWhiteBlock = function(node) {
141124
if (this.state.type.startsExpr) return this.parseMaybeAssign();
142125
// oneline statement case

0 commit comments

Comments
 (0)