From 59dc29f3f0e950e33a612c83cd5e9b085283fd3f Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Wed, 4 Mar 2015 15:29:15 +0100 Subject: [PATCH] In ES6-mode, don't treat keywords with escaped characters as regular identifiers See https://mathiasbynens.be/notes/javascript-identifiers-es6 --- acorn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acorn.js b/acorn.js index 979b9317de..c6341b605e 100644 --- a/acorn.js +++ b/acorn.js @@ -1269,7 +1269,7 @@ function readWord() { var word = readWord1(); var type = _name; - if (!containsEsc && isKeyword(word)) + if ((options.ecmaVersion >= 6 || !containsEsc) && isKeyword(word)) type = keywordTypes[word]; return finishToken(type, word); }