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/dist/meriyah.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version$1 = "7.4.
|
|
1
|
+
var version$1 = "7.4.2";
|
|
2
2
|
var packageJson = {
|
|
3
3
|
version: version$1};
|
|
4
4
|
|
|
@@ -1886,7 +1886,9 @@ function scanSingleToken(parser, context, state) {
|
|
|
1886
1886
|
}
|
|
1887
1887
|
if (ch === 33) {
|
|
1888
1888
|
const index = parser.index + 1;
|
|
1889
|
-
if (
|
|
1889
|
+
if (parser.options.webcompat &&
|
|
1890
|
+
!(context & 2) &&
|
|
1891
|
+
index + 1 < parser.end &&
|
|
1890
1892
|
source.charCodeAt(index) === 45 &&
|
|
1891
1893
|
source.charCodeAt(index + 1) == 45) {
|
|
1892
1894
|
parser.column += 3;
|
|
@@ -1968,7 +1970,10 @@ function scanSingleToken(parser, context, state) {
|
|
|
1968
1970
|
const ch = parser.currentChar;
|
|
1969
1971
|
if (ch === 45) {
|
|
1970
1972
|
advanceChar(parser);
|
|
1971
|
-
if (
|
|
1973
|
+
if (parser.currentChar === 62 &&
|
|
1974
|
+
(state & 1 ||
|
|
1975
|
+
isStartOfLine ||
|
|
1976
|
+
(parser.getToken() === 1048576 && parser.line > 1))) {
|
|
1972
1977
|
if (!parser.options.webcompat)
|
|
1973
1978
|
parser.report(114);
|
|
1974
1979
|
advanceChar(parser);
|
|
@@ -2240,10 +2245,10 @@ function validateFunctionName(parser, context, t) {
|
|
|
2240
2245
|
if ((t & 20480) === 20480) {
|
|
2241
2246
|
parser.report(102);
|
|
2242
2247
|
}
|
|
2243
|
-
if (context & (2048 | 2) && t === 209006) {
|
|
2248
|
+
if (context & (2048 | 2) && (t & 2147483647) === 209006) {
|
|
2244
2249
|
parser.report(112);
|
|
2245
2250
|
}
|
|
2246
|
-
if (context & (1024 | 1) && t === 241771) {
|
|
2251
|
+
if (context & (1024 | 1) && (t & 2147483647) === 241771) {
|
|
2247
2252
|
parser.report(97, 'yield');
|
|
2248
2253
|
}
|
|
2249
2254
|
}
|
|
@@ -2303,7 +2308,8 @@ function isValidIdentifier(context, t) {
|
|
|
2303
2308
|
return false;
|
|
2304
2309
|
if (context & 1024 && t === 241771)
|
|
2305
2310
|
return false;
|
|
2306
|
-
|
|
2311
|
+
if (context & 1)
|
|
2312
|
+
return (t & 12288) === 12288;
|
|
2307
2313
|
}
|
|
2308
2314
|
return (t & 12288) === 12288 || (t & 36864) === 36864;
|
|
2309
2315
|
}
|
|
@@ -2757,12 +2763,14 @@ class PrivateScope {
|
|
|
2757
2763
|
this.refs[name] ??= [];
|
|
2758
2764
|
this.refs[name].push(this.parser.tokenStart);
|
|
2759
2765
|
}
|
|
2760
|
-
isPrivateIdentifierDefined(name) {
|
|
2761
|
-
return this.hasPrivateIdentifier(name) || Boolean(this.parent?.isPrivateIdentifierDefined(name));
|
|
2762
|
-
}
|
|
2763
2766
|
validatePrivateIdentifierRefs() {
|
|
2764
2767
|
for (const name in this.refs) {
|
|
2765
|
-
if (
|
|
2768
|
+
if (this.hasPrivateIdentifier(name))
|
|
2769
|
+
continue;
|
|
2770
|
+
if (this.parent) {
|
|
2771
|
+
(this.parent.refs[name] ??= []).push(...this.refs[name]);
|
|
2772
|
+
}
|
|
2773
|
+
else {
|
|
2766
2774
|
const { index, line, column } = this.refs[name][0];
|
|
2767
2775
|
throw new ParseError({ index, line, column }, { index: index + name.length, line, column: column + name.length }, 4, name);
|
|
2768
2776
|
}
|
|
@@ -3183,7 +3191,7 @@ function parseStatementListItem(parser, context, scope, privateScope, labels, or
|
|
|
3183
3191
|
case 86090:
|
|
3184
3192
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
|
|
3185
3193
|
case 241737:
|
|
3186
|
-
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
3194
|
+
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin);
|
|
3187
3195
|
case 209013:
|
|
3188
3196
|
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
3189
3197
|
case 209006:
|
|
@@ -3205,7 +3213,7 @@ function parseStatementListItem(parser, context, scope, privateScope, labels, or
|
|
|
3205
3213
|
parser.report(103, 'import');
|
|
3206
3214
|
}
|
|
3207
3215
|
case 209005:
|
|
3208
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
|
|
3216
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, 1, origin);
|
|
3209
3217
|
default:
|
|
3210
3218
|
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
3211
3219
|
}
|
|
@@ -3243,7 +3251,7 @@ function parseStatement(parser, context, scope, privateScope, labels, allowFuncD
|
|
|
3243
3251
|
case 20560:
|
|
3244
3252
|
return parseDebuggerStatement(parser, context);
|
|
3245
3253
|
case 209005:
|
|
3246
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
|
|
3254
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, allowFuncDecl, origin);
|
|
3247
3255
|
case 20557:
|
|
3248
3256
|
parser.report(164);
|
|
3249
3257
|
case 20566:
|
|
@@ -3273,7 +3281,7 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
|
|
|
3273
3281
|
parser.report(84);
|
|
3274
3282
|
break;
|
|
3275
3283
|
default:
|
|
3276
|
-
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart,
|
|
3284
|
+
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart, 1, 1);
|
|
3277
3285
|
}
|
|
3278
3286
|
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
|
|
3279
3287
|
}
|
|
@@ -3337,17 +3345,17 @@ function parseLabelledStatement(parser, context, scope, privateScope, labels, va
|
|
|
3337
3345
|
body,
|
|
3338
3346
|
}, start);
|
|
3339
3347
|
}
|
|
3340
|
-
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
3348
|
+
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowAsyncFuncDecl, allowFuncDecl, origin) {
|
|
3341
3349
|
const { tokenValue, tokenStart: start } = parser;
|
|
3342
3350
|
const token = parser.getToken();
|
|
3343
3351
|
let expr = parseIdentifier(parser, context);
|
|
3344
3352
|
if (parser.getToken() === 21) {
|
|
3345
|
-
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token,
|
|
3353
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, allowFuncDecl, start, origin);
|
|
3346
3354
|
}
|
|
3347
3355
|
const asyncNewLine = parser.flags & 1;
|
|
3348
3356
|
if (!asyncNewLine) {
|
|
3349
3357
|
if (parser.getToken() === 86104) {
|
|
3350
|
-
if (!
|
|
3358
|
+
if (!allowAsyncFuncDecl)
|
|
3351
3359
|
parser.report(125);
|
|
3352
3360
|
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
|
|
3353
3361
|
}
|
|
@@ -3369,7 +3377,9 @@ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, priva
|
|
|
3369
3377
|
}
|
|
3370
3378
|
expr = parseArrowFromIdentifier(parser, context | 2048, privateScope, parser.tokenValue, expr, 0, 1, 0, start);
|
|
3371
3379
|
}
|
|
3372
|
-
|
|
3380
|
+
else {
|
|
3381
|
+
parser.assignable = 1;
|
|
3382
|
+
}
|
|
3373
3383
|
}
|
|
3374
3384
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
|
|
3375
3385
|
expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
|
|
@@ -3624,7 +3634,12 @@ function parseCatchBlock(parser, context, scope, privateScope, labels, start) {
|
|
|
3624
3634
|
}
|
|
3625
3635
|
function parseStaticBlock(parser, context, scope, privateScope, start) {
|
|
3626
3636
|
scope = scope?.createChildScope();
|
|
3627
|
-
const ctorContext = 512 |
|
|
3637
|
+
const ctorContext = 512 |
|
|
3638
|
+
4096 |
|
|
3639
|
+
1024 |
|
|
3640
|
+
4 |
|
|
3641
|
+
128 |
|
|
3642
|
+
32768;
|
|
3628
3643
|
context =
|
|
3629
3644
|
((context | ctorContext) ^ ctorContext) |
|
|
3630
3645
|
256 |
|
|
@@ -3648,7 +3663,7 @@ function parseDoWhileStatement(parser, context, scope, privateScope, labels) {
|
|
|
3648
3663
|
test,
|
|
3649
3664
|
}, start);
|
|
3650
3665
|
}
|
|
3651
|
-
function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin) {
|
|
3666
|
+
function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, labels, origin) {
|
|
3652
3667
|
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
3653
3668
|
const token = parser.getToken();
|
|
3654
3669
|
let expr = parseIdentifier(parser, context);
|
|
@@ -3666,7 +3681,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
3666
3681
|
if (context & 1)
|
|
3667
3682
|
parser.report(85);
|
|
3668
3683
|
if (parser.getToken() === 21) {
|
|
3669
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
3684
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, tokenStart, origin);
|
|
3670
3685
|
}
|
|
3671
3686
|
if (parser.getToken() === 10) {
|
|
3672
3687
|
let scope = void 0;
|
|
@@ -3849,6 +3864,9 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
3849
3864
|
function parseForStatement(parser, context, scope, privateScope, labels) {
|
|
3850
3865
|
const start = parser.tokenStart;
|
|
3851
3866
|
nextToken(parser, context);
|
|
3867
|
+
if (context & 524288 && parser.getToken() === 209006) {
|
|
3868
|
+
parser.report(179);
|
|
3869
|
+
}
|
|
3852
3870
|
const forAwait = ((context & 2048) > 0 || ((context & 2) > 0 && (context & 8) > 0)) &&
|
|
3853
3871
|
consumeOpt(parser, context, 209006);
|
|
3854
3872
|
consume(parser, context | 32, 67174411);
|
|
@@ -4328,7 +4346,9 @@ function parseImportMetaDeclaration(parser, context, start) {
|
|
|
4328
4346
|
}
|
|
4329
4347
|
function parseImportCallDeclaration(parser, context, privateScope, start) {
|
|
4330
4348
|
let expr = parseImportExpression(parser, context, privateScope, 0, start);
|
|
4349
|
+
parser.assignable = 2;
|
|
4331
4350
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, 0, 0, start);
|
|
4351
|
+
expr = parseAssignmentExpression(parser, context, privateScope, 0, 0, start, expr);
|
|
4332
4352
|
if (parser.getToken() === 18) {
|
|
4333
4353
|
expr = parseSequenceExpression(parser, context, privateScope, 0, start, expr);
|
|
4334
4354
|
}
|
|
@@ -4736,9 +4756,9 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
|
|
|
4736
4756
|
}
|
|
4737
4757
|
if (context & 1)
|
|
4738
4758
|
parser.report(97, 'yield');
|
|
4739
|
-
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
4759
|
+
return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
|
|
4740
4760
|
}
|
|
4741
|
-
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
|
|
4761
|
+
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start) {
|
|
4742
4762
|
if (inGroup) {
|
|
4743
4763
|
if ((parser.destructible & 128) === 0) {
|
|
4744
4764
|
parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
|
|
@@ -4749,10 +4769,11 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
|
|
|
4749
4769
|
parser.report(179);
|
|
4750
4770
|
const isEscaped = (parser.getToken() & -2147483648) !== 0;
|
|
4751
4771
|
const allowRegExp = !isEscaped && context & (2048 | 2) ? 1 : 0;
|
|
4752
|
-
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp);
|
|
4772
|
+
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope, allowRegExp, canAssign);
|
|
4753
4773
|
const isIdentifier = isEscaped ||
|
|
4754
4774
|
possibleIdentifierOrArrowFunc.type === 'ArrowFunctionExpression' ||
|
|
4755
|
-
(parser.getToken() & 65536) === 0
|
|
4775
|
+
((parser.getToken() & 65536) === 0 &&
|
|
4776
|
+
(parser.getToken() & 36864) !== 36864);
|
|
4756
4777
|
if (isIdentifier) {
|
|
4757
4778
|
if (context & 2048)
|
|
4758
4779
|
throw new ParseError(start, parser.startPosition, 178);
|
|
@@ -4872,8 +4893,11 @@ function parseLeftHandSideExpression(parser, context, privateScope, canAssign, i
|
|
|
4872
4893
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expression, inGroup, 0, start);
|
|
4873
4894
|
}
|
|
4874
4895
|
function parseUpdateExpression(parser, context, expr, start) {
|
|
4875
|
-
if (parser.assignable & 2
|
|
4896
|
+
if (parser.assignable & 2 ||
|
|
4897
|
+
expr.type === 'ArrayExpression' ||
|
|
4898
|
+
expr.type === 'ObjectExpression') {
|
|
4876
4899
|
parser.report(55);
|
|
4900
|
+
}
|
|
4877
4901
|
const token = parser.getToken();
|
|
4878
4902
|
nextToken(parser, context);
|
|
4879
4903
|
parser.assignable = 2;
|
|
@@ -4952,7 +4976,7 @@ function parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGr
|
|
|
4952
4976
|
parser.flags = (parser.flags | 2048) ^ 2048;
|
|
4953
4977
|
}
|
|
4954
4978
|
const args = parseArguments(parser, context, privateScope, inGroup);
|
|
4955
|
-
if (!(context & 1) && parser.options.webcompat) {
|
|
4979
|
+
if (!restoreHasOptionalChaining && !(context & 1) && parser.options.webcompat) {
|
|
4956
4980
|
parser.assignable = 4;
|
|
4957
4981
|
}
|
|
4958
4982
|
else {
|
|
@@ -5025,12 +5049,7 @@ function parseOptionalChain(parser, context, privateScope, expr, start) {
|
|
|
5025
5049
|
}
|
|
5026
5050
|
else if (parser.getToken() === 67174411) {
|
|
5027
5051
|
const args = parseArguments(parser, context, privateScope, 0);
|
|
5028
|
-
|
|
5029
|
-
parser.assignable = 4;
|
|
5030
|
-
}
|
|
5031
|
-
else {
|
|
5032
|
-
parser.assignable = 2;
|
|
5033
|
-
}
|
|
5052
|
+
parser.assignable = 2;
|
|
5034
5053
|
node = parser.finishNode({
|
|
5035
5054
|
type: 'CallExpression',
|
|
5036
5055
|
callee: expr,
|
|
@@ -5089,7 +5108,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5089
5108
|
switch (parser.getToken()) {
|
|
5090
5109
|
case 209006:
|
|
5091
5110
|
case 209006 | -2147483648:
|
|
5092
|
-
return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start);
|
|
5111
|
+
return parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, canAssign, start);
|
|
5093
5112
|
case 241771:
|
|
5094
5113
|
return parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup, canAssign, start);
|
|
5095
5114
|
case 209005:
|
|
@@ -5110,8 +5129,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5110
5129
|
if (context & 16 &&
|
|
5111
5130
|
!(context & 32768) &&
|
|
5112
5131
|
!(context & 8192) &&
|
|
5113
|
-
parser.tokenValue === 'arguments'
|
|
5114
|
-
parser.
|
|
5132
|
+
parser.tokenValue === 'arguments' &&
|
|
5133
|
+
!(origin & 1 && parser.getToken() === 21))
|
|
5134
|
+
throw new ParseError(start, parser.startPosition, 132);
|
|
5115
5135
|
if ((token & 255) === (241737 & 255)) {
|
|
5116
5136
|
if (context & 1)
|
|
5117
5137
|
parser.report(115);
|
|
@@ -5146,7 +5166,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5146
5166
|
case 69271571:
|
|
5147
5167
|
return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
|
|
5148
5168
|
case 67174411:
|
|
5149
|
-
return parseParenthesizedExpression(parser, context
|
|
5169
|
+
return parseParenthesizedExpression(parser, context, privateScope, canAssign, 1, start, origin);
|
|
5150
5170
|
case 86021:
|
|
5151
5171
|
case 86022:
|
|
5152
5172
|
case 86023:
|
|
@@ -5187,8 +5207,9 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
5187
5207
|
if (parser.options.jsx)
|
|
5188
5208
|
return parseJSXRootElementOrFragment(parser, context, privateScope, 0, parser.tokenStart);
|
|
5189
5209
|
default:
|
|
5190
|
-
if (isValidIdentifier(context, parser.getToken()))
|
|
5191
|
-
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
5210
|
+
if (isValidIdentifier(context, parser.getToken())) {
|
|
5211
|
+
return parseIdentifierOrArrow(parser, context, privateScope, 0, canAssign);
|
|
5212
|
+
}
|
|
5192
5213
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5193
5214
|
}
|
|
5194
5215
|
}
|
|
@@ -5589,6 +5610,8 @@ function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGro
|
|
|
5589
5610
|
if (parser.destructible & 8) {
|
|
5590
5611
|
parser.report(62);
|
|
5591
5612
|
}
|
|
5613
|
+
if (expr.type === 'ArrayExpression')
|
|
5614
|
+
parser.assignable = 2;
|
|
5592
5615
|
return expr;
|
|
5593
5616
|
}
|
|
5594
5617
|
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
@@ -5700,8 +5723,10 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
5700
5723
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5701
5724
|
}
|
|
5702
5725
|
else {
|
|
5703
|
-
left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
|
|
5726
|
+
left = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
|
|
5704
5727
|
if (parser.getToken() !== 18 && parser.getToken() !== 20) {
|
|
5728
|
+
if (parser.getToken() !== 1077936155)
|
|
5729
|
+
destructible |= 16;
|
|
5705
5730
|
left = parseAssignmentExpression(parser, context, privateScope, inGroup, isPattern, tokenStart, left);
|
|
5706
5731
|
if ((kind & (2 | 1)) === 0 && token === 67174411)
|
|
5707
5732
|
destructible |= 16;
|
|
@@ -5833,7 +5858,7 @@ function parseSpreadOrRestElement(parser, context, scope, privateScope, closingT
|
|
|
5833
5858
|
}
|
|
5834
5859
|
else {
|
|
5835
5860
|
destructible |= 32;
|
|
5836
|
-
argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
|
|
5861
|
+
argument = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
|
|
5837
5862
|
const token = parser.getToken();
|
|
5838
5863
|
if (token === 1077936155) {
|
|
5839
5864
|
if (parser.assignable & 2)
|
|
@@ -5909,7 +5934,8 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
|
|
|
5909
5934
|
let scope = parser.createScopeIfLexical(256);
|
|
5910
5935
|
const params = parseMethodFormals(parser, (context | 8192) & -524289, scope, privateScope, kind, 1, inGroup);
|
|
5911
5936
|
scope = scope?.createChildScope(64);
|
|
5912
|
-
const body = parseFunctionBody(parser, (context &
|
|
5937
|
+
const body = parseFunctionBody(parser, (context &
|
|
5938
|
+
-655501) |
|
|
5913
5939
|
32768 |
|
|
5914
5940
|
4096, scope, privateScope, void 0, scope?.parent);
|
|
5915
5941
|
return parser.finishNode({
|
|
@@ -5929,6 +5955,8 @@ function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGr
|
|
|
5929
5955
|
if (parser.destructible & 8) {
|
|
5930
5956
|
parser.report(62);
|
|
5931
5957
|
}
|
|
5958
|
+
if (expr.type === 'ObjectExpression')
|
|
5959
|
+
parser.assignable = 2;
|
|
5932
5960
|
return expr;
|
|
5933
5961
|
}
|
|
5934
5962
|
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
@@ -5958,6 +5986,11 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
5958
5986
|
parser.getToken() === 1074790415 ||
|
|
5959
5987
|
parser.getToken() === 1077936155) {
|
|
5960
5988
|
state |= 4;
|
|
5989
|
+
if (context & 16 &&
|
|
5990
|
+
!(context & 32768) &&
|
|
5991
|
+
!(context & 8192) &&
|
|
5992
|
+
tokenValue === 'arguments')
|
|
5993
|
+
throw new ParseError(tokenStart, currentLocation, 132);
|
|
5961
5994
|
if (context & 1 && (token & 537079808) === 537079808) {
|
|
5962
5995
|
destructible |= 16;
|
|
5963
5996
|
}
|
|
@@ -6071,7 +6104,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
6071
6104
|
}
|
|
6072
6105
|
}
|
|
6073
6106
|
else {
|
|
6074
|
-
value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1);
|
|
6107
|
+
value = parseLeftHandSideExpression(parser, context, privateScope, 1, inGroup, 1, context & 131072 ? 0 : 1);
|
|
6075
6108
|
destructible |=
|
|
6076
6109
|
parser.assignable & 1
|
|
6077
6110
|
? 32
|
|
@@ -6252,7 +6285,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
6252
6285
|
}
|
|
6253
6286
|
}
|
|
6254
6287
|
else {
|
|
6255
|
-
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
|
|
6288
|
+
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
|
|
6256
6289
|
destructible |=
|
|
6257
6290
|
parser.assignable & 1
|
|
6258
6291
|
? 32
|
|
@@ -6365,7 +6398,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
6365
6398
|
}
|
|
6366
6399
|
}
|
|
6367
6400
|
else {
|
|
6368
|
-
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1);
|
|
6401
|
+
value = parseLeftHandSideExpression(parser, context, privateScope, 1, 0, 1, context & 131072 ? 0 : 1);
|
|
6369
6402
|
destructible |=
|
|
6370
6403
|
parser.assignable & 1
|
|
6371
6404
|
? 32
|
|
@@ -6498,7 +6531,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
6498
6531
|
parser.flags |= 512;
|
|
6499
6532
|
}
|
|
6500
6533
|
}
|
|
6501
|
-
left = parseAndClassifyIdentifier(parser, context, scope,
|
|
6534
|
+
left = parseAndClassifyIdentifier(parser, context, scope, type);
|
|
6502
6535
|
}
|
|
6503
6536
|
else {
|
|
6504
6537
|
if (parser.getToken() === 2162700) {
|
|
@@ -6652,7 +6685,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
6652
6685
|
expressions: expressions,
|
|
6653
6686
|
}, tokenAfterParenthesesStart);
|
|
6654
6687
|
}
|
|
6655
|
-
consume(parser, context, 16);
|
|
6688
|
+
consume(parser, context | 64, 16);
|
|
6656
6689
|
parser.destructible = destructible | previousAwaitYield;
|
|
6657
6690
|
if (previousFirstAwaitLocation) {
|
|
6658
6691
|
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
@@ -6688,7 +6721,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
6688
6721
|
expressions: expressions,
|
|
6689
6722
|
}, tokenAfterParenthesesStart);
|
|
6690
6723
|
}
|
|
6691
|
-
consume(parser, context, 16);
|
|
6724
|
+
consume(parser, context | 64, 16);
|
|
6692
6725
|
if (destructible & 16 && destructible & 8)
|
|
6693
6726
|
parser.report(153);
|
|
6694
6727
|
destructible |=
|
|
@@ -6743,7 +6776,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
6743
6776
|
}, parenthesesStart)
|
|
6744
6777
|
: expr;
|
|
6745
6778
|
}
|
|
6746
|
-
function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0) {
|
|
6779
|
+
function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0, canAssign = 1) {
|
|
6747
6780
|
const { tokenValue, tokenStart, currentLocation } = parser;
|
|
6748
6781
|
let isNonSimpleParameterList = 0;
|
|
6749
6782
|
let hasStrictReserved = 0;
|
|
@@ -6756,6 +6789,8 @@ function parseIdentifierOrArrow(parser, context, privateScope, allowRegExp = 0)
|
|
|
6756
6789
|
const expr = parseIdentifier(parser, context, allowRegExp);
|
|
6757
6790
|
parser.assignable = 1;
|
|
6758
6791
|
if (parser.getToken() === 10) {
|
|
6792
|
+
if (!canAssign)
|
|
6793
|
+
parser.report(57);
|
|
6759
6794
|
const scope = parser.options.lexical
|
|
6760
6795
|
? createArrowHeadParsingScope(parser, context, tokenValue, tokenStart, currentLocation)
|
|
6761
6796
|
: undefined;
|
|
@@ -6789,7 +6824,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
6789
6824
|
if (parser.flags & 1)
|
|
6790
6825
|
parser.report(48);
|
|
6791
6826
|
consume(parser, context | 32, 10);
|
|
6792
|
-
const modifierFlags = 1024 | 2048 | 8192 | 524288;
|
|
6827
|
+
const modifierFlags = 1024 | 2048 | 8192 | 524288 | 8;
|
|
6793
6828
|
context = ((context | modifierFlags) ^ modifierFlags) | (isAsync ? 2048 : 0);
|
|
6794
6829
|
const expression = parser.getToken() !== 2162700;
|
|
6795
6830
|
let body;
|
|
@@ -6802,7 +6837,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
6802
6837
|
}
|
|
6803
6838
|
else {
|
|
6804
6839
|
scope = scope?.createChildScope(64);
|
|
6805
|
-
const modifierFlags = 4 | 131072 | 8;
|
|
6840
|
+
const modifierFlags = 4 | 128 | 131072 | 8;
|
|
6806
6841
|
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
|
|
6807
6842
|
switch (parser.getToken()) {
|
|
6808
6843
|
case 69271571:
|
|
@@ -6812,7 +6847,9 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
6812
6847
|
parser.flags |= 8192;
|
|
6813
6848
|
break;
|
|
6814
6849
|
case 67108877:
|
|
6850
|
+
case 67108991:
|
|
6815
6851
|
case 67174409:
|
|
6852
|
+
case 67174408:
|
|
6816
6853
|
case 22:
|
|
6817
6854
|
parser.report(119);
|
|
6818
6855
|
case 67174411:
|
|
@@ -6969,9 +7006,9 @@ function parseNewExpression(parser, context, privateScope, inGroup) {
|
|
|
6969
7006
|
}
|
|
6970
7007
|
const expr = parsePrimaryExpression(parser, context, privateScope, 2, 1, 0, inGroup, 1, tokenStart);
|
|
6971
7008
|
context = (context | 131072) ^ 131072;
|
|
7009
|
+
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
6972
7010
|
if (parser.getToken() === 67108991)
|
|
6973
7011
|
parser.report(170);
|
|
6974
|
-
const callee = parseMemberExpressionNoCall(parser, context, privateScope, expr, inGroup, tokenStart);
|
|
6975
7012
|
parser.assignable = 2;
|
|
6976
7013
|
return parser.finishNode({
|
|
6977
7014
|
type: 'NewExpression',
|
|
@@ -7441,8 +7478,6 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
7441
7478
|
}
|
|
7442
7479
|
else if (token === -2147483526) {
|
|
7443
7480
|
key = parseIdentifier(parser, context);
|
|
7444
|
-
if (parser.getToken() !== 67174411)
|
|
7445
|
-
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
7446
7481
|
}
|
|
7447
7482
|
else {
|
|
7448
7483
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -7458,7 +7493,7 @@ function parseClassElementList(parser, context, scope, privateScope, inheritedCo
|
|
|
7458
7493
|
}
|
|
7459
7494
|
else if (parser.getToken() === 69271571) {
|
|
7460
7495
|
kind |= 2;
|
|
7461
|
-
key = parseComputedPropertyName(parser,
|
|
7496
|
+
key = parseComputedPropertyName(parser, inheritedContext, privateScope, 0);
|
|
7462
7497
|
}
|
|
7463
7498
|
else if (parser.getToken() === 131) {
|
|
7464
7499
|
kind |= 8192;
|
|
@@ -7546,6 +7581,7 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
7546
7581
|
2048 |
|
|
7547
7582
|
8 |
|
|
7548
7583
|
8192 |
|
|
7584
|
+
32768 |
|
|
7549
7585
|
((state & 64) === 0 ? 512 | 16384 : 0);
|
|
7550
7586
|
context =
|
|
7551
7587
|
((context | modifierFlags) ^ modifierFlags) |
|