meriyah 7.3.0 → 7.3.1
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 +11 -0
- package/dist/meriyah.cjs +179 -126
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +179 -126
- package/dist/meriyah.umd.js +179 -126
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/errors.d.ts +3 -1
- package/dist/types/parser/parser.d.ts +4 -0
- package/dist/types/parser/scope.d.ts +1 -1
- package/package.json +1 -1
package/dist/meriyah.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version$1 = "7.3.
|
|
3
|
+
var version$1 = "7.3.1";
|
|
4
4
|
var packageJson = {
|
|
5
5
|
version: version$1};
|
|
6
6
|
|
|
@@ -93,7 +93,7 @@ const CharTypes = [
|
|
|
93
93
|
0,
|
|
94
94
|
16384,
|
|
95
95
|
0,
|
|
96
|
-
|
|
96
|
+
16384,
|
|
97
97
|
0,
|
|
98
98
|
0,
|
|
99
99
|
1 | 2 | 64,
|
|
@@ -156,7 +156,7 @@ const CharTypes = [
|
|
|
156
156
|
1 | 2 | 4,
|
|
157
157
|
16384,
|
|
158
158
|
0,
|
|
159
|
-
|
|
159
|
+
16384,
|
|
160
160
|
0,
|
|
161
161
|
0
|
|
162
162
|
];
|
|
@@ -790,6 +790,8 @@ const errorMessages = {
|
|
|
790
790
|
[177]: "'import.meta' must not contain escaped characters",
|
|
791
791
|
[178]: 'cannot use "await" as identifier inside an async function',
|
|
792
792
|
[179]: 'cannot use "await" in static blocks',
|
|
793
|
+
[180]: "Unexpected token `}`. Did you mean `}` or `{'}'}`?",
|
|
794
|
+
[181]: "Unexpected token `>`. Did you mean `>` or `{'>'}`?",
|
|
793
795
|
};
|
|
794
796
|
class ParseError extends SyntaxError {
|
|
795
797
|
start;
|
|
@@ -2247,6 +2249,9 @@ function isStrictReservedWord(parser, context, t) {
|
|
|
2247
2249
|
if (t === 209006) {
|
|
2248
2250
|
if (context & (2048 | 2))
|
|
2249
2251
|
parser.report(112);
|
|
2252
|
+
if ((parser.destructible & 128) === 0) {
|
|
2253
|
+
parser.firstAwaitLocation ??= { start: parser.tokenStart, end: parser.currentLocation };
|
|
2254
|
+
}
|
|
2250
2255
|
parser.destructible |= 128;
|
|
2251
2256
|
}
|
|
2252
2257
|
if (t === 241771 && context & 1024)
|
|
@@ -4528,6 +4533,12 @@ function nextJSXToken(parser) {
|
|
|
4528
4533
|
parser.setToken(2162700);
|
|
4529
4534
|
return;
|
|
4530
4535
|
}
|
|
4536
|
+
if (parser.currentChar === 125) {
|
|
4537
|
+
parser.report(180);
|
|
4538
|
+
}
|
|
4539
|
+
if (parser.currentChar === 62) {
|
|
4540
|
+
parser.report(181);
|
|
4541
|
+
}
|
|
4531
4542
|
let state = 0;
|
|
4532
4543
|
while (parser.index < parser.end) {
|
|
4533
4544
|
const type = CharTypes[parser.source.charCodeAt(parser.index)];
|
|
@@ -4701,7 +4712,7 @@ class Scope {
|
|
|
4701
4712
|
hasVariable(name) {
|
|
4702
4713
|
return this.variableBindings.has(name);
|
|
4703
4714
|
}
|
|
4704
|
-
addBlockName(context, name, kind, origin) {
|
|
4715
|
+
addBlockName(context, name, kind, origin = 0) {
|
|
4705
4716
|
const { parser } = this;
|
|
4706
4717
|
const value = this.variableBindings.get(name);
|
|
4707
4718
|
if (value && (value & 2) === 0) {
|
|
@@ -4751,7 +4762,7 @@ class Scope {
|
|
|
4751
4762
|
}
|
|
4752
4763
|
function createArrowHeadParsingScope(parser, context, value) {
|
|
4753
4764
|
const scope = parser.createScope().createChildScope(512);
|
|
4754
|
-
scope.addBlockName(context, value, 1
|
|
4765
|
+
scope.addBlockName(context, value, 1);
|
|
4755
4766
|
return scope;
|
|
4756
4767
|
}
|
|
4757
4768
|
|
|
@@ -4781,6 +4792,7 @@ class Parser {
|
|
|
4781
4792
|
assignable = 0;
|
|
4782
4793
|
destructible = 0;
|
|
4783
4794
|
strictReservedRange = null;
|
|
4795
|
+
firstAwaitLocation = null;
|
|
4784
4796
|
leadingDecorators = { decorators: [] };
|
|
4785
4797
|
constructor(source, rawOptions = {}) {
|
|
4786
4798
|
this.source = source;
|
|
@@ -4989,7 +5001,7 @@ function parseStatementList(parser, context, scope) {
|
|
|
4989
5001
|
statements.push(parseDirective(parser, context, expr, token, tokenStart));
|
|
4990
5002
|
}
|
|
4991
5003
|
while (parser.getToken() !== 1048576) {
|
|
4992
|
-
statements.push(parseStatementListItem(parser, context, scope, undefined,
|
|
5004
|
+
statements.push(parseStatementListItem(parser, context, scope, undefined, {}, 4));
|
|
4993
5005
|
}
|
|
4994
5006
|
return statements;
|
|
4995
5007
|
}
|
|
@@ -5025,18 +5037,18 @@ function parseModuleItem(parser, context, scope) {
|
|
|
5025
5037
|
moduleItem = parseImportDeclaration(parser, context, scope);
|
|
5026
5038
|
break;
|
|
5027
5039
|
default:
|
|
5028
|
-
moduleItem = parseStatementListItem(parser, context, scope, undefined,
|
|
5040
|
+
moduleItem = parseStatementListItem(parser, context, scope, undefined, {}, 4);
|
|
5029
5041
|
}
|
|
5030
5042
|
return moduleItem;
|
|
5031
5043
|
}
|
|
5032
|
-
function parseStatementListItem(parser, context, scope, privateScope,
|
|
5044
|
+
function parseStatementListItem(parser, context, scope, privateScope, labels, origin = 2) {
|
|
5033
5045
|
const start = parser.tokenStart;
|
|
5034
5046
|
if (parser.leadingDecorators.decorators.length && parser.getToken() !== 86094) {
|
|
5035
5047
|
parser.report(172);
|
|
5036
5048
|
}
|
|
5037
5049
|
switch (parser.getToken()) {
|
|
5038
5050
|
case 86104:
|
|
5039
|
-
return parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
5051
|
+
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 0, start, origin);
|
|
5040
5052
|
case 133:
|
|
5041
5053
|
if (!(parser.features & 1)) {
|
|
5042
5054
|
parser.report(30, '@');
|
|
@@ -5044,17 +5056,17 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
5044
5056
|
case 86094:
|
|
5045
5057
|
return parseClassDeclaration(parser, context, scope, privateScope, 0);
|
|
5046
5058
|
case 86090:
|
|
5047
|
-
return parseLexicalDeclaration(parser, context, scope, privateScope, 16
|
|
5059
|
+
return parseLexicalDeclaration(parser, context, scope, privateScope, 16);
|
|
5048
5060
|
case 241737:
|
|
5049
5061
|
return parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateScope, origin);
|
|
5050
5062
|
case 209013:
|
|
5051
|
-
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5063
|
+
return parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
5052
5064
|
case 209006:
|
|
5053
5065
|
if ((context & 2048 || (context & 2 && context & 8)) &&
|
|
5054
5066
|
nextTokenIsUsingOnSameLine(parser)) {
|
|
5055
|
-
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5067
|
+
return parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin);
|
|
5056
5068
|
}
|
|
5057
|
-
return parseStatement(parser, context, scope, privateScope,
|
|
5069
|
+
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
5058
5070
|
case 20564:
|
|
5059
5071
|
parser.report(103, 'export');
|
|
5060
5072
|
case 86106:
|
|
@@ -5068,15 +5080,15 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
5068
5080
|
parser.report(103, 'import');
|
|
5069
5081
|
}
|
|
5070
5082
|
case 209005:
|
|
5071
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5083
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 1, origin);
|
|
5072
5084
|
default:
|
|
5073
|
-
return parseStatement(parser, context, scope, privateScope,
|
|
5085
|
+
return parseStatement(parser, context, scope, privateScope, labels, 1, origin);
|
|
5074
5086
|
}
|
|
5075
5087
|
}
|
|
5076
|
-
function parseStatement(parser, context, scope, privateScope,
|
|
5088
|
+
function parseStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin = 0) {
|
|
5077
5089
|
switch (parser.getToken()) {
|
|
5078
5090
|
case 86088:
|
|
5079
|
-
return parseVariableStatement(parser, context, scope, privateScope
|
|
5091
|
+
return parseVariableStatement(parser, context, scope, privateScope);
|
|
5080
5092
|
case 20572:
|
|
5081
5093
|
return parseReturnStatement(parser, context, privateScope);
|
|
5082
5094
|
case 20569:
|
|
@@ -5106,7 +5118,7 @@ function parseStatement(parser, context, scope, privateScope, origin, labels, al
|
|
|
5106
5118
|
case 20560:
|
|
5107
5119
|
return parseDebuggerStatement(parser, context);
|
|
5108
5120
|
case 209005:
|
|
5109
|
-
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5121
|
+
return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, 0, origin);
|
|
5110
5122
|
case 20557:
|
|
5111
5123
|
parser.report(164);
|
|
5112
5124
|
case 20566:
|
|
@@ -5120,10 +5132,10 @@ function parseStatement(parser, context, scope, privateScope, origin, labels, al
|
|
|
5120
5132
|
case 86094:
|
|
5121
5133
|
parser.report(79);
|
|
5122
5134
|
default:
|
|
5123
|
-
return parseExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5135
|
+
return parseExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin);
|
|
5124
5136
|
}
|
|
5125
5137
|
}
|
|
5126
|
-
function parseExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5138
|
+
function parseExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
5127
5139
|
const { tokenValue, tokenStart } = parser;
|
|
5128
5140
|
const token = parser.getToken();
|
|
5129
5141
|
let expr;
|
|
@@ -5138,11 +5150,11 @@ function parseExpressionOrLabelledStatement(parser, context, scope, privateScope
|
|
|
5138
5150
|
default:
|
|
5139
5151
|
expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, 1, 0, 1, parser.tokenStart);
|
|
5140
5152
|
}
|
|
5141
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5153
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, expr, token, tokenValue, tokenStart, origin);
|
|
5142
5154
|
}
|
|
5143
|
-
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5155
|
+
function finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, allowFuncDecl, initialExpression, token, tokenValue, tokenStart, origin) {
|
|
5144
5156
|
if (token & 143360 && parser.getToken() === 21) {
|
|
5145
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5157
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, initialExpression, token, allowFuncDecl, tokenStart, origin);
|
|
5146
5158
|
}
|
|
5147
5159
|
let expression = parseMemberOrUpdateExpression(parser, context, privateScope, initialExpression, 0, 0, tokenStart);
|
|
5148
5160
|
expression = parseAssignmentExpression(parser, context, privateScope, 0, 0, tokenStart, expression);
|
|
@@ -5155,7 +5167,7 @@ function parseBlock(parser, context, scope, privateScope, labels, start = parser
|
|
|
5155
5167
|
const body = [];
|
|
5156
5168
|
consume(parser, context | 32, 2162700);
|
|
5157
5169
|
while (parser.getToken() !== 1074790415) {
|
|
5158
|
-
body.push(parseStatementListItem(parser, context, scope, privateScope,
|
|
5170
|
+
body.push(parseStatementListItem(parser, context, scope, privateScope, { $: labels }));
|
|
5159
5171
|
}
|
|
5160
5172
|
consume(parser, context | 32, 1074790415);
|
|
5161
5173
|
return parser.finishNode({
|
|
@@ -5184,7 +5196,7 @@ function parseExpressionStatement(parser, context, expression, start) {
|
|
|
5184
5196
|
expression,
|
|
5185
5197
|
}, start);
|
|
5186
5198
|
}
|
|
5187
|
-
function parseLabelledStatement(parser, context, scope, privateScope,
|
|
5199
|
+
function parseLabelledStatement(parser, context, scope, privateScope, labels, value, expr, token, allowFuncDecl, start, origin) {
|
|
5188
5200
|
validateBindingIdentifier(parser, context, 0, token, 1);
|
|
5189
5201
|
validateAndDeclareLabel(parser, labels, value);
|
|
5190
5202
|
nextToken(parser, context | 32);
|
|
@@ -5192,27 +5204,27 @@ function parseLabelledStatement(parser, context, scope, privateScope, origin, la
|
|
|
5192
5204
|
(context & 1) === 0 &&
|
|
5193
5205
|
parser.options.webcompat &&
|
|
5194
5206
|
parser.getToken() === 86104
|
|
5195
|
-
? parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope,
|
|
5196
|
-
: parseStatement(parser, context, scope, privateScope,
|
|
5207
|
+
? parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0, parser.tokenStart, origin)
|
|
5208
|
+
: parseStatement(parser, context, scope, privateScope, labels, allowFuncDecl, origin);
|
|
5197
5209
|
return parser.finishNode({
|
|
5198
5210
|
type: 'LabeledStatement',
|
|
5199
5211
|
label: expr,
|
|
5200
5212
|
body,
|
|
5201
5213
|
}, start);
|
|
5202
5214
|
}
|
|
5203
|
-
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope,
|
|
5215
|
+
function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, privateScope, labels, allowFuncDecl, origin) {
|
|
5204
5216
|
const { tokenValue, tokenStart: start } = parser;
|
|
5205
5217
|
const token = parser.getToken();
|
|
5206
5218
|
let expr = parseIdentifier(parser, context);
|
|
5207
5219
|
if (parser.getToken() === 21) {
|
|
5208
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5220
|
+
return parseLabelledStatement(parser, context, scope, privateScope, labels, tokenValue, expr, token, 1, start, origin);
|
|
5209
5221
|
}
|
|
5210
5222
|
const asyncNewLine = parser.flags & 1;
|
|
5211
5223
|
if (!asyncNewLine) {
|
|
5212
5224
|
if (parser.getToken() === 86104) {
|
|
5213
5225
|
if (!allowFuncDecl)
|
|
5214
5226
|
parser.report(125);
|
|
5215
|
-
return parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
5227
|
+
return parseFunctionDeclaration(parser, context, scope, privateScope, 1, 0, 1, start, origin);
|
|
5216
5228
|
}
|
|
5217
5229
|
if (isValidIdentifier(context, parser.getToken())) {
|
|
5218
5230
|
expr = parseAsyncArrowAfterIdent(parser, context, privateScope, 1, start);
|
|
@@ -5222,7 +5234,7 @@ function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, priva
|
|
|
5222
5234
|
}
|
|
5223
5235
|
}
|
|
5224
5236
|
if (parser.getToken() === 67174411) {
|
|
5225
|
-
expr = parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, 1, 1,
|
|
5237
|
+
expr = parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, 1, 1, asyncNewLine, start);
|
|
5226
5238
|
}
|
|
5227
5239
|
else {
|
|
5228
5240
|
if (parser.getToken() === 10) {
|
|
@@ -5308,8 +5320,8 @@ function parseConsequentOrAlternative(parser, context, scope, privateScope, labe
|
|
|
5308
5320
|
return context & 1 ||
|
|
5309
5321
|
!parser.options.webcompat ||
|
|
5310
5322
|
parser.getToken() !== 86104
|
|
5311
|
-
? parseStatement(parser, context, scope, privateScope,
|
|
5312
|
-
: parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0,
|
|
5323
|
+
? parseStatement(parser, context, scope, privateScope, { $: labels }, 0)
|
|
5324
|
+
: parseFunctionDeclaration(parser, context, scope?.createChildScope(), privateScope, 0, 0, 0, tokenStart);
|
|
5313
5325
|
}
|
|
5314
5326
|
function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
5315
5327
|
const start = parser.tokenStart;
|
|
@@ -5338,7 +5350,7 @@ function parseSwitchStatement(parser, context, scope, privateScope, labels) {
|
|
|
5338
5350
|
while (parser.getToken() !== 20556 &&
|
|
5339
5351
|
parser.getToken() !== 1074790415 &&
|
|
5340
5352
|
parser.getToken() !== 20561) {
|
|
5341
|
-
const statement = parseStatementListItem(parser, context | 4, scope, privateScope,
|
|
5353
|
+
const statement = parseStatementListItem(parser, context | 4, scope, privateScope, {
|
|
5342
5354
|
$: labels,
|
|
5343
5355
|
});
|
|
5344
5356
|
if (statement.type === 'VariableDeclaration' &&
|
|
@@ -5374,7 +5386,7 @@ function parseWhileStatement(parser, context, scope, privateScope, labels) {
|
|
|
5374
5386
|
}, start);
|
|
5375
5387
|
}
|
|
5376
5388
|
function parseIterationStatementBody(parser, context, scope, privateScope, labels) {
|
|
5377
|
-
return parseStatement(parser, ((context | 131072) ^ 131072) | 128, scope, privateScope,
|
|
5389
|
+
return parseStatement(parser, ((context | 131072) ^ 131072) | 128, scope, privateScope, { loop: 1, $: labels }, 0);
|
|
5378
5390
|
}
|
|
5379
5391
|
function parseContinueStatement(parser, context, labels) {
|
|
5380
5392
|
if ((context & 128) === 0)
|
|
@@ -5421,7 +5433,7 @@ function parseWithStatement(parser, context, scope, privateScope, labels) {
|
|
|
5421
5433
|
consume(parser, context | 32, 67174411);
|
|
5422
5434
|
const object = parseExpressions(parser, context, privateScope, 0, 1, parser.tokenStart);
|
|
5423
5435
|
consume(parser, context | 32, 16);
|
|
5424
|
-
const body = parseStatement(parser, context, scope, privateScope,
|
|
5436
|
+
const body = parseStatement(parser, context, scope, privateScope, labels, 0, 2);
|
|
5425
5437
|
return parser.finishNode({
|
|
5426
5438
|
type: 'WithStatement',
|
|
5427
5439
|
object,
|
|
@@ -5468,7 +5480,7 @@ function parseCatchBlock(parser, context, scope, privateScope, labels, start) {
|
|
|
5468
5480
|
scope = scope?.createChildScope(4);
|
|
5469
5481
|
param = parseBindingPattern(parser, context, scope, privateScope, (parser.getToken() & 2097152) === 2097152
|
|
5470
5482
|
? 256
|
|
5471
|
-
: 512
|
|
5483
|
+
: 512);
|
|
5472
5484
|
if (parser.getToken() === 18) {
|
|
5473
5485
|
parser.report(86);
|
|
5474
5486
|
}
|
|
@@ -5517,7 +5529,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
5517
5529
|
let expr = parseIdentifier(parser, context);
|
|
5518
5530
|
if (parser.getToken() & (143360 | 2097152) &&
|
|
5519
5531
|
(parser.getToken() & 20480) !== 20480) {
|
|
5520
|
-
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 8
|
|
5532
|
+
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 8);
|
|
5521
5533
|
matchOrInsertSemicolon(parser, context | 32);
|
|
5522
5534
|
return parser.finishNode({
|
|
5523
5535
|
type: 'VariableDeclaration',
|
|
@@ -5529,7 +5541,7 @@ function parseLetIdentOrVarDeclarationStatement(parser, context, scope, privateS
|
|
|
5529
5541
|
if (context & 1)
|
|
5530
5542
|
parser.report(85);
|
|
5531
5543
|
if (parser.getToken() === 21) {
|
|
5532
|
-
return parseLabelledStatement(parser, context, scope, privateScope,
|
|
5544
|
+
return parseLabelledStatement(parser, context, scope, privateScope, {}, tokenValue, expr, token, 0, tokenStart, origin);
|
|
5533
5545
|
}
|
|
5534
5546
|
if (parser.getToken() === 10) {
|
|
5535
5547
|
let scope = void 0;
|
|
@@ -5583,20 +5595,23 @@ function nextTokenIsUsingOnSameLine(parser) {
|
|
|
5583
5595
|
function isResourceBindingStart(token) {
|
|
5584
5596
|
return (token & 143360) === 143360 && (token & 20480) !== 20480;
|
|
5585
5597
|
}
|
|
5586
|
-
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5598
|
+
function parseUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin) {
|
|
5587
5599
|
const { tokenStart, tokenValue } = parser;
|
|
5588
5600
|
const token = parser.getToken();
|
|
5589
5601
|
const expression = parseIdentifier(parser, context);
|
|
5590
5602
|
if ((parser.flags & 1) === 0 && isResourceBindingStart(parser.getToken())) {
|
|
5591
|
-
if (origin & 4 &&
|
|
5603
|
+
if (origin & 4 &&
|
|
5604
|
+
context & 8 &&
|
|
5605
|
+
(context & 2) === 0 &&
|
|
5606
|
+
(context & 4096) === 0) {
|
|
5592
5607
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
5593
5608
|
}
|
|
5594
5609
|
return parseLexicalDeclaration(parser, context, scope, privateScope, 16, origin, 'using', tokenStart, 1);
|
|
5595
5610
|
}
|
|
5596
5611
|
parser.assignable = 1;
|
|
5597
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5612
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, 1, expression, token, tokenValue, tokenStart, origin);
|
|
5598
5613
|
}
|
|
5599
|
-
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope,
|
|
5614
|
+
function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope, privateScope, labels, origin) {
|
|
5600
5615
|
const start = parser.tokenStart;
|
|
5601
5616
|
if (context & 524288)
|
|
5602
5617
|
parser.report(179);
|
|
@@ -5620,9 +5635,9 @@ function parseAwaitUsingDeclarationOrExpressionStatement(parser, context, scope,
|
|
|
5620
5635
|
type: 'AwaitExpression',
|
|
5621
5636
|
argument,
|
|
5622
5637
|
}, start);
|
|
5623
|
-
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope,
|
|
5638
|
+
return finishExpressionOrLabelledStatement(parser, context, scope, privateScope, labels, 0, expression, 1048576, '', start, origin);
|
|
5624
5639
|
}
|
|
5625
|
-
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5640
|
+
function parseLexicalDeclaration(parser, context, scope, privateScope, kind, origin = 0, declarationKind, declarationStart = parser.tokenStart, keywordConsumed = 0) {
|
|
5626
5641
|
const start = declarationStart;
|
|
5627
5642
|
if (!keywordConsumed)
|
|
5628
5643
|
nextToken(parser, context);
|
|
@@ -5634,7 +5649,7 @@ function parseLexicalDeclaration(parser, context, scope, privateScope, kind, ori
|
|
|
5634
5649
|
declarations,
|
|
5635
5650
|
}, start);
|
|
5636
5651
|
}
|
|
5637
|
-
function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
5652
|
+
function parseVariableStatement(parser, context, scope, privateScope, origin = 0) {
|
|
5638
5653
|
const start = parser.tokenStart;
|
|
5639
5654
|
nextToken(parser, context);
|
|
5640
5655
|
const declarations = parseVariableDeclarationList(parser, context, scope, privateScope, 4, origin);
|
|
@@ -5645,7 +5660,7 @@ function parseVariableStatement(parser, context, scope, privateScope, origin) {
|
|
|
5645
5660
|
declarations,
|
|
5646
5661
|
}, start);
|
|
5647
5662
|
}
|
|
5648
|
-
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin, declarationKind) {
|
|
5663
|
+
function parseVariableDeclarationList(parser, context, scope, privateScope, kind, origin = 0, declarationKind) {
|
|
5649
5664
|
let bindingCount = 1;
|
|
5650
5665
|
const firstDeclaration = parseVariableDeclaration(parser, context, scope, privateScope, kind, origin, declarationKind);
|
|
5651
5666
|
const list = [firstDeclaration];
|
|
@@ -5676,11 +5691,14 @@ function parseVariableDeclaration(parser, context, scope, privateScope, kind, or
|
|
|
5676
5691
|
const id = parseBindingPattern(parser, context, scope, privateScope, kind, origin);
|
|
5677
5692
|
if (parser.getToken() === 1077936155) {
|
|
5678
5693
|
nextToken(parser, context | 32);
|
|
5679
|
-
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart);
|
|
5694
|
+
init = parseExpression(parser, context, privateScope, 1, 0, parser.tokenStart, origin);
|
|
5680
5695
|
if (origin & 32) {
|
|
5681
5696
|
if (parser.getToken() === 471156 ||
|
|
5682
5697
|
(parser.getToken() === 8673330 &&
|
|
5683
|
-
(token & 2097152 ||
|
|
5698
|
+
(token & 2097152 ||
|
|
5699
|
+
(kind & 4) === 0 ||
|
|
5700
|
+
context & 1 ||
|
|
5701
|
+
!parser.options.webcompat))) {
|
|
5684
5702
|
throw new ParseError(tokenStart, parser.currentLocation, 60, parser.getToken() === 471156 ? 'of' : 'in');
|
|
5685
5703
|
}
|
|
5686
5704
|
}
|
|
@@ -5953,7 +5971,7 @@ function parseRestrictedIdentifier(parser, context, scope) {
|
|
|
5953
5971
|
parser.report(120);
|
|
5954
5972
|
if ((parser.getToken() & 537079808) === 537079808)
|
|
5955
5973
|
parser.report(121);
|
|
5956
|
-
scope?.addBlockName(context, parser.tokenValue, 8
|
|
5974
|
+
scope?.addBlockName(context, parser.tokenValue, 8);
|
|
5957
5975
|
return parseIdentifier(parser, context);
|
|
5958
5976
|
}
|
|
5959
5977
|
function parseImportDeclaration(parser, context, scope) {
|
|
@@ -5981,7 +5999,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
5981
5999
|
specifiers = [parseImportNamespaceSpecifier(parser, context, scope)];
|
|
5982
6000
|
}
|
|
5983
6001
|
else if (parser.getToken() === 209011 || parser.getToken() === 18) {
|
|
5984
|
-
scope?.addBlockName(context, tokenValue, 8
|
|
6002
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
5985
6003
|
specifiers = [
|
|
5986
6004
|
parser.finishNode({
|
|
5987
6005
|
type: 'ImportDefaultSpecifier',
|
|
@@ -5999,7 +6017,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
5999
6017
|
const fromLocal = parseIdentifier(parser, context);
|
|
6000
6018
|
if (parser.getToken() === 209011) {
|
|
6001
6019
|
validateBindingIdentifier(parser, context, 16, fromToken, 0);
|
|
6002
|
-
scope?.addBlockName(context, fromLocal.name, 8
|
|
6020
|
+
scope?.addBlockName(context, fromLocal.name, 8);
|
|
6003
6021
|
phase = 'source';
|
|
6004
6022
|
specifiers = [
|
|
6005
6023
|
parser.finishNode({
|
|
@@ -6009,7 +6027,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
6009
6027
|
];
|
|
6010
6028
|
}
|
|
6011
6029
|
else {
|
|
6012
|
-
scope?.addBlockName(context, tokenValue, 8
|
|
6030
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6013
6031
|
specifiers = [
|
|
6014
6032
|
parser.finishNode({
|
|
6015
6033
|
type: 'ImportDefaultSpecifier',
|
|
@@ -6034,7 +6052,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
6034
6052
|
];
|
|
6035
6053
|
}
|
|
6036
6054
|
else if (parser.getToken() === 18) {
|
|
6037
|
-
scope?.addBlockName(context, tokenValue, 8
|
|
6055
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6038
6056
|
specifiers = [
|
|
6039
6057
|
parser.finishNode({
|
|
6040
6058
|
type: 'ImportDefaultSpecifier',
|
|
@@ -6141,7 +6159,7 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
|
|
|
6141
6159
|
else {
|
|
6142
6160
|
parser.report(25, KeywordDescTable[77932 & 255]);
|
|
6143
6161
|
}
|
|
6144
|
-
scope?.addBlockName(context, tokenValue, 8
|
|
6162
|
+
scope?.addBlockName(context, tokenValue, 8);
|
|
6145
6163
|
specifiers.push(parser.finishNode({
|
|
6146
6164
|
type: 'ImportSpecifier',
|
|
6147
6165
|
local,
|
|
@@ -6187,7 +6205,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6187
6205
|
if (isDefaultExport) {
|
|
6188
6206
|
switch (parser.getToken()) {
|
|
6189
6207
|
case 86104: {
|
|
6190
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6208
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 0, parser.tokenStart, 4);
|
|
6191
6209
|
break;
|
|
6192
6210
|
}
|
|
6193
6211
|
case 133:
|
|
@@ -6203,11 +6221,11 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6203
6221
|
const { flags } = parser;
|
|
6204
6222
|
if ((flags & 1) === 0) {
|
|
6205
6223
|
if (parser.getToken() === 86104) {
|
|
6206
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6224
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 1, 1, tokenStart, 4);
|
|
6207
6225
|
}
|
|
6208
6226
|
else {
|
|
6209
6227
|
if (parser.getToken() === 67174411) {
|
|
6210
|
-
declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1,
|
|
6228
|
+
declaration = parseAsyncArrowOrCallExpression(parser, context, undefined, declaration, 1, 1, flags, tokenStart);
|
|
6211
6229
|
declaration = parseMemberOrUpdateExpression(parser, context, undefined, declaration, 0, 0, tokenStart);
|
|
6212
6230
|
declaration = parseAssignmentExpression(parser, context, undefined, 0, 0, tokenStart, declaration);
|
|
6213
6231
|
}
|
|
@@ -6324,7 +6342,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6324
6342
|
declaration = parseClassDeclaration(parser, context, scope, undefined, 2);
|
|
6325
6343
|
break;
|
|
6326
6344
|
case 86104:
|
|
6327
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6345
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 2, 0, parser.tokenStart, 4);
|
|
6328
6346
|
break;
|
|
6329
6347
|
case 241737:
|
|
6330
6348
|
declaration = parseLexicalDeclaration(parser, context, scope, undefined, 8, 64);
|
|
@@ -6339,7 +6357,7 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6339
6357
|
const { tokenStart } = parser;
|
|
6340
6358
|
nextToken(parser, context);
|
|
6341
6359
|
if ((parser.flags & 1) === 0 && parser.getToken() === 86104) {
|
|
6342
|
-
declaration = parseFunctionDeclaration(parser, context, scope, undefined,
|
|
6360
|
+
declaration = parseFunctionDeclaration(parser, context, scope, undefined, 1, 2, 1, tokenStart, 4);
|
|
6343
6361
|
break;
|
|
6344
6362
|
}
|
|
6345
6363
|
}
|
|
@@ -6355,8 +6373,8 @@ function parseExportDeclaration(parser, context, scope) {
|
|
|
6355
6373
|
};
|
|
6356
6374
|
return parser.finishNode(node, start);
|
|
6357
6375
|
}
|
|
6358
|
-
function parseExpression(parser, context, privateScope, canAssign, inGroup, start) {
|
|
6359
|
-
let expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, canAssign, inGroup, 1, start);
|
|
6376
|
+
function parseExpression(parser, context, privateScope, canAssign, inGroup, start, origin = 0) {
|
|
6377
|
+
let expr = parsePrimaryExpression(parser, context, privateScope, 2, 0, canAssign, inGroup, 1, start, origin);
|
|
6360
6378
|
expr = parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6361
6379
|
return parseAssignmentExpression(parser, context, privateScope, inGroup, 0, start, expr);
|
|
6362
6380
|
}
|
|
@@ -6511,7 +6529,7 @@ function parseAsyncExpression(parser, context, privateScope, inGroup, isLHS, can
|
|
|
6511
6529
|
}
|
|
6512
6530
|
}
|
|
6513
6531
|
if (!inNew && parser.getToken() === 67174411) {
|
|
6514
|
-
return parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, canAssign, 1,
|
|
6532
|
+
return parseAsyncArrowOrCallExpression(parser, context, privateScope, expr, canAssign, 1, flags, start);
|
|
6515
6533
|
}
|
|
6516
6534
|
if (parser.getToken() === 10) {
|
|
6517
6535
|
classifyIdentifier(parser, context, token);
|
|
@@ -6559,8 +6577,12 @@ function parseYieldExpressionOrIdentifier(parser, context, privateScope, inGroup
|
|
|
6559
6577
|
return parseIdentifierOrArrow(parser, context, privateScope);
|
|
6560
6578
|
}
|
|
6561
6579
|
function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew, inGroup, start) {
|
|
6562
|
-
if (inGroup)
|
|
6580
|
+
if (inGroup) {
|
|
6581
|
+
if ((parser.destructible & 128) === 0) {
|
|
6582
|
+
parser.firstAwaitLocation ??= { start, end: parser.currentLocation };
|
|
6583
|
+
}
|
|
6563
6584
|
parser.destructible |= 128;
|
|
6585
|
+
}
|
|
6564
6586
|
if (context & 524288)
|
|
6565
6587
|
parser.report(179);
|
|
6566
6588
|
const possibleIdentifierOrArrowFunc = parseIdentifierOrArrow(parser, context, privateScope);
|
|
@@ -6594,7 +6616,7 @@ function parseAwaitExpressionOrIdentifier(parser, context, privateScope, inNew,
|
|
|
6594
6616
|
throw new ParseError(start, { index: parser.startIndex, line: parser.startLine, column: parser.startColumn }, 98);
|
|
6595
6617
|
return possibleIdentifierOrArrowFunc;
|
|
6596
6618
|
}
|
|
6597
|
-
function parseFunctionBody(parser, context, scope, privateScope,
|
|
6619
|
+
function parseFunctionBody(parser, context, scope, privateScope, funcNameToken, functionScope, origin = 0) {
|
|
6598
6620
|
const { tokenStart } = parser;
|
|
6599
6621
|
parser.flags &= -4161;
|
|
6600
6622
|
consume(parser, context | 32, 2162700);
|
|
@@ -6643,7 +6665,7 @@ function parseFunctionBody(parser, context, scope, privateScope, origin, funcNam
|
|
|
6643
6665
|
(512 | 256 | 64 | 4096);
|
|
6644
6666
|
parser.destructible = (parser.destructible | 256) ^ 256;
|
|
6645
6667
|
while (parser.getToken() !== 1074790415) {
|
|
6646
|
-
body.push(parseStatementListItem(parser, context, scope, privateScope,
|
|
6668
|
+
body.push(parseStatementListItem(parser, context, scope, privateScope, {}, 4));
|
|
6647
6669
|
}
|
|
6648
6670
|
consume(parser, origin & (16 | 8) ? context | 32 : context, 1074790415);
|
|
6649
6671
|
parser.flags &= -4289;
|
|
@@ -6892,7 +6914,7 @@ function parseUpdateExpressionPrefixed(parser, context, privateScope, inNew, isL
|
|
|
6892
6914
|
prefix: true,
|
|
6893
6915
|
}, start);
|
|
6894
6916
|
}
|
|
6895
|
-
function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canAssign, inGroup, isLHS, start) {
|
|
6917
|
+
function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canAssign, inGroup, isLHS, start, origin = 0) {
|
|
6896
6918
|
if ((parser.getToken() & 143360) === 143360) {
|
|
6897
6919
|
switch (parser.getToken()) {
|
|
6898
6920
|
case 209006:
|
|
@@ -6912,7 +6934,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6912
6934
|
if ((token & 36864) === 36864) {
|
|
6913
6935
|
parser.flags |= 256;
|
|
6914
6936
|
}
|
|
6915
|
-
return parseArrowFromIdentifier(parser, context, privateScope, tokenValue, expr, inNew, canAssign, 0, start);
|
|
6937
|
+
return parseArrowFromIdentifier(parser, context, privateScope, tokenValue, expr, inNew, canAssign, 0, start, origin);
|
|
6916
6938
|
}
|
|
6917
6939
|
if (context & 16 &&
|
|
6918
6940
|
!(context & 32768) &&
|
|
@@ -6953,7 +6975,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6953
6975
|
case 69271571:
|
|
6954
6976
|
return parseArrayLiteral(parser, context, privateScope, canAssign ? 0 : 1, inGroup);
|
|
6955
6977
|
case 67174411:
|
|
6956
|
-
return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1,
|
|
6978
|
+
return parseParenthesizedExpression(parser, context | 64, privateScope, canAssign, 1, start, origin);
|
|
6957
6979
|
case 86021:
|
|
6958
6980
|
case 86022:
|
|
6959
6981
|
case 86023:
|
|
@@ -7282,7 +7304,7 @@ function parseThisExpression(parser, context) {
|
|
|
7282
7304
|
type: 'ThisExpression',
|
|
7283
7305
|
}, tokenStart);
|
|
7284
7306
|
}
|
|
7285
|
-
function parseFunctionDeclaration(parser, context, scope, privateScope,
|
|
7307
|
+
function parseFunctionDeclaration(parser, context, scope, privateScope, allowGen, flags, isAsync, start, origin = 0) {
|
|
7286
7308
|
nextToken(parser, context | 32);
|
|
7287
7309
|
const isGenerator = allowGen ? optionalBit(parser, context, 8391476) : 0;
|
|
7288
7310
|
let id = null;
|
|
@@ -7336,7 +7358,7 @@ function parseFunctionDeclaration(parser, context, scope, privateScope, origin,
|
|
|
7336
7358
|
functionScope = functionScope?.createChildScope(256);
|
|
7337
7359
|
const params = parseFormalParametersOrFormalList(parser, (context | 8192) & -524289, functionScope, privateScope, 0, 1);
|
|
7338
7360
|
const modifierFlags = 8 | 4 | 128 | 524288;
|
|
7339
|
-
const body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 32768 | 4096, functionScope?.createChildScope(64), privateScope,
|
|
7361
|
+
const body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 32768 | 4096, functionScope?.createChildScope(64), privateScope, funcNameToken, functionScope, 8);
|
|
7340
7362
|
return parser.finishNode({
|
|
7341
7363
|
type: 'FunctionDeclaration',
|
|
7342
7364
|
id,
|
|
@@ -7375,7 +7397,7 @@ function parseFunctionExpression(parser, context, privateScope, isAsync, inGroup
|
|
|
7375
7397
|
const params = parseFormalParametersOrFormalList(parser, (context | 8192) & -524289, scope, privateScope, inGroup, 1);
|
|
7376
7398
|
const body = parseFunctionBody(parser, (context & -131229) |
|
|
7377
7399
|
32768 |
|
|
7378
|
-
4096, scope?.createChildScope(64), privateScope,
|
|
7400
|
+
4096, scope?.createChildScope(64), privateScope, funcNameToken, scope);
|
|
7379
7401
|
parser.assignable = 2;
|
|
7380
7402
|
return parser.finishNode({
|
|
7381
7403
|
type: 'FunctionExpression',
|
|
@@ -7387,7 +7409,7 @@ function parseFunctionExpression(parser, context, privateScope, isAsync, inGroup
|
|
|
7387
7409
|
}, start);
|
|
7388
7410
|
}
|
|
7389
7411
|
function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGroup) {
|
|
7390
|
-
const expr = parseArrayExpressionOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2
|
|
7412
|
+
const expr = parseArrayExpressionOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2);
|
|
7391
7413
|
if (parser.destructible & 64) {
|
|
7392
7414
|
parser.report(63);
|
|
7393
7415
|
}
|
|
@@ -7396,7 +7418,7 @@ function parseArrayLiteral(parser, context, privateScope, skipInitializer, inGro
|
|
|
7396
7418
|
}
|
|
7397
7419
|
return expr;
|
|
7398
7420
|
}
|
|
7399
|
-
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin) {
|
|
7421
|
+
function parseArrayExpressionOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
7400
7422
|
const { tokenStart: start } = parser;
|
|
7401
7423
|
nextToken(parser, context | 32);
|
|
7402
7424
|
const elements = [];
|
|
@@ -7505,7 +7527,7 @@ function parseArrayExpressionOrPattern(parser, context, scope, privateScope, ski
|
|
|
7505
7527
|
}
|
|
7506
7528
|
}
|
|
7507
7529
|
else if (token === 14) {
|
|
7508
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 20, kind,
|
|
7530
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 20, kind, 0, inGroup, isPattern, origin);
|
|
7509
7531
|
destructible |= parser.destructible;
|
|
7510
7532
|
if (parser.getToken() !== 18 && parser.getToken() !== 20)
|
|
7511
7533
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
@@ -7575,7 +7597,7 @@ function parseArrayOrObjectAssignmentPattern(parser, context, privateScope, dest
|
|
|
7575
7597
|
right,
|
|
7576
7598
|
}, start);
|
|
7577
7599
|
}
|
|
7578
|
-
function parseSpreadOrRestElement(parser, context, scope, privateScope, closingToken, kind,
|
|
7600
|
+
function parseSpreadOrRestElement(parser, context, scope, privateScope, closingToken, kind, isAsync, inGroup, isPattern, origin = 0) {
|
|
7579
7601
|
const { tokenStart: start } = parser;
|
|
7580
7602
|
nextToken(parser, context | 32);
|
|
7581
7603
|
let argument = null;
|
|
@@ -7724,7 +7746,7 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
|
|
|
7724
7746
|
scope = scope?.createChildScope(64);
|
|
7725
7747
|
const body = parseFunctionBody(parser, (context & -655373) |
|
|
7726
7748
|
32768 |
|
|
7727
|
-
4096, scope, privateScope,
|
|
7749
|
+
4096, scope, privateScope, void 0, scope?.parent);
|
|
7728
7750
|
return parser.finishNode({
|
|
7729
7751
|
type: 'FunctionExpression',
|
|
7730
7752
|
params,
|
|
@@ -7735,7 +7757,7 @@ function parseMethodDefinition(parser, context, privateScope, kind, inGroup, sta
|
|
|
7735
7757
|
}, start);
|
|
7736
7758
|
}
|
|
7737
7759
|
function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGroup) {
|
|
7738
|
-
const expr = parseObjectLiteralOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2
|
|
7760
|
+
const expr = parseObjectLiteralOrPattern(parser, context, void 0, privateScope, skipInitializer, inGroup, 0, 2);
|
|
7739
7761
|
if (parser.destructible & 64) {
|
|
7740
7762
|
parser.report(63);
|
|
7741
7763
|
}
|
|
@@ -7744,7 +7766,7 @@ function parseObjectLiteral(parser, context, privateScope, skipInitializer, inGr
|
|
|
7744
7766
|
}
|
|
7745
7767
|
return expr;
|
|
7746
7768
|
}
|
|
7747
|
-
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin) {
|
|
7769
|
+
function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipInitializer, inGroup, isPattern, kind, origin = 0) {
|
|
7748
7770
|
const { tokenStart: start } = parser;
|
|
7749
7771
|
nextToken(parser, context);
|
|
7750
7772
|
const properties = [];
|
|
@@ -7755,7 +7777,7 @@ function parseObjectLiteralOrPattern(parser, context, scope, privateScope, skipI
|
|
|
7755
7777
|
const { tokenValue, tokenStart } = parser;
|
|
7756
7778
|
const token = parser.getToken();
|
|
7757
7779
|
if (token === 14) {
|
|
7758
|
-
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind,
|
|
7780
|
+
properties.push(parseSpreadOrRestElement(parser, context, scope, privateScope, 1074790415, kind, 0, inGroup, isPattern, origin));
|
|
7759
7781
|
}
|
|
7760
7782
|
else {
|
|
7761
7783
|
let state = 0;
|
|
@@ -8283,6 +8305,7 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
8283
8305
|
const params = [];
|
|
8284
8306
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8285
8307
|
parser.strictReservedRange = null;
|
|
8308
|
+
parser.firstAwaitLocation = null;
|
|
8286
8309
|
if (parser.getToken() === 16) {
|
|
8287
8310
|
if (kind & 512) {
|
|
8288
8311
|
parser.report(37, 'Setter', 'one', '');
|
|
@@ -8312,17 +8335,17 @@ function parseMethodFormals(parser, context, scope, privateScope, kind, type, in
|
|
|
8312
8335
|
parser.flags |= 512;
|
|
8313
8336
|
}
|
|
8314
8337
|
}
|
|
8315
|
-
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1
|
|
8338
|
+
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
|
|
8316
8339
|
}
|
|
8317
8340
|
else {
|
|
8318
8341
|
if (parser.getToken() === 2162700) {
|
|
8319
|
-
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type
|
|
8342
|
+
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type);
|
|
8320
8343
|
}
|
|
8321
8344
|
else if (parser.getToken() === 69271571) {
|
|
8322
|
-
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type
|
|
8345
|
+
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, type);
|
|
8323
8346
|
}
|
|
8324
8347
|
else if (parser.getToken() === 14) {
|
|
8325
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, type, 0,
|
|
8348
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, type, 0, inGroup, 1);
|
|
8326
8349
|
}
|
|
8327
8350
|
isNonSimpleParameterList = 1;
|
|
8328
8351
|
if (parser.destructible & (32 | 16))
|
|
@@ -8361,17 +8384,20 @@ function parseComputedPropertyName(parser, context, privateScope, inGroup) {
|
|
|
8361
8384
|
consume(parser, context, 20);
|
|
8362
8385
|
return key;
|
|
8363
8386
|
}
|
|
8364
|
-
function parseParenthesizedExpression(parser, context, privateScope, canAssign, kind,
|
|
8387
|
+
function parseParenthesizedExpression(parser, context, privateScope, canAssign, kind, start, origin) {
|
|
8365
8388
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8366
8389
|
const parenthesesStart = parser.tokenStart;
|
|
8367
8390
|
nextToken(parser, context | 32 | 262144);
|
|
8368
8391
|
const scope = parser.createScopeIfLexical()?.createChildScope(512);
|
|
8369
8392
|
context = (context | 131072) ^ 131072;
|
|
8370
8393
|
if (consumeOpt(parser, context, 16)) {
|
|
8371
|
-
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 0, start);
|
|
8394
|
+
return parseParenthesizedArrow(parser, context, scope, privateScope, [], canAssign, 0, start, origin);
|
|
8372
8395
|
}
|
|
8373
8396
|
let destructible = 0;
|
|
8397
|
+
const previousAwaitYield = parser.destructible & (256 | 128);
|
|
8374
8398
|
parser.destructible &= -385;
|
|
8399
|
+
const previousFirstAwaitLocation = parser.firstAwaitLocation;
|
|
8400
|
+
parser.firstAwaitLocation = null;
|
|
8375
8401
|
let expr;
|
|
8376
8402
|
let expressions = [];
|
|
8377
8403
|
let isSequence = 0;
|
|
@@ -8383,14 +8409,14 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8383
8409
|
const { tokenStart } = parser;
|
|
8384
8410
|
const token = parser.getToken();
|
|
8385
8411
|
if (token & 143360) {
|
|
8386
|
-
scope?.addBlockName(context, parser.tokenValue, 1
|
|
8412
|
+
scope?.addBlockName(context, parser.tokenValue, 1);
|
|
8387
8413
|
if ((token & 537079808) === 537079808) {
|
|
8388
8414
|
isNonSimpleParameterList = 1;
|
|
8389
8415
|
}
|
|
8390
8416
|
else if ((token & 36864) === 36864) {
|
|
8391
8417
|
hasStrictReserved = 1;
|
|
8392
8418
|
}
|
|
8393
|
-
expr = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, 1, 1, tokenStart);
|
|
8419
|
+
expr = parsePrimaryExpression(parser, context, privateScope, kind, 0, 1, 1, 1, tokenStart, 0);
|
|
8394
8420
|
if (parser.getToken() === 16 || parser.getToken() === 18) {
|
|
8395
8421
|
if (parser.assignable & 2) {
|
|
8396
8422
|
destructible |= 16;
|
|
@@ -8413,8 +8439,8 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8413
8439
|
else if ((token & 2097152) === 2097152) {
|
|
8414
8440
|
expr =
|
|
8415
8441
|
token === 2162700
|
|
8416
|
-
? parseObjectLiteralOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind
|
|
8417
|
-
: parseArrayExpressionOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind
|
|
8442
|
+
? parseObjectLiteralOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind)
|
|
8443
|
+
: parseArrayExpressionOrPattern(parser, context | 262144, scope, privateScope, 0, 1, 0, kind);
|
|
8418
8444
|
destructible |= parser.destructible;
|
|
8419
8445
|
isNonSimpleParameterList = 1;
|
|
8420
8446
|
parser.assignable = 2;
|
|
@@ -8429,7 +8455,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8429
8455
|
}
|
|
8430
8456
|
}
|
|
8431
8457
|
else if (token === 14) {
|
|
8432
|
-
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind,
|
|
8458
|
+
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0, 1, 0);
|
|
8433
8459
|
if (parser.destructible & 16)
|
|
8434
8460
|
parser.report(74);
|
|
8435
8461
|
isNonSimpleParameterList = 1;
|
|
@@ -8462,7 +8488,10 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8462
8488
|
}, tokenAfterParenthesesStart);
|
|
8463
8489
|
}
|
|
8464
8490
|
consume(parser, context, 16);
|
|
8465
|
-
parser.destructible = destructible;
|
|
8491
|
+
parser.destructible = destructible | previousAwaitYield;
|
|
8492
|
+
if (previousFirstAwaitLocation) {
|
|
8493
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8494
|
+
}
|
|
8466
8495
|
return parser.options.preserveParens
|
|
8467
8496
|
? parser.finishNode({
|
|
8468
8497
|
type: 'ParenthesizedExpression',
|
|
@@ -8503,8 +8532,12 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8503
8532
|
if (parser.getToken() === 10) {
|
|
8504
8533
|
if (destructible & (32 | 16))
|
|
8505
8534
|
parser.report(49);
|
|
8506
|
-
if (context & (2048 | 2) && destructible & 128)
|
|
8535
|
+
if (context & (2048 | 2) && destructible & 128) {
|
|
8536
|
+
const loc = parser.firstAwaitLocation;
|
|
8537
|
+
if (loc)
|
|
8538
|
+
throw new ParseError(loc.start, loc.end, 31);
|
|
8507
8539
|
parser.report(31);
|
|
8540
|
+
}
|
|
8508
8541
|
if (context & (1 | 1024) && destructible & 256) {
|
|
8509
8542
|
parser.report(32);
|
|
8510
8543
|
}
|
|
@@ -8512,7 +8545,7 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8512
8545
|
parser.flags |= 128;
|
|
8513
8546
|
if (hasStrictReserved)
|
|
8514
8547
|
parser.flags |= 256;
|
|
8515
|
-
return parseParenthesizedArrow(parser, context, scope, privateScope, isSequence ? expressions : [expr], canAssign, 0, start);
|
|
8548
|
+
return parseParenthesizedArrow(parser, context, scope, privateScope, isSequence ? expressions : [expr], canAssign, 0, start, origin);
|
|
8516
8549
|
}
|
|
8517
8550
|
if (destructible & 64) {
|
|
8518
8551
|
parser.report(63);
|
|
@@ -8520,7 +8553,11 @@ function parseParenthesizedExpression(parser, context, privateScope, canAssign,
|
|
|
8520
8553
|
if (destructible & 8) {
|
|
8521
8554
|
parser.report(146);
|
|
8522
8555
|
}
|
|
8523
|
-
parser.destructible =
|
|
8556
|
+
parser.destructible =
|
|
8557
|
+
((parser.destructible | 256) ^ 256) | destructible | previousAwaitYield;
|
|
8558
|
+
if (previousFirstAwaitLocation) {
|
|
8559
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8560
|
+
}
|
|
8524
8561
|
return parser.options.preserveParens
|
|
8525
8562
|
? parser.finishNode({
|
|
8526
8563
|
type: 'ParenthesizedExpression',
|
|
@@ -8551,23 +8588,23 @@ function parseIdentifierOrArrow(parser, context, privateScope) {
|
|
|
8551
8588
|
}
|
|
8552
8589
|
return expr;
|
|
8553
8590
|
}
|
|
8554
|
-
function parseArrowFromIdentifier(parser, context, privateScope, value, expr, inNew, canAssign, isAsync, start) {
|
|
8591
|
+
function parseArrowFromIdentifier(parser, context, privateScope, value, expr, inNew, canAssign, isAsync, start, origin = 0) {
|
|
8555
8592
|
if (!canAssign)
|
|
8556
8593
|
parser.report(57);
|
|
8557
8594
|
if (inNew)
|
|
8558
8595
|
parser.report(51);
|
|
8559
8596
|
parser.flags &= -129;
|
|
8560
8597
|
const scope = parser.options.lexical ? createArrowHeadParsingScope(parser, context, value) : void 0;
|
|
8561
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start);
|
|
8598
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, [expr], isAsync, start, origin);
|
|
8562
8599
|
}
|
|
8563
|
-
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start) {
|
|
8600
|
+
function parseParenthesizedArrow(parser, context, scope, privateScope, params, canAssign, isAsync, start, origin = 0) {
|
|
8564
8601
|
if (!canAssign)
|
|
8565
8602
|
parser.report(57);
|
|
8566
8603
|
for (let i = 0; i < params.length; ++i)
|
|
8567
8604
|
reinterpretToPattern(parser, params[i]);
|
|
8568
|
-
return parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start);
|
|
8605
|
+
return parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start, origin);
|
|
8569
8606
|
}
|
|
8570
|
-
function parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start) {
|
|
8607
|
+
function parseArrowFunctionExpression(parser, context, scope, privateScope, params, isAsync, start, origin = 0) {
|
|
8571
8608
|
if (parser.flags & 1)
|
|
8572
8609
|
parser.report(48);
|
|
8573
8610
|
consume(parser, context | 32, 10);
|
|
@@ -8585,7 +8622,7 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
8585
8622
|
else {
|
|
8586
8623
|
scope = scope?.createChildScope(64);
|
|
8587
8624
|
const modifierFlags = 4 | 131072 | 8;
|
|
8588
|
-
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope,
|
|
8625
|
+
body = parseFunctionBody(parser, ((context | modifierFlags) ^ modifierFlags) | 4096, scope, privateScope, void 0, void 0, 16);
|
|
8589
8626
|
switch (parser.getToken()) {
|
|
8590
8627
|
case 69271571:
|
|
8591
8628
|
if ((parser.flags & 1) === 0) {
|
|
@@ -8604,8 +8641,11 @@ function parseArrowFunctionExpression(parser, context, scope, privateScope, para
|
|
|
8604
8641
|
parser.flags |= 1024;
|
|
8605
8642
|
break;
|
|
8606
8643
|
}
|
|
8607
|
-
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0)
|
|
8608
|
-
|
|
8644
|
+
if ((parser.getToken() & 8388608) === 8388608 && (parser.flags & 1) === 0) {
|
|
8645
|
+
if (parser.getToken() !== 8673330 || origin !== 32) {
|
|
8646
|
+
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
8647
|
+
}
|
|
8648
|
+
}
|
|
8609
8649
|
if ((parser.getToken() & 33619968) === 33619968)
|
|
8610
8650
|
parser.report(127);
|
|
8611
8651
|
}
|
|
@@ -8623,6 +8663,7 @@ function parseFormalParametersOrFormalList(parser, context, scope, privateScope,
|
|
|
8623
8663
|
consume(parser, context, 67174411);
|
|
8624
8664
|
parser.flags = (parser.flags | 128) ^ 128;
|
|
8625
8665
|
parser.strictReservedRange = null;
|
|
8666
|
+
parser.firstAwaitLocation = null;
|
|
8626
8667
|
const params = [];
|
|
8627
8668
|
if (consumeOpt(parser, context, 16))
|
|
8628
8669
|
return params;
|
|
@@ -8642,17 +8683,17 @@ function parseFormalParametersOrFormalList(parser, context, scope, privateScope,
|
|
|
8642
8683
|
parser.flags |= 512;
|
|
8643
8684
|
}
|
|
8644
8685
|
}
|
|
8645
|
-
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1
|
|
8686
|
+
left = parseAndClassifyIdentifier(parser, context, scope, kind | 1);
|
|
8646
8687
|
}
|
|
8647
8688
|
else {
|
|
8648
8689
|
if (token === 2162700) {
|
|
8649
|
-
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind
|
|
8690
|
+
left = parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind);
|
|
8650
8691
|
}
|
|
8651
8692
|
else if (token === 69271571) {
|
|
8652
|
-
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind
|
|
8693
|
+
left = parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, inGroup, 1, kind);
|
|
8653
8694
|
}
|
|
8654
8695
|
else if (token === 14) {
|
|
8655
|
-
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0,
|
|
8696
|
+
left = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 0, inGroup, 1);
|
|
8656
8697
|
}
|
|
8657
8698
|
else {
|
|
8658
8699
|
parser.report(30, KeywordDescTable[token & 255]);
|
|
@@ -8776,9 +8817,11 @@ function parseAsyncArrowAfterIdent(parser, context, privateScope, canAssign, sta
|
|
|
8776
8817
|
}
|
|
8777
8818
|
return parseArrowFromIdentifier(parser, (context & -524289) | 2048, privateScope, parser.tokenValue, parseIdentifier(parser, context), 0, canAssign, 1, start);
|
|
8778
8819
|
}
|
|
8779
|
-
function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee, canAssign, kind,
|
|
8820
|
+
function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee, canAssign, kind, flags, start) {
|
|
8780
8821
|
nextToken(parser, context | 32);
|
|
8781
8822
|
const scope = parser.createScopeIfLexical()?.createChildScope(512);
|
|
8823
|
+
const previousFirstAwaitLocation = parser.firstAwaitLocation;
|
|
8824
|
+
parser.firstAwaitLocation = null;
|
|
8782
8825
|
context = (context | 131072) ^ 131072;
|
|
8783
8826
|
if (consumeOpt(parser, context, 16)) {
|
|
8784
8827
|
if (parser.getToken() === 10) {
|
|
@@ -8792,6 +8835,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8792
8835
|
else {
|
|
8793
8836
|
parser.assignable = 2;
|
|
8794
8837
|
}
|
|
8838
|
+
if (previousFirstAwaitLocation)
|
|
8839
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8795
8840
|
return parser.finishNode({
|
|
8796
8841
|
type: 'CallExpression',
|
|
8797
8842
|
callee,
|
|
@@ -8810,7 +8855,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8810
8855
|
const { tokenStart } = parser;
|
|
8811
8856
|
const token = parser.getToken();
|
|
8812
8857
|
if (token & 143360) {
|
|
8813
|
-
scope?.addBlockName(context, parser.tokenValue, kind
|
|
8858
|
+
scope?.addBlockName(context, parser.tokenValue, kind);
|
|
8814
8859
|
if ((token & 537079808) === 537079808) {
|
|
8815
8860
|
parser.flags |= 512;
|
|
8816
8861
|
}
|
|
@@ -8840,8 +8885,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8840
8885
|
else if (token & 2097152) {
|
|
8841
8886
|
expr =
|
|
8842
8887
|
token === 2162700
|
|
8843
|
-
? parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind
|
|
8844
|
-
: parseArrayExpressionOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind
|
|
8888
|
+
? parseObjectLiteralOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind)
|
|
8889
|
+
: parseArrayExpressionOrPattern(parser, context, scope, privateScope, 0, 1, 0, kind);
|
|
8845
8890
|
destructible |= parser.destructible;
|
|
8846
8891
|
isNonSimpleParameterList = 1;
|
|
8847
8892
|
if (parser.getToken() !== 16 && parser.getToken() !== 18) {
|
|
@@ -8858,7 +8903,7 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8858
8903
|
}
|
|
8859
8904
|
}
|
|
8860
8905
|
else if (token === 14) {
|
|
8861
|
-
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind,
|
|
8906
|
+
expr = parseSpreadOrRestElement(parser, context, scope, privateScope, 16, kind, 1, 1, 0);
|
|
8862
8907
|
destructible |=
|
|
8863
8908
|
(parser.getToken() === 16 ? 0 : 16) | parser.destructible;
|
|
8864
8909
|
isNonSimpleParameterList = 1;
|
|
@@ -8879,6 +8924,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8879
8924
|
else {
|
|
8880
8925
|
parser.assignable = 2;
|
|
8881
8926
|
}
|
|
8927
|
+
if (previousFirstAwaitLocation)
|
|
8928
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8882
8929
|
return parser.finishNode({
|
|
8883
8930
|
type: 'CallExpression',
|
|
8884
8931
|
callee,
|
|
@@ -8902,8 +8949,12 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8902
8949
|
parser.report(27);
|
|
8903
8950
|
if (parser.flags & 1 || flags & 1)
|
|
8904
8951
|
parser.report(48);
|
|
8905
|
-
if (destructible & 128)
|
|
8952
|
+
if (destructible & 128) {
|
|
8953
|
+
const loc = parser.firstAwaitLocation;
|
|
8954
|
+
if (loc)
|
|
8955
|
+
throw new ParseError(loc.start, loc.end, 31);
|
|
8906
8956
|
parser.report(31);
|
|
8957
|
+
}
|
|
8907
8958
|
if (context & (1 | 1024) && destructible & 256)
|
|
8908
8959
|
parser.report(32);
|
|
8909
8960
|
if (isNonSimpleParameterList)
|
|
@@ -8922,6 +8973,8 @@ function parseAsyncArrowOrCallExpression(parser, context, privateScope, callee,
|
|
|
8922
8973
|
else {
|
|
8923
8974
|
parser.assignable = 2;
|
|
8924
8975
|
}
|
|
8976
|
+
if (previousFirstAwaitLocation)
|
|
8977
|
+
parser.firstAwaitLocation = previousFirstAwaitLocation;
|
|
8925
8978
|
return parser.finishNode({
|
|
8926
8979
|
type: 'CallExpression',
|
|
8927
8980
|
callee,
|
|
@@ -8968,7 +9021,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8968
9021
|
parser.report(121);
|
|
8969
9022
|
}
|
|
8970
9023
|
if (scope) {
|
|
8971
|
-
scope.addBlockName(context, tokenValue, 32
|
|
9024
|
+
scope.addBlockName(context, tokenValue, 32);
|
|
8972
9025
|
if (flags) {
|
|
8973
9026
|
if (flags & 2) {
|
|
8974
9027
|
parser.declareUnboundVariable(tokenValue);
|
|
@@ -8989,7 +9042,7 @@ function parseClassDeclaration(parser, context, scope, privateScope, flags) {
|
|
|
8989
9042
|
else {
|
|
8990
9043
|
inheritedContext = (inheritedContext | 512) ^ 512;
|
|
8991
9044
|
}
|
|
8992
|
-
const body = parseClassBody(parser, inheritedContext, context, scope, privateScope, 2,
|
|
9045
|
+
const body = parseClassBody(parser, inheritedContext, context, scope, privateScope, 2, 0, 8);
|
|
8993
9046
|
return parser.finishNode({
|
|
8994
9047
|
type: 'ClassDeclaration',
|
|
8995
9048
|
id,
|
|
@@ -9020,7 +9073,7 @@ function parseClassExpression(parser, context, privateScope, inGroup, start) {
|
|
|
9020
9073
|
else {
|
|
9021
9074
|
inheritedContext = (inheritedContext | 512) ^ 512;
|
|
9022
9075
|
}
|
|
9023
|
-
const body = parseClassBody(parser, inheritedContext, context, void 0, privateScope, 2,
|
|
9076
|
+
const body = parseClassBody(parser, inheritedContext, context, void 0, privateScope, 2, inGroup);
|
|
9024
9077
|
parser.assignable = 2;
|
|
9025
9078
|
return parser.finishNode({
|
|
9026
9079
|
type: 'ClassExpression',
|
|
@@ -9087,7 +9140,7 @@ function parseDecorator(parser, context, privateScope) {
|
|
|
9087
9140
|
expression,
|
|
9088
9141
|
}, start);
|
|
9089
9142
|
}
|
|
9090
|
-
function parseClassBody(parser, context, inheritedContext, scope, parentScope, kind,
|
|
9143
|
+
function parseClassBody(parser, context, inheritedContext, scope, parentScope, kind, inGroup, origin = 0) {
|
|
9091
9144
|
const { tokenStart } = parser;
|
|
9092
9145
|
const privateScope = parser.createPrivateScopeIfLexical(parentScope);
|
|
9093
9146
|
consume(parser, context | 32, 2162700);
|
|
@@ -9327,22 +9380,22 @@ function parsePropertyDefinition(parser, context, privateScope, key, state, deco
|
|
|
9327
9380
|
...(parser.features & 1 ? { decorators } : null),
|
|
9328
9381
|
}, start);
|
|
9329
9382
|
}
|
|
9330
|
-
function parseBindingPattern(parser, context, scope, privateScope,
|
|
9383
|
+
function parseBindingPattern(parser, context, scope, privateScope, kind, origin = 0) {
|
|
9331
9384
|
if (parser.getToken() & 143360 ||
|
|
9332
9385
|
((context & 1) === 0 && parser.getToken() === -2147483526))
|
|
9333
|
-
return parseAndClassifyIdentifier(parser, context, scope,
|
|
9386
|
+
return parseAndClassifyIdentifier(parser, context, scope, kind, origin);
|
|
9334
9387
|
if ((parser.getToken() & 2097152) !== 2097152)
|
|
9335
9388
|
parser.report(30, KeywordDescTable[parser.getToken() & 255]);
|
|
9336
9389
|
const left = parser.getToken() === 69271571
|
|
9337
|
-
? parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, 0, 1,
|
|
9338
|
-
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, 0, 1,
|
|
9390
|
+
? parseArrayExpressionOrPattern(parser, context, scope, privateScope, 1, 0, 1, kind, origin)
|
|
9391
|
+
: parseObjectLiteralOrPattern(parser, context, scope, privateScope, 1, 0, 1, kind, origin);
|
|
9339
9392
|
if (parser.destructible & 16)
|
|
9340
9393
|
parser.report(50);
|
|
9341
9394
|
if (parser.destructible & 32)
|
|
9342
9395
|
parser.report(50);
|
|
9343
9396
|
return left;
|
|
9344
9397
|
}
|
|
9345
|
-
function parseAndClassifyIdentifier(parser, context, scope, kind, origin) {
|
|
9398
|
+
function parseAndClassifyIdentifier(parser, context, scope, kind, origin = 0) {
|
|
9346
9399
|
const token = parser.getToken();
|
|
9347
9400
|
if (context & 1) {
|
|
9348
9401
|
if ((token & 537079808) === 537079808) {
|
|
@@ -9470,7 +9523,7 @@ function parseJSXChildrenAndClosingFragment(parser, context, privateScope, inJSX
|
|
|
9470
9523
|
}
|
|
9471
9524
|
function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild) {
|
|
9472
9525
|
if (parser.getToken() === 138)
|
|
9473
|
-
return parseJSXText(parser
|
|
9526
|
+
return parseJSXText(parser);
|
|
9474
9527
|
if (parser.getToken() === 2162700)
|
|
9475
9528
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
9476
9529
|
if (parser.getToken() === 8456256) {
|
|
@@ -9484,7 +9537,7 @@ function parseJSXChildOrClosingElement(parser, context, privateScope, inJSXChild
|
|
|
9484
9537
|
}
|
|
9485
9538
|
function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChild) {
|
|
9486
9539
|
if (parser.getToken() === 138)
|
|
9487
|
-
return parseJSXText(parser
|
|
9540
|
+
return parseJSXText(parser);
|
|
9488
9541
|
if (parser.getToken() === 2162700)
|
|
9489
9542
|
return parseJSXExpressionContainer(parser, context, privateScope, 1, 0);
|
|
9490
9543
|
if (parser.getToken() === 8456256) {
|
|
@@ -9496,9 +9549,9 @@ function parseJSXChildOrClosingFragment(parser, context, privateScope, inJSXChil
|
|
|
9496
9549
|
}
|
|
9497
9550
|
parser.report(0);
|
|
9498
9551
|
}
|
|
9499
|
-
function parseJSXText(parser
|
|
9552
|
+
function parseJSXText(parser) {
|
|
9500
9553
|
const start = parser.tokenStart;
|
|
9501
|
-
|
|
9554
|
+
nextJSXToken(parser);
|
|
9502
9555
|
const node = {
|
|
9503
9556
|
type: 'JSXText',
|
|
9504
9557
|
value: parser.tokenValue,
|