In ES6-mode, don't treat keywords with escaped characters as regular identifiers

See https://mathiasbynens.be/notes/javascript-identifiers-es6
This commit is contained in:
Marijn Haverbeke 2015-03-04 15:29:15 +01:00
parent cbd8aa8f06
commit 59dc29f3f0

View File

@ -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);
}