Allow some keywords to be treated as identifier names; update ecmaVersion in benchmark.
This commit is contained in:
parent
eb7ccea743
commit
82b9f30fc9
12
acorn.js
12
acorn.js
@ -1761,8 +1761,15 @@
|
|||||||
next();
|
next();
|
||||||
return finishNode(node, "ThisExpression");
|
return finishNode(node, "ThisExpression");
|
||||||
|
|
||||||
|
case _yield:
|
||||||
|
if (inGenerator) return parseYield();
|
||||||
|
|
||||||
case _name:
|
case _name:
|
||||||
var id = parseIdent();
|
case _static:
|
||||||
|
case _from:
|
||||||
|
case _of:
|
||||||
|
case _as:
|
||||||
|
var id = parseIdent(tokType !== _name);
|
||||||
if (eat(_arrow)) {
|
if (eat(_arrow)) {
|
||||||
return parseArrowExpression(startNodeFrom(id), [id]);
|
return parseArrowExpression(startNodeFrom(id), [id]);
|
||||||
}
|
}
|
||||||
@ -1865,9 +1872,6 @@
|
|||||||
case _bquote:
|
case _bquote:
|
||||||
return parseTemplate();
|
return parseTemplate();
|
||||||
|
|
||||||
case _yield:
|
|
||||||
return inGenerator ? parseYield() : parseIdent(true);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unexpected();
|
unexpected();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ numbers.</p>
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
function runAcorn(code, locations) {
|
function runAcorn(code, locations) {
|
||||||
acorn.parse(code, {locations: locations});
|
acorn.parse(code, {ecmaVersion: 6, locations: locations});
|
||||||
}
|
}
|
||||||
function runEsprima(code, locations) {
|
function runEsprima(code, locations) {
|
||||||
esprima.parse(code, {loc: locations});
|
esprima.parse(code, {loc: locations});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user