upgrade acorn and parse as ES2018

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

@ -45,7 +45,7 @@
"devDependencies": { "devDependencies": {
"@types/mocha": "^2.2.41", "@types/mocha": "^2.2.41",
"@types/node": "^8.0.17", "@types/node": "^8.0.17",
"acorn": "^5.1.1", "acorn": "^5.4.1",
"acorn-dynamic-import": "^2.0.2", "acorn-dynamic-import": "^2.0.2",
"chalk": "^2.0.1", "chalk": "^2.0.1",
"codecov": "^2.2.0", "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.index = expression.end;
parser.allowWhitespace(); parser.allowWhitespace();
@ -102,7 +104,7 @@ export function readBindingDirective(
} }
const source = repeat(' ', a) + parser.template.slice(a, b); 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') { if (value.type !== 'Identifier' && value.type !== 'MemberExpression') {
parser.error(`Cannot bind to rvalue`, value.start); parser.error(`Cannot bind to rvalue`, value.start);

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

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

@ -58,10 +58,14 @@ acorn@^4.0.3:
version "4.0.13" version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" 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" version "5.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.3.0.tgz#7446d39459c54fb49a80e6ee6478149b940ec822" 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: acorn@~5.1.1:
version "5.1.2" version "5.1.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7"

Loading…
Cancel
Save