From f6e7cf4a310d945eb82bdaa0cb98c4e10e8c8f0b Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 1 Jun 2015 03:36:14 +0100 Subject: [PATCH] remove DoExpression statement parsing and clear labels and set inFunction to false when parsing DoExpression body - fixes #1658 --- src/expression.js | 6 ++++++ src/statement.js | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/expression.js b/src/expression.js index 08c4b26084..7433cda730 100755 --- a/src/expression.js +++ b/src/expression.js @@ -274,7 +274,13 @@ pp.parseExprAtom = function(refShorthandDefaultPos) { if (this.options.features["es7.doExpressions"]) { let node = this.startNode() this.next() + var oldInFunction = this.inFunction + var oldLabels = this.labels + this.labels = [] + this.inFunction = false node.body = this.parseBlock() + this.inFunction = oldInFunction + this.labels = oldLabels return this.finishNode(node, "DoExpression") } diff --git a/src/statement.js b/src/statement.js index 23bd66f5f4..0507b8308f 100755 --- a/src/statement.js +++ b/src/statement.js @@ -168,12 +168,6 @@ pp.parseDoStatement = function(node) { this.labels.push(loopLabel) node.body = this.parseStatement(false) 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) node.test = this.parseParenExpression() if (this.options.ecmaVersion >= 6)