upgrade acorn and parse as ES2018

pull/1182/head
Conduitry 7 years ago
parent 8330f328fa
commit 8c1f09db1f

@ -45,7 +45,7 @@
"devDependencies": {
"@types/mocha": "^2.2.41",
"@types/node": "^8.0.17",
"acorn": "^5.1.1",
"acorn": "^5.4.1",
"acorn-dynamic-import": "^2.0.2",
"chalk": "^2.0.1",
"codecov": "^2.2.0",

@ -31,7 +31,9 @@ function readExpression(parser: Parser, start: number, quoteMark: string|null) {
}
}
const expression = parseExpressionAt(repeat(' ', start) + str, start);
const expression = parseExpressionAt(repeat(' ', start) + str, start, {
ecmaVersion: 9,
});
parser.index = expression.end;
parser.allowWhitespace();
@ -102,7 +104,7 @@ export function readBindingDirective(
}
const source = repeat(' ', a) + parser.template.slice(a, b);
value = parseExpressionAt(source, a);
value = parseExpressionAt(source, a, { ecmaVersion: 9 });
if (value.type !== 'Identifier' && value.type !== 'MemberExpression') {
parser.error(`Cannot bind to rvalue`, value.start);

@ -32,6 +32,7 @@ export default function readExpression(parser: Parser) {
try {
const node = parseExpressionAt(parser.template, parser.index, {
ecmaVersion: 9,
preserveParens: true,
});
parser.index = node.end;

@ -22,7 +22,7 @@ export default function readScript(parser: Parser, start: number, attributes: No
try {
ast = acorn.parse(source, {
ecmaVersion: 8,
ecmaVersion: 9,
sourceType: 'module',
plugins: {
dynamicImport: true

@ -58,10 +58,14 @@ acorn@^4.0.3:
version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
acorn@^5.0.0, acorn@^5.1.1, acorn@^5.2.1, acorn@^5.3.0:
acorn@^5.0.0, acorn@^5.2.1, acorn@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.3.0.tgz#7446d39459c54fb49a80e6ee6478149b940ec822"
acorn@^5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102"
acorn@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7"

Loading…
Cancel
Save