Allow some keywords to be treated as identifier names; update ecmaVersion in benchmark.

This commit is contained in:
Ingvar Stepanyan 2014-07-26 08:56:22 +03:00 committed by Marijn Haverbeke
parent eb7ccea743
commit 82b9f30fc9
2 changed files with 9 additions and 5 deletions

View File

@ -1761,8 +1761,15 @@
next();
return finishNode(node, "ThisExpression");
case _yield:
if (inGenerator) return parseYield();
case _name:
var id = parseIdent();
case _static:
case _from:
case _of:
case _as:
var id = parseIdent(tokType !== _name);
if (eat(_arrow)) {
return parseArrowExpression(startNodeFrom(id), [id]);
}
@ -1865,9 +1872,6 @@
case _bquote:
return parseTemplate();
case _yield:
return inGenerator ? parseYield() : parseIdent(true);
default:
unexpected();
}

View File

@ -36,7 +36,7 @@ numbers.</p>
<script>
function runAcorn(code, locations) {
acorn.parse(code, {locations: locations});
acorn.parse(code, {ecmaVersion: 6, locations: locations});
}
function runEsprima(code, locations) {
esprima.parse(code, {loc: locations});