meriyah 4.1.5 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/README.md +2 -1
- package/dist/meriyah.amd.js +96 -72
- package/dist/meriyah.amd.min.js +1 -1
- package/dist/meriyah.cjs +94 -70
- package/dist/meriyah.cjs.js +94 -70
- package/dist/meriyah.cjs.min.js +1 -1
- package/dist/meriyah.esm.js +94 -70
- package/dist/meriyah.esm.min.js +1 -1
- package/dist/meriyah.esm.min.mjs +1 -0
- package/dist/meriyah.esm.mjs +8806 -0
- package/dist/meriyah.iife.js +95 -71
- package/dist/meriyah.iife.min.js +1 -1
- package/dist/meriyah.min.cjs +1 -1
- package/dist/meriyah.system.js +98 -74
- package/dist/meriyah.system.min.js +1 -1
- package/dist/meriyah.umd.cjs +96 -72
- package/dist/meriyah.umd.es5.js +108 -80
- package/dist/meriyah.umd.es5.min.js +1 -15
- package/dist/meriyah.umd.js +96 -72
- package/dist/meriyah.umd.min.cjs +1 -1
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/estree.d.ts +9 -4
- package/dist/src/estree.d.ts.map +1 -1
- package/dist/src/lexer/regexp.d.ts.map +1 -1
- package/dist/src/parser.d.ts +1 -0
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/token.d.ts +2 -2
- package/package.json +25 -30
- package/src/errors.ts +0 -2
- package/src/estree.ts +11 -3
- package/src/lexer/numeric.ts +7 -7
- package/src/lexer/regexp.ts +22 -9
- package/src/lexer/scan.ts +1 -1
- package/src/parser.ts +94 -56
- package/src/token.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
# [4.3.0](https://github.com/meriyah/meriyah/compare/v4.2.1...v4.3.0) (2022-08-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **parser:** Support for class static initialization block without next flag ([a3b10f0](https://github.com/meriyah/meriyah/commit/a3b10f01651cb1f02e703fde0ef2fac1a3222d65))
|
|
7
|
+
* **parser:** support top level for-await in module context ([69761bf](https://github.com/meriyah/meriyah/commit/69761bf60d30524e7d95251d4219ed8166d97577)), closes [#214](https://github.com/meriyah/meriyah/issues/214)
|
|
8
|
+
* use null as regex value in environment missing flag "d" support ([b174ae6](https://github.com/meriyah/meriyah/commit/b174ae69cc45ce1d925c86f6c8eab8cce58057b8))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **lexer:** support new RegExp Indices flag "d" ([#217](https://github.com/meriyah/meriyah/issues/217)) ([b98e3bd](https://github.com/meriyah/meriyah/commit/b98e3bd79f7c13bef436976c37b04e128b40cec5)), closes [#214](https://github.com/meriyah/meriyah/issues/214)
|
|
14
|
+
* **parser:** Add support for class static initialization block ([1510e36](https://github.com/meriyah/meriyah/commit/1510e36b28e58317be93e59b7caed35985320c68))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [4.2.1](https://github.com/meriyah/meriyah/compare/v4.2.0...v4.2.1) (2022-03-31)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **lexer:** fix wrong error when using regex flag s together with m or y ([d757c6b](https://github.com/meriyah/meriyah/commit/d757c6b20ae4f6f4e55a77179726db36cf2bd50b)), closes [#202](https://github.com/meriyah/meriyah/issues/202)
|
|
24
|
+
* **parser:** allow regular expression in JSXExpressionContainer ([a5fcb80](https://github.com/meriyah/meriyah/commit/a5fcb8072084f2961e11e9db24f7b8ac0ecd04a6)), closes [#204](https://github.com/meriyah/meriyah/issues/204)
|
|
25
|
+
* **parser:** allow top level await in expressions ([37c6361](https://github.com/meriyah/meriyah/commit/37c63613771e5bc6e23b7da2d92e992c60dafc5a)), closes [#212](https://github.com/meriyah/meriyah/issues/212)
|
|
26
|
+
* **parser:** fix wrong starting loc for any non-trival expression in return statement ([7063af5](https://github.com/meriyah/meriyah/commit/7063af55b2c5d6d370fdf6480b87b70387c707fe)), closes [#207](https://github.com/meriyah/meriyah/issues/207)
|
|
27
|
+
* **parser:** super call should be allowed in private method ([6de707a](https://github.com/meriyah/meriyah/commit/6de707a0efb3053767deaa36b1ed6979b0d3f873)), closes [#203](https://github.com/meriyah/meriyah/issues/203)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# [4.2.0](https://github.com/meriyah/meriyah/compare/v4.1.5...v4.2.0) (2021-07-11)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **parser:** keep InGlobal flag in parenthesized ([023ee0e](https://github.com/meriyah/meriyah/commit/023ee0e36fc28e75d0448739b8343ec801ac887f))
|
|
37
|
+
* **parser:** rejects "await 2**2" ([9a75bf6](https://github.com/meriyah/meriyah/commit/9a75bf67c9a6d22d28accc782665ed614a5a66c1)), closes [#187](https://github.com/meriyah/meriyah/issues/187)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
* **parser:** support top-level await ([7b2a5bd](https://github.com/meriyah/meriyah/commit/7b2a5bd5832cfa4c98dac4219f22901c6eb28196)), closes [#186](https://github.com/meriyah/meriyah/issues/186)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
1
46
|
## [4.1.5](https://github.com/meriyah/meriyah/compare/v4.1.4...v4.1.5) (2021-03-05)
|
|
2
47
|
|
|
3
48
|
|
package/README.md
CHANGED
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* Support TC39 proposals via option
|
|
22
22
|
* Support for additional ECMAScript features for Web Browsers
|
|
23
23
|
* JSX support via option
|
|
24
|
+
* Does **not** support TypeScript or Flow
|
|
24
25
|
* Optionally track syntactic node locations
|
|
25
|
-
* Emits an ESTree-compatible abstract syntax tree
|
|
26
|
+
* Emits an ESTree-compatible abstract syntax tree
|
|
26
27
|
* No backtracking
|
|
27
28
|
* Low memory usage
|
|
28
29
|
* Very well tested (~99 000 unit tests with full code coverage)
|
package/dist/meriyah.amd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(['exports'], function (exports) { 'use strict';
|
|
1
|
+
define(['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
const errorMessages = {
|
|
4
4
|
[0]: 'Unexpected token',
|
|
@@ -96,7 +96,6 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
96
96
|
[89]: 'Illegal return statement',
|
|
97
97
|
[90]: 'The left hand side of the for-header binding declaration is not destructible',
|
|
98
98
|
[91]: 'new.target only allowed within functions',
|
|
99
|
-
[92]: "'Unexpected token: 'escaped keyword'",
|
|
100
99
|
[93]: "'#' not followed by identifier",
|
|
101
100
|
[99]: 'Invalid keyword',
|
|
102
101
|
[98]: "Can not use 'let' as a class name",
|
|
@@ -111,7 +110,6 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
111
110
|
[104]: "Only '*' or '{...}' can be imported after default",
|
|
112
111
|
[105]: 'Trailing decorator may be followed by method',
|
|
113
112
|
[106]: "Decorators can't be used with a constructor",
|
|
114
|
-
[107]: "'%0' may not be used as an identifier in this context",
|
|
115
113
|
[108]: 'HTML comments are only allowed with web compatibility (Annex B)',
|
|
116
114
|
[109]: "The identifier 'let' must not be in expression position in strict mode",
|
|
117
115
|
[110]: 'Cannot assign to `eval` and `arguments` in strict mode',
|
|
@@ -867,7 +865,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
867
865
|
break;
|
|
868
866
|
case 117:
|
|
869
867
|
if (mask & 16)
|
|
870
|
-
report(parser, 34, '
|
|
868
|
+
report(parser, 34, 'u');
|
|
871
869
|
mask |= 16;
|
|
872
870
|
break;
|
|
873
871
|
case 121:
|
|
@@ -876,9 +874,14 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
876
874
|
mask |= 8;
|
|
877
875
|
break;
|
|
878
876
|
case 115:
|
|
879
|
-
if (mask &
|
|
877
|
+
if (mask & 32)
|
|
880
878
|
report(parser, 34, 's');
|
|
881
|
-
mask |=
|
|
879
|
+
mask |= 32;
|
|
880
|
+
break;
|
|
881
|
+
case 100:
|
|
882
|
+
if (mask & 64)
|
|
883
|
+
report(parser, 34, 'd');
|
|
884
|
+
mask |= 64;
|
|
882
885
|
break;
|
|
883
886
|
default:
|
|
884
887
|
report(parser, 33);
|
|
@@ -898,7 +901,13 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
898
901
|
return new RegExp(pattern, flags);
|
|
899
902
|
}
|
|
900
903
|
catch (e) {
|
|
901
|
-
|
|
904
|
+
try {
|
|
905
|
+
new RegExp(pattern, flags.replace('d', ''));
|
|
906
|
+
return null;
|
|
907
|
+
}
|
|
908
|
+
catch (e) {
|
|
909
|
+
report(parser, 32);
|
|
910
|
+
}
|
|
902
911
|
}
|
|
903
912
|
}
|
|
904
913
|
|
|
@@ -1209,8 +1218,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1209
1218
|
digits++;
|
|
1210
1219
|
char = advanceChar(parser);
|
|
1211
1220
|
}
|
|
1212
|
-
if (digits
|
|
1213
|
-
report(parser, digits
|
|
1221
|
+
if (digits === 0 || !allowSeparator) {
|
|
1222
|
+
report(parser, digits === 0 ? 19 : 147);
|
|
1214
1223
|
}
|
|
1215
1224
|
}
|
|
1216
1225
|
else if ((char | 32) === 111) {
|
|
@@ -1230,8 +1239,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1230
1239
|
digits++;
|
|
1231
1240
|
char = advanceChar(parser);
|
|
1232
1241
|
}
|
|
1233
|
-
if (digits
|
|
1234
|
-
report(parser, digits
|
|
1242
|
+
if (digits === 0 || !allowSeparator) {
|
|
1243
|
+
report(parser, digits === 0 ? 0 : 147);
|
|
1235
1244
|
}
|
|
1236
1245
|
}
|
|
1237
1246
|
else if ((char | 32) === 98) {
|
|
@@ -1251,8 +1260,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1251
1260
|
digits++;
|
|
1252
1261
|
char = advanceChar(parser);
|
|
1253
1262
|
}
|
|
1254
|
-
if (digits
|
|
1255
|
-
report(parser, digits
|
|
1263
|
+
if (digits === 0 || !allowSeparator) {
|
|
1264
|
+
report(parser, digits === 0 ? 0 : 147);
|
|
1256
1265
|
}
|
|
1257
1266
|
}
|
|
1258
1267
|
else if (CharTypes[char] & 32) {
|
|
@@ -1328,7 +1337,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1328
1337
|
if (CharTypes[char] & 256)
|
|
1329
1338
|
char = advanceChar(parser);
|
|
1330
1339
|
const { index } = parser;
|
|
1331
|
-
if ((CharTypes[char] & 16)
|
|
1340
|
+
if ((CharTypes[char] & 16) === 0)
|
|
1332
1341
|
report(parser, 10);
|
|
1333
1342
|
value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
|
|
1334
1343
|
char = parser.currentChar;
|
|
@@ -1791,7 +1800,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1791
1800
|
}
|
|
1792
1801
|
else if (ch === 61) {
|
|
1793
1802
|
advanceChar(parser);
|
|
1794
|
-
return
|
|
1803
|
+
return 8456256;
|
|
1795
1804
|
}
|
|
1796
1805
|
if (ch === 33) {
|
|
1797
1806
|
const index = parser.index + 1;
|
|
@@ -1809,7 +1818,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1809
1818
|
return 8456258;
|
|
1810
1819
|
}
|
|
1811
1820
|
if (ch === 47) {
|
|
1812
|
-
if ((context & 16)
|
|
1821
|
+
if ((context & 16) === 0)
|
|
1813
1822
|
return 8456258;
|
|
1814
1823
|
const index = parser.index + 1;
|
|
1815
1824
|
if (index < parser.end) {
|
|
@@ -1974,7 +1983,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
1974
1983
|
const ch = parser.currentChar;
|
|
1975
1984
|
if (ch === 61) {
|
|
1976
1985
|
advanceChar(parser);
|
|
1977
|
-
return
|
|
1986
|
+
return 8456257;
|
|
1978
1987
|
}
|
|
1979
1988
|
if (ch !== 62)
|
|
1980
1989
|
return 8456259;
|
|
@@ -4915,7 +4924,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
4915
4924
|
case 86106:
|
|
4916
4925
|
report(parser, context & 1024
|
|
4917
4926
|
? 73
|
|
4918
|
-
: (context & 256)
|
|
4927
|
+
: (context & 256) === 0
|
|
4919
4928
|
? 75
|
|
4920
4929
|
: 74);
|
|
4921
4930
|
case 86096:
|
|
@@ -4961,12 +4970,12 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
4961
4970
|
});
|
|
4962
4971
|
}
|
|
4963
4972
|
function parseReturnStatement(parser, context, start, line, column) {
|
|
4964
|
-
if ((context & 32)
|
|
4973
|
+
if ((context & 32) === 0 && context & 8192)
|
|
4965
4974
|
report(parser, 89);
|
|
4966
4975
|
nextToken(parser, context | 32768);
|
|
4967
4976
|
const argument = parser.flags & 1 || parser.token & 1048576
|
|
4968
4977
|
? null
|
|
4969
|
-
: parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.
|
|
4978
|
+
: parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
|
|
4970
4979
|
matchOrInsertSemicolon(parser, context | 32768);
|
|
4971
4980
|
return finishNode(parser, context, start, line, column, {
|
|
4972
4981
|
type: 'ReturnStatement',
|
|
@@ -4985,7 +4994,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
4985
4994
|
validateAndDeclareLabel(parser, labels, value);
|
|
4986
4995
|
nextToken(parser, context | 32768);
|
|
4987
4996
|
const body = allowFuncDecl &&
|
|
4988
|
-
(context & 1024)
|
|
4997
|
+
(context & 1024) === 0 &&
|
|
4989
4998
|
context & 256 &&
|
|
4990
4999
|
parser.token === 86106
|
|
4991
5000
|
? parseFunctionDeclaration(parser, context, addChildScope(scope, 2), origin, 0, 0, 0, parser.tokenPos, parser.linePos, parser.colPos)
|
|
@@ -5094,7 +5103,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5094
5103
|
}
|
|
5095
5104
|
function parseConsequentOrAlternative(parser, context, scope, labels, start, line, column) {
|
|
5096
5105
|
return context & 1024 ||
|
|
5097
|
-
(context & 256)
|
|
5106
|
+
(context & 256) === 0 ||
|
|
5098
5107
|
parser.token !== 86106
|
|
5099
5108
|
? parseStatement(parser, context, scope, 0, { $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos)
|
|
5100
5109
|
: parseFunctionDeclaration(parser, context, addChildScope(scope, 2), 0, 0, 0, 0, start, line, column);
|
|
@@ -5159,11 +5168,11 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5159
5168
|
return parseStatement(parser, ((context | 134217728) ^ 134217728) | 131072, scope, 0, { loop: 1, $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos);
|
|
5160
5169
|
}
|
|
5161
5170
|
function parseContinueStatement(parser, context, labels, start, line, column) {
|
|
5162
|
-
if ((context & 131072)
|
|
5171
|
+
if ((context & 131072) === 0)
|
|
5163
5172
|
report(parser, 65);
|
|
5164
5173
|
nextToken(parser, context);
|
|
5165
5174
|
let label = null;
|
|
5166
|
-
if ((parser.flags & 1)
|
|
5175
|
+
if ((parser.flags & 1) === 0 && parser.token & 143360) {
|
|
5167
5176
|
const { tokenValue } = parser;
|
|
5168
5177
|
label = parseIdentifier(parser, context | 32768, 0);
|
|
5169
5178
|
if (!isValidLabel(parser, labels, tokenValue, 1))
|
|
@@ -5178,13 +5187,13 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5178
5187
|
function parseBreakStatement(parser, context, labels, start, line, column) {
|
|
5179
5188
|
nextToken(parser, context | 32768);
|
|
5180
5189
|
let label = null;
|
|
5181
|
-
if ((parser.flags & 1)
|
|
5190
|
+
if ((parser.flags & 1) === 0 && parser.token & 143360) {
|
|
5182
5191
|
const { tokenValue } = parser;
|
|
5183
5192
|
label = parseIdentifier(parser, context | 32768, 0);
|
|
5184
5193
|
if (!isValidLabel(parser, labels, tokenValue, 0))
|
|
5185
5194
|
report(parser, 134, tokenValue);
|
|
5186
5195
|
}
|
|
5187
|
-
else if ((context & (4096 | 131072))
|
|
5196
|
+
else if ((context & (4096 | 131072)) === 0) {
|
|
5188
5197
|
report(parser, 66);
|
|
5189
5198
|
}
|
|
5190
5199
|
matchOrInsertSemicolon(parser, context | 32768);
|
|
@@ -5264,6 +5273,17 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5264
5273
|
body
|
|
5265
5274
|
});
|
|
5266
5275
|
}
|
|
5276
|
+
function parseStaticBlock(parser, context, scope, start, line, column) {
|
|
5277
|
+
if (scope)
|
|
5278
|
+
scope = addChildScope(scope, 2);
|
|
5279
|
+
const ctorContext = 16384 | 524288;
|
|
5280
|
+
context = ((context | ctorContext) ^ ctorContext) | 262144;
|
|
5281
|
+
const { body } = parseBlock(parser, context, scope, {}, start, line, column);
|
|
5282
|
+
return finishNode(parser, context, start, line, column, {
|
|
5283
|
+
type: 'StaticBlock',
|
|
5284
|
+
body
|
|
5285
|
+
});
|
|
5286
|
+
}
|
|
5267
5287
|
function parseDoWhileStatement(parser, context, scope, labels, start, line, column) {
|
|
5268
5288
|
nextToken(parser, context | 32768);
|
|
5269
5289
|
const body = parseIterationStatementBody(parser, context, scope, labels);
|
|
@@ -5351,10 +5371,10 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5351
5371
|
if (parser.token === 1077936157) {
|
|
5352
5372
|
nextToken(parser, context | 32768);
|
|
5353
5373
|
init = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos);
|
|
5354
|
-
if (origin & 32 || (token & 2097152)
|
|
5374
|
+
if (origin & 32 || (token & 2097152) === 0) {
|
|
5355
5375
|
if (parser.token === 274549 ||
|
|
5356
5376
|
(parser.token === 8738868 &&
|
|
5357
|
-
(token & 2097152 || (kind & 4)
|
|
5377
|
+
(token & 2097152 || (kind & 4) === 0 || context & 1024))) {
|
|
5358
5378
|
reportMessageAt(tokenPos, parser.line, parser.index - 3, 57, parser.token === 274549 ? 'of' : 'in');
|
|
5359
5379
|
}
|
|
5360
5380
|
}
|
|
@@ -5371,7 +5391,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5371
5391
|
}
|
|
5372
5392
|
function parseForStatement(parser, context, scope, labels, start, line, column) {
|
|
5373
5393
|
nextToken(parser, context);
|
|
5374
|
-
const forAwait = (context & 4194304) > 0 &&
|
|
5394
|
+
const forAwait = ((context & 4194304) > 0 || ((context & 2048) > 0 && (context & 8192) > 0)) &&
|
|
5395
|
+
consumeOpt(parser, context, 209008);
|
|
5375
5396
|
consume(parser, context | 32768, 67174411);
|
|
5376
5397
|
if (scope)
|
|
5377
5398
|
scope = addChildScope(scope, 1);
|
|
@@ -5660,7 +5681,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5660
5681
|
const { tokenPos, linePos, colPos } = parser;
|
|
5661
5682
|
declaration = parseIdentifier(parser, context, 0);
|
|
5662
5683
|
const { flags } = parser;
|
|
5663
|
-
if ((flags & 1)
|
|
5684
|
+
if ((flags & 1) === 0) {
|
|
5664
5685
|
if (parser.token === 86106) {
|
|
5665
5686
|
declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 1, 1, tokenPos, linePos, colPos);
|
|
5666
5687
|
}
|
|
@@ -5784,7 +5805,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5784
5805
|
case 209007:
|
|
5785
5806
|
const { tokenPos, linePos, colPos } = parser;
|
|
5786
5807
|
nextToken(parser, context);
|
|
5787
|
-
if ((parser.flags & 1)
|
|
5808
|
+
if ((parser.flags & 1) === 0 && parser.token === 86106) {
|
|
5788
5809
|
declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 2, 1, tokenPos, linePos, colPos);
|
|
5789
5810
|
if (scope) {
|
|
5790
5811
|
key = declaration.id ? declaration.id.name : '';
|
|
@@ -5941,7 +5962,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5941
5962
|
const { token } = parser;
|
|
5942
5963
|
const expr = parseIdentifier(parser, context, isPattern);
|
|
5943
5964
|
const { flags } = parser;
|
|
5944
|
-
if ((flags & 1)
|
|
5965
|
+
if ((flags & 1) === 0) {
|
|
5945
5966
|
if (parser.token === 86106) {
|
|
5946
5967
|
return parseFunctionExpression(parser, context, 1, inGroup, start, line, column);
|
|
5947
5968
|
}
|
|
@@ -5975,7 +5996,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5975
5996
|
report(parser, 120);
|
|
5976
5997
|
let argument = null;
|
|
5977
5998
|
let delegate = false;
|
|
5978
|
-
if ((parser.flags & 1)
|
|
5999
|
+
if ((parser.flags & 1) === 0) {
|
|
5979
6000
|
delegate = consumeOpt(parser, context | 32768, 8457014);
|
|
5980
6001
|
if (parser.token & (12288 | 65536) || delegate) {
|
|
5981
6002
|
argument = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos);
|
|
@@ -5995,7 +6016,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
5995
6016
|
function parseAwaitExpression(parser, context, inNew, inGroup, start, line, column) {
|
|
5996
6017
|
if (inGroup)
|
|
5997
6018
|
parser.destructible |= 128;
|
|
5998
|
-
if (context & 4194304) {
|
|
6019
|
+
if (context & 4194304 || (context & 2048 && context & 8192)) {
|
|
5999
6020
|
if (inNew)
|
|
6000
6021
|
report(parser, 0);
|
|
6001
6022
|
if (context & 8388608) {
|
|
@@ -6003,6 +6024,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6003
6024
|
}
|
|
6004
6025
|
nextToken(parser, context | 32768);
|
|
6005
6026
|
const argument = parseLeftHandSideExpression(parser, context, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
|
|
6027
|
+
if (parser.token === 8457273)
|
|
6028
|
+
report(parser, 31);
|
|
6006
6029
|
parser.assignable = 2;
|
|
6007
6030
|
return finishNode(parser, context, start, line, column, {
|
|
6008
6031
|
type: 'AwaitExpression',
|
|
@@ -6010,7 +6033,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6010
6033
|
});
|
|
6011
6034
|
}
|
|
6012
6035
|
if (context & 2048)
|
|
6013
|
-
report(parser,
|
|
6036
|
+
report(parser, 95);
|
|
6014
6037
|
return parseIdentifierOrArrow(parser, context, start, line, column);
|
|
6015
6038
|
}
|
|
6016
6039
|
function parseFunctionBody(parser, context, scope, origin, firstRestricted, scopeError) {
|
|
@@ -6050,8 +6073,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6050
6073
|
if (context & 64 &&
|
|
6051
6074
|
scope &&
|
|
6052
6075
|
scopeError !== void 0 &&
|
|
6053
|
-
(prevContext & 1024)
|
|
6054
|
-
(context & 8192)
|
|
6076
|
+
(prevContext & 1024) === 0 &&
|
|
6077
|
+
(context & 8192) === 0) {
|
|
6055
6078
|
reportScopeError(scopeError);
|
|
6056
6079
|
}
|
|
6057
6080
|
}
|
|
@@ -6077,19 +6100,19 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6077
6100
|
case 67108991:
|
|
6078
6101
|
report(parser, 161);
|
|
6079
6102
|
case 67174411: {
|
|
6080
|
-
if ((context & 524288)
|
|
6103
|
+
if ((context & 524288) === 0)
|
|
6081
6104
|
report(parser, 26);
|
|
6082
6105
|
if (context & 16384)
|
|
6083
|
-
report(parser,
|
|
6106
|
+
report(parser, 27);
|
|
6084
6107
|
parser.assignable = 2;
|
|
6085
6108
|
break;
|
|
6086
6109
|
}
|
|
6087
6110
|
case 69271571:
|
|
6088
6111
|
case 67108877: {
|
|
6089
|
-
if ((context & 262144)
|
|
6112
|
+
if ((context & 262144) === 0)
|
|
6090
6113
|
report(parser, 27);
|
|
6091
6114
|
if (context & 16384)
|
|
6092
|
-
report(parser,
|
|
6115
|
+
report(parser, 27);
|
|
6093
6116
|
parser.assignable = 1;
|
|
6094
6117
|
break;
|
|
6095
6118
|
}
|
|
@@ -6116,14 +6139,14 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6116
6139
|
});
|
|
6117
6140
|
}
|
|
6118
6141
|
function parseMemberOrUpdateExpression(parser, context, expr, inGroup, inChain, start, line, column) {
|
|
6119
|
-
if ((parser.token & 33619968) === 33619968 && (parser.flags & 1)
|
|
6142
|
+
if ((parser.token & 33619968) === 33619968 && (parser.flags & 1) === 0) {
|
|
6120
6143
|
expr = parseUpdateExpression(parser, context, expr, start, line, column);
|
|
6121
6144
|
}
|
|
6122
6145
|
else if ((parser.token & 67108864) === 67108864) {
|
|
6123
|
-
context = (context | 134217728
|
|
6146
|
+
context = (context | 134217728) ^ 134217728;
|
|
6124
6147
|
switch (parser.token) {
|
|
6125
6148
|
case 67108877: {
|
|
6126
|
-
nextToken(parser, context | 1073741824);
|
|
6149
|
+
nextToken(parser, (context | 1073741824 | 8192) ^ 8192);
|
|
6127
6150
|
parser.assignable = 1;
|
|
6128
6151
|
const property = parsePropertyOrPrivatePropertyName(parser, context);
|
|
6129
6152
|
expr = finishNode(parser, context, start, line, column, {
|
|
@@ -6179,7 +6202,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6179
6202
|
break;
|
|
6180
6203
|
}
|
|
6181
6204
|
case 67108991: {
|
|
6182
|
-
nextToken(parser, context);
|
|
6205
|
+
nextToken(parser, (context | 1073741824 | 8192) ^ 8192);
|
|
6183
6206
|
parser.flags |= 2048;
|
|
6184
6207
|
parser.assignable = 2;
|
|
6185
6208
|
expr = parseOptionalChain(parser, context, expr, start, line, column);
|
|
@@ -6243,7 +6266,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6243
6266
|
});
|
|
6244
6267
|
}
|
|
6245
6268
|
else {
|
|
6246
|
-
if ((parser.token & (143360 | 4096))
|
|
6269
|
+
if ((parser.token & (143360 | 4096)) === 0)
|
|
6247
6270
|
report(parser, 154);
|
|
6248
6271
|
const property = parseIdentifier(parser, context, 0);
|
|
6249
6272
|
parser.assignable = 2;
|
|
@@ -6261,7 +6284,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6261
6284
|
return node;
|
|
6262
6285
|
}
|
|
6263
6286
|
function parsePropertyOrPrivatePropertyName(parser, context) {
|
|
6264
|
-
if ((parser.token & (143360 | 4096))
|
|
6287
|
+
if ((parser.token & (143360 | 4096)) === 0 && parser.token !== 131) {
|
|
6265
6288
|
report(parser, 154);
|
|
6266
6289
|
}
|
|
6267
6290
|
return context & 1 && parser.token === 131
|
|
@@ -6586,11 +6609,11 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6586
6609
|
let firstRestricted;
|
|
6587
6610
|
let functionScope = scope ? createScope() : void 0;
|
|
6588
6611
|
if (parser.token === 67174411) {
|
|
6589
|
-
if ((flags & 1)
|
|
6612
|
+
if ((flags & 1) === 0)
|
|
6590
6613
|
report(parser, 37, 'Function');
|
|
6591
6614
|
}
|
|
6592
6615
|
else {
|
|
6593
|
-
const kind = origin & 4 && ((context & 8192)
|
|
6616
|
+
const kind = origin & 4 && ((context & 8192) === 0 || (context & 2048) === 0)
|
|
6594
6617
|
? 4
|
|
6595
6618
|
: 64;
|
|
6596
6619
|
validateFunctionName(parser, context | ((context & 3072) << 11), parser.token);
|
|
@@ -6736,7 +6759,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6736
6759
|
destructible |=
|
|
6737
6760
|
kind & 1
|
|
6738
6761
|
? 32
|
|
6739
|
-
: (kind & 2)
|
|
6762
|
+
: (kind & 2) === 0
|
|
6740
6763
|
? 16
|
|
6741
6764
|
: 0;
|
|
6742
6765
|
left = parseMemberOrUpdateExpression(parser, context, left, inGroup, 0, tokenPos, linePos, colPos);
|
|
@@ -6795,7 +6818,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6795
6818
|
left = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos);
|
|
6796
6819
|
if (parser.token !== 18 && parser.token !== 20) {
|
|
6797
6820
|
left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left);
|
|
6798
|
-
if ((kind & (2 | 1))
|
|
6821
|
+
if ((kind & (2 | 1)) === 0 && token === 67174411)
|
|
6799
6822
|
destructible |= 16;
|
|
6800
6823
|
}
|
|
6801
6824
|
else if (parser.assignable & 2) {
|
|
@@ -6984,7 +7007,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
6984
7007
|
});
|
|
6985
7008
|
}
|
|
6986
7009
|
function parseMethodDefinition(parser, context, kind, inGroup, start, line, column) {
|
|
6987
|
-
const modifierFlags = (kind & 64)
|
|
7010
|
+
const modifierFlags = (kind & 64) === 0 ? 31981568 : 14680064;
|
|
6988
7011
|
context =
|
|
6989
7012
|
((context | modifierFlags) ^ modifierFlags) |
|
|
6990
7013
|
((kind & 88) << 18) |
|
|
@@ -7552,7 +7575,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
7552
7575
|
let left = null;
|
|
7553
7576
|
const { tokenPos, linePos, colPos } = parser;
|
|
7554
7577
|
if (parser.token & 143360) {
|
|
7555
|
-
if ((context & 1024)
|
|
7578
|
+
if ((context & 1024) === 0) {
|
|
7556
7579
|
if ((parser.token & 36864) === 36864) {
|
|
7557
7580
|
parser.flags |= 256;
|
|
7558
7581
|
}
|
|
@@ -7615,7 +7638,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
7615
7638
|
const { tokenPos: piStart, linePos: plStart, colPos: pcStart } = parser;
|
|
7616
7639
|
nextToken(parser, context | 32768 | 1073741824);
|
|
7617
7640
|
const scope = context & 64 ? addChildScope(createScope(), 1024) : void 0;
|
|
7618
|
-
context = (context | 134217728
|
|
7641
|
+
context = (context | 134217728) ^ 134217728;
|
|
7619
7642
|
if (consumeOpt(parser, context, 16)) {
|
|
7620
7643
|
return parseParenthesizedArrow(parser, context, scope, [], canAssign, 0, start, line, column);
|
|
7621
7644
|
}
|
|
@@ -7813,7 +7836,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
7813
7836
|
(134221824 | 8192 | 16384), scope, 16, void 0, void 0);
|
|
7814
7837
|
switch (parser.token) {
|
|
7815
7838
|
case 69271571:
|
|
7816
|
-
if ((parser.flags & 1)
|
|
7839
|
+
if ((parser.flags & 1) === 0) {
|
|
7817
7840
|
report(parser, 112);
|
|
7818
7841
|
}
|
|
7819
7842
|
break;
|
|
@@ -7822,13 +7845,13 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
7822
7845
|
case 22:
|
|
7823
7846
|
report(parser, 113);
|
|
7824
7847
|
case 67174411:
|
|
7825
|
-
if ((parser.flags & 1)
|
|
7848
|
+
if ((parser.flags & 1) === 0) {
|
|
7826
7849
|
report(parser, 112);
|
|
7827
7850
|
}
|
|
7828
7851
|
parser.flags |= 1024;
|
|
7829
7852
|
break;
|
|
7830
7853
|
}
|
|
7831
|
-
if ((parser.token & 8454144) === 8454144 && (parser.flags & 1)
|
|
7854
|
+
if ((parser.token & 8454144) === 8454144 && (parser.flags & 1) === 0)
|
|
7832
7855
|
report(parser, 28, KeywordDescTable[parser.token & 255]);
|
|
7833
7856
|
if ((parser.token & 33619968) === 33619968)
|
|
7834
7857
|
report(parser, 121);
|
|
@@ -7854,7 +7877,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
7854
7877
|
let left;
|
|
7855
7878
|
const { tokenPos, linePos, colPos } = parser;
|
|
7856
7879
|
if (parser.token & 143360) {
|
|
7857
|
-
if ((context & 1024)
|
|
7880
|
+
if ((context & 1024) === 0) {
|
|
7858
7881
|
if ((parser.token & 36864) === 36864) {
|
|
7859
7882
|
parser.flags |= 256;
|
|
7860
7883
|
}
|
|
@@ -8174,7 +8197,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8174
8197
|
id = parseIdentifier(parser, context, 0);
|
|
8175
8198
|
}
|
|
8176
8199
|
else {
|
|
8177
|
-
if ((flags & 1)
|
|
8200
|
+
if ((flags & 1) === 0)
|
|
8178
8201
|
report(parser, 37, 'Class');
|
|
8179
8202
|
}
|
|
8180
8203
|
let inheritedContext = context;
|
|
@@ -8305,7 +8328,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8305
8328
|
}
|
|
8306
8329
|
break;
|
|
8307
8330
|
case 209007:
|
|
8308
|
-
if (parser.token !== 67174411 && (parser.flags & 1)
|
|
8331
|
+
if (parser.token !== 67174411 && (parser.flags & 1) === 0) {
|
|
8309
8332
|
if (context & 1 && (parser.token & 1073741824) === 1073741824) {
|
|
8310
8333
|
return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos);
|
|
8311
8334
|
}
|
|
@@ -8343,12 +8366,13 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8343
8366
|
}
|
|
8344
8367
|
else if (context & 1 && parser.token === 131) {
|
|
8345
8368
|
kind |= 4096;
|
|
8346
|
-
key = parsePrivateIdentifier(parser, context, tokenPos, linePos, colPos);
|
|
8347
|
-
context = context | 16384;
|
|
8369
|
+
key = parsePrivateIdentifier(parser, context | 16384, tokenPos, linePos, colPos);
|
|
8348
8370
|
}
|
|
8349
8371
|
else if (context & 1 && (parser.token & 1073741824) === 1073741824) {
|
|
8350
8372
|
kind |= 128;
|
|
8351
|
-
|
|
8373
|
+
}
|
|
8374
|
+
else if (isStatic && token === 2162700) {
|
|
8375
|
+
return parseStaticBlock(parser, context, scope, tokenPos, linePos, colPos);
|
|
8352
8376
|
}
|
|
8353
8377
|
else if (token === 122) {
|
|
8354
8378
|
key = parseIdentifier(parser, context, 0);
|
|
@@ -8379,16 +8403,16 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8379
8403
|
else
|
|
8380
8404
|
report(parser, 131);
|
|
8381
8405
|
}
|
|
8382
|
-
if ((kind & 2)
|
|
8406
|
+
if ((kind & 2) === 0) {
|
|
8383
8407
|
if (parser.tokenValue === 'constructor') {
|
|
8384
8408
|
if ((parser.token & 1073741824) === 1073741824) {
|
|
8385
8409
|
report(parser, 125);
|
|
8386
8410
|
}
|
|
8387
|
-
else if ((kind & 32)
|
|
8411
|
+
else if ((kind & 32) === 0 && parser.token === 67174411) {
|
|
8388
8412
|
if (kind & (768 | 16 | 128 | 8)) {
|
|
8389
8413
|
report(parser, 50, 'accessor');
|
|
8390
8414
|
}
|
|
8391
|
-
else if ((context & 524288)
|
|
8415
|
+
else if ((context & 524288) === 0) {
|
|
8392
8416
|
if (parser.flags & 32)
|
|
8393
8417
|
report(parser, 51);
|
|
8394
8418
|
else
|
|
@@ -8397,7 +8421,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8397
8421
|
}
|
|
8398
8422
|
kind |= 64;
|
|
8399
8423
|
}
|
|
8400
|
-
else if ((kind & 4096)
|
|
8424
|
+
else if ((kind & 4096) === 0 &&
|
|
8401
8425
|
kind & (32 | 768 | 8 | 16) &&
|
|
8402
8426
|
parser.tokenValue === 'prototype') {
|
|
8403
8427
|
report(parser, 49);
|
|
@@ -8410,7 +8434,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8410
8434
|
return finishNode(parser, context, start, line, column, context & 1
|
|
8411
8435
|
? {
|
|
8412
8436
|
type: 'MethodDefinition',
|
|
8413
|
-
kind: (kind & 32)
|
|
8437
|
+
kind: (kind & 32) === 0 && kind & 64
|
|
8414
8438
|
? 'constructor'
|
|
8415
8439
|
: kind & 256
|
|
8416
8440
|
? 'get'
|
|
@@ -8425,7 +8449,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8425
8449
|
}
|
|
8426
8450
|
: {
|
|
8427
8451
|
type: 'MethodDefinition',
|
|
8428
|
-
kind: (kind & 32)
|
|
8452
|
+
kind: (kind & 32) === 0 && kind & 64
|
|
8429
8453
|
? 'constructor'
|
|
8430
8454
|
: kind & 256
|
|
8431
8455
|
? 'get'
|
|
@@ -8714,7 +8738,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8714
8738
|
});
|
|
8715
8739
|
}
|
|
8716
8740
|
function parseJSXExpressionContainer(parser, context, inJSXChild, isAttr, start, line, column) {
|
|
8717
|
-
nextToken(parser, context);
|
|
8741
|
+
nextToken(parser, context | 32768);
|
|
8718
8742
|
const { tokenPos, linePos, colPos } = parser;
|
|
8719
8743
|
if (parser.token === 14)
|
|
8720
8744
|
return parseJSXSpreadChild(parser, context, tokenPos, linePos, colPos);
|
|
@@ -8768,7 +8792,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8768
8792
|
__proto__: null
|
|
8769
8793
|
});
|
|
8770
8794
|
|
|
8771
|
-
var version$1 = "4.
|
|
8795
|
+
var version$1 = "4.3.0";
|
|
8772
8796
|
|
|
8773
8797
|
const version = version$1;
|
|
8774
8798
|
function parseScript(source, options) {
|
|
@@ -8789,4 +8813,4 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
8789
8813
|
|
|
8790
8814
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8791
8815
|
|
|
8792
|
-
});
|
|
8816
|
+
}));
|