remove DoExpression statement parsing and clear labels and set inFunction to false when parsing DoExpression body - fixes #1658

This commit is contained in:
Sebastian McKenzie 2015-06-01 03:36:14 +01:00
parent 4001a28983
commit f6e7cf4a31
2 changed files with 6 additions and 6 deletions

View File

@ -274,7 +274,13 @@ pp.parseExprAtom = function(refShorthandDefaultPos) {
if (this.options.features["es7.doExpressions"]) { if (this.options.features["es7.doExpressions"]) {
let node = this.startNode() let node = this.startNode()
this.next() this.next()
var oldInFunction = this.inFunction
var oldLabels = this.labels
this.labels = []
this.inFunction = false
node.body = this.parseBlock() node.body = this.parseBlock()
this.inFunction = oldInFunction
this.labels = oldLabels
return this.finishNode(node, "DoExpression") return this.finishNode(node, "DoExpression")
} }

View File

@ -168,12 +168,6 @@ pp.parseDoStatement = function(node) {
this.labels.push(loopLabel) this.labels.push(loopLabel)
node.body = this.parseStatement(false) node.body = this.parseStatement(false)
this.labels.pop() this.labels.pop()
if (this.options.features["es7.doExpressions"] && this.type !== tt._while) {
let container = this.startNodeAt(start)
container.expression = this.finishNode(node, "DoExpression")
this.semicolon()
return this.finishNode(container, "ExpressionStatement")
}
this.expect(tt._while) this.expect(tt._while)
node.test = this.parseParenExpression() node.test = this.parseParenExpression()
if (this.options.ecmaVersion >= 6) if (this.options.ecmaVersion >= 6)