fix infinite loop in acorn_loose when parsing broken import

pull/117/merge
nightwing 2015-07-17 11:00:04 +00:00
rodzic b1ede4860e
commit b551071cdc
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -1146,6 +1146,7 @@ lp.parseImportSpecifierList = function () {
this.pushCx(); this.pushCx();
this.eat(tt.braceL); this.eat(tt.braceL);
if (this.curLineStart > continuedLine) continuedLine = this.curLineStart; if (this.curLineStart > continuedLine) continuedLine = this.curLineStart;
var lastTokenStart = -1;
while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) { while (!this.closes(tt.braceR, indent + (this.curLineStart <= continuedLine ? 1 : 0), line)) {
var elt = this.startNode(); var elt = this.startNode();
if (this.eat(tt.star)) { if (this.eat(tt.star)) {
@ -1157,6 +1158,8 @@ lp.parseImportSpecifierList = function () {
elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported; elt.local = this.eatContextual("as") ? this.parseIdent() : elt.imported;
this.finishNode(elt, "ImportSpecifier"); this.finishNode(elt, "ImportSpecifier");
} }
if (elt.start == lastTokenStart) break;
lastTokenStart = elt.start;
elts.push(elt); elts.push(elt);
this.eat(tt.comma); this.eat(tt.comma);
} }