meriyah 7.4.1 → 7.4.2
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 +31 -0
- package/dist/meriyah.cjs +91 -55
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +91 -55
- package/dist/meriyah.umd.js +91 -55
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/parser/private-scope.d.ts +0 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
## [7.4.2](https://github.com/meriyah/meriyah/compare/v7.4.1...v7.4.2) (2026-11-08)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **lexer:** only treat `<!--` as a comment in web compatible script code ([#683](https://github.com/meriyah/meriyah/issues/683)) ([78eebfe](https://github.com/meriyah/meriyah/commit/78eebfe5a2eb4a51e11212598f6e586faa655606))
|
|
6
|
+
* **lexer:** recognize an HTML close comment after a hashbang line ([#682](https://github.com/meriyah/meriyah/issues/682)) ([133b2b9](https://github.com/meriyah/meriyah/commit/133b2b906ddcc77941797f593389450baa5ad5c7))
|
|
7
|
+
* **parser:** allow `#x in obj` as an array element, object property value and spread argument ([#678](https://github.com/meriyah/meriyah/issues/678)) ([1f7c40e](https://github.com/meriyah/meriyah/commit/1f7c40e8b031ea476934ab27610fdc04d35d2389)), closes [#x](https://github.com/meriyah/meriyah/issues/x)
|
|
8
|
+
* **parser:** allow `arguments` as a label in class field initializers and static blocks ([#703](https://github.com/meriyah/meriyah/issues/703)) ([b3eae1f](https://github.com/meriyah/meriyah/commit/b3eae1f9958e12ffe5d36552b82f11b0cd8ff282))
|
|
9
|
+
* **parser:** allow a nested class to use a private name declared later in an enclosing class ([#699](https://github.com/meriyah/meriyah/issues/699)) ([e476062](https://github.com/meriyah/meriyah/commit/e476062ed155cade8e8aa8fd70cd027068a3732f))
|
|
10
|
+
* **parser:** allow an escaped strict mode reserved word as a class field name ([#698](https://github.com/meriyah/meriyah/issues/698)) ([5a764b5](https://github.com/meriyah/meriyah/commit/5a764b575b8e332a92c261e5e4fffef34e7c4eda))
|
|
11
|
+
* **parser:** allow strict mode reserved words as identifiers in sloppy generators ([#674](https://github.com/meriyah/meriyah/issues/674)) ([0dc7926](https://github.com/meriyah/meriyah/commit/0dc792608674ac7796b8485f5b3cbaabbb604503))
|
|
12
|
+
* **parser:** declare method parameters as parameters in lexical mode ([#688](https://github.com/meriyah/meriyah/issues/688)) ([c1dae06](https://github.com/meriyah/meriyah/commit/c1dae06f4cd76c75c780bd34c3c93ce08dc7980c))
|
|
13
|
+
* **parser:** keep enclosing labels and allow web compat function declarations for a `let` label ([#692](https://github.com/meriyah/meriyah/issues/692)) ([0ab5c32](https://github.com/meriyah/meriyah/commit/0ab5c3289a0f581e42ec9a970851ffd929056627))
|
|
14
|
+
* **parser:** parse `await` followed by a strict mode reserved word in sloppy async functions ([#679](https://github.com/meriyah/meriyah/issues/679)) ([dd8e9aa](https://github.com/meriyah/meriyah/commit/dd8e9aa6e16fe909e656bec4da02538e690597c0))
|
|
15
|
+
* **parser:** parse operators after an import call at the start of a statement ([#677](https://github.com/meriyah/meriyah/issues/677)) ([c4b297a](https://github.com/meriyah/meriyah/commit/c4b297a26fbba6d01620f029d8ef9aef01a8b4a8))
|
|
16
|
+
* **parser:** parse the computed key of a generator, async or accessor method in the enclosing context ([#695](https://github.com/meriyah/meriyah/issues/695)) ([a158249](https://github.com/meriyah/meriyah/commit/a1582490dc29ef1527e04af9cde38790da3bce32))
|
|
17
|
+
* **parser:** reject `?.` and templates with substitutions after a block body arrow ([#686](https://github.com/meriyah/meriyah/issues/686)) ([1845d76](https://github.com/meriyah/meriyah/commit/1845d768841ccb0756372cf2f531b4184a59ce18))
|
|
18
|
+
* **parser:** reject `++` and `--` after an array or object literal nested in another literal ([#694](https://github.com/meriyah/meriyah/issues/694)) ([7e1ec5e](https://github.com/meriyah/meriyah/commit/7e1ec5e78c1f00f911df78ad7b6fcb35e777dd9e))
|
|
19
|
+
* **parser:** reject `++` and `--` on array and object literals ([#689](https://github.com/meriyah/meriyah/issues/689)) ([e13e7c9](https://github.com/meriyah/meriyah/commit/e13e7c922e91dfa692e35d49ba85f003087dbb5b))
|
|
20
|
+
* **parser:** reject `arguments` in class field initializers and static blocks nested in functions ([#676](https://github.com/meriyah/meriyah/issues/676)) ([9a4f073](https://github.com/meriyah/meriyah/commit/9a4f07372b3766fa126d868fb40e45fd2554e50b))
|
|
21
|
+
* **parser:** reject `await` in the concise body of a non-async arrow in module code ([#673](https://github.com/meriyah/meriyah/issues/673)) ([43449ea](https://github.com/meriyah/meriyah/commit/43449ea396c78524e1188ce816d4cc21d27a85a8))
|
|
22
|
+
* **parser:** reject `break` and `continue` in an arrow or method body inside a loop ([#693](https://github.com/meriyah/meriyah/issues/693)) ([dfa8ad0](https://github.com/meriyah/meriyah/commit/dfa8ad0bb89f0bdd65db991e0f5e436f16ea67f9))
|
|
23
|
+
* **parser:** reject `for await` in class static blocks ([#680](https://github.com/meriyah/meriyah/issues/680)) ([65d5350](https://github.com/meriyah/meriyah/commit/65d5350ad326d3f764500be51f4e93aa006b455a))
|
|
24
|
+
* **parser:** reject a function declaration after an `async:` label in a single-statement context ([#697](https://github.com/meriyah/meriyah/issues/697)) ([4c4ea12](https://github.com/meriyah/meriyah/commit/4c4ea129bbb8eb6d68976b41d316752100694122))
|
|
25
|
+
* **parser:** reject an escaped `yield` or `await` as the name of a generator or async function expression ([#702](https://github.com/meriyah/meriyah/issues/702)) ([1480dad](https://github.com/meriyah/meriyah/commit/1480dad32cc6546ea7d2a623e851f18fccf32a7f))
|
|
26
|
+
* **parser:** reject an optional call as an assignment target in web compat mode ([#696](https://github.com/meriyah/meriyah/issues/696)) ([a3d5926](https://github.com/meriyah/meriyah/commit/a3d59264e1261c04030898a0001c7cbcd8a735ea))
|
|
27
|
+
* **parser:** reject arrow functions after unary operators when the parameter is a reserved word ([#687](https://github.com/meriyah/meriyah/issues/687)) ([e79d7db](https://github.com/meriyah/meriyah/commit/e79d7dbd1a56f44144f6e9a5dcb281c2bc7f21d1))
|
|
28
|
+
* **parser:** reject assignment to a statement-level arrow with an `async` parameter ([#690](https://github.com/meriyah/meriyah/issues/690)) ([1f16445](https://github.com/meriyah/meriyah/commit/1f164456e95a4338d45a80d3bb6489e1802c2ae8))
|
|
29
|
+
* **parser:** reject optional chains after a member expression in `new` without arguments ([#691](https://github.com/meriyah/meriyah/issues/691)) ([b299db5](https://github.com/meriyah/meriyah/commit/b299db5590d7789d048eb2cdc89669ac58219921))
|
|
30
|
+
* **parser:** template literal inside parentheses should not be processed as tagged template ([#701](https://github.com/meriyah/meriyah/issues/701)) ([431f0f4](https://github.com/meriyah/meriyah/commit/431f0f42faa4b51b1b1480371a55033fc126f30a)), closes [#700](https://github.com/meriyah/meriyah/issues/700)
|
|
31
|
+
|
|
1
32
|
## [7.4.1](https://github.com/meriyah/meriyah/compare/v7.4.0...v7.4.1) (2026-10-25)
|
|
2
33
|
|
|
3
34
|
### Bug Fixes
|
package/dist/meriyah.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version$1 = "7.4.
|
|
3
|
+
var version$1 = "7.4.2";
|
|
4
4
|
var packageJson = {
|
|
5
5
|
version: version$1};
|
|
6
6
|
|
|
@@ -1888,7 +1888,9 @@ function scanSingleToken(parser, context, state) {
|
|
|
1888
1888
|
}
|
|
1889
1889
|
if (ch === 33) {
|
|
1890
1890
|
const index = parser.index + 1;
|
|
1891
|
-
if (
|
|
1891
|
+
if (parser.options.webcompat &&
|
|
1892
|
+
!(context & 2) &&
|
|
1893
|
+
index + 1 < parser.end &&
|
|
1892
1894
|
source.charCodeAt(index) === 45 &&
|
|
1893
1895
|
source.charCodeAt(index + 1) == 45) {
|
|
1894
1896
|
parser.column += 3;
|
|
@@ -1970,7 +1972,10 @@ function scanSingleToken(parser, context, state) {
|
|
|
1970
1972
|
const ch = parser.currentChar;
|
|
1971
1973
|
if (ch === 45) {
|
|
1972
1974
|
advanceChar(parser);
|
|
1973
|
-
if (
|
|
1975
|
+
if (parser.currentChar === 62 &&
|
|
1976
|
+
(state & 1 ||
|
|
1977
|
+
isStartOfLine ||
|
|
1978
|
+
(parser.getToken() === 1048576 && parser.line > 1))) {
|
|
1974
1979
|
if (!parser.options.webcompat)
|
|
1975
1980
|
parser.report(114);
|
|
1976
1981
|
advanceChar(parser);
|
|
@@ -2242,10 +2247,10 @@ function validateFunctionName(parser, context, t) {
|
|
|
2242
2247
|
if ((t & 20480) === 20480) {
|
|
2243
2248
|
parser.report(102);
|
|
2244
2249
|
}
|
|
2245
|
-
if (context & (2048 | 2) && t === 209006) {
|
|
2250
|
+
if (context & (2048 | 2) && (t & 2147483647) === 209006) {
|
|
2246
2251
|
parser.report(112);
|
|
2247
2252
|
}
|
|
2248
|
-
if (context & (1024 | 1) && t === 241771) {
|
|
2253
|
+
if (context & (1024 | 1) && (t & 2147483647) === 241771) {
|
|
2249
2254
|
parser.report(97, 'yield');
|
|
2250
2255
|
}
|
|
2251
2256
|
}
|
|
@@ -2305,7 +2310,8 @@ function isValidIdentifier(context, t) {
|
|
|
2305
2310
|
return false;
|
|
2306
2311
|
if (context & 1024 && t === 241771)
|
|
2307
2312
|
return false;
|
|
2308
|
-
|
|
2313
|
+
if (context & 1)
|
|
2314
|
+
return (t & 12288) === 12288;
|
|
2309
2315
|
}
|
|
2310
2316
|
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
2311
2317
|
}
|
|
@@ -2759,12 +2765,14 @@ class PrivateScope {
|
|
|
2759
2765
|
this.refs[name] ??= [];
|
|
2760
2766
|
this.refs[name].push(this.parser.tokenStart);
|
|
2761
2767
|
}
|
|
2762
|
-
isPrivateIdentifierDefined(name) {
|
|
2763
|
-
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
2764
|
-
}
|
|
2765
2768
|
validatePrivateIdentifierRefs() {
|
|
2766
2769
|
for (const name in this.refs) {
|
|
2767
|
-
if (
|
|
2770
|
+
if (this.hasPrivateIdentifier(name))
|
|
2771
|
+
continue;
|
|
2772
|
+
if (this.parent) {
|
|
2773
|
+
(this.parent.refs[name] ??= []).push(...this.refs[name]);
|
|
2774
|
+
}
|
|
2775
|
+
else {
|
|
2768
2776
|
const { index, line, column } = this.refs[name][0];
|
|
2769
2777
|
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
2770
2778
|
}
|
|
@@ -3185,7 +3193,7 @@ function parseStatementListItem(parser, context, scope, privateScope, labels, or
|
|
|
3185
3193
|
case 86090:
|
|
3186
3194
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
|
|
3187
3195
|
case 241737:
|
|
3188
|
-
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
3196
|
+
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin);
|
|
3189
3197
|
case 209013:
|
|
3190
3198
|
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
3191
3199
|
case 209006:
|
|
@@ -3207,7 +3215,7 @@ function parseStatementListItem(parser, context, scope, privateScope, labels, or
|
|
|
3207
3215
|
parser.report(103, 'import');
|
|
3208
3216
|
}
|
|
3209
3217
|
case 209005:
|
|
3210
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
|
|
3218
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, 1, origin);
|
|
3211
3219
|
default:
|
|
3212
3220
|
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
3213
3221
|
}
|
|
@@ -3245,7 +3253,7 @@ function parseStatement(parser, context, scope, privateScope, labels, allowFuncD
|
|
|
3245
3253
|
case 20560:
|
|
3246
3254
|
return parseDebuggerStatement(parser, context);
|
|
3247
3255
|
case 209005:
|
|
3248
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
|
|
3256
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, allowFuncDecl, origin);
|
|
3249
3257
|
case 20557:
|
|
3250
3258
|
parser.report(164);
|
|
3251
3259
|
case 20566:
|
|
@@ -3275,7 +3283,7 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
|
|
|
3275
3283
|
parser.report(84);
|
|
3276
3284
|
break;
|
|
3277
3285
|
default:
|
|
3278
|
-
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart,
|
|
3286
|
+
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart, 1, 1);
|
|
3279
3287
|
}
|
|
3280
3288
|
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
|
|
3281
3289
|
}
|
|
@@ -3339,17 +3347,17 @@ function parseLabelledStatement(parser, context, scope, privateScope, labels, va
|
|
|
3339
3347
|
body,
|
|
3340
3348
|
}, start);
|
|
3341
3349
|
}
|
|
3342
|
-
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
3350
|
+
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowAsyncFuncDecl, allowFuncDecl, origin) {
|
|
3343
3351
|
const { tokenValue, tokenStart: start } = parser;
|
|
3344
3352
|
const token = parser.getToken();
|
|
3345
3353
|
let expr = parseIdentifier(parser, context);
|
|
3346
3354
|
if (parser.getToken() === 21) {
|
|
3347
|
-
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token,
|
|
3355
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, allowFuncDecl, start, origin);
|
|
3348
3356
|
}
|
|
3349
3357
|
const asyncNewLine = parser.flags & 1;
|
|
3350
3358
|
if (!asyncNewLine) {
|
|
3351
3359
|
if (parser.getToken() === 86104) {
|
|
3352
|
-
if (!
|
|
3360
|
+
if (!allowAsyncFuncDecl)
|
|
3353
3361
|
parser.report(125);
|
|
3354
3362
|
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
|
|
3355
3363
|
}
|
|
@@ -3371,7 +3379,9 @@ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, priva
|
|
|
3371
3379
|
}
|
|
3372
3380
|
expr = parseArrowFromIdentifier(parser, context | 2048, privateScope, parser.tokenValue, expr, 0, 1, 0, start);
|
|
3373
3381
|
}
|
|
3374
|
-
|
|
3382
|
+
else {
|
|
3383
|
+
parser.assignable = 1;
|
|
3384
|
+
}
|
|
3375
3385
|
}
|
|
3376
3386
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
|
|
3377
3387
|
expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
|
|
@@ -3626,7 +3636,12 @@ function parseCatchBlock(parser, context, scope, privateScope, labels, start) {
|
|
|
3626
3636
|
}
|
|
3627
3637
|
function parseStaticBlock(parser, context, scope, privateScope, start) {
|
|
3628
3638
|
scope = scope?.createChildScope();
|
|
3629
|
-
const ctorContext = 512 |
|
|
3639
|
+
const ctorContext = 512 |
|
|
3640
|
+
4096 |
|
|
3641
|
+
1024 |
|
|
3642
|
+
4 |
|
|
3643
|
+
128 |
|
|
3644
|
+
32768;
|
|
3630
3645
|
context =
|
|
3631
3646
|
((context | ctorContext) ^ ctorContext) |
|
|
3632
3647
|
256 |
|
|
@@ -3650,7 +3665,7 @@ function parseDoWhileStatement(parser, context, scope, privateScope, labels) {
|
|
|
3650
3665
|
test,
|
|
3651
3666
|
}, start);
|
|
3652
3667
|
}
|
|
3653
|
-
function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin) {
|
|
3668
|
+
function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin) {
|
|
3654
3669
|
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
3655
3670
|
const token = parser.getToken();
|
|
3656
3671
|
let expr = parseIdentifier(parser, context);
|
|
@@ -3668,7 +3683,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
3668
3683
|
if (context & 1)
|
|
3669
3684
|
parser.report(85);
|
|
3670
3685
|
if (parser.getToken() === 21) {
|
|
3671
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
3686
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, tokenStart, origin);
|
|
3672
3687
|
}
|
|
3673
3688
|
if (parser.getToken() === 10) {
|
|
3674
3689
|
let scope = void 0;
|
|
@@ -3851,6 +3866,9 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
3851
3866
|
function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
3852
3867
|
const start = parser.tokenStart;
|
|
3853
3868
|
nextToken(parser, context);
|
|
3869
|
+
if (context & 524288 && parser.getToken() === 209006) {
|
|
3870
|
+
parser.report(179);
|
|
3871
|
+
}
|
|
3854
3872
|
const forAwait = ((context & 2048) > 0 || ((context & 2) > 0 && (context & 8) > 0)) &&
|
|
3855
3873
|
consumeOpt(parser, context, 209006);
|
|
3856
3874
|
consume(parser, context | 32, 67174411);
|
|
@@ -4330,7 +4348,9 @@ function parseImportMetaDeclaration(parser, context, start) {
|
|
|
4330
4348
|
}
|
|
4331
4349
|
function parseImportCallDeclaration(parser, context, privateScope, start) {
|
|
4332
4350
|
let expr = parseImportExpression(parser, context, privateScope, 0, start);
|
|
4351
|
+
parser.assignable = 2;
|
|
4333
4352
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
|
|
4353
|
+
expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
|
|
4334
4354
|
if (parser.getToken() === 18) {
|
|
4335
4355
|
expr = parseSequenceExpression(parser, context, privateScope, 0, start, expr);
|
|
4336
4356
|
}
|
|
@@ -4738,9 +4758,9 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
|
|
|
4738
4758
|
}
|
|
4739
4759
|
if (context & 1)
|
|
4740
4760
|
parser.report(97, 'yield');
|
|
4741
|
-
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
4761
|
+
return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
|
|
4742
4762
|
}
|
|
4743
|
-
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
|
|
4763
|
+
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start) {
|
|
4744
4764
|
if (inGroup) {
|
|
4745
4765
|
if ((parser.destructible & 128) === 0) {
|
|
4746
4766
|
parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
|
|
@@ -4751,10 +4771,11 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
|
|
|
4751
4771
|
parser.report(179);
|
|
4752
4772
|
const isEscaped = (parser.getToken() & -2147483648) !== 0;
|
|
4753
4773
|
const allowRegExp = !isEscaped && context & (2048 | 2) ? 1 : 0;
|
|
4754
|
-
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp);
|
|
4774
|
+
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp, canAssign);
|
|
4755
4775
|
const isIdentifier = isEscaped ||
|
|
4756
4776
|
possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
|
|
4757
|
-
(parser.getToken() & 65536) === 0
|
|
4777
|
+
((parser.getToken() & 65536) === 0 &&
|
|
4778
|
+
(parser.getToken() & 36864) !== 36864);
|
|
4758
4779
|
if (isIdentifier) {
|
|
4759
4780
|
if (context & 2048)
|
|
4760
4781
|
throw new ParseError(start, parser.startPosition, 178);
|
|
@@ -4874,8 +4895,11 @@ function parseLeftHandSideExpression(parser, context, privateScope, canAssign, i
|
|
|
4874
4895
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expression, inGroup, 0, start);
|
|
4875
4896
|
}
|
|
4876
4897
|
function parseUpdateExpression(parser, context, expr, start) {
|
|
4877
|
-
if (parser.assignable & 2
|
|
4898
|
+
if (parser.assignable & 2 ||
|
|
4899
|
+
expr.type === 'ArrayExpression' ||
|
|
4900
|
+
expr.type === 'ObjectExpression') {
|
|
4878
4901
|
parser.report(55);
|
|
4902
|
+
}
|
|
4879
4903
|
const token = parser.getToken();
|
|
4880
4904
|
nextToken(parser, context);
|
|
4881
4905
|
parser.assignable = 2;
|
|
@@ -4954,7 +4978,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
4954
4978
|
parser.flags = (parser.flags | 2048) ^ 2048;
|
|
4955
4979
|
}
|
|
4956
4980
|
const args = parseArguments(parser, context, privateScope, inGroup);
|
|
4957
|
-
if (!(context & 1) && parser.options.webcompat) {
|
|
4981
|
+
if (!restoreHasOptionalChaining && !(context & 1) && parser.options.webcompat) {
|
|
4958
4982
|
parser.assignable = 4;
|
|
4959
4983
|
}
|
|
4960
4984
|
else {
|
|
@@ -5027,12 +5051,7 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
|
|
|
5027
5051
|
}
|
|
5028
5052
|
else if (parser.getToken() === 67174411) {
|
|
5029
5053
|
const args = parseArguments(parser, context, privateScope, 0);
|
|
5030
|
-
|
|
5031
|
-
parser.assignable = 4;
|
|
5032
|
-
}
|
|
5033
|
-
else {
|
|
5034
|
-
parser.assignable = 2;
|
|
5035
|
-
}
|
|
5054
|
+
parser.assignable = 2;
|
|
5036
5055
|
node = parser.finishNode({
|
|
5037
5056
|
type: 'CallExpression',
|
|
5038
5057
|
callee: expr,
|
|
@@ -5091,7 +5110,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5091
5110
|
switch (parser.getToken()) {
|
|
5092
5111
|
case 209006:
|
|
5093
5112
|
case 209006 | -2147483648:
|
|
5094
|
-
return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start);
|
|
5113
|
+
return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start);
|
|
5095
5114
|
case 241771:
|
|
5096
5115
|
return parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup, canAssign, start);
|
|
5097
5116
|
case 209005:
|
|
@@ -5112,8 +5131,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5112
5131
|
if (context & 16 &&
|
|
5113
5132
|
!(context & 32768) &&
|
|
5114
5133
|
!(context & 8192) &&
|
|
5115
|
-
parser.tokenValue === 'arguments'
|
|
5116
|
-
parser.
|
|
5134
|
+
parser.tokenValue === 'arguments' &&
|
|
5135
|
+
!(origin & 1 && parser.getToken() === 21))
|
|
5136
|
+
throw new ParseError(start, parser.startPosition, 132);
|
|
5117
5137
|
if ((token & 255) === (241737 & 255)) {
|
|
5118
5138
|
if (context & 1)
|
|
5119
5139
|
parser.report(115);
|
|
@@ -5148,7 +5168,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5148
5168
|
case 69271571:
|
|
5149
5169
|
return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
|
|
5150
5170
|
case 67174411:
|
|
5151
|
-
return parseParenthesizedExpression(parser, context
|
|
5171
|
+
return parseParenthesizedExpression(parser, context, privateScope, canAssign, 1, start, origin);
|
|
5152
5172
|
case 86021:
|
|
5153
5173
|
case 86022:
|
|
5154
5174
|
case 86023:
|
|
@@ -5189,8 +5209,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5189
5209
|
if (parser.options.jsx)
|
|
5190
5210
|
return parseJSXRootElementOrFragment(parser, context, privateScope, 0, parser.tokenStart);
|
|
5191
5211
|
default:
|
|
5192
|
-
if (isValidIdentifier(context, parser.getToken()))
|
|
5193
|
-
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
5212
|
+
if (isValidIdentifier(context, parser.getToken())) {
|
|
5213
|
+
return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
|
|
5214
|
+
}
|
|
5194
5215
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5195
5216
|
}
|
|
5196
5217
|
}
|
|
@@ -5591,6 +5612,8 @@ function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGro
|
|
|
5591
5612
|
if (parser.destructible & 8) {
|
|
5592
5613
|
parser.report(62);
|
|
5593
5614
|
}
|
|
5615
|
+
if (expr.type === 'ArrayExpression')
|
|
5616
|
+
parser.assignable = 2;
|
|
5594
5617
|
return expr;
|
|
5595
5618
|
}
|
|
5596
5619
|
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
@@ -5702,8 +5725,10 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
5702
5725
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5703
5726
|
}
|
|
5704
5727
|
else {
|
|
5705
|
-
left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
|
|
5728
|
+
left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
|
|
5706
5729
|
if (parser.getToken() !== 18 && parser.getToken() !== 20) {
|
|
5730
|
+
if (parser.getToken() !== 1077936155)
|
|
5731
|
+
destructible |= 16;
|
|
5707
5732
|
left = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, left);
|
|
5708
5733
|
if ((kind & (2 | 1)) === 0 && token === 67174411)
|
|
5709
5734
|
destructible |= 16;
|
|
@@ -5835,7 +5860,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
5835
5860
|
}
|
|
5836
5861
|
else {
|
|
5837
5862
|
destructible |= 32;
|
|
5838
|
-
argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
|
|
5863
|
+
argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
|
|
5839
5864
|
const token = parser.getToken();
|
|
5840
5865
|
if (token === 1077936155) {
|
|
5841
5866
|
if (parser.assignable & 2)
|
|
@@ -5911,7 +5936,8 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
|
|
|
5911
5936
|
let scope = parser.createScopeIfLexical(256);
|
|
5912
5937
|
const params = parseMethodFormals(parser, (context | 8192) & -524289, scope, privateScope, kind, 1, inGroup);
|
|
5913
5938
|
scope = scope?.createChildScope(64);
|
|
5914
|
-
const body = parseFunctionBody(parser, (context &
|
|
5939
|
+
const body = parseFunctionBody(parser, (context &
|
|
5940
|
+
-655501) |
|
|
5915
5941
|
32768 |
|
|
5916
5942
|
4096, scope, privateScope, void 0, scope?.parent);
|
|
5917
5943
|
return parser.finishNode({
|
|
@@ -5931,6 +5957,8 @@ function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGr
|
|
|
5931
5957
|
if (parser.destructible & 8) {
|
|
5932
5958
|
parser.report(62);
|
|
5933
5959
|
}
|
|
5960
|
+
if (expr.type === 'ObjectExpression')
|
|
5961
|
+
parser.assignable = 2;
|
|
5934
5962
|
return expr;
|
|
5935
5963
|
}
|
|
5936
5964
|
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
@@ -5960,6 +5988,11 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
5960
5988
|
parser.getToken() === 1074790415 ||
|
|
5961
5989
|
parser.getToken() === 1077936155) {
|
|
5962
5990
|
state |= 4;
|
|
5991
|
+
if (context & 16 &&
|
|
5992
|
+
!(context & 32768) &&
|
|
5993
|
+
!(context & 8192) &&
|
|
5994
|
+
tokenValue === 'arguments')
|
|
5995
|
+
throw new ParseError(tokenStart, currentLocation, 132);
|
|
5963
5996
|
if (context & 1 && (token & 537079808) === 537079808) {
|
|
5964
5997
|
destructible |= 16;
|
|
5965
5998
|
}
|
|
@@ -6073,7 +6106,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
6073
6106
|
}
|
|
6074
6107
|
}
|
|
6075
6108
|
else {
|
|
6076
|
-
value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
|
|
6109
|
+
value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
|
|
6077
6110
|
destructible |=
|
|
6078
6111
|
parser.assignable & 1
|
|
6079
6112
|
? 32
|
|
@@ -6254,7 +6287,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
6254
6287
|
}
|
|
6255
6288
|
}
|
|
6256
6289
|
else {
|
|
6257
|
-
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
|
|
6290
|
+
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
|
|
6258
6291
|
destructible |=
|
|
6259
6292
|
parser.assignable & 1
|
|
6260
6293
|
? 32
|
|
@@ -6367,7 +6400,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
6367
6400
|
}
|
|
6368
6401
|
}
|
|
6369
6402
|
else {
|
|
6370
|
-
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
|
|
6403
|
+
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
|
|
6371
6404
|
destructible |=
|
|
6372
6405
|
parser.assignable & 1
|
|
6373
6406
|
? 32
|
|
@@ -6500,7 +6533,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
6500
6533
|
parser.flags |= 512;
|
|
6501
6534
|
}
|
|
6502
6535
|
}
|
|
6503
|
-
left = parseAndClassifyIdentifier(parser, context, scope,
|
|
6536
|
+
left = parseAndClassifyIdentifier(parser, context, scope, type);
|
|
6504
6537
|
}
|
|
6505
6538
|
else {
|
|
6506
6539
|
if (parser.getToken() === 2162700) {
|
|
@@ -6654,7 +6687,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
6654
6687
|
expressions: expressions,
|
|
6655
6688
|
}, tokenAfterParenthesesStart);
|
|
6656
6689
|
}
|
|
6657
|
-
consume(parser, context, 16);
|
|
6690
|
+
consume(parser, context | 64, 16);
|
|
6658
6691
|
parser.destructible = destructible | previousAwaitYield;
|
|
6659
6692
|
if (previousFirstAwaitLocation) {
|
|
6660
6693
|
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
@@ -6690,7 +6723,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
6690
6723
|
expressions: expressions,
|
|
6691
6724
|
}, tokenAfterParenthesesStart);
|
|
6692
6725
|
}
|
|
6693
|
-
consume(parser, context, 16);
|
|
6726
|
+
consume(parser, context | 64, 16);
|
|
6694
6727
|
if (destructible & 16 && destructible & 8)
|
|
6695
6728
|
parser.report(153);
|
|
6696
6729
|
destructible |=
|
|
@@ -6745,7 +6778,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
6745
6778
|
}, parenthesesStart)
|
|
6746
6779
|
: expr;
|
|
6747
6780
|
}
|
|
6748
|
-
function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0) {
|
|
6781
|
+
function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0, canAssign = 1) {
|
|
6749
6782
|
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
6750
6783
|
let isNonSimpleParameterList = 0;
|
|
6751
6784
|
let hasStrictReserved = 0;
|
|
@@ -6758,6 +6791,8 @@ function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0)
|
|
|
6758
6791
|
const expr = parseIdentifier(parser, context, allowRegExp);
|
|
6759
6792
|
parser.assignable = 1;
|
|
6760
6793
|
if (parser.getToken() === 10) {
|
|
6794
|
+
if (!canAssign)
|
|
6795
|
+
parser.report(57);
|
|
6761
6796
|
const scope = parser.options.lexical
|
|
6762
6797
|
? createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation)
|
|
6763
6798
|
: undefined;
|
|
@@ -6791,7 +6826,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
6791
6826
|
if (parser.flags & 1)
|
|
6792
6827
|
parser.report(48);
|
|
6793
6828
|
consume(parser, context | 32, 10);
|
|
6794
|
-
const modifierFlags = 1024 | 2048 | 8192 | 524288;
|
|
6829
|
+
const modifierFlags = 1024 | 2048 | 8192 | 524288 | 8;
|
|
6795
6830
|
context = ((context | modifierFlags) ^ modifierFlags) | (isAsync ? 2048 : 0);
|
|
6796
6831
|
const expression = parser.getToken() !== 2162700;
|
|
6797
6832
|
let body;
|
|
@@ -6804,7 +6839,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
6804
6839
|
}
|
|
6805
6840
|
else {
|
|
6806
6841
|
scope = scope?.createChildScope(64);
|
|
6807
|
-
const modifierFlags = 4 | 131072 | 8;
|
|
6842
|
+
const modifierFlags = 4 | 128 | 131072 | 8;
|
|
6808
6843
|
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
|
|
6809
6844
|
switch (parser.getToken()) {
|
|
6810
6845
|
case 69271571:
|
|
@@ -6814,7 +6849,9 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
6814
6849
|
parser.flags |= 8192;
|
|
6815
6850
|
break;
|
|
6816
6851
|
case 67108877:
|
|
6852
|
+
case 67108991:
|
|
6817
6853
|
case 67174409:
|
|
6854
|
+
case 67174408:
|
|
6818
6855
|
case 22:
|
|
6819
6856
|
parser.report(119);
|
|
6820
6857
|
case 67174411:
|
|
@@ -6971,9 +7008,9 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
6971
7008
|
}
|
|
6972
7009
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
6973
7010
|
context = (context | 131072) ^ 131072;
|
|
7011
|
+
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
6974
7012
|
if (parser.getToken() === 67108991)
|
|
6975
7013
|
parser.report(170);
|
|
6976
|
-
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
6977
7014
|
parser.assignable = 2;
|
|
6978
7015
|
return parser.finishNode({
|
|
6979
7016
|
type: 'NewExpression',
|
|
@@ -7443,8 +7480,6 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
7443
7480
|
}
|
|
7444
7481
|
else if (token === -2147483526) {
|
|
7445
7482
|
key = parseIdentifier(parser, context);
|
|
7446
|
-
if (parser.getToken() !== 67174411)
|
|
7447
|
-
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
7448
7483
|
}
|
|
7449
7484
|
else {
|
|
7450
7485
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -7460,7 +7495,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
7460
7495
|
}
|
|
7461
7496
|
else if (parser.getToken() === 69271571) {
|
|
7462
7497
|
kind |= 2;
|
|
7463
|
-
key = parseComputedPropertyName(parser,
|
|
7498
|
+
key = parseComputedPropertyName(parser, inheritedContext, privateScope, 0);
|
|
7464
7499
|
}
|
|
7465
7500
|
else if (parser.getToken() === 131) {
|
|
7466
7501
|
kind |= 8192;
|
|
@@ -7548,6 +7583,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
7548
7583
|
2048 |
|
|
7549
7584
|
8 |
|
|
7550
7585
|
8192 |
|
|
7586
|
+
32768 |
|
|
7551
7587
|
((state & 64) === 0 ? 512 | 16384 : 0);
|
|
7552
7588
|
context =
|
|
7553
7589
|
((context | modifierFlags) ^ modifierFlags) |
|