deps: import acorn@5.7.2

Imported from the tarball published on npm
(https://registry.npmjs.org/acorn/-/acorn-5.7.2.tgz).

Update to emcaScript version 10 in order to get support for
binding-less catch statements.

Also needed to parse node.js lib API in #22405.

PR-URL: https://github.com/nodejs/node/pull/22488
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Bryan English <bryan@bryanenglish.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Sam Ruby 2018-08-23 15:33:47 -04:00
parent 317b894b12
commit 49bfc37241
18 changed files with 4649 additions and 805 deletions

View File

@ -53,7 +53,7 @@ The externally maintained libraries used by Node.js are:
- Acorn, located at deps/acorn, is licensed as follows: - Acorn, located at deps/acorn, is licensed as follows:
""" """
Copyright (C) 2012-2017 by various contributors (see AUTHORS) Copyright (C) 2012-2018 by various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

8
deps/acorn/AUTHORS vendored
View File

@ -1,5 +1,6 @@
List of Acorn contributors. Updated before every release. List of Acorn contributors. Updated before every release.
Adrian Heine
Adrian Rakovsky Adrian Rakovsky
Alistair Braidwood Alistair Braidwood
Amila Welihinda Amila Welihinda
@ -8,14 +9,19 @@ Angelo
Aparajita Fishman Aparajita Fishman
Arian Stolwijk Arian Stolwijk
Artem Govorov Artem Govorov
Boopesh Mahendran
Bradley Heinz Bradley Heinz
Brandon Mills Brandon Mills
Charles Hughes Charles Hughes
Charmander
Chris McKnight
Conrad Irwin Conrad Irwin
Daniel Tschinder Daniel Tschinder
David Bonnet David Bonnet
Domenico Matteo Domenico Matteo
ehmicky ehmicky
Eugene Obrezkov
Felix Maier
Forbes Lindesay Forbes Lindesay
Gilad Peleg Gilad Peleg
impinball impinball
@ -34,6 +40,7 @@ Keheliya Gallaba
Kevin Irish Kevin Irish
Kevin Kwok Kevin Kwok
krator krator
laosb
Marek Marek
Marijn Haverbeke Marijn Haverbeke
Martin Carlberg Martin Carlberg
@ -60,6 +67,7 @@ Richard Gibson
Rich Harris Rich Harris
Sebastian McKenzie Sebastian McKenzie
Shahar Soel Shahar Soel
Sheel Bedi
Simen Bekkhus Simen Bekkhus
Teddy Katz Teddy Katz
Timothy Gu Timothy Gu

View File

@ -1,3 +1,129 @@
## 5.7.2 (2018-08-24)
### Bug fixes
Properly handle `allowAwaitOutsideFunction` in for statements.
Treat function declarations at the top level of modules like let bindings.
Don't allow async function declarations as the only statement under a label.
## 5.7.1 (2018-06-15)
### Bug fixes
Make sure the walker and bin files are rebuilt on release (the previous release didn't get the up-to-date versions).
## 5.7.0 (2018-06-15)
### Bug fixes
Fix crash in walker when walking a binding-less catch node.
### New features
Upgraded to Unicode 11.
## 5.6.2 (2018-06-05)
### Bug fixes
In the walker, go back to allowing the `baseVisitor` argument to be null to default to the default base everywhere.
## 5.6.1 (2018-06-01)
### Bug fixes
Fix regression when passing `null` as fourth argument to `walk.recursive`.
## 5.6.0 (2018-05-31)
### Bug fixes
Fix a bug in the walker that caused a crash when walking an object pattern spread.
### New features
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
Allow binding-less catch statements when ECMAVersion >= 10.
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
## 5.5.3 (2018-03-08)
### Bug fixes
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
## 5.5.2 (2018-03-08)
### Bug fixes
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
## 5.5.1 (2018-03-06)
### Bug fixes
Fix regression in walker causing property values in object patterns to be walked as expressions.
Fix misleading error message for octal escapes in template strings.
## 5.5.0 (2018-02-27)
### Bug fixes
Support object spread in the AST walker.
### New features
The identifier character categorization is now based on Unicode version 10.
Acorn will now validate the content of regular expressions, including new ES9 features.
## 5.4.1 (2018-02-02)
### Bug fixes
5.4.0 somehow accidentally included an old version of walk.js.
## 5.4.0 (2018-02-01)
### Bug fixes
Disallow duplicate or escaped flags on regular expressions.
Disallow octal escapes in strings in strict mode.
### New features
Add support for async iteration.
Add support for object spread and rest.
## 5.3.0 (2017-12-28)
### Bug fixes
Fix parsing of floating point literals with leading zeroes in loose mode.
Allow duplicate property names in object patterns.
Don't allow static class methods named `prototype`.
Disallow async functions directly under `if` or `else`.
Parse right-hand-side of `for`/`of` as an assignment expression.
Stricter parsing of `for`/`in`.
Don't allow unicode escapes in contextual keywords.
### New features
Parsing class members was factored into smaller methods to allow plugins to hook into it.
## 5.2.1 (2017-10-30) ## 5.2.1 (2017-10-30)
### Bug fixes ### Bug fixes

2
deps/acorn/LICENSE vendored
View File

@ -1,4 +1,4 @@
Copyright (C) 2012-2017 by various contributors (see AUTHORS) Copyright (C) 2012-2018 by various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

43
deps/acorn/README.md vendored
View File

@ -1,6 +1,6 @@
# Acorn # Acorn
[![Build Status](https://travis-ci.org/ternjs/acorn.svg?branch=master)](https://travis-ci.org/ternjs/acorn) [![Build Status](https://travis-ci.org/acornjs/acorn.svg?branch=master)](https://travis-ci.org/acornjs/acorn)
[![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.com/package/acorn) [![NPM version](https://img.shields.io/npm/v/acorn.svg)](https://www.npmjs.com/package/acorn)
[![CDNJS](https://img.shields.io/cdnjs/v/acorn.svg)](https://cdnjs.com/libraries/acorn) [![CDNJS](https://img.shields.io/cdnjs/v/acorn.svg)](https://cdnjs.com/libraries/acorn)
[Author funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?force)](https://marijnhaverbeke.nl/fund/) [Author funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?force)](https://marijnhaverbeke.nl/fund/)
@ -10,11 +10,11 @@ A tiny, fast JavaScript parser, written completely in JavaScript.
## Community ## Community
Acorn is open source software released under an Acorn is open source software released under an
[MIT license](https://github.com/ternjs/acorn/blob/master/LICENSE). [MIT license](https://github.com/acornjs/acorn/blob/master/LICENSE).
You are welcome to You are welcome to
[report bugs](https://github.com/ternjs/acorn/issues) or create pull [report bugs](https://github.com/acornjs/acorn/issues) or create pull
requests on [github](https://github.com/ternjs/acorn). For questions requests on [github](https://github.com/acornjs/acorn). For questions
and discussion, please use the and discussion, please use the
[Tern discussion forum](https://discuss.ternjs.net). [Tern discussion forum](https://discuss.ternjs.net).
@ -28,10 +28,13 @@ The easiest way to install acorn is with [`npm`][npm].
npm install acorn npm install acorn
``` ```
Alternately, download the source. Alternately, you can download the source and build acorn yourself:
```sh ```sh
git clone https://github.com/ternjs/acorn.git git clone https://github.com/acornjs/acorn.git
cd acorn
npm install
npm run build
``` ```
## Components ## Components
@ -63,7 +66,7 @@ object referring to that same position.
[estree]: https://github.com/estree/estree [estree]: https://github.com/estree/estree
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be - **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
either 3, 5, 6 (2015), 7 (2016), 8 (2017), or 9 (2018, partial either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018) or 10 (2019, partial
support). This influences support for strict mode, the set of support). This influences support for strict mode, the set of
reserved words, and support for new syntax features. Default is 7. reserved words, and support for new syntax features. Default is 7.
@ -97,6 +100,8 @@ object referring to that same position.
declarations can only appear at a program's top level. Setting this declarations can only appear at a program's top level. Setting this
option to `true` allows them anywhere where a statement is allowed. option to `true` allows them anywhere where a statement is allowed.
- **allowAwaitOutsideFunction**: By default, `await` expressions can only appear inside `async` functions. Setting this option to `true` allows to have top-level `await` expressions. They are still not allowed in non-`async` functions, though.
- **allowHashBang**: When this is enabled (off by default), if the - **allowHashBang**: When this is enabled (off by default), if the
code starts with the characters `#!` (as in a shellscript), the code starts with the characters `#!` (as in a shellscript), the
first line will be treated as a comment. first line will be treated as a comment.
@ -351,7 +356,7 @@ The `bin/acorn` utility can be used to parse a file from the command
line. It accepts as arguments its input file and the following line. It accepts as arguments its input file and the following
options: options:
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9`: Sets the ECMAScript version - `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
to parse. Default is version 7. to parse. Default is version 7.
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. - `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
@ -443,10 +448,20 @@ looseParser.extend("readToken", function(nextMethod) {
### Existing plugins ### Existing plugins
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx) - [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
- [`acorn-es7-plugin`](https://github.com/MatAtBread/acorn-es7-plugin/): Parse [async/await syntax proposal](https://github.com/tc39/ecmascript-asyncawait) - [`acorn-objj`](https://github.com/cappuccino/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin
- [`acorn-object-spread`](https://github.com/UXtemple/acorn-object-spread): Parse [object spread syntax proposal](https://github.com/sebmarkbage/ecmascript-rest-spread)
- [`acorn-es7`](https://www.npmjs.com/package/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators)
- [`acorn-objj`](https://www.npmjs.com/package/acorn-objj): [Objective-J](http://www.cappuccino-project.org/learn/objective-j.html) language parser built as Acorn plugin
- [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread) Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread), works with latest Acorn version (5.0.3)
- [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer) Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus)
Plugins for ECMAScript proposals:
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
- [`acorn-async-iteration`](https://github.com/acornjs/acorn-async-iteration): Parse [async iteration proposal](https://github.com/tc39/proposal-async-iteration)
- [`acorn-bigint`](https://github.com/acornjs/acorn-bigint): Parse [BigInt proposal](https://github.com/tc39/proposal-bigint)
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
- [`acorn-dynamic-import`](https://github.com/kesne/acorn-dynamic-import): Parse [import() proposal](https://github.com/tc39/proposal-dynamic-import)
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
- [`acorn-numeric-separator`](https://github.com/acornjs/acorn-numeric-separator): Parse [numeric separator proposal](https://github.com/tc39/proposal-numeric-separator)
- [`acorn-optional-catch-binding`](https://github.com/acornjs/acorn-optional-catch-binding): Parse [optional catch binding proposal](https://github.com/tc39/proposal-optional-catch-binding)
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)
- [`acorn5-object-spread`](https://github.com/adrianheine/acorn5-object-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread)
- [`acorn-object-rest-spread`](https://github.com/victor-homyakov/acorn-object-rest-spread): Parse [Object Rest/Spread Properties proposal](https://github.com/tc39/proposal-object-rest-spread)
- [`acorn-es7`](https://github.com/angelozerr/acorn-es7): Parse [decorator syntax proposal](https://github.com/wycats/javascript-decorators)
- [`acorn-static-class-property-initializer`](https://github.com/victor-homyakov/acorn-static-class-property-initializer): Partial support for static class properties from [ES Class Fields & Static Properties Proposal](https://github.com/tc39/proposal-class-public-fields) to support static property initializers in [React components written as ES6+ classes](https://babeljs.io/blog/2015/06/07/react-on-es6-plus)

69
deps/acorn/bin/_acorn.js vendored Normal file
View File

@ -0,0 +1,69 @@
#!/usr/bin/env node
'use strict';
var path = require('path');
var fs = require('fs');
var acorn = require('../dist/acorn.js');
var infile;
var forceFile;
var silent = false;
var compact = false;
var tokenize = false;
var options = {};
function help(status) {
var print = (status === 0) ? console.log : console.error;
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
process.exit(status);
}
for (var i = 2; i < process.argv.length; ++i) {
var arg = process.argv[i];
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
else if (arg === "--locations") { options.locations = true; }
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
else if (arg === "--silent") { silent = true; }
else if (arg === "--compact") { compact = true; }
else if (arg === "--help") { help(0); }
else if (arg === "--tokenize") { tokenize = true; }
else if (arg === "--module") { options.sourceType = "module"; }
else {
var match = arg.match(/^--ecma(\d+)$/);
if (match)
{ options.ecmaVersion = +match[1]; }
else
{ help(1); }
}
}
function run(code) {
var result;
try {
if (!tokenize) {
result = acorn.parse(code, options);
} else {
result = [];
var tokenizer$$1 = acorn.tokenizer(code, options), token;
do {
token = tokenizer$$1.getToken();
result.push(token);
} while (token.type !== acorn.tokTypes.eof)
}
} catch (e) {
console.error(e.message);
process.exit(1);
}
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
}
if (forceFile || infile && infile !== "-") {
run(fs.readFileSync(infile, "utf8"));
} else {
var code = "";
process.stdin.resume();
process.stdin.on("data", function (chunk) { return code += chunk; });
process.stdin.on("end", function () { return run(code); });
}

67
deps/acorn/bin/acorn vendored
View File

@ -1,69 +1,4 @@
#!/usr/bin/env node #!/usr/bin/env node
'use strict'; 'use strict';
var path = require('path'); require('./_acorn.js');
var fs = require('fs');
var acorn = require('../dist/acorn.js');
var infile;
var forceFile;
var silent = false;
var compact = false;
var tokenize = false;
var options = {};
function help(status) {
var print = (status == 0) ? console.log : console.error;
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
process.exit(status);
}
for (var i = 2; i < process.argv.length; ++i) {
var arg = process.argv[i];
if ((arg == "-" || arg[0] != "-") && !infile) { infile = arg; }
else if (arg == "--" && !infile && i + 2 == process.argv.length) { forceFile = infile = process.argv[++i]; }
else if (arg == "--locations") { options.locations = true; }
else if (arg == "--allow-hash-bang") { options.allowHashBang = true; }
else if (arg == "--silent") { silent = true; }
else if (arg == "--compact") { compact = true; }
else if (arg == "--help") { help(0); }
else if (arg == "--tokenize") { tokenize = true; }
else if (arg == "--module") { options.sourceType = "module"; }
else {
var match = arg.match(/^--ecma(\d+)$/);
if (match)
{ options.ecmaVersion = +match[1]; }
else
{ help(1); }
}
}
function run(code) {
var result;
try {
if (!tokenize) {
result = acorn.parse(code, options);
} else {
result = [];
var tokenizer$$1 = acorn.tokenizer(code, options), token;
do {
token = tokenizer$$1.getToken();
result.push(token);
} while (token.type != acorn.tokTypes.eof)
}
} catch (e) {
console.error(e.message);
process.exit(1);
}
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
}
if (forceFile || infile && infile != "-") {
run(fs.readFileSync(infile, "utf8"));
} else {
var code = "";
process.stdin.resume();
process.stdin.on("data", function (chunk) { return code += chunk; });
process.stdin.on("end", function () { return run(code); });
}

21
deps/acorn/bin/run_test262.js vendored Normal file
View File

@ -0,0 +1,21 @@
const fs = require("fs")
const path = require("path")
const run = require("test262-parser-runner")
const parse = require("..").parse
const unsupportedFeatures = [
"BigInt",
"class-fields",
"class-fields-private",
"class-fields-public",
"numeric-separator-literal"
];
run(
(content, {sourceType}) => parse(content, {sourceType, ecmaVersion: 10}),
{
testsDirectory: path.dirname(require.resolve("test262/package.json")),
skip: test => (test.attrs.features && unsupportedFeatures.some(f => test.attrs.features.includes(f))),
whitelist: fs.readFileSync("./bin/test262.whitelist", "utf8").split("\n").filter(v => v)
}
)

404
deps/acorn/bin/test262.whitelist vendored Normal file
View File

@ -0,0 +1,404 @@
annexB/language/function-code/block-decl-func-no-skip-try.js (default)
annexB/language/function-code/block-decl-func-skip-early-err-block.js (default)
annexB/language/function-code/block-decl-func-skip-early-err.js (default)
annexB/language/function-code/block-decl-func-skip-early-err-switch.js (default)
annexB/language/function-code/block-decl-func-skip-early-err-try.js (default)
annexB/language/function-code/if-decl-else-decl-a-func-no-skip-try.js (default)
annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-block.js (default)
annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err.js (default)
annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-switch.js (default)
annexB/language/function-code/if-decl-else-decl-a-func-skip-early-err-try.js (default)
annexB/language/function-code/if-decl-else-decl-b-func-no-skip-try.js (default)
annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-block.js (default)
annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err.js (default)
annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-switch.js (default)
annexB/language/function-code/if-decl-else-decl-b-func-skip-early-err-try.js (default)
annexB/language/function-code/if-decl-else-stmt-func-no-skip-try.js (default)
annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-block.js (default)
annexB/language/function-code/if-decl-else-stmt-func-skip-early-err.js (default)
annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-switch.js (default)
annexB/language/function-code/if-decl-else-stmt-func-skip-early-err-try.js (default)
annexB/language/function-code/if-decl-no-else-func-no-skip-try.js (default)
annexB/language/function-code/if-decl-no-else-func-skip-early-err-block.js (default)
annexB/language/function-code/if-decl-no-else-func-skip-early-err.js (default)
annexB/language/function-code/if-decl-no-else-func-skip-early-err-switch.js (default)
annexB/language/function-code/if-decl-no-else-func-skip-early-err-try.js (default)
annexB/language/function-code/if-stmt-else-decl-func-no-skip-try.js (default)
annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-block.js (default)
annexB/language/function-code/if-stmt-else-decl-func-skip-early-err.js (default)
annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-switch.js (default)
annexB/language/function-code/if-stmt-else-decl-func-skip-early-err-try.js (default)
annexB/language/function-code/switch-case-func-no-skip-try.js (default)
annexB/language/function-code/switch-case-func-skip-early-err-block.js (default)
annexB/language/function-code/switch-case-func-skip-early-err.js (default)
annexB/language/function-code/switch-case-func-skip-early-err-switch.js (default)
annexB/language/function-code/switch-case-func-skip-early-err-try.js (default)
annexB/language/function-code/switch-dflt-func-no-skip-try.js (default)
annexB/language/function-code/switch-dflt-func-skip-early-err-block.js (default)
annexB/language/function-code/switch-dflt-func-skip-early-err.js (default)
annexB/language/function-code/switch-dflt-func-skip-early-err-switch.js (default)
annexB/language/function-code/switch-dflt-func-skip-early-err-try.js (default)
annexB/language/global-code/block-decl-global-no-skip-try.js (default)
annexB/language/global-code/block-decl-global-skip-early-err-block.js (default)
annexB/language/global-code/block-decl-global-skip-early-err.js (default)
annexB/language/global-code/block-decl-global-skip-early-err-switch.js (default)
annexB/language/global-code/block-decl-global-skip-early-err-try.js (default)
annexB/language/global-code/if-decl-else-decl-a-global-no-skip-try.js (default)
annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-block.js (default)
annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err.js (default)
annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-switch.js (default)
annexB/language/global-code/if-decl-else-decl-a-global-skip-early-err-try.js (default)
annexB/language/global-code/if-decl-else-decl-b-global-no-skip-try.js (default)
annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-block.js (default)
annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err.js (default)
annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-switch.js (default)
annexB/language/global-code/if-decl-else-decl-b-global-skip-early-err-try.js (default)
annexB/language/global-code/if-decl-else-stmt-global-no-skip-try.js (default)
annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-block.js (default)
annexB/language/global-code/if-decl-else-stmt-global-skip-early-err.js (default)
annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-switch.js (default)
annexB/language/global-code/if-decl-else-stmt-global-skip-early-err-try.js (default)
annexB/language/global-code/if-decl-no-else-global-no-skip-try.js (default)
annexB/language/global-code/if-decl-no-else-global-skip-early-err-block.js (default)
annexB/language/global-code/if-decl-no-else-global-skip-early-err.js (default)
annexB/language/global-code/if-decl-no-else-global-skip-early-err-switch.js (default)
annexB/language/global-code/if-decl-no-else-global-skip-early-err-try.js (default)
annexB/language/global-code/if-stmt-else-decl-global-no-skip-try.js (default)
annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-block.js (default)
annexB/language/global-code/if-stmt-else-decl-global-skip-early-err.js (default)
annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-switch.js (default)
annexB/language/global-code/if-stmt-else-decl-global-skip-early-err-try.js (default)
annexB/language/global-code/switch-case-global-no-skip-try.js (default)
annexB/language/global-code/switch-case-global-skip-early-err-block.js (default)
annexB/language/global-code/switch-case-global-skip-early-err.js (default)
annexB/language/global-code/switch-case-global-skip-early-err-switch.js (default)
annexB/language/global-code/switch-case-global-skip-early-err-try.js (default)
annexB/language/global-code/switch-dflt-global-no-skip-try.js (default)
annexB/language/global-code/switch-dflt-global-skip-early-err-block.js (default)
annexB/language/global-code/switch-dflt-global-skip-early-err.js (default)
annexB/language/global-code/switch-dflt-global-skip-early-err-switch.js (default)
annexB/language/global-code/switch-dflt-global-skip-early-err-try.js (default)
annexB/language/statements/try/catch-redeclared-for-in-var.js (default)
annexB/language/statements/try/catch-redeclared-for-in-var.js (strict mode)
annexB/language/statements/try/catch-redeclared-for-var.js (default)
annexB/language/statements/try/catch-redeclared-for-var.js (strict mode)
annexB/language/statements/try/catch-redeclared-var-statement-captured.js (default)
annexB/language/statements/try/catch-redeclared-var-statement-captured.js (strict mode)
annexB/language/statements/try/catch-redeclared-var-statement.js (default)
annexB/language/statements/try/catch-redeclared-var-statement.js (strict mode)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/block-scope/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/block-scope/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/block-scope/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/block-scope/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js (default)
language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js (strict mode)
language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js (default)
language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js (strict mode)
language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js (default)
language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js (strict mode)
language/expressions/async-function/early-errors-expression-body-contains-super-call.js (default)
language/expressions/async-function/early-errors-expression-body-contains-super-call.js (strict mode)
language/expressions/async-function/early-errors-expression-body-contains-super-property.js (default)
language/expressions/async-function/early-errors-expression-body-contains-super-property.js (strict mode)
language/expressions/async-function/early-errors-expression-formals-contains-super-call.js (default)
language/expressions/async-function/early-errors-expression-formals-contains-super-call.js (strict mode)
language/expressions/async-function/early-errors-expression-formals-contains-super-property.js (default)
language/expressions/async-function/early-errors-expression-formals-contains-super-property.js (strict mode)
language/expressions/class/method-param-dflt-yield.js (default)
language/expressions/class/static-method-param-dflt-yield.js (default)
language/expressions/function/early-body-super-call.js (default)
language/expressions/function/early-body-super-call.js (strict mode)
language/expressions/function/early-body-super-prop.js (default)
language/expressions/function/early-body-super-prop.js (strict mode)
language/expressions/function/early-params-super-call.js (default)
language/expressions/function/early-params-super-call.js (strict mode)
language/expressions/function/early-params-super-prop.js (default)
language/expressions/function/early-params-super-prop.js (strict mode)
language/expressions/object/method-definition/early-errors-object-method-body-contains-super-call.js (default)
language/expressions/object/method-definition/early-errors-object-method-body-contains-super-call.js (strict mode)
language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js (default)
language/expressions/object/method-definition/early-errors-object-method-formals-contains-super-call.js (default)
language/expressions/object/method-definition/early-errors-object-method-formals-contains-super-call.js (strict mode)
language/expressions/object/method-definition/generator-super-call-body.js (default)
language/expressions/object/method-definition/generator-super-call-body.js (strict mode)
language/expressions/object/method-definition/generator-super-call-param.js (default)
language/expressions/object/method-definition/generator-super-call-param.js (strict mode)
language/expressions/object/prop-def-invalid-async-prefix.js (default)
language/expressions/object/prop-def-invalid-async-prefix.js (strict mode)
language/expressions/yield/in-iteration-stmt.js (default)
language/expressions/yield/in-iteration-stmt.js (strict mode)
language/expressions/yield/star-in-iteration-stmt.js (default)
language/expressions/yield/star-in-iteration-stmt.js (strict mode)
language/global-code/new.target-arrow.js (default)
language/global-code/new.target-arrow.js (strict mode)
language/global-code/super-call-arrow.js (default)
language/global-code/super-call-arrow.js (strict mode)
language/global-code/super-prop-arrow.js (default)
language/global-code/super-prop-arrow.js (strict mode)
language/module-code/early-export-global.js (default)
language/module-code/early-export-global.js (strict mode)
language/module-code/early-export-unresolvable.js (default)
language/module-code/early-export-unresolvable.js (strict mode)
language/statements/async-function/early-errors-declaration-body-contains-super-call.js (default)
language/statements/async-function/early-errors-declaration-body-contains-super-call.js (strict mode)
language/statements/async-function/early-errors-declaration-body-contains-super-property.js (default)
language/statements/async-function/early-errors-declaration-body-contains-super-property.js (strict mode)
language/statements/async-function/early-errors-declaration-formals-contains-super-call.js (default)
language/statements/async-function/early-errors-declaration-formals-contains-super-call.js (strict mode)
language/statements/async-function/early-errors-declaration-formals-contains-super-property.js (default)
language/statements/async-function/early-errors-declaration-formals-contains-super-property.js (strict mode)
language/expressions/async-generator/early-errors-expression-body-contains-super-call.js (default)
language/expressions/async-generator/early-errors-expression-body-contains-super-call.js (strict mode)
language/expressions/async-generator/early-errors-expression-body-contains-super-property.js (default)
language/expressions/async-generator/early-errors-expression-body-contains-super-property.js (strict mode)
language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js (default)
language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js (strict mode)
language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js (default)
language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js (strict mode)
language/statements/class/definition/early-errors-class-method-arguments-in-formal-parameters.js (default)
language/statements/class/definition/early-errors-class-method-body-contains-super-call.js (default)
language/statements/class/definition/early-errors-class-method-body-contains-super-call.js (strict mode)
language/statements/class/definition/early-errors-class-method-duplicate-parameters.js (default)
language/statements/class/definition/early-errors-class-method-eval-in-formal-parameters.js (default)
language/statements/class/definition/early-errors-class-method-formals-contains-super-call.js (default)
language/statements/class/definition/early-errors-class-method-formals-contains-super-call.js (strict mode)
language/statements/class/definition/methods-gen-yield-as-function-expression-binding-identifier.js (default)
language/statements/class/definition/methods-gen-yield-as-identifier-in-nested-function.js (default)
language/statements/class/method-param-yield.js (default)
language/statements/class/static-method-param-yield.js (default)
language/statements/class/strict-mode/with.js (default)
language/statements/class/syntax/early-errors/class-body-has-direct-super-missing-class-heritage.js (default)
language/statements/class/syntax/early-errors/class-body-has-direct-super-missing-class-heritage.js (strict mode)
language/statements/class/syntax/early-errors/class-body-method-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-method-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-body-special-method-generator-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-special-method-generator-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-body-special-method-get-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-special-method-get-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-body-special-method-set-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-special-method-set-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-body-static-method-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-static-method-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-body-static-method-get-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-static-method-get-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-body-static-method-set-contains-direct-super.js (default)
language/statements/class/syntax/early-errors/class-body-static-method-set-contains-direct-super.js (strict mode)
language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js (default)
language/statements/class/syntax/early-errors/class-definition-evaluation-block-duplicate-binding.js (strict mode)
language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js (default)
language/statements/class/syntax/early-errors/class-definition-evaluation-scriptbody-duplicate-binding.js (strict mode)
language/statements/const/syntax/const-declaring-let-split-across-two-lines.js (default)
language/statements/do-while/labelled-fn-stmt.js (default)
language/statements/for/head-let-bound-names-in-stmt.js (default)
language/statements/for/head-let-bound-names-in-stmt.js (strict mode)
language/statements/for-in/head-const-bound-names-in-stmt.js (default)
language/statements/for-in/head-const-bound-names-in-stmt.js (strict mode)
language/statements/for-in/head-const-bound-names-let.js (default)
language/statements/for-in/head-let-bound-names-in-stmt.js (default)
language/statements/for-in/head-let-bound-names-in-stmt.js (strict mode)
language/statements/for-in/head-let-bound-names-let.js (default)
language/statements/for-in/labelled-fn-stmt-const.js (default)
language/statements/for-in/labelled-fn-stmt-let.js (default)
language/statements/for-in/labelled-fn-stmt-lhs.js (default)
language/statements/for-in/labelled-fn-stmt-var.js (default)
language/statements/for-in/let-block-with-newline.js (default)
language/statements/for-in/let-identifier-with-newline.js (default)
language/statements/for/labelled-fn-stmt-expr.js (default)
language/statements/for/labelled-fn-stmt-let.js (default)
language/statements/for/labelled-fn-stmt-var.js (default)
language/statements/for/let-block-with-newline.js (default)
language/statements/for/let-identifier-with-newline.js (default)
language/statements/for-of/head-const-bound-names-in-stmt.js (default)
language/statements/for-of/head-const-bound-names-in-stmt.js (strict mode)
language/statements/for-of/head-const-bound-names-let.js (default)
language/statements/for-of/head-let-bound-names-in-stmt.js (default)
language/statements/for-of/head-let-bound-names-in-stmt.js (strict mode)
language/statements/for-of/head-let-bound-names-let.js (default)
language/statements/for-of/labelled-fn-stmt-const.js (default)
language/statements/for-of/labelled-fn-stmt-let.js (default)
language/statements/for-of/labelled-fn-stmt-lhs.js (default)
language/statements/for-of/labelled-fn-stmt-var.js (default)
language/statements/for-of/let-block-with-newline.js (default)
language/statements/for-of/let-identifier-with-newline.js (default)
language/statements/for-await-of/let-block-with-newline.js (default)
language/statements/for-await-of/let-identifier-with-newline.js (default)
language/statements/function/early-body-super-call.js (default)
language/statements/function/early-body-super-call.js (strict mode)
language/statements/function/early-body-super-prop.js (default)
language/statements/function/early-body-super-prop.js (strict mode)
language/statements/function/early-params-super-call.js (default)
language/statements/function/early-params-super-call.js (strict mode)
language/statements/function/early-params-super-prop.js (default)
language/statements/function/early-params-super-prop.js (strict mode)
language/statements/if/if-gen-else-gen.js (default)
language/statements/if/if-gen-else-stmt.js (default)
language/statements/if/if-gen-no-else.js (default)
language/statements/if/if-stmt-else-gen.js (default)
language/statements/if/labelled-fn-stmt-first.js (default)
language/statements/if/labelled-fn-stmt-lone.js (default)
language/statements/if/labelled-fn-stmt-second.js (default)
language/statements/if/let-block-with-newline.js (default)
language/statements/if/let-identifier-with-newline.js (default)
language/statements/labeled/let-block-with-newline.js (default)
language/statements/labeled/let-identifier-with-newline.js (default)
language/statements/let/syntax/identifier-let-disallowed-as-boundname.js (default)
language/statements/let/syntax/let-let-declaration-split-across-two-lines.js (default)
language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/statements/switch/syntax/redeclaration/async-generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-const-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-let-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/statements/switch/syntax/redeclaration/class-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/const-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/statements/switch/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (default)
language/statements/switch/syntax/redeclaration/generator-declaration-attempt-to-redeclare-with-var-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/let-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-async-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (default)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-class-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (default)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-function-declaration.js (strict mode)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (default)
language/statements/switch/syntax/redeclaration/var-declaration-attempt-to-redeclare-with-generator-declaration.js (strict mode)
language/statements/while/labelled-fn-stmt.js (default)
language/statements/while/let-block-with-newline.js (default)
language/statements/while/let-identifier-with-newline.js (default)
language/statements/with/labelled-fn-stmt.js (default)
language/statements/with/let-block-with-newline.js (default)
language/statements/with/let-identifier-with-newline.js (default)
language/white-space/mongolian-vowel-separator.js (default)
language/white-space/mongolian-vowel-separator.js (strict mode)

File diff suppressed because it is too large Load Diff

2117
deps/acorn/dist/acorn.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
import { Node, SourceLocation, Token, addLooseExports, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, tokTypes, tokenizer } from './acorn.es'; import { Node, SourceLocation, Token, addLooseExports, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, tokTypes, tokenizer } from './acorn.es';
function noop() {}
// Registered plugins // Registered plugins
var pluginsLoose = {}; var pluginsLoose = {};
@ -10,6 +12,8 @@ var LooseParser = function LooseParser(input, options) {
this.options = this.toks.options; this.options = this.toks.options;
this.input = this.toks.input; this.input = this.toks.input;
this.tok = this.last = {type: tokTypes.eof, start: 0, end: 0}; this.tok = this.last = {type: tokTypes.eof, start: 0, end: 0};
this.tok.validateRegExpFlags = noop;
this.tok.validateRegExpPattern = noop;
if (this.options.locations) { if (this.options.locations) {
var here = this.toks.curPosition(); var here = this.toks.curPosition();
this.tok.loc = new SourceLocation(this.toks, here, here); this.tok.loc = new SourceLocation(this.toks, here, here);
@ -20,6 +24,7 @@ var LooseParser = function LooseParser(input, options) {
this.curLineStart = 0; this.curLineStart = 0;
this.nextLineStart = this.lineEnd(this.curLineStart) + 1; this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
this.inAsync = false; this.inAsync = false;
this.inFunction = false;
// Load plugins // Load plugins
this.options.pluginsLoose = options.pluginsLoose || {}; this.options.pluginsLoose = options.pluginsLoose || {};
this.loadPlugins(this.options.pluginsLoose); this.loadPlugins(this.options.pluginsLoose);
@ -106,7 +111,7 @@ LooseParser.prototype.expect = function expect (type) {
if (this.eat(type)) { return true } if (this.eat(type)) { return true }
for (var i = 1; i <= 2; i++) { for (var i = 1; i <= 2; i++) {
if (this$1.lookAhead(i).type == type) { if (this$1.lookAhead(i).type === type) {
for (var j = 0; j < i; j++) { this$1.next(); } for (var j = 0; j < i; j++) { this$1.next(); }
return true return true
} }
@ -139,7 +144,7 @@ LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) { LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === tokTypes.eof) { return true } if (this.tok.type === closeTok || this.tok.type === tokTypes.eof) { return true }
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() && return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
(!blockHeuristic || this.nextLineStart >= this.input.length || (!blockHeuristic || this.nextLineStart >= this.input.length ||
this.indentationAfter(this.nextLineStart) < indent) this.indentationAfter(this.nextLineStart) < indent)
}; };
@ -269,7 +274,7 @@ lp.resetTo = function(pos) {
var ch = this.input.charAt(pos - 1); var ch = this.input.charAt(pos - 1);
this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) || this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) && /[enwfd]/.test(ch) &&
/\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos)); /\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(pos - 10, pos));
if (this.options.locations) { if (this.options.locations) {
this.toks.curLine = 1; this.toks.curLine = 1;
@ -290,7 +295,7 @@ lp.lookAhead = function(n) {
return this.ahead[n - 1] return this.ahead[n - 1]
}; };
function isDummy(node) { return node.name == "✖" } function isDummy(node) { return node.name === "✖" }
var lp$1 = LooseParser.prototype; var lp$1 = LooseParser.prototype;
@ -343,7 +348,9 @@ lp$1.parseStatement = function() {
return this.finishNode(node, "DoWhileStatement") return this.finishNode(node, "DoWhileStatement")
case tokTypes._for: case tokTypes._for:
this.next(); this.next(); // `for` keyword
var isAwait = this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await");
this.pushCx(); this.pushCx();
this.expect(tokTypes.parenL); this.expect(tokTypes.parenL);
if (this.tok.type === tokTypes.semi) { return this.parseFor(node, null) } if (this.tok.type === tokTypes.semi) { return this.parseFor(node, null) }
@ -351,13 +358,20 @@ lp$1.parseStatement = function() {
if (isLet || this.tok.type === tokTypes._var || this.tok.type === tokTypes._const) { if (isLet || this.tok.type === tokTypes._var || this.tok.type === tokTypes._const) {
var init$1 = this.parseVar(true, isLet ? "let" : this.tok.value); var init$1 = this.parseVar(true, isLet ? "let" : this.tok.value);
if (init$1.declarations.length === 1 && (this.tok.type === tokTypes._in || this.isContextual("of"))) { if (init$1.declarations.length === 1 && (this.tok.type === tokTypes._in || this.isContextual("of"))) {
if (this.options.ecmaVersion >= 9 && this.tok.type !== tokTypes._in) {
node.await = isAwait;
}
return this.parseForIn(node, init$1) return this.parseForIn(node, init$1)
} }
return this.parseFor(node, init$1) return this.parseFor(node, init$1)
} }
var init = this.parseExpression(true); var init = this.parseExpression(true);
if (this.tok.type === tokTypes._in || this.isContextual("of")) if (this.tok.type === tokTypes._in || this.isContextual("of")) {
{ return this.parseForIn(node, this.toAssignable(init)) } if (this.options.ecmaVersion >= 9 && this.tok.type !== tokTypes._in) {
node.await = isAwait;
}
return this.parseForIn(node, this.toAssignable(init))
}
return this.parseFor(node, init) return this.parseFor(node, init)
case tokTypes._function: case tokTypes._function:
@ -423,9 +437,12 @@ lp$1.parseStatement = function() {
if (this.tok.type === tokTypes._catch) { if (this.tok.type === tokTypes._catch) {
var clause = this.startNode(); var clause = this.startNode();
this.next(); this.next();
this.expect(tokTypes.parenL); if (this.eat(tokTypes.parenL)) {
clause.param = this.toAssignable(this.parseExprAtom(), true); clause.param = this.toAssignable(this.parseExprAtom(), true);
this.expect(tokTypes.parenR); this.expect(tokTypes.parenR);
} else {
clause.param = null;
}
clause.body = this.parseBlock(); clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause"); node.handler = this.finishNode(clause, "CatchClause");
} }
@ -572,7 +589,7 @@ lp$1.parseClass = function(isStatement) {
this$1.parsePropertyName(method); this$1.parsePropertyName(method);
if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(tokTypes.comma); continue } if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(tokTypes.comma); continue }
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
(this$1.tok.type != tokTypes.parenL && this$1.tok.type != tokTypes.braceL)) { (this$1.tok.type !== tokTypes.parenL && this$1.tok.type !== tokTypes.braceL)) {
method.static = true; method.static = true;
isGenerator = this$1.eat(tokTypes.star); isGenerator = this$1.eat(tokTypes.star);
this$1.parsePropertyName(method); this$1.parsePropertyName(method);
@ -582,8 +599,9 @@ lp$1.parseClass = function(isStatement) {
if (!method.computed && if (!method.computed &&
method.key.type === "Identifier" && method.key.name === "async" && this$1.tok.type !== tokTypes.parenL && method.key.type === "Identifier" && method.key.name === "async" && this$1.tok.type !== tokTypes.parenL &&
!this$1.canInsertSemicolon()) { !this$1.canInsertSemicolon()) {
this$1.parsePropertyName(method);
isAsync = true; isAsync = true;
isGenerator = this$1.options.ecmaVersion >= 9 && this$1.eat(tokTypes.star);
this$1.parsePropertyName(method);
} else { } else {
isAsync = false; isAsync = false;
} }
@ -618,7 +636,7 @@ lp$1.parseClass = function(isStatement) {
}; };
lp$1.parseFunction = function(node, isStatement, isAsync) { lp$1.parseFunction = function(node, isStatement, isAsync) {
var oldInAsync = this.inAsync; var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
this.initFunction(node); this.initFunction(node);
if (this.options.ecmaVersion >= 6) { if (this.options.ecmaVersion >= 6) {
node.generator = this.eat(tokTypes.star); node.generator = this.eat(tokTypes.star);
@ -629,10 +647,12 @@ lp$1.parseFunction = function(node, isStatement, isAsync) {
if (this.tok.type === tokTypes.name) { node.id = this.parseIdent(); } if (this.tok.type === tokTypes.name) { node.id = this.parseIdent(); }
else if (isStatement === true) { node.id = this.dummyIdent(); } else if (isStatement === true) { node.id = this.dummyIdent(); }
this.inAsync = node.async; this.inAsync = node.async;
this.inFunction = true;
node.params = this.parseFunctionParams(); node.params = this.parseFunctionParams();
node.body = this.parseBlock(); node.body = this.parseBlock();
this.toks.adaptDirectivePrologue(node.body.body); this.toks.adaptDirectivePrologue(node.body.body);
this.inAsync = oldInAsync; this.inAsync = oldInAsync;
this.inFunction = oldInFunction;
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression") return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
}; };
@ -687,7 +707,7 @@ lp$1.parseImport = function() {
this.eat(tokTypes.comma); this.eat(tokTypes.comma);
} }
node.specifiers = this.parseImportSpecifierList(); node.specifiers = this.parseImportSpecifierList();
node.source = this.eatContextual("from") && this.tok.type == tokTypes.string ? this.parseExprAtom() : this.dummyString(); node.source = this.eatContextual("from") && this.tok.type === tokTypes.string ? this.parseExprAtom() : this.dummyString();
if (elt) { node.specifiers.unshift(elt); } if (elt) { node.specifiers.unshift(elt); }
} }
this.semicolon(); this.semicolon();
@ -797,7 +817,7 @@ lp$2.parseMaybeAssign = function(noIn) {
if (this.toks.isContextual("yield")) { if (this.toks.isContextual("yield")) {
var node = this.startNode(); var node = this.startNode();
this.next(); this.next();
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type != tokTypes.star && !this.tok.type.startsExpr)) { if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type !== tokTypes.star && !this.tok.type.startsExpr)) {
node.delegate = false; node.delegate = false;
node.argument = null; node.argument = null;
} else { } else {
@ -840,7 +860,7 @@ lp$2.parseExprOps = function(noIn) {
}; };
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) { lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) { return left } if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left }
var prec = this.tok.type.binop; var prec = this.tok.type.binop;
if (prec != null && (!noIn || this.tok.type !== tokTypes._in)) { if (prec != null && (!noIn || this.tok.type !== tokTypes._in)) {
if (prec > minPrec) { if (prec > minPrec) {
@ -848,7 +868,7 @@ lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
node.left = left; node.left = left;
node.operator = this.tok.value; node.operator = this.tok.value;
this.next(); this.next();
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) { if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) {
node.right = this.dummyIdent(); node.right = this.dummyIdent();
} else { } else {
var rightStart = this.storeCurrentPos(); var rightStart = this.storeCurrentPos();
@ -865,7 +885,9 @@ lp$2.parseMaybeUnary = function(sawUnary) {
var this$1 = this; var this$1 = this;
var start = this.storeCurrentPos(), expr; var start = this.storeCurrentPos(), expr;
if (this.options.ecmaVersion >= 8 && this.inAsync && this.toks.isContextual("await")) { if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") &&
(this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))
) {
expr = this.parseAwait(); expr = this.parseAwait();
sawUnary = true; sawUnary = true;
} else if (this.tok.type.prefix) { } else if (this.tok.type.prefix) {
@ -914,8 +936,8 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
var this$1 = this; var this$1 = this;
for (;;) { for (;;) {
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) { if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) {
if (this$1.tok.type == tokTypes.dot && this$1.curIndent == startIndent) if (this$1.tok.type === tokTypes.dot && this$1.curIndent === startIndent)
{ --startIndent; } { --startIndent; }
else else
{ return base } { return base }
@ -926,13 +948,13 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
if (this$1.eat(tokTypes.dot)) { if (this$1.eat(tokTypes.dot)) {
var node = this$1.startNodeAt(start); var node = this$1.startNodeAt(start);
node.object = base; node.object = base;
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine())
{ node.property = this$1.dummyIdent(); } { node.property = this$1.dummyIdent(); }
else else
{ node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); } { node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); }
node.computed = false; node.computed = false;
base = this$1.finishNode(node, "MemberExpression"); base = this$1.finishNode(node, "MemberExpression");
} else if (this$1.tok.type == tokTypes.bracketL) { } else if (this$1.tok.type === tokTypes.bracketL) {
this$1.pushCx(); this$1.pushCx();
this$1.next(); this$1.next();
var node$1 = this$1.startNodeAt(start); var node$1 = this$1.startNodeAt(start);
@ -942,7 +964,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
this$1.popCx(); this$1.popCx();
this$1.expect(tokTypes.bracketR); this$1.expect(tokTypes.bracketR);
base = this$1.finishNode(node$1, "MemberExpression"); base = this$1.finishNode(node$1, "MemberExpression");
} else if (!noCalls && this$1.tok.type == tokTypes.parenL) { } else if (!noCalls && this$1.tok.type === tokTypes.parenL) {
var exprList = this$1.parseExprList(tokTypes.parenR); var exprList = this$1.parseExprList(tokTypes.parenR);
if (maybeAsyncArrow && this$1.eat(tokTypes.arrow)) if (maybeAsyncArrow && this$1.eat(tokTypes.arrow))
{ return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) } { return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) }
@ -950,7 +972,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
node$2.callee = base; node$2.callee = base;
node$2.arguments = exprList; node$2.arguments = exprList;
base = this$1.finishNode(node$2, "CallExpression"); base = this$1.finishNode(node$2, "CallExpression");
} else if (this$1.tok.type == tokTypes.backQuote) { } else if (this$1.tok.type === tokTypes.backQuote) {
var node$3 = this$1.startNodeAt(start); var node$3 = this$1.startNodeAt(start);
node$3.tag = base; node$3.tag = base;
node$3.quasi = this$1.parseTemplate(); node$3.quasi = this$1.parseTemplate();
@ -1064,7 +1086,7 @@ lp$2.parseNew = function() {
} }
var start = this.storeCurrentPos(); var start = this.storeCurrentPos();
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line); node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
if (this.tok.type == tokTypes.parenL) { if (this.tok.type === tokTypes.parenL) {
node.arguments = this.parseExprList(tokTypes.parenR); node.arguments = this.parseExprList(tokTypes.parenR);
} else { } else {
node.arguments = []; node.arguments = [];
@ -1128,6 +1150,12 @@ lp$2.parseObj = function() {
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; } if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
while (!this.closes(tokTypes.braceR, indent, line)) { while (!this.closes(tokTypes.braceR, indent, line)) {
var prop = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0); var prop = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0);
if (this$1.options.ecmaVersion >= 9 && this$1.eat(tokTypes.ellipsis)) {
prop.argument = this$1.parseMaybeAssign();
node.properties.push(this$1.finishNode(prop, "SpreadElement"));
this$1.eat(tokTypes.comma);
continue
}
if (this$1.options.ecmaVersion >= 6) { if (this$1.options.ecmaVersion >= 6) {
start = this$1.storeCurrentPos(); start = this$1.storeCurrentPos();
prop.method = false; prop.method = false;
@ -1136,8 +1164,9 @@ lp$2.parseObj = function() {
} }
this$1.parsePropertyName(prop); this$1.parsePropertyName(prop);
if (this$1.toks.isAsyncProp(prop)) { if (this$1.toks.isAsyncProp(prop)) {
this$1.parsePropertyName(prop);
isAsync = true; isAsync = true;
isGenerator = this$1.options.ecmaVersion >= 9 && this$1.eat(tokTypes.star);
this$1.parsePropertyName(prop);
} else { } else {
isAsync = false; isAsync = false;
} }
@ -1151,7 +1180,7 @@ lp$2.parseObj = function() {
prop.value = this$1.parseMethod(isGenerator, isAsync); prop.value = this$1.parseMethod(isGenerator, isAsync);
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && } else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
(this$1.tok.type != tokTypes.comma && this$1.tok.type != tokTypes.braceR && this$1.tok.type != tokTypes.eq)) { (this$1.tok.type !== tokTypes.comma && this$1.tok.type !== tokTypes.braceR && this$1.tok.type !== tokTypes.eq)) {
prop.kind = prop.key.name; prop.kind = prop.key.name;
this$1.parsePropertyName(prop); this$1.parsePropertyName(prop);
prop.value = this$1.parseMethod(false); prop.value = this$1.parseMethod(false);
@ -1230,28 +1259,29 @@ lp$2.initFunction = function(node) {
lp$2.toAssignable = function(node, binding) { lp$2.toAssignable = function(node, binding) {
var this$1 = this; var this$1 = this;
if (!node || node.type == "Identifier" || (node.type == "MemberExpression" && !binding)) { if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) {
// Okay // Okay
} else if (node.type == "ParenthesizedExpression") { } else if (node.type === "ParenthesizedExpression") {
this.toAssignable(node.expression, binding); this.toAssignable(node.expression, binding);
} else if (this.options.ecmaVersion < 6) { } else if (this.options.ecmaVersion < 6) {
return this.dummyIdent() return this.dummyIdent()
} else if (node.type == "ObjectExpression") { } else if (node.type === "ObjectExpression") {
node.type = "ObjectPattern"; node.type = "ObjectPattern";
var props = node.properties; for (var i = 0, list = node.properties; i < list.length; i += 1)
for (var i = 0, list = props; i < list.length; i += 1)
{ {
var prop = list[i]; var prop = list[i];
this$1.toAssignable(prop.value, binding); this$1.toAssignable(prop, binding);
} }
} else if (node.type == "ArrayExpression") { } else if (node.type === "ArrayExpression") {
node.type = "ArrayPattern"; node.type = "ArrayPattern";
this.toAssignableList(node.elements, binding); this.toAssignableList(node.elements, binding);
} else if (node.type == "SpreadElement") { } else if (node.type === "Property") {
this.toAssignable(node.value, binding);
} else if (node.type === "SpreadElement") {
node.type = "RestElement"; node.type = "RestElement";
this.toAssignable(node.argument, binding); this.toAssignable(node.argument, binding);
} else if (node.type == "AssignmentExpression") { } else if (node.type === "AssignmentExpression") {
node.type = "AssignmentPattern"; node.type = "AssignmentPattern";
delete node.operator; delete node.operator;
} else { } else {
@ -1278,26 +1308,29 @@ lp$2.parseFunctionParams = function(params) {
}; };
lp$2.parseMethod = function(isGenerator, isAsync) { lp$2.parseMethod = function(isGenerator, isAsync) {
var node = this.startNode(), oldInAsync = this.inAsync; var node = this.startNode(), oldInAsync = this.inAsync, oldInFunction = this.inFunction;
this.initFunction(node); this.initFunction(node);
if (this.options.ecmaVersion >= 6) if (this.options.ecmaVersion >= 6)
{ node.generator = !!isGenerator; } { node.generator = !!isGenerator; }
if (this.options.ecmaVersion >= 8) if (this.options.ecmaVersion >= 8)
{ node.async = !!isAsync; } { node.async = !!isAsync; }
this.inAsync = node.async; this.inAsync = node.async;
this.inFunction = true;
node.params = this.parseFunctionParams(); node.params = this.parseFunctionParams();
node.body = this.parseBlock(); node.body = this.parseBlock();
this.toks.adaptDirectivePrologue(node.body.body); this.toks.adaptDirectivePrologue(node.body.body);
this.inAsync = oldInAsync; this.inAsync = oldInAsync;
this.inFunction = oldInFunction;
return this.finishNode(node, "FunctionExpression") return this.finishNode(node, "FunctionExpression")
}; };
lp$2.parseArrowExpression = function(node, params, isAsync) { lp$2.parseArrowExpression = function(node, params, isAsync) {
var oldInAsync = this.inAsync; var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
this.initFunction(node); this.initFunction(node);
if (this.options.ecmaVersion >= 8) if (this.options.ecmaVersion >= 8)
{ node.async = !!isAsync; } { node.async = !!isAsync; }
this.inAsync = node.async; this.inAsync = node.async;
this.inFunction = true;
node.params = this.toAssignableList(params, true); node.params = this.toAssignableList(params, true);
node.expression = this.tok.type !== tokTypes.braceL; node.expression = this.tok.type !== tokTypes.braceL;
if (node.expression) { if (node.expression) {
@ -1307,6 +1340,7 @@ lp$2.parseArrowExpression = function(node, params, isAsync) {
this.toks.adaptDirectivePrologue(node.body.body); this.toks.adaptDirectivePrologue(node.body.body);
} }
this.inAsync = oldInAsync; this.inAsync = oldInAsync;
this.inFunction = oldInFunction;
return this.finishNode(node, "ArrowFunctionExpression") return this.finishNode(node, "ArrowFunctionExpression")
}; };

View File

@ -1,9 +1,11 @@
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./acorn')) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('./acorn')) :
typeof define === 'function' && define.amd ? define(['exports', './acorn'], factory) : typeof define === 'function' && define.amd ? define(['exports', './acorn'], factory) :
(factory((global.acorn = global.acorn || {}, global.acorn.loose = global.acorn.loose || {}),global.acorn)); (factory((global.acorn = global.acorn || {}, global.acorn.loose = {}),global.acorn));
}(this, (function (exports,__acorn) { 'use strict'; }(this, (function (exports,__acorn) { 'use strict';
function noop() {}
// Registered plugins // Registered plugins
var pluginsLoose = {}; var pluginsLoose = {};
@ -14,6 +16,8 @@ var LooseParser = function LooseParser(input, options) {
this.options = this.toks.options; this.options = this.toks.options;
this.input = this.toks.input; this.input = this.toks.input;
this.tok = this.last = {type: __acorn.tokTypes.eof, start: 0, end: 0}; this.tok = this.last = {type: __acorn.tokTypes.eof, start: 0, end: 0};
this.tok.validateRegExpFlags = noop;
this.tok.validateRegExpPattern = noop;
if (this.options.locations) { if (this.options.locations) {
var here = this.toks.curPosition(); var here = this.toks.curPosition();
this.tok.loc = new __acorn.SourceLocation(this.toks, here, here); this.tok.loc = new __acorn.SourceLocation(this.toks, here, here);
@ -24,6 +28,7 @@ var LooseParser = function LooseParser(input, options) {
this.curLineStart = 0; this.curLineStart = 0;
this.nextLineStart = this.lineEnd(this.curLineStart) + 1; this.nextLineStart = this.lineEnd(this.curLineStart) + 1;
this.inAsync = false; this.inAsync = false;
this.inFunction = false;
// Load plugins // Load plugins
this.options.pluginsLoose = options.pluginsLoose || {}; this.options.pluginsLoose = options.pluginsLoose || {};
this.loadPlugins(this.options.pluginsLoose); this.loadPlugins(this.options.pluginsLoose);
@ -110,7 +115,7 @@ LooseParser.prototype.expect = function expect (type) {
if (this.eat(type)) { return true } if (this.eat(type)) { return true }
for (var i = 1; i <= 2; i++) { for (var i = 1; i <= 2; i++) {
if (this$1.lookAhead(i).type == type) { if (this$1.lookAhead(i).type === type) {
for (var j = 0; j < i; j++) { this$1.next(); } for (var j = 0; j < i; j++) { this$1.next(); }
return true return true
} }
@ -143,7 +148,7 @@ LooseParser.prototype.indentationAfter = function indentationAfter (pos) {
LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) { LooseParser.prototype.closes = function closes (closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === __acorn.tokTypes.eof) { return true } if (this.tok.type === closeTok || this.tok.type === __acorn.tokTypes.eof) { return true }
return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() && return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
(!blockHeuristic || this.nextLineStart >= this.input.length || (!blockHeuristic || this.nextLineStart >= this.input.length ||
this.indentationAfter(this.nextLineStart) < indent) this.indentationAfter(this.nextLineStart) < indent)
}; };
@ -273,7 +278,7 @@ lp.resetTo = function(pos) {
var ch = this.input.charAt(pos - 1); var ch = this.input.charAt(pos - 1);
this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) || this.toks.exprAllowed = !ch || /[[{(,;:?/*=+\-~!|&%^<>]/.test(ch) ||
/[enwfd]/.test(ch) && /[enwfd]/.test(ch) &&
/\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos)); /\b(case|else|return|throw|new|in|(instance|type)?of|delete|void)$/.test(this.input.slice(pos - 10, pos));
if (this.options.locations) { if (this.options.locations) {
this.toks.curLine = 1; this.toks.curLine = 1;
@ -294,7 +299,7 @@ lp.lookAhead = function(n) {
return this.ahead[n - 1] return this.ahead[n - 1]
}; };
function isDummy(node) { return node.name == "✖" } function isDummy(node) { return node.name === "✖" }
var lp$1 = LooseParser.prototype; var lp$1 = LooseParser.prototype;
@ -347,7 +352,9 @@ lp$1.parseStatement = function() {
return this.finishNode(node, "DoWhileStatement") return this.finishNode(node, "DoWhileStatement")
case __acorn.tokTypes._for: case __acorn.tokTypes._for:
this.next(); this.next(); // `for` keyword
var isAwait = this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await");
this.pushCx(); this.pushCx();
this.expect(__acorn.tokTypes.parenL); this.expect(__acorn.tokTypes.parenL);
if (this.tok.type === __acorn.tokTypes.semi) { return this.parseFor(node, null) } if (this.tok.type === __acorn.tokTypes.semi) { return this.parseFor(node, null) }
@ -355,13 +362,20 @@ lp$1.parseStatement = function() {
if (isLet || this.tok.type === __acorn.tokTypes._var || this.tok.type === __acorn.tokTypes._const) { if (isLet || this.tok.type === __acorn.tokTypes._var || this.tok.type === __acorn.tokTypes._const) {
var init$1 = this.parseVar(true, isLet ? "let" : this.tok.value); var init$1 = this.parseVar(true, isLet ? "let" : this.tok.value);
if (init$1.declarations.length === 1 && (this.tok.type === __acorn.tokTypes._in || this.isContextual("of"))) { if (init$1.declarations.length === 1 && (this.tok.type === __acorn.tokTypes._in || this.isContextual("of"))) {
if (this.options.ecmaVersion >= 9 && this.tok.type !== __acorn.tokTypes._in) {
node.await = isAwait;
}
return this.parseForIn(node, init$1) return this.parseForIn(node, init$1)
} }
return this.parseFor(node, init$1) return this.parseFor(node, init$1)
} }
var init = this.parseExpression(true); var init = this.parseExpression(true);
if (this.tok.type === __acorn.tokTypes._in || this.isContextual("of")) if (this.tok.type === __acorn.tokTypes._in || this.isContextual("of")) {
{ return this.parseForIn(node, this.toAssignable(init)) } if (this.options.ecmaVersion >= 9 && this.tok.type !== __acorn.tokTypes._in) {
node.await = isAwait;
}
return this.parseForIn(node, this.toAssignable(init))
}
return this.parseFor(node, init) return this.parseFor(node, init)
case __acorn.tokTypes._function: case __acorn.tokTypes._function:
@ -427,9 +441,12 @@ lp$1.parseStatement = function() {
if (this.tok.type === __acorn.tokTypes._catch) { if (this.tok.type === __acorn.tokTypes._catch) {
var clause = this.startNode(); var clause = this.startNode();
this.next(); this.next();
this.expect(__acorn.tokTypes.parenL); if (this.eat(__acorn.tokTypes.parenL)) {
clause.param = this.toAssignable(this.parseExprAtom(), true); clause.param = this.toAssignable(this.parseExprAtom(), true);
this.expect(__acorn.tokTypes.parenR); this.expect(__acorn.tokTypes.parenR);
} else {
clause.param = null;
}
clause.body = this.parseBlock(); clause.body = this.parseBlock();
node.handler = this.finishNode(clause, "CatchClause"); node.handler = this.finishNode(clause, "CatchClause");
} }
@ -576,7 +593,7 @@ lp$1.parseClass = function(isStatement) {
this$1.parsePropertyName(method); this$1.parsePropertyName(method);
if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(__acorn.tokTypes.comma); continue } if (isDummy(method.key)) { if (isDummy(this$1.parseMaybeAssign())) { this$1.next(); } this$1.eat(__acorn.tokTypes.comma); continue }
if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" && if (method.key.type === "Identifier" && !method.computed && method.key.name === "static" &&
(this$1.tok.type != __acorn.tokTypes.parenL && this$1.tok.type != __acorn.tokTypes.braceL)) { (this$1.tok.type !== __acorn.tokTypes.parenL && this$1.tok.type !== __acorn.tokTypes.braceL)) {
method.static = true; method.static = true;
isGenerator = this$1.eat(__acorn.tokTypes.star); isGenerator = this$1.eat(__acorn.tokTypes.star);
this$1.parsePropertyName(method); this$1.parsePropertyName(method);
@ -586,8 +603,9 @@ lp$1.parseClass = function(isStatement) {
if (!method.computed && if (!method.computed &&
method.key.type === "Identifier" && method.key.name === "async" && this$1.tok.type !== __acorn.tokTypes.parenL && method.key.type === "Identifier" && method.key.name === "async" && this$1.tok.type !== __acorn.tokTypes.parenL &&
!this$1.canInsertSemicolon()) { !this$1.canInsertSemicolon()) {
this$1.parsePropertyName(method);
isAsync = true; isAsync = true;
isGenerator = this$1.options.ecmaVersion >= 9 && this$1.eat(__acorn.tokTypes.star);
this$1.parsePropertyName(method);
} else { } else {
isAsync = false; isAsync = false;
} }
@ -622,7 +640,7 @@ lp$1.parseClass = function(isStatement) {
}; };
lp$1.parseFunction = function(node, isStatement, isAsync) { lp$1.parseFunction = function(node, isStatement, isAsync) {
var oldInAsync = this.inAsync; var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
this.initFunction(node); this.initFunction(node);
if (this.options.ecmaVersion >= 6) { if (this.options.ecmaVersion >= 6) {
node.generator = this.eat(__acorn.tokTypes.star); node.generator = this.eat(__acorn.tokTypes.star);
@ -633,10 +651,12 @@ lp$1.parseFunction = function(node, isStatement, isAsync) {
if (this.tok.type === __acorn.tokTypes.name) { node.id = this.parseIdent(); } if (this.tok.type === __acorn.tokTypes.name) { node.id = this.parseIdent(); }
else if (isStatement === true) { node.id = this.dummyIdent(); } else if (isStatement === true) { node.id = this.dummyIdent(); }
this.inAsync = node.async; this.inAsync = node.async;
this.inFunction = true;
node.params = this.parseFunctionParams(); node.params = this.parseFunctionParams();
node.body = this.parseBlock(); node.body = this.parseBlock();
this.toks.adaptDirectivePrologue(node.body.body); this.toks.adaptDirectivePrologue(node.body.body);
this.inAsync = oldInAsync; this.inAsync = oldInAsync;
this.inFunction = oldInFunction;
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression") return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
}; };
@ -691,7 +711,7 @@ lp$1.parseImport = function() {
this.eat(__acorn.tokTypes.comma); this.eat(__acorn.tokTypes.comma);
} }
node.specifiers = this.parseImportSpecifierList(); node.specifiers = this.parseImportSpecifierList();
node.source = this.eatContextual("from") && this.tok.type == __acorn.tokTypes.string ? this.parseExprAtom() : this.dummyString(); node.source = this.eatContextual("from") && this.tok.type === __acorn.tokTypes.string ? this.parseExprAtom() : this.dummyString();
if (elt) { node.specifiers.unshift(elt); } if (elt) { node.specifiers.unshift(elt); }
} }
this.semicolon(); this.semicolon();
@ -801,7 +821,7 @@ lp$2.parseMaybeAssign = function(noIn) {
if (this.toks.isContextual("yield")) { if (this.toks.isContextual("yield")) {
var node = this.startNode(); var node = this.startNode();
this.next(); this.next();
if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type != __acorn.tokTypes.star && !this.tok.type.startsExpr)) { if (this.semicolon() || this.canInsertSemicolon() || (this.tok.type !== __acorn.tokTypes.star && !this.tok.type.startsExpr)) {
node.delegate = false; node.delegate = false;
node.argument = null; node.argument = null;
} else { } else {
@ -844,7 +864,7 @@ lp$2.parseExprOps = function(noIn) {
}; };
lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) { lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) { return left } if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) { return left }
var prec = this.tok.type.binop; var prec = this.tok.type.binop;
if (prec != null && (!noIn || this.tok.type !== __acorn.tokTypes._in)) { if (prec != null && (!noIn || this.tok.type !== __acorn.tokTypes._in)) {
if (prec > minPrec) { if (prec > minPrec) {
@ -852,7 +872,7 @@ lp$2.parseExprOp = function(left, start, minPrec, noIn, indent, line) {
node.left = left; node.left = left;
node.operator = this.tok.value; node.operator = this.tok.value;
this.next(); this.next();
if (this.curLineStart != line && this.curIndent < indent && this.tokenStartsLine()) { if (this.curLineStart !== line && this.curIndent < indent && this.tokenStartsLine()) {
node.right = this.dummyIdent(); node.right = this.dummyIdent();
} else { } else {
var rightStart = this.storeCurrentPos(); var rightStart = this.storeCurrentPos();
@ -869,7 +889,9 @@ lp$2.parseMaybeUnary = function(sawUnary) {
var this$1 = this; var this$1 = this;
var start = this.storeCurrentPos(), expr; var start = this.storeCurrentPos(), expr;
if (this.options.ecmaVersion >= 8 && this.inAsync && this.toks.isContextual("await")) { if (this.options.ecmaVersion >= 8 && this.toks.isContextual("await") &&
(this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))
) {
expr = this.parseAwait(); expr = this.parseAwait();
sawUnary = true; sawUnary = true;
} else if (this.tok.type.prefix) { } else if (this.tok.type.prefix) {
@ -918,8 +940,8 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
var this$1 = this; var this$1 = this;
for (;;) { for (;;) {
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) { if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) {
if (this$1.tok.type == __acorn.tokTypes.dot && this$1.curIndent == startIndent) if (this$1.tok.type === __acorn.tokTypes.dot && this$1.curIndent === startIndent)
{ --startIndent; } { --startIndent; }
else else
{ return base } { return base }
@ -930,13 +952,13 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
if (this$1.eat(__acorn.tokTypes.dot)) { if (this$1.eat(__acorn.tokTypes.dot)) {
var node = this$1.startNodeAt(start); var node = this$1.startNodeAt(start);
node.object = base; node.object = base;
if (this$1.curLineStart != line && this$1.curIndent <= startIndent && this$1.tokenStartsLine()) if (this$1.curLineStart !== line && this$1.curIndent <= startIndent && this$1.tokenStartsLine())
{ node.property = this$1.dummyIdent(); } { node.property = this$1.dummyIdent(); }
else else
{ node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); } { node.property = this$1.parsePropertyAccessor() || this$1.dummyIdent(); }
node.computed = false; node.computed = false;
base = this$1.finishNode(node, "MemberExpression"); base = this$1.finishNode(node, "MemberExpression");
} else if (this$1.tok.type == __acorn.tokTypes.bracketL) { } else if (this$1.tok.type === __acorn.tokTypes.bracketL) {
this$1.pushCx(); this$1.pushCx();
this$1.next(); this$1.next();
var node$1 = this$1.startNodeAt(start); var node$1 = this$1.startNodeAt(start);
@ -946,7 +968,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
this$1.popCx(); this$1.popCx();
this$1.expect(__acorn.tokTypes.bracketR); this$1.expect(__acorn.tokTypes.bracketR);
base = this$1.finishNode(node$1, "MemberExpression"); base = this$1.finishNode(node$1, "MemberExpression");
} else if (!noCalls && this$1.tok.type == __acorn.tokTypes.parenL) { } else if (!noCalls && this$1.tok.type === __acorn.tokTypes.parenL) {
var exprList = this$1.parseExprList(__acorn.tokTypes.parenR); var exprList = this$1.parseExprList(__acorn.tokTypes.parenR);
if (maybeAsyncArrow && this$1.eat(__acorn.tokTypes.arrow)) if (maybeAsyncArrow && this$1.eat(__acorn.tokTypes.arrow))
{ return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) } { return this$1.parseArrowExpression(this$1.startNodeAt(start), exprList, true) }
@ -954,7 +976,7 @@ lp$2.parseSubscripts = function(base, start, noCalls, startIndent, line) {
node$2.callee = base; node$2.callee = base;
node$2.arguments = exprList; node$2.arguments = exprList;
base = this$1.finishNode(node$2, "CallExpression"); base = this$1.finishNode(node$2, "CallExpression");
} else if (this$1.tok.type == __acorn.tokTypes.backQuote) { } else if (this$1.tok.type === __acorn.tokTypes.backQuote) {
var node$3 = this$1.startNodeAt(start); var node$3 = this$1.startNodeAt(start);
node$3.tag = base; node$3.tag = base;
node$3.quasi = this$1.parseTemplate(); node$3.quasi = this$1.parseTemplate();
@ -1068,7 +1090,7 @@ lp$2.parseNew = function() {
} }
var start = this.storeCurrentPos(); var start = this.storeCurrentPos();
node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line); node.callee = this.parseSubscripts(this.parseExprAtom(), start, true, startIndent, line);
if (this.tok.type == __acorn.tokTypes.parenL) { if (this.tok.type === __acorn.tokTypes.parenL) {
node.arguments = this.parseExprList(__acorn.tokTypes.parenR); node.arguments = this.parseExprList(__acorn.tokTypes.parenR);
} else { } else {
node.arguments = []; node.arguments = [];
@ -1132,6 +1154,12 @@ lp$2.parseObj = function() {
if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; } if (this.curIndent + 1 < indent) { indent = this.curIndent; line = this.curLineStart; }
while (!this.closes(__acorn.tokTypes.braceR, indent, line)) { while (!this.closes(__acorn.tokTypes.braceR, indent, line)) {
var prop = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0); var prop = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0), start = (void 0);
if (this$1.options.ecmaVersion >= 9 && this$1.eat(__acorn.tokTypes.ellipsis)) {
prop.argument = this$1.parseMaybeAssign();
node.properties.push(this$1.finishNode(prop, "SpreadElement"));
this$1.eat(__acorn.tokTypes.comma);
continue
}
if (this$1.options.ecmaVersion >= 6) { if (this$1.options.ecmaVersion >= 6) {
start = this$1.storeCurrentPos(); start = this$1.storeCurrentPos();
prop.method = false; prop.method = false;
@ -1140,8 +1168,9 @@ lp$2.parseObj = function() {
} }
this$1.parsePropertyName(prop); this$1.parsePropertyName(prop);
if (this$1.toks.isAsyncProp(prop)) { if (this$1.toks.isAsyncProp(prop)) {
this$1.parsePropertyName(prop);
isAsync = true; isAsync = true;
isGenerator = this$1.options.ecmaVersion >= 9 && this$1.eat(__acorn.tokTypes.star);
this$1.parsePropertyName(prop);
} else { } else {
isAsync = false; isAsync = false;
} }
@ -1155,7 +1184,7 @@ lp$2.parseObj = function() {
prop.value = this$1.parseMethod(isGenerator, isAsync); prop.value = this$1.parseMethod(isGenerator, isAsync);
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" && } else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") && !prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
(this$1.tok.type != __acorn.tokTypes.comma && this$1.tok.type != __acorn.tokTypes.braceR && this$1.tok.type != __acorn.tokTypes.eq)) { (this$1.tok.type !== __acorn.tokTypes.comma && this$1.tok.type !== __acorn.tokTypes.braceR && this$1.tok.type !== __acorn.tokTypes.eq)) {
prop.kind = prop.key.name; prop.kind = prop.key.name;
this$1.parsePropertyName(prop); this$1.parsePropertyName(prop);
prop.value = this$1.parseMethod(false); prop.value = this$1.parseMethod(false);
@ -1234,28 +1263,29 @@ lp$2.initFunction = function(node) {
lp$2.toAssignable = function(node, binding) { lp$2.toAssignable = function(node, binding) {
var this$1 = this; var this$1 = this;
if (!node || node.type == "Identifier" || (node.type == "MemberExpression" && !binding)) { if (!node || node.type === "Identifier" || (node.type === "MemberExpression" && !binding)) {
// Okay // Okay
} else if (node.type == "ParenthesizedExpression") { } else if (node.type === "ParenthesizedExpression") {
this.toAssignable(node.expression, binding); this.toAssignable(node.expression, binding);
} else if (this.options.ecmaVersion < 6) { } else if (this.options.ecmaVersion < 6) {
return this.dummyIdent() return this.dummyIdent()
} else if (node.type == "ObjectExpression") { } else if (node.type === "ObjectExpression") {
node.type = "ObjectPattern"; node.type = "ObjectPattern";
var props = node.properties; for (var i = 0, list = node.properties; i < list.length; i += 1)
for (var i = 0, list = props; i < list.length; i += 1)
{ {
var prop = list[i]; var prop = list[i];
this$1.toAssignable(prop.value, binding); this$1.toAssignable(prop, binding);
} }
} else if (node.type == "ArrayExpression") { } else if (node.type === "ArrayExpression") {
node.type = "ArrayPattern"; node.type = "ArrayPattern";
this.toAssignableList(node.elements, binding); this.toAssignableList(node.elements, binding);
} else if (node.type == "SpreadElement") { } else if (node.type === "Property") {
this.toAssignable(node.value, binding);
} else if (node.type === "SpreadElement") {
node.type = "RestElement"; node.type = "RestElement";
this.toAssignable(node.argument, binding); this.toAssignable(node.argument, binding);
} else if (node.type == "AssignmentExpression") { } else if (node.type === "AssignmentExpression") {
node.type = "AssignmentPattern"; node.type = "AssignmentPattern";
delete node.operator; delete node.operator;
} else { } else {
@ -1282,26 +1312,29 @@ lp$2.parseFunctionParams = function(params) {
}; };
lp$2.parseMethod = function(isGenerator, isAsync) { lp$2.parseMethod = function(isGenerator, isAsync) {
var node = this.startNode(), oldInAsync = this.inAsync; var node = this.startNode(), oldInAsync = this.inAsync, oldInFunction = this.inFunction;
this.initFunction(node); this.initFunction(node);
if (this.options.ecmaVersion >= 6) if (this.options.ecmaVersion >= 6)
{ node.generator = !!isGenerator; } { node.generator = !!isGenerator; }
if (this.options.ecmaVersion >= 8) if (this.options.ecmaVersion >= 8)
{ node.async = !!isAsync; } { node.async = !!isAsync; }
this.inAsync = node.async; this.inAsync = node.async;
this.inFunction = true;
node.params = this.parseFunctionParams(); node.params = this.parseFunctionParams();
node.body = this.parseBlock(); node.body = this.parseBlock();
this.toks.adaptDirectivePrologue(node.body.body); this.toks.adaptDirectivePrologue(node.body.body);
this.inAsync = oldInAsync; this.inAsync = oldInAsync;
this.inFunction = oldInFunction;
return this.finishNode(node, "FunctionExpression") return this.finishNode(node, "FunctionExpression")
}; };
lp$2.parseArrowExpression = function(node, params, isAsync) { lp$2.parseArrowExpression = function(node, params, isAsync) {
var oldInAsync = this.inAsync; var oldInAsync = this.inAsync, oldInFunction = this.inFunction;
this.initFunction(node); this.initFunction(node);
if (this.options.ecmaVersion >= 8) if (this.options.ecmaVersion >= 8)
{ node.async = !!isAsync; } { node.async = !!isAsync; }
this.inAsync = node.async; this.inAsync = node.async;
this.inFunction = true;
node.params = this.toAssignableList(params, true); node.params = this.toAssignableList(params, true);
node.expression = this.tok.type !== __acorn.tokTypes.braceL; node.expression = this.tok.type !== __acorn.tokTypes.braceL;
if (node.expression) { if (node.expression) {
@ -1311,6 +1344,7 @@ lp$2.parseArrowExpression = function(node, params, isAsync) {
this.toks.adaptDirectivePrologue(node.body.body); this.toks.adaptDirectivePrologue(node.body.body);
} }
this.inAsync = oldInAsync; this.inAsync = oldInAsync;
this.inFunction = oldInFunction;
return this.finishNode(node, "ArrowFunctionExpression") return this.finishNode(node, "ArrowFunctionExpression")
}; };

View File

@ -16,11 +16,11 @@
// walker, and state can be used to give this walked an initial // walker, and state can be used to give this walked an initial
// state. // state.
function simple(node, visitors, base, state, override) { function simple(node, visitors, baseVisitor, state, override) {
if (!base) { base = exports.base if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) { ; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type]; var type = override || node.type, found = visitors[type];
base[type](node, st, c); baseVisitor[type](node, st, c);
if (found) { found(node, st); } if (found) { found(node, st); }
})(node, state, override); })(node, state, override);
} }
@ -28,13 +28,14 @@ function simple(node, visitors, base, state, override) {
// An ancestor walk keeps an array of ancestor nodes (including the // An ancestor walk keeps an array of ancestor nodes (including the
// current node) and passes them to the callback as third parameter // current node) and passes them to the callback as third parameter
// (and also as state parameter when no other state is present). // (and also as state parameter when no other state is present).
function ancestor(node, visitors, base, state) { function ancestor(node, visitors, baseVisitor, state) {
if (!base) { base = exports.base; } var ancestors = [];
var ancestors = [];(function c(node, st, override) { if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type]; var type = override || node.type, found = visitors[type];
var isNew = node != ancestors[ancestors.length - 1]; var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); } if (isNew) { ancestors.push(node); }
base[type](node, st, c); baseVisitor[type](node, st, c);
if (found) { found(node, st || ancestors, ancestors); } if (found) { found(node, st || ancestors, ancestors); }
if (isNew) { ancestors.pop(); } if (isNew) { ancestors.pop(); }
})(node, state); })(node, state);
@ -45,15 +46,15 @@ function ancestor(node, visitors, base, state) {
// threaded through the walk, and can opt how and whether to walk // threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these // their child nodes (by calling their third argument on these
// nodes). // nodes).
function recursive(node, state, funcs, base, override) { function recursive(node, state, funcs, baseVisitor, override) {
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) { var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
visitor[override || node.type](node, st, c); visitor[override || node.type](node, st, c);
})(node, state, override); })(node, state, override);
} }
function makeTest(test) { function makeTest(test) {
if (typeof test == "string") if (typeof test === "string")
{ return function (type) { return type == test; } } { return function (type) { return type === test; } }
else if (!test) else if (!test)
{ return function () { return true; } } { return function () { return true; } }
else else
@ -63,24 +64,24 @@ function makeTest(test) {
var Found = function Found(node, state) { this.node = node; this.state = state; }; var Found = function Found(node, state) { this.node = node; this.state = state; };
// A full walk triggers the callback on each node // A full walk triggers the callback on each node
function full(node, callback, base, state, override) { function full(node, callback, baseVisitor, state, override) {
if (!base) { base = exports.base if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) { ; }(function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
base[type](node, st, c); baseVisitor[type](node, st, c);
if (!override) { callback(node, st, type); } if (!override) { callback(node, st, type); }
})(node, state, override); })(node, state, override);
} }
// An fullAncestor walk is like an ancestor walk, but triggers // An fullAncestor walk is like an ancestor walk, but triggers
// the callback on each node // the callback on each node
function fullAncestor(node, callback, base, state) { function fullAncestor(node, callback, baseVisitor, state) {
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
var ancestors = [];(function c(node, st, override) { var ancestors = [];(function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
var isNew = node != ancestors[ancestors.length - 1]; var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); } if (isNew) { ancestors.push(node); }
base[type](node, st, c); baseVisitor[type](node, st, c);
if (!override) { callback(node, st || ancestors, ancestors, type); } if (!override) { callback(node, st || ancestors, ancestors, type); }
if (isNew) { ancestors.pop(); } if (isNew) { ancestors.pop(); }
})(node, state); })(node, state);
@ -89,17 +90,17 @@ function fullAncestor(node, callback, base, state) {
// Find a node with a given start, end, and type (all are optional, // Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or // null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node. // undefined when it doesn't find a matching node.
function findNodeAt(node, start, end, test, base, state) { function findNodeAt(node, start, end, test, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; }
try { try {
(function c(node, st, override) { (function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
if ((start == null || node.start <= start) && if ((start == null || node.start <= start) &&
(end == null || node.end >= end)) (end == null || node.end >= end))
{ base[type](node, st, c); } { baseVisitor[type](node, st, c); }
if ((start == null || node.start == start) && if ((start == null || node.start === start) &&
(end == null || node.end == end) && (end == null || node.end === end) &&
test(type, node)) test(type, node))
{ throw new Found(node, st) } { throw new Found(node, st) }
})(node, state); })(node, state);
@ -111,14 +112,14 @@ function findNodeAt(node, start, end, test, base, state) {
// Find the innermost node of a given type that contains the given // Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt. // position. Interface similar to findNodeAt.
function findNodeAround(node, pos, test, base, state) { function findNodeAround(node, pos, test, baseVisitor, state) {
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
try { try {
(function c(node, st, override) { (function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
if (node.start > pos || node.end < pos) { return } if (node.start > pos || node.end < pos) { return }
base[type](node, st, c); baseVisitor[type](node, st, c);
if (test(type, node)) { throw new Found(node, st) } if (test(type, node)) { throw new Found(node, st) }
})(node, state); })(node, state);
} catch (e) { } catch (e) {
@ -128,15 +129,15 @@ function findNodeAround(node, pos, test, base, state) {
} }
// Find the outermost matching node after a given position. // Find the outermost matching node after a given position.
function findNodeAfter(node, pos, test, base, state) { function findNodeAfter(node, pos, test, baseVisitor, state) {
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
try { try {
(function c(node, st, override) { (function c(node, st, override) {
if (node.end < pos) { return } if (node.end < pos) { return }
var type = override || node.type; var type = override || node.type;
if (node.start >= pos && test(type, node)) { throw new Found(node, st) } if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
base[type](node, st, c); baseVisitor[type](node, st, c);
})(node, state); })(node, state);
} catch (e) { } catch (e) {
if (e instanceof Found) { return e } if (e instanceof Found) { return e }
@ -145,15 +146,15 @@ function findNodeAfter(node, pos, test, base, state) {
} }
// Find the outermost matching node before a given position. // Find the outermost matching node before a given position.
function findNodeBefore(node, pos, test, base, state) { function findNodeBefore(node, pos, test, baseVisitor, state) {
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
var max;(function c(node, st, override) { var max;(function c(node, st, override) {
if (node.start > pos) { return } if (node.start > pos) { return }
var type = override || node.type; var type = override || node.type;
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
{ max = new Found(node, st); } { max = new Found(node, st); }
base[type](node, st, c); baseVisitor[type](node, st, c);
})(node, state); })(node, state);
return max return max
} }
@ -167,9 +168,8 @@ var create = Object.create || function(proto) {
// Used to create a custom walker. Will fill in all missing node // Used to create a custom walker. Will fill in all missing node
// type properties with the defaults. // type properties with the defaults.
function make(funcs, base) { function make(funcs, baseVisitor) {
if (!base) { base = exports.base; } var visitor = create(baseVisitor || base);
var visitor = create(base);
for (var type in funcs) { visitor[type] = funcs[type]; } for (var type in funcs) { visitor[type] = funcs[type]; }
return visitor return visitor
} }
@ -218,6 +218,15 @@ base.SwitchStatement = function (node, st, c) {
} }
} }
}; };
base.SwitchCase = function (node, st, c) {
if (node.test) { c(node.test, st, "Expression"); }
for (var i = 0, list = node.consequent; i < list.length; i += 1)
{
var cons = list[i];
c(cons, st, "Statement");
}
};
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
if (node.argument) { c(node.argument, st, "Expression"); } if (node.argument) { c(node.argument, st, "Expression"); }
}; };
@ -229,7 +238,7 @@ base.TryStatement = function (node, st, c) {
if (node.finalizer) { c(node.finalizer, st, "Statement"); } if (node.finalizer) { c(node.finalizer, st, "Statement"); }
}; };
base.CatchClause = function (node, st, c) { base.CatchClause = function (node, st, c) {
c(node.param, st, "Pattern"); if (node.param) { c(node.param, st, "Pattern"); }
c(node.body, st, "ScopeBody"); c(node.body, st, "ScopeBody");
}; };
base.WhileStatement = base.DoWhileStatement = function (node, st, c) { base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
@ -248,7 +257,7 @@ base.ForInStatement = base.ForOfStatement = function (node, st, c) {
c(node.body, st, "Statement"); c(node.body, st, "Statement");
}; };
base.ForInit = function (node, st, c) { base.ForInit = function (node, st, c) {
if (node.type == "VariableDeclaration") { c(node, st); } if (node.type === "VariableDeclaration") { c(node, st); }
else { c(node, st, "Expression"); } else { c(node, st, "Expression"); }
}; };
base.DebuggerStatement = ignore; base.DebuggerStatement = ignore;
@ -283,9 +292,9 @@ base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); };
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); }; base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); };
base.Pattern = function (node, st, c) { base.Pattern = function (node, st, c) {
if (node.type == "Identifier") if (node.type === "Identifier")
{ c(node, st, "VariablePattern"); } { c(node, st, "VariablePattern"); }
else if (node.type == "MemberExpression") else if (node.type === "MemberExpression")
{ c(node, st, "MemberPattern"); } { c(node, st, "MemberPattern"); }
else else
{ c(node, st); } { c(node, st); }
@ -301,11 +310,15 @@ base.ArrayPattern = function (node, st, c) {
} }
}; };
base.ObjectPattern = function (node, st, c) { base.ObjectPattern = function (node, st, c) {
for (var i = 0, list = node.properties; i < list.length; i += 1) for (var i = 0, list = node.properties; i < list.length; i += 1) {
{
var prop = list[i]; var prop = list[i];
c(prop.value, st, "Pattern"); if (prop.type === "Property") {
if (prop.computed) { c(prop.key, st, "Expression"); }
c(prop.value, st, "Pattern");
} else if (prop.type === "RestElement") {
c(prop.argument, st, "Pattern");
}
} }
}; };
@ -367,7 +380,7 @@ base.MemberExpression = function (node, st, c) {
}; };
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
if (node.declaration) if (node.declaration)
{ c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
if (node.source) { c(node.source, st, "Expression"); } if (node.source) { c(node.source, st, "Expression"); }
}; };
base.ExportAllDeclaration = function (node, st, c) { base.ExportAllDeclaration = function (node, st, c) {
@ -386,17 +399,20 @@ base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifi
base.TaggedTemplateExpression = function (node, st, c) { base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression"); c(node.tag, st, "Expression");
c(node.quasi, st); c(node.quasi, st, "Expression");
}; };
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }; base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
base.Class = function (node, st, c) { base.Class = function (node, st, c) {
if (node.id) { c(node.id, st, "Pattern"); } if (node.id) { c(node.id, st, "Pattern"); }
if (node.superClass) { c(node.superClass, st, "Expression"); } if (node.superClass) { c(node.superClass, st, "Expression"); }
for (var i = 0, list = node.body.body; i < list.length; i += 1) c(node.body, st);
};
base.ClassBody = function (node, st, c) {
for (var i = 0, list = node.body; i < list.length; i += 1)
{ {
var item = list[i]; var elt = list[i];
c(item, st); c(elt, st);
} }
}; };
base.MethodDefinition = base.Property = function (node, st, c) { base.MethodDefinition = base.Property = function (node, st, c) {

View File

@ -1,7 +1,7 @@
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) : typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.acorn = global.acorn || {}, global.acorn.walk = global.acorn.walk || {}))); (factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
}(this, (function (exports) { 'use strict'; }(this, (function (exports) { 'use strict';
// AST walker module for Mozilla Parser API compatible trees // AST walker module for Mozilla Parser API compatible trees
@ -22,11 +22,11 @@
// walker, and state can be used to give this walked an initial // walker, and state can be used to give this walked an initial
// state. // state.
function simple(node, visitors, base, state, override) { function simple(node, visitors, baseVisitor, state, override) {
if (!base) { base = exports.base if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) { ; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type]; var type = override || node.type, found = visitors[type];
base[type](node, st, c); baseVisitor[type](node, st, c);
if (found) { found(node, st); } if (found) { found(node, st); }
})(node, state, override); })(node, state, override);
} }
@ -34,13 +34,14 @@ function simple(node, visitors, base, state, override) {
// An ancestor walk keeps an array of ancestor nodes (including the // An ancestor walk keeps an array of ancestor nodes (including the
// current node) and passes them to the callback as third parameter // current node) and passes them to the callback as third parameter
// (and also as state parameter when no other state is present). // (and also as state parameter when no other state is present).
function ancestor(node, visitors, base, state) { function ancestor(node, visitors, baseVisitor, state) {
if (!base) { base = exports.base; } var ancestors = [];
var ancestors = [];(function c(node, st, override) { if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type]; var type = override || node.type, found = visitors[type];
var isNew = node != ancestors[ancestors.length - 1]; var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); } if (isNew) { ancestors.push(node); }
base[type](node, st, c); baseVisitor[type](node, st, c);
if (found) { found(node, st || ancestors, ancestors); } if (found) { found(node, st || ancestors, ancestors); }
if (isNew) { ancestors.pop(); } if (isNew) { ancestors.pop(); }
})(node, state); })(node, state);
@ -51,15 +52,15 @@ function ancestor(node, visitors, base, state) {
// threaded through the walk, and can opt how and whether to walk // threaded through the walk, and can opt how and whether to walk
// their child nodes (by calling their third argument on these // their child nodes (by calling their third argument on these
// nodes). // nodes).
function recursive(node, state, funcs, base, override) { function recursive(node, state, funcs, baseVisitor, override) {
var visitor = funcs ? exports.make(funcs, base) : base;(function c(node, st, override) { var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
visitor[override || node.type](node, st, c); visitor[override || node.type](node, st, c);
})(node, state, override); })(node, state, override);
} }
function makeTest(test) { function makeTest(test) {
if (typeof test == "string") if (typeof test === "string")
{ return function (type) { return type == test; } } { return function (type) { return type === test; } }
else if (!test) else if (!test)
{ return function () { return true; } } { return function () { return true; } }
else else
@ -69,24 +70,24 @@ function makeTest(test) {
var Found = function Found(node, state) { this.node = node; this.state = state; }; var Found = function Found(node, state) { this.node = node; this.state = state; };
// A full walk triggers the callback on each node // A full walk triggers the callback on each node
function full(node, callback, base, state, override) { function full(node, callback, baseVisitor, state, override) {
if (!base) { base = exports.base if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) { ; }(function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
base[type](node, st, c); baseVisitor[type](node, st, c);
if (!override) { callback(node, st, type); } if (!override) { callback(node, st, type); }
})(node, state, override); })(node, state, override);
} }
// An fullAncestor walk is like an ancestor walk, but triggers // An fullAncestor walk is like an ancestor walk, but triggers
// the callback on each node // the callback on each node
function fullAncestor(node, callback, base, state) { function fullAncestor(node, callback, baseVisitor, state) {
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
var ancestors = [];(function c(node, st, override) { var ancestors = [];(function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
var isNew = node != ancestors[ancestors.length - 1]; var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); } if (isNew) { ancestors.push(node); }
base[type](node, st, c); baseVisitor[type](node, st, c);
if (!override) { callback(node, st || ancestors, ancestors, type); } if (!override) { callback(node, st || ancestors, ancestors, type); }
if (isNew) { ancestors.pop(); } if (isNew) { ancestors.pop(); }
})(node, state); })(node, state);
@ -95,17 +96,17 @@ function fullAncestor(node, callback, base, state) {
// Find a node with a given start, end, and type (all are optional, // Find a node with a given start, end, and type (all are optional,
// null can be used as wildcard). Returns a {node, state} object, or // null can be used as wildcard). Returns a {node, state} object, or
// undefined when it doesn't find a matching node. // undefined when it doesn't find a matching node.
function findNodeAt(node, start, end, test, base, state) { function findNodeAt(node, start, end, test, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; }
try { try {
(function c(node, st, override) { (function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
if ((start == null || node.start <= start) && if ((start == null || node.start <= start) &&
(end == null || node.end >= end)) (end == null || node.end >= end))
{ base[type](node, st, c); } { baseVisitor[type](node, st, c); }
if ((start == null || node.start == start) && if ((start == null || node.start === start) &&
(end == null || node.end == end) && (end == null || node.end === end) &&
test(type, node)) test(type, node))
{ throw new Found(node, st) } { throw new Found(node, st) }
})(node, state); })(node, state);
@ -117,14 +118,14 @@ function findNodeAt(node, start, end, test, base, state) {
// Find the innermost node of a given type that contains the given // Find the innermost node of a given type that contains the given
// position. Interface similar to findNodeAt. // position. Interface similar to findNodeAt.
function findNodeAround(node, pos, test, base, state) { function findNodeAround(node, pos, test, baseVisitor, state) {
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
try { try {
(function c(node, st, override) { (function c(node, st, override) {
var type = override || node.type; var type = override || node.type;
if (node.start > pos || node.end < pos) { return } if (node.start > pos || node.end < pos) { return }
base[type](node, st, c); baseVisitor[type](node, st, c);
if (test(type, node)) { throw new Found(node, st) } if (test(type, node)) { throw new Found(node, st) }
})(node, state); })(node, state);
} catch (e) { } catch (e) {
@ -134,15 +135,15 @@ function findNodeAround(node, pos, test, base, state) {
} }
// Find the outermost matching node after a given position. // Find the outermost matching node after a given position.
function findNodeAfter(node, pos, test, base, state) { function findNodeAfter(node, pos, test, baseVisitor, state) {
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
try { try {
(function c(node, st, override) { (function c(node, st, override) {
if (node.end < pos) { return } if (node.end < pos) { return }
var type = override || node.type; var type = override || node.type;
if (node.start >= pos && test(type, node)) { throw new Found(node, st) } if (node.start >= pos && test(type, node)) { throw new Found(node, st) }
base[type](node, st, c); baseVisitor[type](node, st, c);
})(node, state); })(node, state);
} catch (e) { } catch (e) {
if (e instanceof Found) { return e } if (e instanceof Found) { return e }
@ -151,15 +152,15 @@ function findNodeAfter(node, pos, test, base, state) {
} }
// Find the outermost matching node before a given position. // Find the outermost matching node before a given position.
function findNodeBefore(node, pos, test, base, state) { function findNodeBefore(node, pos, test, baseVisitor, state) {
test = makeTest(test); test = makeTest(test);
if (!base) { base = exports.base; } if (!baseVisitor) { baseVisitor = base; }
var max;(function c(node, st, override) { var max;(function c(node, st, override) {
if (node.start > pos) { return } if (node.start > pos) { return }
var type = override || node.type; var type = override || node.type;
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
{ max = new Found(node, st); } { max = new Found(node, st); }
base[type](node, st, c); baseVisitor[type](node, st, c);
})(node, state); })(node, state);
return max return max
} }
@ -173,9 +174,8 @@ var create = Object.create || function(proto) {
// Used to create a custom walker. Will fill in all missing node // Used to create a custom walker. Will fill in all missing node
// type properties with the defaults. // type properties with the defaults.
function make(funcs, base) { function make(funcs, baseVisitor) {
if (!base) { base = exports.base; } var visitor = create(baseVisitor || base);
var visitor = create(base);
for (var type in funcs) { visitor[type] = funcs[type]; } for (var type in funcs) { visitor[type] = funcs[type]; }
return visitor return visitor
} }
@ -224,6 +224,15 @@ base.SwitchStatement = function (node, st, c) {
} }
} }
}; };
base.SwitchCase = function (node, st, c) {
if (node.test) { c(node.test, st, "Expression"); }
for (var i = 0, list = node.consequent; i < list.length; i += 1)
{
var cons = list[i];
c(cons, st, "Statement");
}
};
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
if (node.argument) { c(node.argument, st, "Expression"); } if (node.argument) { c(node.argument, st, "Expression"); }
}; };
@ -235,7 +244,7 @@ base.TryStatement = function (node, st, c) {
if (node.finalizer) { c(node.finalizer, st, "Statement"); } if (node.finalizer) { c(node.finalizer, st, "Statement"); }
}; };
base.CatchClause = function (node, st, c) { base.CatchClause = function (node, st, c) {
c(node.param, st, "Pattern"); if (node.param) { c(node.param, st, "Pattern"); }
c(node.body, st, "ScopeBody"); c(node.body, st, "ScopeBody");
}; };
base.WhileStatement = base.DoWhileStatement = function (node, st, c) { base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
@ -254,7 +263,7 @@ base.ForInStatement = base.ForOfStatement = function (node, st, c) {
c(node.body, st, "Statement"); c(node.body, st, "Statement");
}; };
base.ForInit = function (node, st, c) { base.ForInit = function (node, st, c) {
if (node.type == "VariableDeclaration") { c(node, st); } if (node.type === "VariableDeclaration") { c(node, st); }
else { c(node, st, "Expression"); } else { c(node, st, "Expression"); }
}; };
base.DebuggerStatement = ignore; base.DebuggerStatement = ignore;
@ -289,9 +298,9 @@ base.ScopeBody = function (node, st, c) { return c(node, st, "Statement"); };
base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); }; base.ScopeExpression = function (node, st, c) { return c(node, st, "Expression"); };
base.Pattern = function (node, st, c) { base.Pattern = function (node, st, c) {
if (node.type == "Identifier") if (node.type === "Identifier")
{ c(node, st, "VariablePattern"); } { c(node, st, "VariablePattern"); }
else if (node.type == "MemberExpression") else if (node.type === "MemberExpression")
{ c(node, st, "MemberPattern"); } { c(node, st, "MemberPattern"); }
else else
{ c(node, st); } { c(node, st); }
@ -307,11 +316,15 @@ base.ArrayPattern = function (node, st, c) {
} }
}; };
base.ObjectPattern = function (node, st, c) { base.ObjectPattern = function (node, st, c) {
for (var i = 0, list = node.properties; i < list.length; i += 1) for (var i = 0, list = node.properties; i < list.length; i += 1) {
{
var prop = list[i]; var prop = list[i];
c(prop.value, st, "Pattern"); if (prop.type === "Property") {
if (prop.computed) { c(prop.key, st, "Expression"); }
c(prop.value, st, "Pattern");
} else if (prop.type === "RestElement") {
c(prop.argument, st, "Pattern");
}
} }
}; };
@ -373,7 +386,7 @@ base.MemberExpression = function (node, st, c) {
}; };
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
if (node.declaration) if (node.declaration)
{ c(node.declaration, st, node.type == "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
if (node.source) { c(node.source, st, "Expression"); } if (node.source) { c(node.source, st, "Expression"); }
}; };
base.ExportAllDeclaration = function (node, st, c) { base.ExportAllDeclaration = function (node, st, c) {
@ -392,17 +405,20 @@ base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifi
base.TaggedTemplateExpression = function (node, st, c) { base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression"); c(node.tag, st, "Expression");
c(node.quasi, st); c(node.quasi, st, "Expression");
}; };
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }; base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
base.Class = function (node, st, c) { base.Class = function (node, st, c) {
if (node.id) { c(node.id, st, "Pattern"); } if (node.id) { c(node.id, st, "Pattern"); }
if (node.superClass) { c(node.superClass, st, "Expression"); } if (node.superClass) { c(node.superClass, st, "Expression"); }
for (var i = 0, list = node.body.body; i < list.length; i += 1) c(node.body, st);
};
base.ClassBody = function (node, st, c) {
for (var i = 0, list = node.body; i < list.length; i += 1)
{ {
var item = list[i]; var elt = list[i];
c(item, st); c(elt, st);
} }
}; };
base.MethodDefinition = base.Property = function (node, st, c) { base.MethodDefinition = base.Property = function (node, st, c) {

View File

@ -1,10 +1,10 @@
{ {
"name": "acorn", "name": "acorn",
"description": "ECMAScript parser", "description": "ECMAScript parser",
"homepage": "https://github.com/ternjs/acorn", "homepage": "https://github.com/acornjs/acorn",
"main": "dist/acorn.js", "main": "dist/acorn.js",
"module": "dist/acorn.es.js", "module": "dist/acorn.es.js",
"version": "5.2.1", "version": "5.7.2",
"engines": { "engines": {
"node": ">=0.4.0" "node": ">=0.4.0"
}, },
@ -18,17 +18,22 @@
"name": "Ingvar Stepanyan", "name": "Ingvar Stepanyan",
"email": "me@rreverser.com", "email": "me@rreverser.com",
"web": "http://rreverser.com/" "web": "http://rreverser.com/"
},
{
"name": "Adrian Heine",
"email": "http://adrianheine.de"
} }
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/ternjs/acorn.git" "url": "https://github.com/acornjs/acorn.git"
}, },
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"prepare": "npm test", "prepare": "npm run build && node test/run.js && node test/lint.js",
"test": "node test/run.js && node test/lint.js", "test": "node test/run.js && node test/lint.js",
"pretest": "npm run build:main && npm run build:loose", "pretest": "npm run build:main && npm run build:loose",
"test:test262": "node bin/run_test262.js",
"build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin", "build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin",
"build:main": "rollup -c rollup/config.main.js", "build:main": "rollup -c rollup/config.main.js",
"build:walk": "rollup -c rollup/config.walk.js", "build:walk": "rollup -c rollup/config.walk.js",
@ -40,13 +45,16 @@
"acorn": "./bin/acorn" "acorn": "./bin/acorn"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^3.18.0", "eslint": "^4.10.0",
"eslint-config-standard": "^7.1.0", "eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.2.0", "eslint-plugin-import": "^2.2.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.5.0", "eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.1.1", "eslint-plugin-standard": "^3.0.1",
"rollup": "^0.43.0", "rollup": "^0.45.0",
"rollup-plugin-buble": "^0.15.0", "rollup-plugin-buble": "^0.16.0",
"unicode-9.0.0": "^0.7.0" "test262": "git+https://github.com/tc39/test262.git#3bfad28cc302fd4455badcfcbca7c5bb7ce41a72",
"test262-parser-runner": "^0.4.0",
"unicode-11.0.0": "^0.7.7"
} }
} }

View File

@ -68,7 +68,7 @@ function processTopLevelAwait(src) {
const wrappedArray = wrapped.split(''); const wrappedArray = wrapped.split('');
let root; let root;
try { try {
root = acorn.parse(wrapped, { ecmaVersion: 8 }); root = acorn.parse(wrapped, { ecmaVersion: 10 });
} catch (err) { } catch (err) {
return null; return null;
} }

View File

@ -63,7 +63,7 @@ function isRecoverableError(e, code) {
// Try to parse the code with acorn. If the parse fails, ignore the acorn // Try to parse the code with acorn. If the parse fails, ignore the acorn
// error and return the recoverable status. // error and return the recoverable status.
try { try {
acorn.parse(code, { plugins: { replRecoverable: true } }); acorn.parse(code, { plugins: { replRecoverable: true }, ecmaVersion: 10 });
// Odd case: the underlying JS engine (V8, Chakra) rejected this input // Odd case: the underlying JS engine (V8, Chakra) rejected this input
// but Acorn detected no issue. Presume that additional text won't // but Acorn detected no issue. Presume that additional text won't