From 1221112610d8dc30cf158cdf107d6b5bc0fb3d29 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 26 Jan 2015 00:12:01 +1100 Subject: [PATCH] add canInsertSemicolon check to async function parsing --- acorn.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acorn.js b/acorn.js index 6f49749bc8..9e37092ace 100644 --- a/acorn.js +++ b/acorn.js @@ -2630,7 +2630,7 @@ default: var maybeName = tokVal, expr = parseExpression(false, true); - if (options.ecmaVersion >= 7 && starttype === _name && maybeName === "async" && tokType === _function) { + if (options.ecmaVersion >= 7 && starttype === _name && maybeName === "async" && tokType === _function && !canInsertSemicolon()) { next(); var func = parseFunctionStatement(node); func.async = true; @@ -3225,7 +3225,7 @@ } // normal functions - if (tokType === _function) { + if (tokType === _function && !canInsertSemicolon()) { next(); return parseFunction(node, false, true); }