Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade acorn and parse as ES2018 #1182

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions src/parse/read/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/parse/read/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/parse/read/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down