jass 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jass.rb +5 -0
- data/lib/jass/compiler.rb +5 -0
- data/lib/jass/plugin.rb +2 -1
- data/lib/jass/version.rb +1 -1
- data/vendor/node_modules/@types/estree/index.d.ts +4 -2
- data/vendor/node_modules/@types/estree/package.json +2 -2
- data/vendor/node_modules/acorn/bin/_acorn.js +12 -12
- data/vendor/node_modules/acorn/bin/run_test262.js +2 -3
- data/vendor/node_modules/acorn/bin/test262.whitelist +0 -5
- data/vendor/node_modules/acorn/dist/acorn.es.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +42 -30
- data/vendor/node_modules/acorn/dist/acorn_loose.js +42 -30
- data/vendor/node_modules/acorn/dist/walk.es.js +47 -43
- data/vendor/node_modules/acorn/dist/walk.js +47 -43
- data/vendor/node_modules/acorn/package.json +9 -5
- data/vendor/node_modules/chalk/index.js.flow +93 -0
- data/vendor/node_modules/chalk/package.json +8 -3
- data/vendor/node_modules/color-convert/conversions.js +36 -29
- data/vendor/node_modules/color-convert/package.json +4 -4
- data/vendor/node_modules/estree-walker/index.d.ts +17 -0
- data/vendor/node_modules/estree-walker/package.json +2 -1
- data/vendor/node_modules/fill-range/index.js +2 -2
- data/vendor/node_modules/fill-range/package.json +24 -7
- data/vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/is-reference/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/math-random/browser.js +17 -0
- data/vendor/node_modules/math-random/node.js +13 -0
- data/vendor/node_modules/math-random/package.json +31 -0
- data/vendor/node_modules/math-random/test.js +26 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +115 -11
- data/vendor/node_modules/nodent-compiler/{lib/output.js → output.js} +0 -0
- data/vendor/node_modules/nodent-compiler/package.json +8 -4
- data/vendor/node_modules/{nodent-compiler/lib → nodent-transform}/arboriculture.js +1340 -1107
- data/vendor/node_modules/nodent-transform/package.json +19 -0
- data/vendor/node_modules/path-parse/package.json +1 -1
- data/vendor/node_modules/pretty-ms/index.js +2 -1
- data/vendor/node_modules/pretty-ms/package.json +2 -3
- data/vendor/node_modules/randomatic/index.js +12 -2
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +6 -7
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +9 -16
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +112 -102
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +18 -20
- data/vendor/node_modules/randomatic/package.json +15 -13
- data/vendor/node_modules/repeat-element/index.js +1 -1
- data/vendor/node_modules/repeat-element/package.json +27 -22
- data/vendor/node_modules/resolve/lib/async.js +20 -17
- data/vendor/node_modules/resolve/lib/core.js +2 -2
- data/vendor/node_modules/resolve/lib/core.json +4 -1
- data/vendor/node_modules/resolve/lib/sync.js +52 -13
- data/vendor/node_modules/resolve/package.json +3 -3
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +2 -2
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +49 -11
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +81 -84
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +81 -2
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +81 -3
- data/vendor/node_modules/rollup-pluginutils/package.json +12 -6
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +10 -2
- data/vendor/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +1 -0
- data/vendor/node_modules/supports-color/index.js +1 -5
- data/vendor/node_modules/supports-color/package.json +51 -51
- data/vendor/yarn.lock +65 -70
- metadata +16 -21
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +0 -146
- data/vendor/node_modules/irregular-plurals/package.json +0 -39
- data/vendor/node_modules/nodent-compiler/lib/parser.js +0 -291
- data/vendor/node_modules/path-parse/index.min.js +0 -1
- data/vendor/node_modules/path-parse/test.min.js +0 -1
- data/vendor/node_modules/plur/index.js +0 -20
- data/vendor/node_modules/plur/package.json +0 -42
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +0 -116
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +0 -90
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +0 -217
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +0 -55
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +0 -59
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +0 -65
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +0 -33
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 324ddf7781bbfba9401230e3b1b499c0c81b98a9862331235dfa5e32c0c83a15
|
4
|
+
data.tar.gz: 0b134300473cf8d37fe3075814c0618ce29a620d6a7e26aa47f92597a4c29695
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a752c5d6699ecf8a63b4febe8427216a4f36e85be3b85b752a796a372ff2f117678380536e1fc4e57f29da2ad5bec2e62f458ed93228d660642c1b8acd9f88d
|
7
|
+
data.tar.gz: a8fe1d8f013ae8dbf0a1a842a9adbfc72841259a430918f6e1066921b809c097d4f11e24acc23361aa975d76c3a08f392341066f8d30ee9abad4b69a71a029e5
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ Use `yarn` to install your custom npm dependencies into `vendor/node_modules`.
|
|
33
33
|
Create your bundle entry points as `.jass` files under `app/assets/javascripts` in regular
|
34
34
|
ES6 syntax (`import`, `async/await`).
|
35
35
|
|
36
|
-
External dependencies can be declared to
|
36
|
+
External dependencies can be declared to Rollup using the `global` comment:
|
37
37
|
|
38
38
|
```js
|
39
39
|
// application.jass
|
data/lib/jass.rb
CHANGED
data/lib/jass/compiler.rb
CHANGED
@@ -94,6 +94,11 @@ module Jass
|
|
94
94
|
dependency name => package
|
95
95
|
end
|
96
96
|
|
97
|
+
def append_plugin(package, name, arguments = nil, root = nil)
|
98
|
+
plugins.push(Plugin.new(name, arguments, root))
|
99
|
+
dependency name => package
|
100
|
+
end
|
101
|
+
|
97
102
|
def node_paths
|
98
103
|
([Jass.modules_root, Jass.vendor_modules_root] + plugins.map(&:root)).compact.map { |p| File.absolute_path(File.join(p, 'node_modules')) }
|
99
104
|
end
|
data/lib/jass/plugin.rb
CHANGED
data/lib/jass/version.rb
CHANGED
@@ -196,7 +196,8 @@ interface BaseDeclaration extends BaseStatement { }
|
|
196
196
|
|
197
197
|
export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
|
198
198
|
type: "FunctionDeclaration";
|
199
|
-
|
199
|
+
/** It is null when a function declaration is a part of the `export default function` statement */
|
200
|
+
id: Identifier | null;
|
200
201
|
body: BlockStatement;
|
201
202
|
}
|
202
203
|
|
@@ -473,7 +474,8 @@ export interface MethodDefinition extends BaseNode {
|
|
473
474
|
|
474
475
|
export interface ClassDeclaration extends BaseClass, BaseDeclaration {
|
475
476
|
type: "ClassDeclaration";
|
476
|
-
|
477
|
+
/** It is null when a class declaration is a part of the `export default class` statement */
|
478
|
+
id: Identifier | null;
|
477
479
|
}
|
478
480
|
|
479
481
|
export interface ClassExpression extends BaseClass, BaseExpression {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/estree",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.39",
|
4
4
|
"description": "TypeScript definitions for ESTree AST specification",
|
5
5
|
"license": "MIT",
|
6
6
|
"contributors": [
|
@@ -17,6 +17,6 @@
|
|
17
17
|
},
|
18
18
|
"scripts": {},
|
19
19
|
"dependencies": {},
|
20
|
-
"typesPublisherContentHash": "
|
20
|
+
"typesPublisherContentHash": "427ba878ebb5570e15aab870f708720d146a1c4b272e4a9d9990db4d1d033170",
|
21
21
|
"typeScriptVersion": "2.0"
|
22
22
|
}
|
@@ -13,7 +13,7 @@ var tokenize = false;
|
|
13
13
|
var options = {};
|
14
14
|
|
15
15
|
function help(status) {
|
16
|
-
var print = (status
|
16
|
+
var print = (status === 0) ? console.log : console.error;
|
17
17
|
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
18
18
|
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
19
19
|
process.exit(status);
|
@@ -21,15 +21,15 @@ function help(status) {
|
|
21
21
|
|
22
22
|
for (var i = 2; i < process.argv.length; ++i) {
|
23
23
|
var arg = process.argv[i];
|
24
|
-
if ((arg
|
25
|
-
else if (arg
|
26
|
-
else if (arg
|
27
|
-
else if (arg
|
28
|
-
else if (arg
|
29
|
-
else if (arg
|
30
|
-
else if (arg
|
31
|
-
else if (arg
|
32
|
-
else if (arg
|
24
|
+
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
|
25
|
+
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
26
|
+
else if (arg === "--locations") { options.locations = true; }
|
27
|
+
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
28
|
+
else if (arg === "--silent") { silent = true; }
|
29
|
+
else if (arg === "--compact") { compact = true; }
|
30
|
+
else if (arg === "--help") { help(0); }
|
31
|
+
else if (arg === "--tokenize") { tokenize = true; }
|
32
|
+
else if (arg === "--module") { options.sourceType = "module"; }
|
33
33
|
else {
|
34
34
|
var match = arg.match(/^--ecma(\d+)$/);
|
35
35
|
if (match)
|
@@ -50,7 +50,7 @@ function run(code) {
|
|
50
50
|
do {
|
51
51
|
token = tokenizer$$1.getToken();
|
52
52
|
result.push(token);
|
53
|
-
} while (token.type
|
53
|
+
} while (token.type !== acorn.tokTypes.eof)
|
54
54
|
}
|
55
55
|
} catch (e) {
|
56
56
|
console.error(e.message);
|
@@ -59,7 +59,7 @@ function run(code) {
|
|
59
59
|
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
60
60
|
}
|
61
61
|
|
62
|
-
if (forceFile || infile && infile
|
62
|
+
if (forceFile || infile && infile !== "-") {
|
63
63
|
run(fs.readFileSync(infile, "utf8"));
|
64
64
|
} else {
|
65
65
|
var code = "";
|
@@ -8,12 +8,11 @@ const unsupportedFeatures = [
|
|
8
8
|
"class-fields",
|
9
9
|
"class-fields-private",
|
10
10
|
"class-fields-public",
|
11
|
-
"numeric-separator-literal"
|
12
|
-
"optional-catch-binding"
|
11
|
+
"numeric-separator-literal"
|
13
12
|
];
|
14
13
|
|
15
14
|
run(
|
16
|
-
(content, {sourceType}) => parse(content, {sourceType, ecmaVersion:
|
15
|
+
(content, {sourceType}) => parse(content, {sourceType, ecmaVersion: 10}),
|
17
16
|
{
|
18
17
|
testsDirectory: path.dirname(require.resolve("test262/package.json")),
|
19
18
|
skip: test => (test.attrs.features && unsupportedFeatures.some(f => test.attrs.features.includes(f))),
|
@@ -212,10 +212,6 @@ language/module-code/early-export-global.js (default)
|
|
212
212
|
language/module-code/early-export-global.js (strict mode)
|
213
213
|
language/module-code/early-export-unresolvable.js (default)
|
214
214
|
language/module-code/early-export-unresolvable.js (strict mode)
|
215
|
-
language/module-code/parse-err-hoist-lex-fun.js (default)
|
216
|
-
language/module-code/parse-err-hoist-lex-fun.js (strict mode)
|
217
|
-
language/module-code/parse-err-hoist-lex-gen.js (default)
|
218
|
-
language/module-code/parse-err-hoist-lex-gen.js (strict mode)
|
219
215
|
language/statements/async-function/early-errors-declaration-body-contains-super-call.js (default)
|
220
216
|
language/statements/async-function/early-errors-declaration-body-contains-super-call.js (strict mode)
|
221
217
|
language/statements/async-function/early-errors-declaration-body-contains-super-property.js (default)
|
@@ -316,7 +312,6 @@ language/statements/if/labelled-fn-stmt-lone.js (default)
|
|
316
312
|
language/statements/if/labelled-fn-stmt-second.js (default)
|
317
313
|
language/statements/if/let-block-with-newline.js (default)
|
318
314
|
language/statements/if/let-identifier-with-newline.js (default)
|
319
|
-
language/statements/labeled/decl-async-function.js (default)
|
320
315
|
language/statements/labeled/let-block-with-newline.js (default)
|
321
316
|
language/statements/labeled/let-identifier-with-newline.js (default)
|
322
317
|
language/statements/let/syntax/identifier-let-disallowed-as-boundname.js (default)
|
@@ -27,8 +27,8 @@ var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
27
27
|
// code point above 128.
|
28
28
|
// Generated by `bin/generate-identifier-regex.js`.
|
29
29
|
|
30
|
-
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\
|
31
|
-
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\
|
30
|
+
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7b9\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
31
|
+
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
32
32
|
|
33
33
|
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
34
34
|
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
@@ -42,10 +42,10 @@ nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
42
42
|
// generated by bin/generate-identifier-regex.js
|
43
43
|
|
44
44
|
// eslint-disable-next-line comma-spacing
|
45
|
-
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,
|
45
|
+
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,190,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,54,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,86,26,230,43,117,63,32,0,257,0,11,39,8,0,22,0,12,39,3,3,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,68,12,0,67,12,65,1,31,6129,15,754,9486,286,82,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,60,67,1213,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541];
|
46
46
|
|
47
47
|
// eslint-disable-next-line comma-spacing
|
48
|
-
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,
|
48
|
+
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,280,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,2214,6,110,6,6,9,792487,239];
|
49
49
|
|
50
50
|
// This has a complexity linear to the value of the code. The
|
51
51
|
// assumption is that looking up astral identifier characters is
|
@@ -244,8 +244,8 @@ var types = {
|
|
244
244
|
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
245
245
|
var lineBreakG = new RegExp(lineBreak.source, "g");
|
246
246
|
|
247
|
-
function isNewLine(code) {
|
248
|
-
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029
|
247
|
+
function isNewLine(code, ecma2019String) {
|
248
|
+
return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))
|
249
249
|
}
|
250
250
|
|
251
251
|
var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
|
@@ -336,6 +336,9 @@ var defaultOptions = {
|
|
336
336
|
// When enabled, import/export statements are not constrained to
|
337
337
|
// appearing at the top of the program.
|
338
338
|
allowImportExportEverywhere: false,
|
339
|
+
// When enabled, await identifiers are allowed to appear at the top-level scope,
|
340
|
+
// but they are still not allowed in non-async functions.
|
341
|
+
allowAwaitOutsideFunction: false,
|
339
342
|
// When enabled, hashbang directive in the beginning of file
|
340
343
|
// is allowed and treated as a line comment.
|
341
344
|
allowHashBang: false,
|
@@ -443,7 +446,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
443
446
|
if (!options.allowReserved) {
|
444
447
|
for (var v = options.ecmaVersion;; v--)
|
445
448
|
{ if (reserved = reservedWords[v]) { break } }
|
446
|
-
if (options.sourceType
|
449
|
+
if (options.sourceType === "module") { reserved += " await"; }
|
447
450
|
}
|
448
451
|
this.reservedWords = keywordRegexp(reserved);
|
449
452
|
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
|
@@ -555,7 +558,7 @@ pp.strictDirective = function(start) {
|
|
555
558
|
start += skipWhiteSpace.exec(this$1.input)[0].length;
|
556
559
|
var match = literal.exec(this$1.input.slice(start));
|
557
560
|
if (!match) { return false }
|
558
|
-
if ((match[1] || match[2])
|
561
|
+
if ((match[1] || match[2]) === "use strict") { return true }
|
559
562
|
start += match[0].length;
|
560
563
|
}
|
561
564
|
};
|
@@ -616,7 +619,7 @@ pp.semicolon = function() {
|
|
616
619
|
};
|
617
620
|
|
618
621
|
pp.afterTrailingComma = function(tokType, notNext) {
|
619
|
-
if (this.type
|
622
|
+
if (this.type === tokType) {
|
620
623
|
if (this.options.onTrailingComma)
|
621
624
|
{ this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }
|
622
625
|
if (!notNext)
|
@@ -713,7 +716,7 @@ pp$1.isLet = function() {
|
|
713
716
|
skipWhiteSpace.lastIndex = this.pos;
|
714
717
|
var skip = skipWhiteSpace.exec(this.input);
|
715
718
|
var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
|
716
|
-
if (nextCh === 91 || nextCh
|
719
|
+
if (nextCh === 91 || nextCh === 123) { return true } // '{' and '['
|
717
720
|
if (isIdentifierStart(nextCh, true)) {
|
718
721
|
var pos = next + 1;
|
719
722
|
while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }
|
@@ -735,7 +738,7 @@ pp$1.isAsyncFunction = function() {
|
|
735
738
|
var next = this.pos + skip[0].length;
|
736
739
|
return !lineBreak.test(this.input.slice(this.pos, next)) &&
|
737
740
|
this.input.slice(next, next + 8) === "function" &&
|
738
|
-
(next + 8
|
741
|
+
(next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))
|
739
742
|
};
|
740
743
|
|
741
744
|
// Parse a single statement.
|
@@ -775,7 +778,7 @@ pp$1.parseStatement = function(declaration, topLevel, exports) {
|
|
775
778
|
case types._try: return this.parseTryStatement(node)
|
776
779
|
case types._const: case types._var:
|
777
780
|
kind = kind || this.value;
|
778
|
-
if (!declaration && kind
|
781
|
+
if (!declaration && kind !== "var") { this.unexpected(); }
|
779
782
|
return this.parseVarStatement(node, kind)
|
780
783
|
case types._while: return this.parseWhileStatement(node)
|
781
784
|
case types._with: return this.parseWithStatement(node)
|
@@ -813,7 +816,7 @@ pp$1.parseStatement = function(declaration, topLevel, exports) {
|
|
813
816
|
pp$1.parseBreakContinueStatement = function(node, keyword) {
|
814
817
|
var this$1 = this;
|
815
818
|
|
816
|
-
var isBreak = keyword
|
819
|
+
var isBreak = keyword === "break";
|
817
820
|
this.next();
|
818
821
|
if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }
|
819
822
|
else if (this.type !== types.name) { this.unexpected(); }
|
@@ -866,7 +869,7 @@ pp$1.parseDoStatement = function(node) {
|
|
866
869
|
|
867
870
|
pp$1.parseForStatement = function(node) {
|
868
871
|
this.next();
|
869
|
-
var awaitAt = (this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await")) ? this.lastTokStart : -1;
|
872
|
+
var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1;
|
870
873
|
this.labels.push(loopLabel);
|
871
874
|
this.enterLexicalScope();
|
872
875
|
this.expect(types.parenL);
|
@@ -919,8 +922,8 @@ pp$1.parseIfStatement = function(node) {
|
|
919
922
|
this.next();
|
920
923
|
node.test = this.parseParenExpression();
|
921
924
|
// allow function declarations in branches, but only in non-strict mode
|
922
|
-
node.consequent = this.parseStatement(!this.strict && this.type
|
923
|
-
node.alternate = this.eat(types._else) ? this.parseStatement(!this.strict && this.type
|
925
|
+
node.consequent = this.parseStatement(!this.strict && this.type === types._function);
|
926
|
+
node.alternate = this.eat(types._else) ? this.parseStatement(!this.strict && this.type === types._function) : null;
|
924
927
|
return this.finishNode(node, "IfStatement")
|
925
928
|
};
|
926
929
|
|
@@ -953,7 +956,7 @@ pp$1.parseSwitchStatement = function(node) {
|
|
953
956
|
// adding statements to.
|
954
957
|
|
955
958
|
var cur;
|
956
|
-
for (var sawDefault = false; this.type
|
959
|
+
for (var sawDefault = false; this.type !== types.braceR;) {
|
957
960
|
if (this$1.type === types._case || this$1.type === types._default) {
|
958
961
|
var isCase = this$1.type === types._case;
|
959
962
|
if (cur) { this$1.finishNode(cur, "SwitchCase"); }
|
@@ -1000,11 +1003,16 @@ pp$1.parseTryStatement = function(node) {
|
|
1000
1003
|
if (this.type === types._catch) {
|
1001
1004
|
var clause = this.startNode();
|
1002
1005
|
this.next();
|
1003
|
-
this.
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1006
|
+
if (this.eat(types.parenL)) {
|
1007
|
+
clause.param = this.parseBindingAtom();
|
1008
|
+
this.enterLexicalScope();
|
1009
|
+
this.checkLVal(clause.param, "let");
|
1010
|
+
this.expect(types.parenR);
|
1011
|
+
} else {
|
1012
|
+
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
1013
|
+
clause.param = null;
|
1014
|
+
this.enterLexicalScope();
|
1015
|
+
}
|
1008
1016
|
clause.body = this.parseBlock(false);
|
1009
1017
|
this.exitLexicalScope();
|
1010
1018
|
node.handler = this.finishNode(clause, "CatchClause");
|
@@ -1057,7 +1065,7 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr) {
|
|
1057
1065
|
var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null;
|
1058
1066
|
for (var i = this.labels.length - 1; i >= 0; i--) {
|
1059
1067
|
var label$1 = this$1.labels[i];
|
1060
|
-
if (label$1.statementStart
|
1068
|
+
if (label$1.statementStart === node.start) {
|
1061
1069
|
// Update information about previous labels on this node
|
1062
1070
|
label$1.statementStart = this$1.start;
|
1063
1071
|
label$1.kind = kind;
|
@@ -1065,9 +1073,9 @@ pp$1.parseLabeledStatement = function(node, maybeName, expr) {
|
|
1065
1073
|
}
|
1066
1074
|
this.labels.push({name: maybeName, kind: kind, statementStart: this.start});
|
1067
1075
|
node.body = this.parseStatement(true);
|
1068
|
-
if (node.body.type
|
1069
|
-
node.body.type
|
1070
|
-
node.body.type
|
1076
|
+
if (node.body.type === "ClassDeclaration" ||
|
1077
|
+
node.body.type === "VariableDeclaration" && node.body.kind !== "var" ||
|
1078
|
+
node.body.type === "FunctionDeclaration" && (this.strict || node.body.generator || node.body.async))
|
1071
1079
|
{ this.raiseRecoverable(node.body.start, "Invalid labeled declaration"); }
|
1072
1080
|
this.labels.pop();
|
1073
1081
|
node.label = expr;
|
@@ -1127,14 +1135,14 @@ pp$1.parseFor = function(node, init) {
|
|
1127
1135
|
pp$1.parseForIn = function(node, init) {
|
1128
1136
|
var type = this.type === types._in ? "ForInStatement" : "ForOfStatement";
|
1129
1137
|
this.next();
|
1130
|
-
if (type
|
1138
|
+
if (type === "ForInStatement") {
|
1131
1139
|
if (init.type === "AssignmentPattern" ||
|
1132
1140
|
(init.type === "VariableDeclaration" && init.declarations[0].init != null &&
|
1133
1141
|
(this.strict || init.declarations[0].id.type !== "Identifier")))
|
1134
1142
|
{ this.raise(init.start, "Invalid assignment in for-in loop head"); }
|
1135
1143
|
}
|
1136
1144
|
node.left = init;
|
1137
|
-
node.right = type
|
1145
|
+
node.right = type === "ForInStatement" ? this.parseExpression() : this.parseMaybeAssign();
|
1138
1146
|
this.expect(types.parenR);
|
1139
1147
|
this.exitLexicalScope();
|
1140
1148
|
node.body = this.parseStatement(false);
|
@@ -1156,7 +1164,7 @@ pp$1.parseVar = function(node, isFor, kind) {
|
|
1156
1164
|
decl.init = this$1.parseMaybeAssign(isFor);
|
1157
1165
|
} else if (kind === "const" && !(this$1.type === types._in || (this$1.options.ecmaVersion >= 6 && this$1.isContextual("of")))) {
|
1158
1166
|
this$1.unexpected();
|
1159
|
-
} else if (decl.id.type
|
1167
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this$1.type === types._in || this$1.isContextual("of")))) {
|
1160
1168
|
this$1.raise(this$1.lastTokEnd, "Complex binding patterns require an initialization value");
|
1161
1169
|
} else {
|
1162
1170
|
decl.init = null;
|
@@ -1183,9 +1191,9 @@ pp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {
|
|
1183
1191
|
{ node.async = !!isAsync; }
|
1184
1192
|
|
1185
1193
|
if (isStatement) {
|
1186
|
-
node.id = isStatement === "nullableID" && this.type
|
1194
|
+
node.id = isStatement === "nullableID" && this.type !== types.name ? null : this.parseIdent();
|
1187
1195
|
if (node.id) {
|
1188
|
-
this.checkLVal(node.id, "var");
|
1196
|
+
this.checkLVal(node.id, this.inModule && !this.inFunction ? "let" : "var");
|
1189
1197
|
}
|
1190
1198
|
}
|
1191
1199
|
|
@@ -1199,7 +1207,7 @@ pp$1.parseFunction = function(node, isStatement, allowExpressionBody, isAsync) {
|
|
1199
1207
|
this.enterFunctionScope();
|
1200
1208
|
|
1201
1209
|
if (!isStatement)
|
1202
|
-
{ node.id = this.type
|
1210
|
+
{ node.id = this.type === types.name ? this.parseIdent() : null; }
|
1203
1211
|
|
1204
1212
|
this.parseFunctionParams(node);
|
1205
1213
|
this.parseFunctionBody(node, allowExpressionBody);
|
@@ -1383,28 +1391,28 @@ pp$1.checkPatternExport = function(exports, pat) {
|
|
1383
1391
|
var this$1 = this;
|
1384
1392
|
|
1385
1393
|
var type = pat.type;
|
1386
|
-
if (type
|
1394
|
+
if (type === "Identifier")
|
1387
1395
|
{ this.checkExport(exports, pat.name, pat.start); }
|
1388
|
-
else if (type
|
1396
|
+
else if (type === "ObjectPattern")
|
1389
1397
|
{ for (var i = 0, list = pat.properties; i < list.length; i += 1)
|
1390
1398
|
{
|
1391
1399
|
var prop = list[i];
|
1392
1400
|
|
1393
1401
|
this$1.checkPatternExport(exports, prop);
|
1394
1402
|
} }
|
1395
|
-
else if (type
|
1403
|
+
else if (type === "ArrayPattern")
|
1396
1404
|
{ for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
1397
1405
|
var elt = list$1[i$1];
|
1398
1406
|
|
1399
1407
|
if (elt) { this$1.checkPatternExport(exports, elt); }
|
1400
1408
|
} }
|
1401
|
-
else if (type
|
1409
|
+
else if (type === "Property")
|
1402
1410
|
{ this.checkPatternExport(exports, pat.value); }
|
1403
|
-
else if (type
|
1411
|
+
else if (type === "AssignmentPattern")
|
1404
1412
|
{ this.checkPatternExport(exports, pat.left); }
|
1405
|
-
else if (type
|
1413
|
+
else if (type === "RestElement")
|
1406
1414
|
{ this.checkPatternExport(exports, pat.argument); }
|
1407
|
-
else if (type
|
1415
|
+
else if (type === "ParenthesizedExpression")
|
1408
1416
|
{ this.checkPatternExport(exports, pat.expression); }
|
1409
1417
|
};
|
1410
1418
|
|
@@ -1571,7 +1579,7 @@ pp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
1571
1579
|
break
|
1572
1580
|
|
1573
1581
|
case "Property":
|
1574
|
-
// AssignmentProperty has type
|
1582
|
+
// AssignmentProperty has type === "Property"
|
1575
1583
|
if (node.kind !== "init") { this.raise(node.key.start, "Object pattern can't contain getter or setter"); }
|
1576
1584
|
this.toAssignable(node.value, isBinding);
|
1577
1585
|
break
|
@@ -1761,7 +1769,7 @@ pp$2.checkLVal = function(expr, bindingType, checkClashes) {
|
|
1761
1769
|
break
|
1762
1770
|
|
1763
1771
|
case "Property":
|
1764
|
-
// AssignmentProperty has type
|
1772
|
+
// AssignmentProperty has type === "Property"
|
1765
1773
|
this.checkLVal(expr.value, bindingType, checkClashes);
|
1766
1774
|
break
|
1767
1775
|
|
@@ -1906,7 +1914,7 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
1906
1914
|
}
|
1907
1915
|
|
1908
1916
|
var startPos = this.start, startLoc = this.startLoc;
|
1909
|
-
if (this.type
|
1917
|
+
if (this.type === types.parenL || this.type === types.name)
|
1910
1918
|
{ this.potentialArrowAt = this.start; }
|
1911
1919
|
var left = this.parseMaybeConditional(noIn, refDestructuringErrors);
|
1912
1920
|
if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
|
@@ -1951,7 +1959,7 @@ pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
|
|
1951
1959
|
var startPos = this.start, startLoc = this.startLoc;
|
1952
1960
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false);
|
1953
1961
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
1954
|
-
return expr.start
|
1962
|
+
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)
|
1955
1963
|
};
|
1956
1964
|
|
1957
1965
|
// Parse binary operators with the operator precedence parsing
|
@@ -1990,7 +1998,7 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
1990
1998
|
var this$1 = this;
|
1991
1999
|
|
1992
2000
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
1993
|
-
if (this.inAsync && this.
|
2001
|
+
if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
|
1994
2002
|
expr = this.parseAwait();
|
1995
2003
|
sawUnary = true;
|
1996
2004
|
} else if (this.type.prefix) {
|
@@ -2045,7 +2053,7 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
|
|
2045
2053
|
var this$1 = this;
|
2046
2054
|
|
2047
2055
|
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
|
2048
|
-
this.lastTokEnd
|
2056
|
+
this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
|
2049
2057
|
for (var computed = (void 0);;) {
|
2050
2058
|
if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) {
|
2051
2059
|
var node = this$1.startNodeAt(startPos, startLoc);
|
@@ -2090,7 +2098,7 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
|
|
2090
2098
|
// or `{}`.
|
2091
2099
|
|
2092
2100
|
pp$3.parseExprAtom = function(refDestructuringErrors) {
|
2093
|
-
var node, canBeArrow = this.potentialArrowAt
|
2101
|
+
var node, canBeArrow = this.potentialArrowAt === this.start;
|
2094
2102
|
switch (this.type) {
|
2095
2103
|
case types._super:
|
2096
2104
|
if (!this.inFunction)
|
@@ -2435,7 +2443,7 @@ pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
2435
2443
|
} else if (!isPattern && !containsEsc &&
|
2436
2444
|
this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
|
2437
2445
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
2438
|
-
(this.type
|
2446
|
+
(this.type !== types.comma && this.type !== types.braceR)) {
|
2439
2447
|
if (isGenerator || isAsync) { this.unexpected(); }
|
2440
2448
|
prop.kind = prop.key.name;
|
2441
2449
|
this.parsePropertyName(prop);
|
@@ -2664,7 +2672,7 @@ pp$3.checkUnreserved = function(ref) {
|
|
2664
2672
|
if (this.isKeyword(name))
|
2665
2673
|
{ this.raise(start, ("Unexpected keyword '" + name + "'")); }
|
2666
2674
|
if (this.options.ecmaVersion < 6 &&
|
2667
|
-
this.input.slice(start, end).indexOf("\\")
|
2675
|
+
this.input.slice(start, end).indexOf("\\") !== -1) { return }
|
2668
2676
|
var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
|
2669
2677
|
if (re.test(name)) {
|
2670
2678
|
if (!this.inAsync && name === "await")
|
@@ -2679,7 +2687,7 @@ pp$3.checkUnreserved = function(ref) {
|
|
2679
2687
|
|
2680
2688
|
pp$3.parseIdent = function(liberal, isBinding) {
|
2681
2689
|
var node = this.startNode();
|
2682
|
-
if (liberal && this.options.allowReserved
|
2690
|
+
if (liberal && this.options.allowReserved === "never") { liberal = false; }
|
2683
2691
|
if (this.type === types.name) {
|
2684
2692
|
node.name = this.value;
|
2685
2693
|
} else if (this.type.keyword) {
|
@@ -2709,7 +2717,7 @@ pp$3.parseYield = function() {
|
|
2709
2717
|
|
2710
2718
|
var node = this.startNode();
|
2711
2719
|
this.next();
|
2712
|
-
if (this.type
|
2720
|
+
if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {
|
2713
2721
|
node.delegate = false;
|
2714
2722
|
node.argument = null;
|
2715
2723
|
} else {
|
@@ -2916,13 +2924,13 @@ pp$7.braceIsBlock = function(prevType) {
|
|
2916
2924
|
// The check for `tt.name && exprAllowed` detects whether we are
|
2917
2925
|
// after a `yield` or `of` construct. See the `updateContext` for
|
2918
2926
|
// `tt.name`.
|
2919
|
-
if (prevType === types._return || prevType
|
2927
|
+
if (prevType === types._return || prevType === types.name && this.exprAllowed)
|
2920
2928
|
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
|
2921
|
-
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType
|
2929
|
+
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)
|
2922
2930
|
{ return true }
|
2923
|
-
if (prevType
|
2931
|
+
if (prevType === types.braceL)
|
2924
2932
|
{ return parent === types$1.b_stat }
|
2925
|
-
if (prevType
|
2933
|
+
if (prevType === types._var || prevType === types.name)
|
2926
2934
|
{ return false }
|
2927
2935
|
return !this.exprAllowed
|
2928
2936
|
};
|
@@ -2940,7 +2948,7 @@ pp$7.inGeneratorContext = function() {
|
|
2940
2948
|
|
2941
2949
|
pp$7.updateContext = function(prevType) {
|
2942
2950
|
var update, type = this.type;
|
2943
|
-
if (type.keyword && prevType
|
2951
|
+
if (type.keyword && prevType === types.dot)
|
2944
2952
|
{ this.exprAllowed = false; }
|
2945
2953
|
else if (update = type.updateContext)
|
2946
2954
|
{ update.call(this, prevType); }
|
@@ -2951,7 +2959,7 @@ pp$7.updateContext = function(prevType) {
|
|
2951
2959
|
// Token-specific context update code
|
2952
2960
|
|
2953
2961
|
types.parenR.updateContext = types.braceR.updateContext = function() {
|
2954
|
-
if (this.context.length
|
2962
|
+
if (this.context.length === 1) {
|
2955
2963
|
this.exprAllowed = true;
|
2956
2964
|
return
|
2957
2965
|
}
|
@@ -3000,7 +3008,7 @@ types.backQuote.updateContext = function() {
|
|
3000
3008
|
};
|
3001
3009
|
|
3002
3010
|
types.star.updateContext = function(prevType) {
|
3003
|
-
if (prevType
|
3011
|
+
if (prevType === types._function) {
|
3004
3012
|
var index = this.context.length - 1;
|
3005
3013
|
if (this.context[index] === types$1.f_expr)
|
3006
3014
|
{ this.context[index] = types$1.f_expr_gen; }
|
@@ -3013,8 +3021,8 @@ types.star.updateContext = function(prevType) {
|
|
3013
3021
|
types.name.updateContext = function(prevType) {
|
3014
3022
|
var allowed = false;
|
3015
3023
|
if (this.options.ecmaVersion >= 6) {
|
3016
|
-
if (this.value
|
3017
|
-
this.value
|
3024
|
+
if (this.value === "of" && !this.exprAllowed ||
|
3025
|
+
this.value === "yield" && this.inGeneratorContext())
|
3018
3026
|
{ allowed = true; }
|
3019
3027
|
}
|
3020
3028
|
this.exprAllowed = allowed;
|
@@ -3583,7 +3591,7 @@ pp$9.validateRegExpFlags = function(state) {
|
|
3583
3591
|
|
3584
3592
|
for (var i = 0; i < flags.length; i++) {
|
3585
3593
|
var flag = flags.charAt(i);
|
3586
|
-
if (validFlags.indexOf(flag)
|
3594
|
+
if (validFlags.indexOf(flag) === -1) {
|
3587
3595
|
this$1.raise(state.start, "Invalid regular expression flag");
|
3588
3596
|
}
|
3589
3597
|
if (flags.indexOf(flag, i + 1) > -1) {
|
@@ -4749,7 +4757,7 @@ pp$8.readToken_mult_modulo_exp = function(code) { // '%*'
|
|
4749
4757
|
var tokentype = code === 42 ? types.star : types.modulo;
|
4750
4758
|
|
4751
4759
|
// exponentiation operator ** and **=
|
4752
|
-
if (this.options.ecmaVersion >= 7 && code
|
4760
|
+
if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {
|
4753
4761
|
++size;
|
4754
4762
|
tokentype = types.starstar;
|
4755
4763
|
next = this.input.charCodeAt(this.pos + 2);
|
@@ -4775,7 +4783,7 @@ pp$8.readToken_caret = function() { // '^'
|
|
4775
4783
|
pp$8.readToken_plus_min = function(code) { // '+-'
|
4776
4784
|
var next = this.input.charCodeAt(this.pos + 1);
|
4777
4785
|
if (next === code) {
|
4778
|
-
if (next
|
4786
|
+
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
|
4779
4787
|
(this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {
|
4780
4788
|
// A `-->` line comment
|
4781
4789
|
this.skipLineComment(3);
|
@@ -4796,8 +4804,8 @@ pp$8.readToken_lt_gt = function(code) { // '<>'
|
|
4796
4804
|
if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }
|
4797
4805
|
return this.finishOp(types.bitShift, size)
|
4798
4806
|
}
|
4799
|
-
if (next
|
4800
|
-
this.input.charCodeAt(this.pos + 3)
|
4807
|
+
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&
|
4808
|
+
this.input.charCodeAt(this.pos + 3) === 45) {
|
4801
4809
|
// `<!--`, an XML-style comment that should be interpreted as a line comment
|
4802
4810
|
this.skipLineComment(4);
|
4803
4811
|
this.skipSpace();
|
@@ -5031,7 +5039,7 @@ pp$8.readString = function(quote) {
|
|
5031
5039
|
out += this$1.readEscapedChar(false);
|
5032
5040
|
chunkStart = this$1.pos;
|
5033
5041
|
} else {
|
5034
|
-
if (isNewLine(ch)) { this$1.raise(this$1.start, "Unterminated string constant"); }
|
5042
|
+
if (isNewLine(ch, this$1.options.ecmaVersion >= 10)) { this$1.raise(this$1.start, "Unterminated string constant"); }
|
5035
5043
|
++this$1.pos;
|
5036
5044
|
}
|
5037
5045
|
}
|
@@ -5167,7 +5175,7 @@ pp$8.readEscapedChar = function(inTemplate) {
|
|
5167
5175
|
}
|
5168
5176
|
this.pos += octalStr.length - 1;
|
5169
5177
|
ch = this.input.charCodeAt(this.pos);
|
5170
|
-
if ((octalStr !== "0" || ch
|
5178
|
+
if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
|
5171
5179
|
this.invalidStringToken(
|
5172
5180
|
this.pos - 1 - octalStr.length,
|
5173
5181
|
inTemplate
|
@@ -5210,7 +5218,7 @@ pp$8.readWord1 = function() {
|
|
5210
5218
|
this$1.containsEsc = true;
|
5211
5219
|
word += this$1.input.slice(chunkStart, this$1.pos);
|
5212
5220
|
var escStart = this$1.pos;
|
5213
|
-
if (this$1.input.charCodeAt(++this$1.pos)
|
5221
|
+
if (this$1.input.charCodeAt(++this$1.pos) !== 117) // "u"
|
5214
5222
|
{ this$1.invalidStringToken(this$1.pos, "Expecting Unicode escape sequence \\uXXXX"); }
|
5215
5223
|
++this$1.pos;
|
5216
5224
|
var esc = this$1.readCodePoint();
|
@@ -5260,7 +5268,7 @@ pp$8.readWord = function() {
|
|
5260
5268
|
// [dammit]: acorn_loose.js
|
5261
5269
|
// [walk]: util/walk.js
|
5262
5270
|
|
5263
|
-
var version = "5.
|
5271
|
+
var version = "5.7.2";
|
5264
5272
|
|
5265
5273
|
// The main exported interface (under `self.acorn` when in the
|
5266
5274
|
// browser) is a `parse` function that takes a code string and
|