@next-core/brick-utils 2.31.1 → 2.31.5
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 +21 -16
- package/dist/index.bundle.js +872 -698
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +872 -698
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -3131,18 +3131,46 @@ function getLineInfo(input, offset) {
|
|
|
3131
3131
|
return new Position(line, offset - lineStart);
|
|
3132
3132
|
}
|
|
3133
3133
|
|
|
3134
|
+
function createPositionWithColumnOffset(position, columnOffset) {
|
|
3135
|
+
var {
|
|
3136
|
+
line,
|
|
3137
|
+
column
|
|
3138
|
+
} = position;
|
|
3139
|
+
return new Position(line, column + columnOffset);
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3134
3142
|
class BaseParser {
|
|
3135
3143
|
constructor() {
|
|
3136
3144
|
this.sawUnambiguousESM = false;
|
|
3137
3145
|
this.ambiguousScriptDifferentAst = false;
|
|
3138
3146
|
}
|
|
3139
3147
|
|
|
3140
|
-
hasPlugin(
|
|
3141
|
-
|
|
3148
|
+
hasPlugin(pluginConfig) {
|
|
3149
|
+
if (typeof pluginConfig === "string") {
|
|
3150
|
+
return this.plugins.has(pluginConfig);
|
|
3151
|
+
} else {
|
|
3152
|
+
var [pluginName, pluginOptions] = pluginConfig;
|
|
3153
|
+
|
|
3154
|
+
if (!this.hasPlugin(pluginName)) {
|
|
3155
|
+
return false;
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
var actualOptions = this.plugins.get(pluginName);
|
|
3159
|
+
|
|
3160
|
+
for (var key of Object.keys(pluginOptions)) {
|
|
3161
|
+
if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
|
|
3162
|
+
return false;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
|
|
3166
|
+
return true;
|
|
3167
|
+
}
|
|
3142
3168
|
}
|
|
3143
3169
|
|
|
3144
3170
|
getPluginOption(plugin, name) {
|
|
3145
|
-
|
|
3171
|
+
var _this$plugins$get;
|
|
3172
|
+
|
|
3173
|
+
return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
|
|
3146
3174
|
}
|
|
3147
3175
|
|
|
3148
3176
|
}
|
|
@@ -3395,6 +3423,7 @@ var ErrorMessages = makeErrorTemplates({
|
|
|
3395
3423
|
ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
|
|
3396
3424
|
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
3397
3425
|
InvalidCodePoint: "Code point out of bounds.",
|
|
3426
|
+
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
3398
3427
|
InvalidDecimal: "Invalid decimal.",
|
|
3399
3428
|
InvalidDigit: "Expected number in radix %0.",
|
|
3400
3429
|
InvalidEscapeSequence: "Bad character escape sequence.",
|
|
@@ -3480,7 +3509,7 @@ var ErrorMessages = makeErrorTemplates({
|
|
|
3480
3509
|
UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
|
|
3481
3510
|
UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
|
|
3482
3511
|
UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
|
|
3483
|
-
UnexpectedPrivateField: "
|
|
3512
|
+
UnexpectedPrivateField: "Unexpected private name.",
|
|
3484
3513
|
UnexpectedReservedWord: "Unexpected reserved word '%0'.",
|
|
3485
3514
|
UnexpectedSuper: "'super' is only allowed in object methods and classes.",
|
|
3486
3515
|
UnexpectedToken: "Unexpected token '%0'.",
|
|
@@ -3981,8 +4010,13 @@ class TokContext {
|
|
|
3981
4010
|
|
|
3982
4011
|
var types = {
|
|
3983
4012
|
brace: new TokContext("{"),
|
|
3984
|
-
|
|
4013
|
+
j_oTag: new TokContext("<tag"),
|
|
4014
|
+
j_cTag: new TokContext("</tag"),
|
|
4015
|
+
j_expr: new TokContext("<tag>...</tag>", true)
|
|
3985
4016
|
};
|
|
4017
|
+
{
|
|
4018
|
+
types.template = new TokContext("`", true);
|
|
4019
|
+
}
|
|
3986
4020
|
var beforeExpr = true;
|
|
3987
4021
|
var startsExpr = true;
|
|
3988
4022
|
var isLoop = true;
|
|
@@ -4143,6 +4177,13 @@ var tt = {
|
|
|
4143
4177
|
beforeExpr,
|
|
4144
4178
|
startsExpr
|
|
4145
4179
|
}),
|
|
4180
|
+
templateTail: createToken("...`", {
|
|
4181
|
+
startsExpr
|
|
4182
|
+
}),
|
|
4183
|
+
templateNonTail: createToken("...${", {
|
|
4184
|
+
beforeExpr,
|
|
4185
|
+
startsExpr
|
|
4186
|
+
}),
|
|
4146
4187
|
at: createToken("@"),
|
|
4147
4188
|
hash: createToken("#", {
|
|
4148
4189
|
startsExpr
|
|
@@ -4448,19 +4489,19 @@ var tt = {
|
|
|
4448
4489
|
};
|
|
4449
4490
|
|
|
4450
4491
|
function tokenIsIdentifier(token) {
|
|
4451
|
-
return token >=
|
|
4492
|
+
return token >= 89 && token <= 124;
|
|
4452
4493
|
}
|
|
4453
4494
|
|
|
4454
4495
|
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
4455
|
-
return token <=
|
|
4496
|
+
return token <= 88;
|
|
4456
4497
|
}
|
|
4457
4498
|
|
|
4458
4499
|
function tokenIsKeywordOrIdentifier(token) {
|
|
4459
|
-
return token >=
|
|
4500
|
+
return token >= 54 && token <= 124;
|
|
4460
4501
|
}
|
|
4461
4502
|
|
|
4462
4503
|
function tokenIsLiteralPropertyName(token) {
|
|
4463
|
-
return token >=
|
|
4504
|
+
return token >= 54 && token <= 128;
|
|
4464
4505
|
}
|
|
4465
4506
|
|
|
4466
4507
|
function tokenComesBeforeExpression(token) {
|
|
@@ -4472,27 +4513,27 @@ function tokenCanStartExpression(token) {
|
|
|
4472
4513
|
}
|
|
4473
4514
|
|
|
4474
4515
|
function tokenIsAssignment(token) {
|
|
4475
|
-
return token >=
|
|
4516
|
+
return token >= 29 && token <= 33;
|
|
4476
4517
|
}
|
|
4477
4518
|
|
|
4478
4519
|
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
4479
|
-
return token >=
|
|
4520
|
+
return token >= 121 && token <= 123;
|
|
4480
4521
|
}
|
|
4481
4522
|
|
|
4482
4523
|
function tokenIsLoop(token) {
|
|
4483
|
-
return token >=
|
|
4524
|
+
return token >= 86 && token <= 88;
|
|
4484
4525
|
}
|
|
4485
4526
|
|
|
4486
4527
|
function tokenIsKeyword(token) {
|
|
4487
|
-
return token >=
|
|
4528
|
+
return token >= 54 && token <= 88;
|
|
4488
4529
|
}
|
|
4489
4530
|
|
|
4490
4531
|
function tokenIsOperator(token) {
|
|
4491
|
-
return token >=
|
|
4532
|
+
return token >= 37 && token <= 55;
|
|
4492
4533
|
}
|
|
4493
4534
|
|
|
4494
4535
|
function tokenIsPostfix(token) {
|
|
4495
|
-
return token ===
|
|
4536
|
+
return token === 34;
|
|
4496
4537
|
}
|
|
4497
4538
|
|
|
4498
4539
|
function tokenIsPrefix(token) {
|
|
@@ -4500,11 +4541,11 @@ function tokenIsPrefix(token) {
|
|
|
4500
4541
|
}
|
|
4501
4542
|
|
|
4502
4543
|
function tokenIsTSTypeOperator(token) {
|
|
4503
|
-
return token >=
|
|
4544
|
+
return token >= 113 && token <= 115;
|
|
4504
4545
|
}
|
|
4505
4546
|
|
|
4506
4547
|
function tokenIsTSDeclarationStart(token) {
|
|
4507
|
-
return token >=
|
|
4548
|
+
return token >= 116 && token <= 122;
|
|
4508
4549
|
}
|
|
4509
4550
|
|
|
4510
4551
|
function tokenLabelName(token) {
|
|
@@ -4516,7 +4557,11 @@ function tokenOperatorPrecedence(token) {
|
|
|
4516
4557
|
}
|
|
4517
4558
|
|
|
4518
4559
|
function tokenIsRightAssociative(token) {
|
|
4519
|
-
return token ===
|
|
4560
|
+
return token === 53;
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4563
|
+
function tokenIsTemplate(token) {
|
|
4564
|
+
return token >= 24 && token <= 25;
|
|
4520
4565
|
}
|
|
4521
4566
|
|
|
4522
4567
|
function getExportedToken(token) {
|
|
@@ -4544,7 +4589,7 @@ function isTokenType(obj) {
|
|
|
4544
4589
|
}
|
|
4545
4590
|
};
|
|
4546
4591
|
|
|
4547
|
-
tokenTypes[
|
|
4592
|
+
tokenTypes[134].updateContext = context => {
|
|
4548
4593
|
context.push(types.j_expr, types.j_oTag);
|
|
4549
4594
|
};
|
|
4550
4595
|
}
|
|
@@ -4930,7 +4975,7 @@ class State {
|
|
|
4930
4975
|
this.comments = [];
|
|
4931
4976
|
this.commentStack = [];
|
|
4932
4977
|
this.pos = 0;
|
|
4933
|
-
this.type =
|
|
4978
|
+
this.type = 131;
|
|
4934
4979
|
this.value = null;
|
|
4935
4980
|
this.start = 0;
|
|
4936
4981
|
this.end = 0;
|
|
@@ -5118,21 +5163,16 @@ class Tokenizer extends ParserError {
|
|
|
5118
5163
|
}
|
|
5119
5164
|
|
|
5120
5165
|
nextToken() {
|
|
5121
|
-
|
|
5122
|
-
if (!curContext.preserveSpace) this.skipSpace();
|
|
5166
|
+
this.skipSpace();
|
|
5123
5167
|
this.state.start = this.state.pos;
|
|
5124
5168
|
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
|
|
5125
5169
|
|
|
5126
5170
|
if (this.state.pos >= this.length) {
|
|
5127
|
-
this.finishToken(
|
|
5171
|
+
this.finishToken(131);
|
|
5128
5172
|
return;
|
|
5129
5173
|
}
|
|
5130
5174
|
|
|
5131
|
-
|
|
5132
|
-
this.readTmplToken();
|
|
5133
|
-
} else {
|
|
5134
|
-
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
5135
|
-
}
|
|
5175
|
+
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
5136
5176
|
}
|
|
5137
5177
|
|
|
5138
5178
|
skipBlockComment() {
|
|
@@ -5341,12 +5381,12 @@ class Tokenizer extends ParserError {
|
|
|
5341
5381
|
}
|
|
5342
5382
|
} else if (isIdentifierStart(next)) {
|
|
5343
5383
|
++this.state.pos;
|
|
5344
|
-
this.finishToken(
|
|
5384
|
+
this.finishToken(130, this.readWord1(next));
|
|
5345
5385
|
} else if (next === 92) {
|
|
5346
5386
|
++this.state.pos;
|
|
5347
|
-
this.finishToken(
|
|
5387
|
+
this.finishToken(130, this.readWord1());
|
|
5348
5388
|
} else {
|
|
5349
|
-
this.finishOp(
|
|
5389
|
+
this.finishOp(27, 1);
|
|
5350
5390
|
}
|
|
5351
5391
|
}
|
|
5352
5392
|
|
|
@@ -5371,9 +5411,9 @@ class Tokenizer extends ParserError {
|
|
|
5371
5411
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5372
5412
|
|
|
5373
5413
|
if (next === 61) {
|
|
5374
|
-
this.finishOp(
|
|
5414
|
+
this.finishOp(31, 2);
|
|
5375
5415
|
} else {
|
|
5376
|
-
this.finishOp(
|
|
5416
|
+
this.finishOp(52, 1);
|
|
5377
5417
|
}
|
|
5378
5418
|
}
|
|
5379
5419
|
|
|
@@ -5389,24 +5429,24 @@ class Tokenizer extends ParserError {
|
|
|
5389
5429
|
}
|
|
5390
5430
|
|
|
5391
5431
|
var value = this.input.slice(start + 2, this.state.pos);
|
|
5392
|
-
this.finishToken(
|
|
5432
|
+
this.finishToken(28, value);
|
|
5393
5433
|
return true;
|
|
5394
5434
|
}
|
|
5395
5435
|
|
|
5396
5436
|
readToken_mult_modulo(code) {
|
|
5397
|
-
var type = code === 42 ?
|
|
5437
|
+
var type = code === 42 ? 51 : 50;
|
|
5398
5438
|
var width = 1;
|
|
5399
5439
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5400
5440
|
|
|
5401
5441
|
if (code === 42 && next === 42) {
|
|
5402
5442
|
width++;
|
|
5403
5443
|
next = this.input.charCodeAt(this.state.pos + 2);
|
|
5404
|
-
type =
|
|
5444
|
+
type = 53;
|
|
5405
5445
|
}
|
|
5406
5446
|
|
|
5407
5447
|
if (next === 61 && !this.state.inType) {
|
|
5408
5448
|
width++;
|
|
5409
|
-
type = code === 37 ?
|
|
5449
|
+
type = code === 37 ? 33 : 30;
|
|
5410
5450
|
}
|
|
5411
5451
|
|
|
5412
5452
|
this.finishOp(type, width);
|
|
@@ -5417,9 +5457,9 @@ class Tokenizer extends ParserError {
|
|
|
5417
5457
|
|
|
5418
5458
|
if (next === code) {
|
|
5419
5459
|
if (this.input.charCodeAt(this.state.pos + 2) === 61) {
|
|
5420
|
-
this.finishOp(
|
|
5460
|
+
this.finishOp(30, 3);
|
|
5421
5461
|
} else {
|
|
5422
|
-
this.finishOp(code === 124 ?
|
|
5462
|
+
this.finishOp(code === 124 ? 39 : 40, 2);
|
|
5423
5463
|
}
|
|
5424
5464
|
|
|
5425
5465
|
return;
|
|
@@ -5427,7 +5467,7 @@ class Tokenizer extends ParserError {
|
|
|
5427
5467
|
|
|
5428
5468
|
if (code === 124) {
|
|
5429
5469
|
if (next === 62) {
|
|
5430
|
-
this.finishOp(
|
|
5470
|
+
this.finishOp(37, 2);
|
|
5431
5471
|
return;
|
|
5432
5472
|
}
|
|
5433
5473
|
|
|
@@ -5453,20 +5493,20 @@ class Tokenizer extends ParserError {
|
|
|
5453
5493
|
}
|
|
5454
5494
|
|
|
5455
5495
|
if (next === 61) {
|
|
5456
|
-
this.finishOp(
|
|
5496
|
+
this.finishOp(30, 2);
|
|
5457
5497
|
return;
|
|
5458
5498
|
}
|
|
5459
5499
|
|
|
5460
|
-
this.finishOp(code === 124 ?
|
|
5500
|
+
this.finishOp(code === 124 ? 41 : 43, 1);
|
|
5461
5501
|
}
|
|
5462
5502
|
|
|
5463
5503
|
readToken_caret() {
|
|
5464
5504
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5465
5505
|
|
|
5466
5506
|
if (next === 61 && !this.state.inType) {
|
|
5467
|
-
this.finishOp(
|
|
5507
|
+
this.finishOp(32, 2);
|
|
5468
5508
|
} else {
|
|
5469
|
-
this.finishOp(
|
|
5509
|
+
this.finishOp(42, 1);
|
|
5470
5510
|
}
|
|
5471
5511
|
}
|
|
5472
5512
|
|
|
@@ -5474,14 +5514,14 @@ class Tokenizer extends ParserError {
|
|
|
5474
5514
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5475
5515
|
|
|
5476
5516
|
if (next === code) {
|
|
5477
|
-
this.finishOp(
|
|
5517
|
+
this.finishOp(34, 2);
|
|
5478
5518
|
return;
|
|
5479
5519
|
}
|
|
5480
5520
|
|
|
5481
5521
|
if (next === 61) {
|
|
5482
|
-
this.finishOp(
|
|
5522
|
+
this.finishOp(30, 2);
|
|
5483
5523
|
} else {
|
|
5484
|
-
this.finishOp(
|
|
5524
|
+
this.finishOp(49, 1);
|
|
5485
5525
|
}
|
|
5486
5526
|
}
|
|
5487
5527
|
|
|
@@ -5493,20 +5533,20 @@ class Tokenizer extends ParserError {
|
|
|
5493
5533
|
|
|
5494
5534
|
if (next === 60) {
|
|
5495
5535
|
if (this.input.charCodeAt(pos + 2) === 61) {
|
|
5496
|
-
this.finishOp(
|
|
5536
|
+
this.finishOp(30, 3);
|
|
5497
5537
|
return;
|
|
5498
5538
|
}
|
|
5499
5539
|
|
|
5500
|
-
this.finishOp(
|
|
5540
|
+
this.finishOp(48, 2);
|
|
5501
5541
|
return;
|
|
5502
5542
|
}
|
|
5503
5543
|
|
|
5504
5544
|
if (next === 61) {
|
|
5505
|
-
this.finishOp(
|
|
5545
|
+
this.finishOp(47, 2);
|
|
5506
5546
|
return;
|
|
5507
5547
|
}
|
|
5508
5548
|
|
|
5509
|
-
this.finishOp(
|
|
5549
|
+
this.finishOp(45, 1);
|
|
5510
5550
|
}
|
|
5511
5551
|
|
|
5512
5552
|
readToken_gt() {
|
|
@@ -5519,27 +5559,27 @@ class Tokenizer extends ParserError {
|
|
|
5519
5559
|
var size = this.input.charCodeAt(pos + 2) === 62 ? 3 : 2;
|
|
5520
5560
|
|
|
5521
5561
|
if (this.input.charCodeAt(pos + size) === 61) {
|
|
5522
|
-
this.finishOp(
|
|
5562
|
+
this.finishOp(30, size + 1);
|
|
5523
5563
|
return;
|
|
5524
5564
|
}
|
|
5525
5565
|
|
|
5526
|
-
this.finishOp(
|
|
5566
|
+
this.finishOp(48, size);
|
|
5527
5567
|
return;
|
|
5528
5568
|
}
|
|
5529
5569
|
|
|
5530
5570
|
if (next === 61) {
|
|
5531
|
-
this.finishOp(
|
|
5571
|
+
this.finishOp(47, 2);
|
|
5532
5572
|
return;
|
|
5533
5573
|
}
|
|
5534
5574
|
|
|
5535
|
-
this.finishOp(
|
|
5575
|
+
this.finishOp(46, 1);
|
|
5536
5576
|
}
|
|
5537
5577
|
|
|
5538
5578
|
readToken_eq_excl(code) {
|
|
5539
5579
|
var next = this.input.charCodeAt(this.state.pos + 1);
|
|
5540
5580
|
|
|
5541
5581
|
if (next === 61) {
|
|
5542
|
-
this.finishOp(
|
|
5582
|
+
this.finishOp(44, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
|
|
5543
5583
|
return;
|
|
5544
5584
|
}
|
|
5545
5585
|
|
|
@@ -5549,7 +5589,7 @@ class Tokenizer extends ParserError {
|
|
|
5549
5589
|
return;
|
|
5550
5590
|
}
|
|
5551
5591
|
|
|
5552
|
-
this.finishOp(code === 61 ?
|
|
5592
|
+
this.finishOp(code === 61 ? 29 : 35, 1);
|
|
5553
5593
|
}
|
|
5554
5594
|
|
|
5555
5595
|
readToken_question() {
|
|
@@ -5558,9 +5598,9 @@ class Tokenizer extends ParserError {
|
|
|
5558
5598
|
|
|
5559
5599
|
if (next === 63) {
|
|
5560
5600
|
if (next2 === 61) {
|
|
5561
|
-
this.finishOp(
|
|
5601
|
+
this.finishOp(30, 3);
|
|
5562
5602
|
} else {
|
|
5563
|
-
this.finishOp(
|
|
5603
|
+
this.finishOp(38, 2);
|
|
5564
5604
|
}
|
|
5565
5605
|
} else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
|
|
5566
5606
|
this.state.pos += 2;
|
|
@@ -5652,8 +5692,7 @@ class Tokenizer extends ParserError {
|
|
|
5652
5692
|
return;
|
|
5653
5693
|
|
|
5654
5694
|
case 96:
|
|
5655
|
-
|
|
5656
|
-
this.finishToken(22);
|
|
5695
|
+
this.readTemplateToken();
|
|
5657
5696
|
return;
|
|
5658
5697
|
|
|
5659
5698
|
case 48:
|
|
@@ -5730,12 +5769,12 @@ class Tokenizer extends ParserError {
|
|
|
5730
5769
|
return;
|
|
5731
5770
|
|
|
5732
5771
|
case 126:
|
|
5733
|
-
this.finishOp(
|
|
5772
|
+
this.finishOp(36, 1);
|
|
5734
5773
|
return;
|
|
5735
5774
|
|
|
5736
5775
|
case 64:
|
|
5737
5776
|
++this.state.pos;
|
|
5738
|
-
this.finishToken(
|
|
5777
|
+
this.finishToken(26);
|
|
5739
5778
|
return;
|
|
5740
5779
|
|
|
5741
5780
|
case 35:
|
|
@@ -5819,7 +5858,7 @@ class Tokenizer extends ParserError {
|
|
|
5819
5858
|
}
|
|
5820
5859
|
|
|
5821
5860
|
this.state.pos = pos;
|
|
5822
|
-
this.finishToken(
|
|
5861
|
+
this.finishToken(129, {
|
|
5823
5862
|
pattern: content,
|
|
5824
5863
|
flags: mods
|
|
5825
5864
|
});
|
|
@@ -5913,11 +5952,11 @@ class Tokenizer extends ParserError {
|
|
|
5913
5952
|
|
|
5914
5953
|
if (isBigInt) {
|
|
5915
5954
|
var str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
|
|
5916
|
-
this.finishToken(
|
|
5955
|
+
this.finishToken(127, str);
|
|
5917
5956
|
return;
|
|
5918
5957
|
}
|
|
5919
5958
|
|
|
5920
|
-
this.finishToken(
|
|
5959
|
+
this.finishToken(126, val);
|
|
5921
5960
|
}
|
|
5922
5961
|
|
|
5923
5962
|
readNumber(startsWithDot) {
|
|
@@ -6001,17 +6040,17 @@ class Tokenizer extends ParserError {
|
|
|
6001
6040
|
var str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
6002
6041
|
|
|
6003
6042
|
if (isBigInt) {
|
|
6004
|
-
this.finishToken(
|
|
6043
|
+
this.finishToken(127, str);
|
|
6005
6044
|
return;
|
|
6006
6045
|
}
|
|
6007
6046
|
|
|
6008
6047
|
if (isDecimal) {
|
|
6009
|
-
this.finishToken(
|
|
6048
|
+
this.finishToken(128, str);
|
|
6010
6049
|
return;
|
|
6011
6050
|
}
|
|
6012
6051
|
|
|
6013
6052
|
var val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
6014
|
-
this.finishToken(
|
|
6053
|
+
this.finishToken(126, val);
|
|
6015
6054
|
}
|
|
6016
6055
|
|
|
6017
6056
|
readCodePoint(throwOnInvalid) {
|
|
@@ -6065,36 +6104,42 @@ class Tokenizer extends ParserError {
|
|
|
6065
6104
|
}
|
|
6066
6105
|
|
|
6067
6106
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
6068
|
-
this.finishToken(
|
|
6107
|
+
this.finishToken(125, out);
|
|
6108
|
+
}
|
|
6109
|
+
|
|
6110
|
+
readTemplateContinuation() {
|
|
6111
|
+
if (!this.match(8)) {
|
|
6112
|
+
this.unexpected(this.state.start, 8);
|
|
6113
|
+
}
|
|
6114
|
+
|
|
6115
|
+
this.state.pos--;
|
|
6116
|
+
this.readTemplateToken();
|
|
6069
6117
|
}
|
|
6070
6118
|
|
|
6071
|
-
|
|
6119
|
+
readTemplateToken() {
|
|
6072
6120
|
var out = "",
|
|
6073
6121
|
chunkStart = this.state.pos,
|
|
6074
6122
|
containsInvalid = false;
|
|
6123
|
+
++this.state.pos;
|
|
6075
6124
|
|
|
6076
6125
|
for (;;) {
|
|
6077
6126
|
if (this.state.pos >= this.length) {
|
|
6078
|
-
throw this.raise(this.state.start, ErrorMessages.UnterminatedTemplate);
|
|
6127
|
+
throw this.raise(this.state.start + 1, ErrorMessages.UnterminatedTemplate);
|
|
6079
6128
|
}
|
|
6080
6129
|
|
|
6081
6130
|
var ch = this.input.charCodeAt(this.state.pos);
|
|
6082
6131
|
|
|
6083
|
-
if (ch === 96
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
} else {
|
|
6090
|
-
++this.state.pos;
|
|
6091
|
-
this.finishToken(22);
|
|
6092
|
-
return;
|
|
6093
|
-
}
|
|
6094
|
-
}
|
|
6132
|
+
if (ch === 96) {
|
|
6133
|
+
++this.state.pos;
|
|
6134
|
+
out += this.input.slice(chunkStart, this.state.pos);
|
|
6135
|
+
this.finishToken(24, containsInvalid ? null : out);
|
|
6136
|
+
return;
|
|
6137
|
+
}
|
|
6095
6138
|
|
|
6139
|
+
if (ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
|
|
6140
|
+
this.state.pos += 2;
|
|
6096
6141
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
6097
|
-
this.finishToken(
|
|
6142
|
+
this.finishToken(25, containsInvalid ? null : out);
|
|
6098
6143
|
return;
|
|
6099
6144
|
}
|
|
6100
6145
|
|
|
@@ -6302,7 +6347,7 @@ class Tokenizer extends ParserError {
|
|
|
6302
6347
|
if (type !== undefined) {
|
|
6303
6348
|
this.finishToken(type, tokenLabelName(type));
|
|
6304
6349
|
} else {
|
|
6305
|
-
this.finishToken(
|
|
6350
|
+
this.finishToken(124, word);
|
|
6306
6351
|
}
|
|
6307
6352
|
}
|
|
6308
6353
|
|
|
@@ -6316,33 +6361,7 @@ class Tokenizer extends ParserError {
|
|
|
6316
6361
|
}
|
|
6317
6362
|
}
|
|
6318
6363
|
|
|
6319
|
-
updateContext(prevType) {
|
|
6320
|
-
var {
|
|
6321
|
-
context,
|
|
6322
|
-
type
|
|
6323
|
-
} = this.state;
|
|
6324
|
-
|
|
6325
|
-
switch (type) {
|
|
6326
|
-
case 8:
|
|
6327
|
-
context.pop();
|
|
6328
|
-
break;
|
|
6329
|
-
|
|
6330
|
-
case 5:
|
|
6331
|
-
case 7:
|
|
6332
|
-
case 23:
|
|
6333
|
-
context.push(types.brace);
|
|
6334
|
-
break;
|
|
6335
|
-
|
|
6336
|
-
case 22:
|
|
6337
|
-
if (context[context.length - 1] === types.template) {
|
|
6338
|
-
context.pop();
|
|
6339
|
-
} else {
|
|
6340
|
-
context.push(types.template);
|
|
6341
|
-
}
|
|
6342
|
-
|
|
6343
|
-
break;
|
|
6344
|
-
}
|
|
6345
|
-
}
|
|
6364
|
+
updateContext(prevType) {}
|
|
6346
6365
|
|
|
6347
6366
|
}
|
|
6348
6367
|
|
|
@@ -6386,11 +6405,15 @@ class ClassScopeHandler {
|
|
|
6386
6405
|
}
|
|
6387
6406
|
|
|
6388
6407
|
declarePrivateName(name, elementType, pos) {
|
|
6389
|
-
var
|
|
6390
|
-
|
|
6408
|
+
var {
|
|
6409
|
+
privateNames,
|
|
6410
|
+
loneAccessors,
|
|
6411
|
+
undefinedPrivateNames
|
|
6412
|
+
} = this.current();
|
|
6413
|
+
var redefined = privateNames.has(name);
|
|
6391
6414
|
|
|
6392
6415
|
if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) {
|
|
6393
|
-
var accessor = redefined &&
|
|
6416
|
+
var accessor = redefined && loneAccessors.get(name);
|
|
6394
6417
|
|
|
6395
6418
|
if (accessor) {
|
|
6396
6419
|
var oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC;
|
|
@@ -6398,9 +6421,9 @@ class ClassScopeHandler {
|
|
|
6398
6421
|
var oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR;
|
|
6399
6422
|
var newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR;
|
|
6400
6423
|
redefined = oldKind === newKind || oldStatic !== newStatic;
|
|
6401
|
-
if (!redefined)
|
|
6424
|
+
if (!redefined) loneAccessors.delete(name);
|
|
6402
6425
|
} else if (!redefined) {
|
|
6403
|
-
|
|
6426
|
+
loneAccessors.set(name, elementType);
|
|
6404
6427
|
}
|
|
6405
6428
|
}
|
|
6406
6429
|
|
|
@@ -6408,8 +6431,8 @@ class ClassScopeHandler {
|
|
|
6408
6431
|
this.raise(pos, ErrorMessages.PrivateNameRedeclaration, name);
|
|
6409
6432
|
}
|
|
6410
6433
|
|
|
6411
|
-
|
|
6412
|
-
|
|
6434
|
+
privateNames.add(name);
|
|
6435
|
+
undefinedPrivateNames.delete(name);
|
|
6413
6436
|
}
|
|
6414
6437
|
|
|
6415
6438
|
usePrivateName(name, pos) {
|
|
@@ -6657,7 +6680,7 @@ class UtilParser extends Tokenizer {
|
|
|
6657
6680
|
}
|
|
6658
6681
|
|
|
6659
6682
|
canInsertSemicolon() {
|
|
6660
|
-
return this.match(
|
|
6683
|
+
return this.match(131) || this.match(8) || this.hasPrecedingLineBreak();
|
|
6661
6684
|
}
|
|
6662
6685
|
|
|
6663
6686
|
hasPrecedingLineBreak() {
|
|
@@ -6713,21 +6736,31 @@ class UtilParser extends Tokenizer {
|
|
|
6713
6736
|
throw this.raise(pos != null ? pos : this.state.start, messageOrType);
|
|
6714
6737
|
}
|
|
6715
6738
|
|
|
6716
|
-
|
|
6717
|
-
|
|
6739
|
+
getPluginNamesFromConfigs(pluginConfigs) {
|
|
6740
|
+
return pluginConfigs.map(c => {
|
|
6741
|
+
if (typeof c === "string") {
|
|
6742
|
+
return c;
|
|
6743
|
+
} else {
|
|
6744
|
+
return c[0];
|
|
6745
|
+
}
|
|
6746
|
+
});
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6749
|
+
expectPlugin(pluginConfig, pos) {
|
|
6750
|
+
if (!this.hasPlugin(pluginConfig)) {
|
|
6718
6751
|
throw this.raiseWithData(pos != null ? pos : this.state.start, {
|
|
6719
|
-
missingPlugin: [
|
|
6720
|
-
}, "This experimental syntax requires enabling the parser plugin:
|
|
6752
|
+
missingPlugin: this.getPluginNamesFromConfigs([pluginConfig])
|
|
6753
|
+
}, "This experimental syntax requires enabling the parser plugin: ".concat(JSON.stringify(pluginConfig), "."));
|
|
6721
6754
|
}
|
|
6722
6755
|
|
|
6723
6756
|
return true;
|
|
6724
6757
|
}
|
|
6725
6758
|
|
|
6726
|
-
expectOnePlugin(
|
|
6727
|
-
if (!
|
|
6759
|
+
expectOnePlugin(pluginConfigs, pos) {
|
|
6760
|
+
if (!pluginConfigs.some(c => this.hasPlugin(c))) {
|
|
6728
6761
|
throw this.raiseWithData(pos != null ? pos : this.state.start, {
|
|
6729
|
-
missingPlugin:
|
|
6730
|
-
}, "This experimental syntax requires enabling one of the following parser plugin(s):
|
|
6762
|
+
missingPlugin: this.getPluginNamesFromConfigs(pluginConfigs)
|
|
6763
|
+
}, "This experimental syntax requires enabling one of the following parser plugin(s): ".concat(pluginConfigs.map(c => JSON.stringify(c)).join(", "), "."));
|
|
6731
6764
|
}
|
|
6732
6765
|
}
|
|
6733
6766
|
|
|
@@ -6805,7 +6838,7 @@ class UtilParser extends Tokenizer {
|
|
|
6805
6838
|
return hasErrors;
|
|
6806
6839
|
} else if (hasErrors) {
|
|
6807
6840
|
if (shorthandAssign >= 0) {
|
|
6808
|
-
this.
|
|
6841
|
+
this.raise(shorthandAssign, ErrorMessages.InvalidCoverInitializedName);
|
|
6809
6842
|
}
|
|
6810
6843
|
|
|
6811
6844
|
if (doubleProto >= 0) {
|
|
@@ -6971,12 +7004,18 @@ function cloneStringLiteral(node) {
|
|
|
6971
7004
|
}
|
|
6972
7005
|
|
|
6973
7006
|
var cloned = Object.create(NodePrototype);
|
|
6974
|
-
cloned.type =
|
|
7007
|
+
cloned.type = type;
|
|
6975
7008
|
cloned.start = start;
|
|
6976
7009
|
cloned.end = end;
|
|
6977
7010
|
cloned.loc = loc;
|
|
6978
7011
|
cloned.range = range;
|
|
6979
|
-
|
|
7012
|
+
|
|
7013
|
+
if (node.raw !== undefined) {
|
|
7014
|
+
cloned.raw = node.raw;
|
|
7015
|
+
} else {
|
|
7016
|
+
cloned.extra = extra;
|
|
7017
|
+
}
|
|
7018
|
+
|
|
6980
7019
|
cloned.value = node.value;
|
|
6981
7020
|
return cloned;
|
|
6982
7021
|
}
|
|
@@ -7087,7 +7126,7 @@ function hasTypeImportKind(node) {
|
|
|
7087
7126
|
}
|
|
7088
7127
|
|
|
7089
7128
|
function isMaybeDefaultImport(type) {
|
|
7090
|
-
return tokenIsKeywordOrIdentifier(type) && type !==
|
|
7129
|
+
return tokenIsKeywordOrIdentifier(type) && type !== 93;
|
|
7091
7130
|
}
|
|
7092
7131
|
|
|
7093
7132
|
var exportSuggestions = {
|
|
@@ -7129,7 +7168,7 @@ var flow = superClass => class extends superClass {
|
|
|
7129
7168
|
}
|
|
7130
7169
|
|
|
7131
7170
|
finishToken(type, val) {
|
|
7132
|
-
if (type !==
|
|
7171
|
+
if (type !== 125 && type !== 13 && type !== 28) {
|
|
7133
7172
|
if (this.flowPragma === undefined) {
|
|
7134
7173
|
this.flowPragma = null;
|
|
7135
7174
|
}
|
|
@@ -7166,7 +7205,7 @@ var flow = superClass => class extends superClass {
|
|
|
7166
7205
|
var node = this.startNode();
|
|
7167
7206
|
var moduloPos = this.state.start;
|
|
7168
7207
|
this.next();
|
|
7169
|
-
this.expectContextual(
|
|
7208
|
+
this.expectContextual(103);
|
|
7170
7209
|
|
|
7171
7210
|
if (this.state.lastTokStart > moduloPos + 1) {
|
|
7172
7211
|
this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks);
|
|
@@ -7188,14 +7227,14 @@ var flow = superClass => class extends superClass {
|
|
|
7188
7227
|
var type = null;
|
|
7189
7228
|
var predicate = null;
|
|
7190
7229
|
|
|
7191
|
-
if (this.match(
|
|
7230
|
+
if (this.match(50)) {
|
|
7192
7231
|
this.state.inType = oldInType;
|
|
7193
7232
|
predicate = this.flowParsePredicate();
|
|
7194
7233
|
} else {
|
|
7195
7234
|
type = this.flowParseType();
|
|
7196
7235
|
this.state.inType = oldInType;
|
|
7197
7236
|
|
|
7198
|
-
if (this.match(
|
|
7237
|
+
if (this.match(50)) {
|
|
7199
7238
|
predicate = this.flowParsePredicate();
|
|
7200
7239
|
}
|
|
7201
7240
|
}
|
|
@@ -7215,7 +7254,7 @@ var flow = superClass => class extends superClass {
|
|
|
7215
7254
|
var typeNode = this.startNode();
|
|
7216
7255
|
var typeContainer = this.startNode();
|
|
7217
7256
|
|
|
7218
|
-
if (this.match(
|
|
7257
|
+
if (this.match(45)) {
|
|
7219
7258
|
typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7220
7259
|
} else {
|
|
7221
7260
|
typeNode.typeParameters = null;
|
|
@@ -7237,13 +7276,13 @@ var flow = superClass => class extends superClass {
|
|
|
7237
7276
|
}
|
|
7238
7277
|
|
|
7239
7278
|
flowParseDeclare(node, insideModule) {
|
|
7240
|
-
if (this.match(
|
|
7279
|
+
if (this.match(76)) {
|
|
7241
7280
|
return this.flowParseDeclareClass(node);
|
|
7242
|
-
} else if (this.match(
|
|
7281
|
+
} else if (this.match(64)) {
|
|
7243
7282
|
return this.flowParseDeclareFunction(node);
|
|
7244
|
-
} else if (this.match(
|
|
7283
|
+
} else if (this.match(70)) {
|
|
7245
7284
|
return this.flowParseDeclareVariable(node);
|
|
7246
|
-
} else if (this.eatContextual(
|
|
7285
|
+
} else if (this.eatContextual(119)) {
|
|
7247
7286
|
if (this.match(16)) {
|
|
7248
7287
|
return this.flowParseDeclareModuleExports(node);
|
|
7249
7288
|
} else {
|
|
@@ -7253,13 +7292,13 @@ var flow = superClass => class extends superClass {
|
|
|
7253
7292
|
|
|
7254
7293
|
return this.flowParseDeclareModule(node);
|
|
7255
7294
|
}
|
|
7256
|
-
} else if (this.isContextual(
|
|
7295
|
+
} else if (this.isContextual(122)) {
|
|
7257
7296
|
return this.flowParseDeclareTypeAlias(node);
|
|
7258
|
-
} else if (this.isContextual(
|
|
7297
|
+
} else if (this.isContextual(123)) {
|
|
7259
7298
|
return this.flowParseDeclareOpaqueType(node);
|
|
7260
|
-
} else if (this.isContextual(
|
|
7299
|
+
} else if (this.isContextual(121)) {
|
|
7261
7300
|
return this.flowParseDeclareInterface(node);
|
|
7262
|
-
} else if (this.match(
|
|
7301
|
+
} else if (this.match(78)) {
|
|
7263
7302
|
return this.flowParseDeclareExportDeclaration(node, insideModule);
|
|
7264
7303
|
} else {
|
|
7265
7304
|
throw this.unexpected();
|
|
@@ -7277,7 +7316,7 @@ var flow = superClass => class extends superClass {
|
|
|
7277
7316
|
flowParseDeclareModule(node) {
|
|
7278
7317
|
this.scope.enter(SCOPE_OTHER);
|
|
7279
7318
|
|
|
7280
|
-
if (this.match(
|
|
7319
|
+
if (this.match(125)) {
|
|
7281
7320
|
node.id = this.parseExprAtom();
|
|
7282
7321
|
} else {
|
|
7283
7322
|
node.id = this.parseIdentifier();
|
|
@@ -7290,16 +7329,16 @@ var flow = superClass => class extends superClass {
|
|
|
7290
7329
|
while (!this.match(8)) {
|
|
7291
7330
|
var _bodyNode = this.startNode();
|
|
7292
7331
|
|
|
7293
|
-
if (this.match(
|
|
7332
|
+
if (this.match(79)) {
|
|
7294
7333
|
this.next();
|
|
7295
7334
|
|
|
7296
|
-
if (!this.isContextual(
|
|
7335
|
+
if (!this.isContextual(122) && !this.match(83)) {
|
|
7297
7336
|
this.raise(this.state.lastTokStart, FlowErrors.InvalidNonTypeImportInDeclareModule);
|
|
7298
7337
|
}
|
|
7299
7338
|
|
|
7300
7339
|
this.parseImport(_bodyNode);
|
|
7301
7340
|
} else {
|
|
7302
|
-
this.expectContextual(
|
|
7341
|
+
this.expectContextual(117, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
7303
7342
|
_bodyNode = this.flowParseDeclare(_bodyNode, true);
|
|
7304
7343
|
}
|
|
7305
7344
|
|
|
@@ -7336,10 +7375,10 @@ var flow = superClass => class extends superClass {
|
|
|
7336
7375
|
}
|
|
7337
7376
|
|
|
7338
7377
|
flowParseDeclareExportDeclaration(node, insideModule) {
|
|
7339
|
-
this.expect(
|
|
7378
|
+
this.expect(78);
|
|
7340
7379
|
|
|
7341
|
-
if (this.eat(
|
|
7342
|
-
if (this.match(
|
|
7380
|
+
if (this.eat(61)) {
|
|
7381
|
+
if (this.match(64) || this.match(76)) {
|
|
7343
7382
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
7344
7383
|
} else {
|
|
7345
7384
|
node.declaration = this.flowParseType();
|
|
@@ -7349,17 +7388,17 @@ var flow = superClass => class extends superClass {
|
|
|
7349
7388
|
node.default = true;
|
|
7350
7389
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
7351
7390
|
} else {
|
|
7352
|
-
if (this.match(
|
|
7391
|
+
if (this.match(71) || this.isLet() || (this.isContextual(122) || this.isContextual(121)) && !insideModule) {
|
|
7353
7392
|
var label = this.state.value;
|
|
7354
7393
|
var suggestion = exportSuggestions[label];
|
|
7355
7394
|
throw this.raise(this.state.start, FlowErrors.UnsupportedDeclareExportKind, label, suggestion);
|
|
7356
7395
|
}
|
|
7357
7396
|
|
|
7358
|
-
if (this.match(
|
|
7397
|
+
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(123)) {
|
|
7359
7398
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
7360
7399
|
node.default = false;
|
|
7361
7400
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
7362
|
-
} else if (this.match(
|
|
7401
|
+
} else if (this.match(51) || this.match(5) || this.isContextual(121) || this.isContextual(122) || this.isContextual(123)) {
|
|
7363
7402
|
node = this.parseExport(node);
|
|
7364
7403
|
|
|
7365
7404
|
if (node.type === "ExportNamedDeclaration") {
|
|
@@ -7378,7 +7417,7 @@ var flow = superClass => class extends superClass {
|
|
|
7378
7417
|
|
|
7379
7418
|
flowParseDeclareModuleExports(node) {
|
|
7380
7419
|
this.next();
|
|
7381
|
-
this.expectContextual(
|
|
7420
|
+
this.expectContextual(104);
|
|
7382
7421
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
7383
7422
|
this.semicolon();
|
|
7384
7423
|
return this.finishNode(node, "DeclareModuleExports");
|
|
@@ -7409,7 +7448,7 @@ var flow = superClass => class extends superClass {
|
|
|
7409
7448
|
node.id = this.flowParseRestrictedIdentifier(!isClass, true);
|
|
7410
7449
|
this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.start);
|
|
7411
7450
|
|
|
7412
|
-
if (this.match(
|
|
7451
|
+
if (this.match(45)) {
|
|
7413
7452
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7414
7453
|
} else {
|
|
7415
7454
|
node.typeParameters = null;
|
|
@@ -7419,13 +7458,13 @@ var flow = superClass => class extends superClass {
|
|
|
7419
7458
|
node.implements = [];
|
|
7420
7459
|
node.mixins = [];
|
|
7421
7460
|
|
|
7422
|
-
if (this.eat(
|
|
7461
|
+
if (this.eat(77)) {
|
|
7423
7462
|
do {
|
|
7424
7463
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
7425
7464
|
} while (!isClass && this.eat(12));
|
|
7426
7465
|
}
|
|
7427
7466
|
|
|
7428
|
-
if (this.isContextual(
|
|
7467
|
+
if (this.isContextual(110)) {
|
|
7429
7468
|
this.next();
|
|
7430
7469
|
|
|
7431
7470
|
do {
|
|
@@ -7433,7 +7472,7 @@ var flow = superClass => class extends superClass {
|
|
|
7433
7472
|
} while (this.eat(12));
|
|
7434
7473
|
}
|
|
7435
7474
|
|
|
7436
|
-
if (this.isContextual(
|
|
7475
|
+
if (this.isContextual(106)) {
|
|
7437
7476
|
this.next();
|
|
7438
7477
|
|
|
7439
7478
|
do {
|
|
@@ -7454,7 +7493,7 @@ var flow = superClass => class extends superClass {
|
|
|
7454
7493
|
var node = this.startNode();
|
|
7455
7494
|
node.id = this.flowParseQualifiedTypeIdentifier();
|
|
7456
7495
|
|
|
7457
|
-
if (this.match(
|
|
7496
|
+
if (this.match(45)) {
|
|
7458
7497
|
node.typeParameters = this.flowParseTypeParameterInstantiation();
|
|
7459
7498
|
} else {
|
|
7460
7499
|
node.typeParameters = null;
|
|
@@ -7488,23 +7527,23 @@ var flow = superClass => class extends superClass {
|
|
|
7488
7527
|
node.id = this.flowParseRestrictedIdentifier(false, true);
|
|
7489
7528
|
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
|
|
7490
7529
|
|
|
7491
|
-
if (this.match(
|
|
7530
|
+
if (this.match(45)) {
|
|
7492
7531
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7493
7532
|
} else {
|
|
7494
7533
|
node.typeParameters = null;
|
|
7495
7534
|
}
|
|
7496
7535
|
|
|
7497
|
-
node.right = this.flowParseTypeInitialiser(
|
|
7536
|
+
node.right = this.flowParseTypeInitialiser(29);
|
|
7498
7537
|
this.semicolon();
|
|
7499
7538
|
return this.finishNode(node, "TypeAlias");
|
|
7500
7539
|
}
|
|
7501
7540
|
|
|
7502
7541
|
flowParseOpaqueType(node, declare) {
|
|
7503
|
-
this.expectContextual(
|
|
7542
|
+
this.expectContextual(122);
|
|
7504
7543
|
node.id = this.flowParseRestrictedIdentifier(true, true);
|
|
7505
7544
|
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
|
|
7506
7545
|
|
|
7507
|
-
if (this.match(
|
|
7546
|
+
if (this.match(45)) {
|
|
7508
7547
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7509
7548
|
} else {
|
|
7510
7549
|
node.typeParameters = null;
|
|
@@ -7519,7 +7558,7 @@ var flow = superClass => class extends superClass {
|
|
|
7519
7558
|
node.impltype = null;
|
|
7520
7559
|
|
|
7521
7560
|
if (!declare) {
|
|
7522
|
-
node.impltype = this.flowParseTypeInitialiser(
|
|
7561
|
+
node.impltype = this.flowParseTypeInitialiser(29);
|
|
7523
7562
|
}
|
|
7524
7563
|
|
|
7525
7564
|
this.semicolon();
|
|
@@ -7536,8 +7575,8 @@ var flow = superClass => class extends superClass {
|
|
|
7536
7575
|
node.variance = variance;
|
|
7537
7576
|
node.bound = ident.typeAnnotation;
|
|
7538
7577
|
|
|
7539
|
-
if (this.match(
|
|
7540
|
-
this.eat(
|
|
7578
|
+
if (this.match(29)) {
|
|
7579
|
+
this.eat(29);
|
|
7541
7580
|
node.default = this.flowParseType();
|
|
7542
7581
|
} else {
|
|
7543
7582
|
if (requireDefault) {
|
|
@@ -7554,7 +7593,7 @@ var flow = superClass => class extends superClass {
|
|
|
7554
7593
|
node.params = [];
|
|
7555
7594
|
this.state.inType = true;
|
|
7556
7595
|
|
|
7557
|
-
if (this.match(
|
|
7596
|
+
if (this.match(45) || this.match(134)) {
|
|
7558
7597
|
this.next();
|
|
7559
7598
|
} else {
|
|
7560
7599
|
this.unexpected();
|
|
@@ -7570,12 +7609,12 @@ var flow = superClass => class extends superClass {
|
|
|
7570
7609
|
defaultRequired = true;
|
|
7571
7610
|
}
|
|
7572
7611
|
|
|
7573
|
-
if (!this.match(
|
|
7612
|
+
if (!this.match(46)) {
|
|
7574
7613
|
this.expect(12);
|
|
7575
7614
|
}
|
|
7576
|
-
} while (!this.match(
|
|
7615
|
+
} while (!this.match(46));
|
|
7577
7616
|
|
|
7578
|
-
this.expect(
|
|
7617
|
+
this.expect(46);
|
|
7579
7618
|
this.state.inType = oldInType;
|
|
7580
7619
|
return this.finishNode(node, "TypeParameterDeclaration");
|
|
7581
7620
|
}
|
|
@@ -7585,20 +7624,20 @@ var flow = superClass => class extends superClass {
|
|
|
7585
7624
|
var oldInType = this.state.inType;
|
|
7586
7625
|
node.params = [];
|
|
7587
7626
|
this.state.inType = true;
|
|
7588
|
-
this.expect(
|
|
7627
|
+
this.expect(45);
|
|
7589
7628
|
var oldNoAnonFunctionType = this.state.noAnonFunctionType;
|
|
7590
7629
|
this.state.noAnonFunctionType = false;
|
|
7591
7630
|
|
|
7592
|
-
while (!this.match(
|
|
7631
|
+
while (!this.match(46)) {
|
|
7593
7632
|
node.params.push(this.flowParseType());
|
|
7594
7633
|
|
|
7595
|
-
if (!this.match(
|
|
7634
|
+
if (!this.match(46)) {
|
|
7596
7635
|
this.expect(12);
|
|
7597
7636
|
}
|
|
7598
7637
|
}
|
|
7599
7638
|
|
|
7600
7639
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
7601
|
-
this.expect(
|
|
7640
|
+
this.expect(46);
|
|
7602
7641
|
this.state.inType = oldInType;
|
|
7603
7642
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
7604
7643
|
}
|
|
@@ -7608,27 +7647,27 @@ var flow = superClass => class extends superClass {
|
|
|
7608
7647
|
var oldInType = this.state.inType;
|
|
7609
7648
|
node.params = [];
|
|
7610
7649
|
this.state.inType = true;
|
|
7611
|
-
this.expect(
|
|
7650
|
+
this.expect(45);
|
|
7612
7651
|
|
|
7613
|
-
while (!this.match(
|
|
7652
|
+
while (!this.match(46)) {
|
|
7614
7653
|
node.params.push(this.flowParseTypeOrImplicitInstantiation());
|
|
7615
7654
|
|
|
7616
|
-
if (!this.match(
|
|
7655
|
+
if (!this.match(46)) {
|
|
7617
7656
|
this.expect(12);
|
|
7618
7657
|
}
|
|
7619
7658
|
}
|
|
7620
7659
|
|
|
7621
|
-
this.expect(
|
|
7660
|
+
this.expect(46);
|
|
7622
7661
|
this.state.inType = oldInType;
|
|
7623
7662
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
7624
7663
|
}
|
|
7625
7664
|
|
|
7626
7665
|
flowParseInterfaceType() {
|
|
7627
7666
|
var node = this.startNode();
|
|
7628
|
-
this.expectContextual(
|
|
7667
|
+
this.expectContextual(121);
|
|
7629
7668
|
node.extends = [];
|
|
7630
7669
|
|
|
7631
|
-
if (this.eat(
|
|
7670
|
+
if (this.eat(77)) {
|
|
7632
7671
|
do {
|
|
7633
7672
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
7634
7673
|
} while (this.eat(12));
|
|
@@ -7645,7 +7684,7 @@ var flow = superClass => class extends superClass {
|
|
|
7645
7684
|
}
|
|
7646
7685
|
|
|
7647
7686
|
flowParseObjectPropertyKey() {
|
|
7648
|
-
return this.match(
|
|
7687
|
+
return this.match(126) || this.match(125) ? this.parseExprAtom() : this.parseIdentifier(true);
|
|
7649
7688
|
}
|
|
7650
7689
|
|
|
7651
7690
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
@@ -7671,7 +7710,7 @@ var flow = superClass => class extends superClass {
|
|
|
7671
7710
|
this.expect(3);
|
|
7672
7711
|
this.expect(3);
|
|
7673
7712
|
|
|
7674
|
-
if (this.match(
|
|
7713
|
+
if (this.match(45) || this.match(10)) {
|
|
7675
7714
|
node.method = true;
|
|
7676
7715
|
node.optional = false;
|
|
7677
7716
|
node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
|
|
@@ -7694,13 +7733,13 @@ var flow = superClass => class extends superClass {
|
|
|
7694
7733
|
node.typeParameters = null;
|
|
7695
7734
|
node.this = null;
|
|
7696
7735
|
|
|
7697
|
-
if (this.match(
|
|
7736
|
+
if (this.match(45)) {
|
|
7698
7737
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
7699
7738
|
}
|
|
7700
7739
|
|
|
7701
7740
|
this.expect(10);
|
|
7702
7741
|
|
|
7703
|
-
if (this.match(
|
|
7742
|
+
if (this.match(74)) {
|
|
7704
7743
|
node.this = this.flowParseFunctionTypeParam(true);
|
|
7705
7744
|
node.this.name = null;
|
|
7706
7745
|
|
|
@@ -7770,7 +7809,7 @@ var flow = superClass => class extends superClass {
|
|
|
7770
7809
|
var inexactStart = null;
|
|
7771
7810
|
var node = this.startNode();
|
|
7772
7811
|
|
|
7773
|
-
if (allowProto && this.isContextual(
|
|
7812
|
+
if (allowProto && this.isContextual(111)) {
|
|
7774
7813
|
var lookahead = this.lookahead();
|
|
7775
7814
|
|
|
7776
7815
|
if (lookahead.type !== 14 && lookahead.type !== 17) {
|
|
@@ -7780,7 +7819,7 @@ var flow = superClass => class extends superClass {
|
|
|
7780
7819
|
}
|
|
7781
7820
|
}
|
|
7782
7821
|
|
|
7783
|
-
if (allowStatic && this.isContextual(
|
|
7822
|
+
if (allowStatic && this.isContextual(100)) {
|
|
7784
7823
|
var _lookahead = this.lookahead();
|
|
7785
7824
|
|
|
7786
7825
|
if (_lookahead.type !== 14 && _lookahead.type !== 17) {
|
|
@@ -7805,7 +7844,7 @@ var flow = superClass => class extends superClass {
|
|
|
7805
7844
|
} else {
|
|
7806
7845
|
nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
|
|
7807
7846
|
}
|
|
7808
|
-
} else if (this.match(10) || this.match(
|
|
7847
|
+
} else if (this.match(10) || this.match(45)) {
|
|
7809
7848
|
if (protoStart != null) {
|
|
7810
7849
|
this.unexpected(protoStart);
|
|
7811
7850
|
}
|
|
@@ -7818,7 +7857,7 @@ var flow = superClass => class extends superClass {
|
|
|
7818
7857
|
} else {
|
|
7819
7858
|
var kind = "init";
|
|
7820
7859
|
|
|
7821
|
-
if (this.isContextual(
|
|
7860
|
+
if (this.isContextual(94) || this.isContextual(99)) {
|
|
7822
7861
|
var _lookahead2 = this.lookahead();
|
|
7823
7862
|
|
|
7824
7863
|
if (tokenIsLiteralPropertyName(_lookahead2.type)) {
|
|
@@ -7894,7 +7933,7 @@ var flow = superClass => class extends superClass {
|
|
|
7894
7933
|
node.kind = kind;
|
|
7895
7934
|
var optional = false;
|
|
7896
7935
|
|
|
7897
|
-
if (this.match(
|
|
7936
|
+
if (this.match(45) || this.match(10)) {
|
|
7898
7937
|
node.method = true;
|
|
7899
7938
|
|
|
7900
7939
|
if (protoStart != null) {
|
|
@@ -7979,7 +8018,7 @@ var flow = superClass => class extends superClass {
|
|
|
7979
8018
|
node.typeParameters = null;
|
|
7980
8019
|
node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
|
|
7981
8020
|
|
|
7982
|
-
if (this.match(
|
|
8021
|
+
if (this.match(45)) {
|
|
7983
8022
|
node.typeParameters = this.flowParseTypeParameterInstantiation();
|
|
7984
8023
|
}
|
|
7985
8024
|
|
|
@@ -7988,7 +8027,7 @@ var flow = superClass => class extends superClass {
|
|
|
7988
8027
|
|
|
7989
8028
|
flowParseTypeofType() {
|
|
7990
8029
|
var node = this.startNode();
|
|
7991
|
-
this.expect(
|
|
8030
|
+
this.expect(83);
|
|
7992
8031
|
node.argument = this.flowParsePrimaryType();
|
|
7993
8032
|
return this.finishNode(node, "TypeofTypeAnnotation");
|
|
7994
8033
|
}
|
|
@@ -8014,7 +8053,7 @@ var flow = superClass => class extends superClass {
|
|
|
8014
8053
|
var typeAnnotation = null;
|
|
8015
8054
|
var node = this.startNode();
|
|
8016
8055
|
var lh = this.lookahead();
|
|
8017
|
-
var isThis = this.state.type ===
|
|
8056
|
+
var isThis = this.state.type === 74;
|
|
8018
8057
|
|
|
8019
8058
|
if (lh.type === 14 || lh.type === 17) {
|
|
8020
8059
|
if (isThis && !first) {
|
|
@@ -8055,7 +8094,7 @@ var flow = superClass => class extends superClass {
|
|
|
8055
8094
|
var rest = null;
|
|
8056
8095
|
var _this = null;
|
|
8057
8096
|
|
|
8058
|
-
if (this.match(
|
|
8097
|
+
if (this.match(74)) {
|
|
8059
8098
|
_this = this.flowParseFunctionTypeParam(true);
|
|
8060
8099
|
_this.name = null;
|
|
8061
8100
|
|
|
@@ -8147,7 +8186,7 @@ var flow = superClass => class extends superClass {
|
|
|
8147
8186
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
8148
8187
|
return type;
|
|
8149
8188
|
|
|
8150
|
-
case
|
|
8189
|
+
case 45:
|
|
8151
8190
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
8152
8191
|
this.expect(10);
|
|
8153
8192
|
tmp = this.flowParseFunctionTypeParams();
|
|
@@ -8163,7 +8202,7 @@ var flow = superClass => class extends superClass {
|
|
|
8163
8202
|
this.next();
|
|
8164
8203
|
|
|
8165
8204
|
if (!this.match(11) && !this.match(21)) {
|
|
8166
|
-
if (tokenIsIdentifier(this.state.type) || this.match(
|
|
8205
|
+
if (tokenIsIdentifier(this.state.type) || this.match(74)) {
|
|
8167
8206
|
var token = this.lookahead().type;
|
|
8168
8207
|
isGroupedType = token !== 17 && token !== 14;
|
|
8169
8208
|
} else {
|
|
@@ -8199,24 +8238,24 @@ var flow = superClass => class extends superClass {
|
|
|
8199
8238
|
node.typeParameters = null;
|
|
8200
8239
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
8201
8240
|
|
|
8202
|
-
case
|
|
8241
|
+
case 125:
|
|
8203
8242
|
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
8204
8243
|
|
|
8205
|
-
case
|
|
8206
|
-
case
|
|
8207
|
-
node.value = this.match(
|
|
8244
|
+
case 81:
|
|
8245
|
+
case 82:
|
|
8246
|
+
node.value = this.match(81);
|
|
8208
8247
|
this.next();
|
|
8209
8248
|
return this.finishNode(node, "BooleanLiteralTypeAnnotation");
|
|
8210
8249
|
|
|
8211
|
-
case
|
|
8250
|
+
case 49:
|
|
8212
8251
|
if (this.state.value === "-") {
|
|
8213
8252
|
this.next();
|
|
8214
8253
|
|
|
8215
|
-
if (this.match(
|
|
8254
|
+
if (this.match(126)) {
|
|
8216
8255
|
return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
8217
8256
|
}
|
|
8218
8257
|
|
|
8219
|
-
if (this.match(
|
|
8258
|
+
if (this.match(127)) {
|
|
8220
8259
|
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
8221
8260
|
}
|
|
8222
8261
|
|
|
@@ -8225,29 +8264,29 @@ var flow = superClass => class extends superClass {
|
|
|
8225
8264
|
|
|
8226
8265
|
throw this.unexpected();
|
|
8227
8266
|
|
|
8228
|
-
case
|
|
8267
|
+
case 126:
|
|
8229
8268
|
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
8230
8269
|
|
|
8231
|
-
case
|
|
8270
|
+
case 127:
|
|
8232
8271
|
return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
|
|
8233
8272
|
|
|
8234
|
-
case
|
|
8273
|
+
case 84:
|
|
8235
8274
|
this.next();
|
|
8236
8275
|
return this.finishNode(node, "VoidTypeAnnotation");
|
|
8237
8276
|
|
|
8238
|
-
case
|
|
8277
|
+
case 80:
|
|
8239
8278
|
this.next();
|
|
8240
8279
|
return this.finishNode(node, "NullLiteralTypeAnnotation");
|
|
8241
8280
|
|
|
8242
|
-
case
|
|
8281
|
+
case 74:
|
|
8243
8282
|
this.next();
|
|
8244
8283
|
return this.finishNode(node, "ThisTypeAnnotation");
|
|
8245
8284
|
|
|
8246
|
-
case
|
|
8285
|
+
case 51:
|
|
8247
8286
|
this.next();
|
|
8248
8287
|
return this.finishNode(node, "ExistsTypeAnnotation");
|
|
8249
8288
|
|
|
8250
|
-
case
|
|
8289
|
+
case 83:
|
|
8251
8290
|
return this.flowParseTypeofType();
|
|
8252
8291
|
|
|
8253
8292
|
default:
|
|
@@ -8256,7 +8295,7 @@ var flow = superClass => class extends superClass {
|
|
|
8256
8295
|
this.next();
|
|
8257
8296
|
return super.createIdentifier(node, label);
|
|
8258
8297
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
8259
|
-
if (this.isContextual(
|
|
8298
|
+
if (this.isContextual(121)) {
|
|
8260
8299
|
return this.flowParseInterfaceType();
|
|
8261
8300
|
}
|
|
8262
8301
|
|
|
@@ -8330,11 +8369,11 @@ var flow = superClass => class extends superClass {
|
|
|
8330
8369
|
|
|
8331
8370
|
flowParseIntersectionType() {
|
|
8332
8371
|
var node = this.startNode();
|
|
8333
|
-
this.eat(
|
|
8372
|
+
this.eat(43);
|
|
8334
8373
|
var type = this.flowParseAnonFunctionWithoutParens();
|
|
8335
8374
|
node.types = [type];
|
|
8336
8375
|
|
|
8337
|
-
while (this.eat(
|
|
8376
|
+
while (this.eat(43)) {
|
|
8338
8377
|
node.types.push(this.flowParseAnonFunctionWithoutParens());
|
|
8339
8378
|
}
|
|
8340
8379
|
|
|
@@ -8343,11 +8382,11 @@ var flow = superClass => class extends superClass {
|
|
|
8343
8382
|
|
|
8344
8383
|
flowParseUnionType() {
|
|
8345
8384
|
var node = this.startNode();
|
|
8346
|
-
this.eat(
|
|
8385
|
+
this.eat(41);
|
|
8347
8386
|
var type = this.flowParseIntersectionType();
|
|
8348
8387
|
node.types = [type];
|
|
8349
8388
|
|
|
8350
|
-
while (this.eat(
|
|
8389
|
+
while (this.eat(41)) {
|
|
8351
8390
|
node.types.push(this.flowParseIntersectionType());
|
|
8352
8391
|
}
|
|
8353
8392
|
|
|
@@ -8363,7 +8402,7 @@ var flow = superClass => class extends superClass {
|
|
|
8363
8402
|
}
|
|
8364
8403
|
|
|
8365
8404
|
flowParseTypeOrImplicitInstantiation() {
|
|
8366
|
-
if (this.state.type ===
|
|
8405
|
+
if (this.state.type === 124 && this.state.value === "_") {
|
|
8367
8406
|
var startPos = this.state.start;
|
|
8368
8407
|
var startLoc = this.state.startLoc;
|
|
8369
8408
|
var node = this.parseIdentifier();
|
|
@@ -8399,7 +8438,7 @@ var flow = superClass => class extends superClass {
|
|
|
8399
8438
|
flowParseVariance() {
|
|
8400
8439
|
var variance = null;
|
|
8401
8440
|
|
|
8402
|
-
if (this.match(
|
|
8441
|
+
if (this.match(49)) {
|
|
8403
8442
|
variance = this.startNode();
|
|
8404
8443
|
|
|
8405
8444
|
if (this.state.value === "+") {
|
|
@@ -8438,7 +8477,7 @@ var flow = superClass => class extends superClass {
|
|
|
8438
8477
|
}
|
|
8439
8478
|
|
|
8440
8479
|
parseStatement(context, topLevel) {
|
|
8441
|
-
if (this.state.strict && this.isContextual(
|
|
8480
|
+
if (this.state.strict && this.isContextual(121)) {
|
|
8442
8481
|
var lookahead = this.lookahead();
|
|
8443
8482
|
|
|
8444
8483
|
if (tokenIsKeywordOrIdentifier(lookahead.type)) {
|
|
@@ -8446,7 +8485,7 @@ var flow = superClass => class extends superClass {
|
|
|
8446
8485
|
this.next();
|
|
8447
8486
|
return this.flowParseInterface(node);
|
|
8448
8487
|
}
|
|
8449
|
-
} else if (this.shouldParseEnums() && this.isContextual(
|
|
8488
|
+
} else if (this.shouldParseEnums() && this.isContextual(118)) {
|
|
8450
8489
|
var _node = this.startNode();
|
|
8451
8490
|
|
|
8452
8491
|
this.next();
|
|
@@ -8465,7 +8504,7 @@ var flow = superClass => class extends superClass {
|
|
|
8465
8504
|
parseExpressionStatement(node, expr) {
|
|
8466
8505
|
if (expr.type === "Identifier") {
|
|
8467
8506
|
if (expr.name === "declare") {
|
|
8468
|
-
if (this.match(
|
|
8507
|
+
if (this.match(76) || tokenIsIdentifier(this.state.type) || this.match(64) || this.match(70) || this.match(78)) {
|
|
8469
8508
|
return this.flowParseDeclare(node);
|
|
8470
8509
|
}
|
|
8471
8510
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
@@ -8487,7 +8526,7 @@ var flow = superClass => class extends superClass {
|
|
|
8487
8526
|
type
|
|
8488
8527
|
} = this.state;
|
|
8489
8528
|
|
|
8490
|
-
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type ===
|
|
8529
|
+
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 118) {
|
|
8491
8530
|
return !this.state.containsEsc;
|
|
8492
8531
|
}
|
|
8493
8532
|
|
|
@@ -8499,7 +8538,7 @@ var flow = superClass => class extends superClass {
|
|
|
8499
8538
|
type
|
|
8500
8539
|
} = this.state;
|
|
8501
8540
|
|
|
8502
|
-
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type ===
|
|
8541
|
+
if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 118) {
|
|
8503
8542
|
return this.state.containsEsc;
|
|
8504
8543
|
}
|
|
8505
8544
|
|
|
@@ -8507,7 +8546,7 @@ var flow = superClass => class extends superClass {
|
|
|
8507
8546
|
}
|
|
8508
8547
|
|
|
8509
8548
|
parseExportDefaultExpression() {
|
|
8510
|
-
if (this.shouldParseEnums() && this.isContextual(
|
|
8549
|
+
if (this.shouldParseEnums() && this.isContextual(118)) {
|
|
8511
8550
|
var node = this.startNode();
|
|
8512
8551
|
this.next();
|
|
8513
8552
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -8680,7 +8719,7 @@ var flow = superClass => class extends superClass {
|
|
|
8680
8719
|
}
|
|
8681
8720
|
|
|
8682
8721
|
parseExportDeclaration(node) {
|
|
8683
|
-
if (this.isContextual(
|
|
8722
|
+
if (this.isContextual(122)) {
|
|
8684
8723
|
node.exportKind = "type";
|
|
8685
8724
|
var declarationNode = this.startNode();
|
|
8686
8725
|
this.next();
|
|
@@ -8692,21 +8731,21 @@ var flow = superClass => class extends superClass {
|
|
|
8692
8731
|
} else {
|
|
8693
8732
|
return this.flowParseTypeAlias(declarationNode);
|
|
8694
8733
|
}
|
|
8695
|
-
} else if (this.isContextual(
|
|
8734
|
+
} else if (this.isContextual(123)) {
|
|
8696
8735
|
node.exportKind = "type";
|
|
8697
8736
|
|
|
8698
8737
|
var _declarationNode = this.startNode();
|
|
8699
8738
|
|
|
8700
8739
|
this.next();
|
|
8701
8740
|
return this.flowParseOpaqueType(_declarationNode, false);
|
|
8702
|
-
} else if (this.isContextual(
|
|
8741
|
+
} else if (this.isContextual(121)) {
|
|
8703
8742
|
node.exportKind = "type";
|
|
8704
8743
|
|
|
8705
8744
|
var _declarationNode2 = this.startNode();
|
|
8706
8745
|
|
|
8707
8746
|
this.next();
|
|
8708
8747
|
return this.flowParseInterface(_declarationNode2);
|
|
8709
|
-
} else if (this.shouldParseEnums() && this.isContextual(
|
|
8748
|
+
} else if (this.shouldParseEnums() && this.isContextual(118)) {
|
|
8710
8749
|
node.exportKind = "value";
|
|
8711
8750
|
|
|
8712
8751
|
var _declarationNode3 = this.startNode();
|
|
@@ -8721,7 +8760,7 @@ var flow = superClass => class extends superClass {
|
|
|
8721
8760
|
eatExportStar(node) {
|
|
8722
8761
|
if (super.eatExportStar(...arguments)) return true;
|
|
8723
8762
|
|
|
8724
|
-
if (this.isContextual(
|
|
8763
|
+
if (this.isContextual(122) && this.lookahead().type === 51) {
|
|
8725
8764
|
node.exportKind = "type";
|
|
8726
8765
|
this.next();
|
|
8727
8766
|
this.next();
|
|
@@ -8745,7 +8784,7 @@ var flow = superClass => class extends superClass {
|
|
|
8745
8784
|
parseClassId(node, isStatement, optionalId) {
|
|
8746
8785
|
super.parseClassId(node, isStatement, optionalId);
|
|
8747
8786
|
|
|
8748
|
-
if (this.match(
|
|
8787
|
+
if (this.match(45)) {
|
|
8749
8788
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
8750
8789
|
}
|
|
8751
8790
|
}
|
|
@@ -8753,7 +8792,7 @@ var flow = superClass => class extends superClass {
|
|
|
8753
8792
|
parseClassMember(classBody, member, state) {
|
|
8754
8793
|
var pos = this.state.start;
|
|
8755
8794
|
|
|
8756
|
-
if (this.isContextual(
|
|
8795
|
+
if (this.isContextual(117)) {
|
|
8757
8796
|
if (this.parseClassMemberFromModifier(classBody, member)) {
|
|
8758
8797
|
return;
|
|
8759
8798
|
}
|
|
@@ -8784,7 +8823,7 @@ var flow = superClass => class extends superClass {
|
|
|
8784
8823
|
this.raise(this.state.pos, ErrorMessages.InvalidIdentifier, fullWord);
|
|
8785
8824
|
}
|
|
8786
8825
|
|
|
8787
|
-
this.finishToken(
|
|
8826
|
+
this.finishToken(124, fullWord);
|
|
8788
8827
|
}
|
|
8789
8828
|
|
|
8790
8829
|
getTokenFromCode(code) {
|
|
@@ -8793,7 +8832,7 @@ var flow = superClass => class extends superClass {
|
|
|
8793
8832
|
if (code === 123 && next === 124) {
|
|
8794
8833
|
return this.finishOp(6, 2);
|
|
8795
8834
|
} else if (this.state.inType && (code === 62 || code === 60)) {
|
|
8796
|
-
return this.finishOp(code === 62 ?
|
|
8835
|
+
return this.finishOp(code === 62 ? 46 : 45, 1);
|
|
8797
8836
|
} else if (this.state.inType && code === 63) {
|
|
8798
8837
|
if (next === 46) {
|
|
8799
8838
|
return this.finishOp(18, 2);
|
|
@@ -8889,7 +8928,7 @@ var flow = superClass => class extends superClass {
|
|
|
8889
8928
|
}
|
|
8890
8929
|
|
|
8891
8930
|
isClassMethod() {
|
|
8892
|
-
return this.match(
|
|
8931
|
+
return this.match(45) || super.isClassMethod();
|
|
8893
8932
|
}
|
|
8894
8933
|
|
|
8895
8934
|
isClassProperty() {
|
|
@@ -8907,7 +8946,7 @@ var flow = superClass => class extends superClass {
|
|
|
8907
8946
|
|
|
8908
8947
|
delete method.variance;
|
|
8909
8948
|
|
|
8910
|
-
if (this.match(
|
|
8949
|
+
if (this.match(45)) {
|
|
8911
8950
|
method.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
8912
8951
|
}
|
|
8913
8952
|
|
|
@@ -8935,7 +8974,7 @@ var flow = superClass => class extends superClass {
|
|
|
8935
8974
|
|
|
8936
8975
|
delete method.variance;
|
|
8937
8976
|
|
|
8938
|
-
if (this.match(
|
|
8977
|
+
if (this.match(45)) {
|
|
8939
8978
|
method.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
8940
8979
|
}
|
|
8941
8980
|
|
|
@@ -8945,11 +8984,11 @@ var flow = superClass => class extends superClass {
|
|
|
8945
8984
|
parseClassSuper(node) {
|
|
8946
8985
|
super.parseClassSuper(node);
|
|
8947
8986
|
|
|
8948
|
-
if (node.superClass && this.match(
|
|
8987
|
+
if (node.superClass && this.match(45)) {
|
|
8949
8988
|
node.superTypeParameters = this.flowParseTypeParameterInstantiation();
|
|
8950
8989
|
}
|
|
8951
8990
|
|
|
8952
|
-
if (this.isContextual(
|
|
8991
|
+
if (this.isContextual(106)) {
|
|
8953
8992
|
this.next();
|
|
8954
8993
|
var implemented = node.implements = [];
|
|
8955
8994
|
|
|
@@ -8958,7 +8997,7 @@ var flow = superClass => class extends superClass {
|
|
|
8958
8997
|
|
|
8959
8998
|
_node3.id = this.flowParseRestrictedIdentifier(true);
|
|
8960
8999
|
|
|
8961
|
-
if (this.match(
|
|
9000
|
+
if (this.match(45)) {
|
|
8962
9001
|
_node3.typeParameters = this.flowParseTypeParameterInstantiation();
|
|
8963
9002
|
} else {
|
|
8964
9003
|
_node3.typeParameters = null;
|
|
@@ -8996,7 +9035,7 @@ var flow = superClass => class extends superClass {
|
|
|
8996
9035
|
delete prop.variance;
|
|
8997
9036
|
var typeParameters;
|
|
8998
9037
|
|
|
8999
|
-
if (this.match(
|
|
9038
|
+
if (this.match(45) && !isAccessor) {
|
|
9000
9039
|
typeParameters = this.flowParseTypeParameterDeclaration();
|
|
9001
9040
|
if (!this.match(10)) this.unexpected();
|
|
9002
9041
|
}
|
|
@@ -9027,7 +9066,7 @@ var flow = superClass => class extends superClass {
|
|
|
9027
9066
|
this.raise(param.start, FlowErrors.ThisParamAnnotationRequired);
|
|
9028
9067
|
}
|
|
9029
9068
|
|
|
9030
|
-
if (this.match(
|
|
9069
|
+
if (this.match(29) && this.isThisParam(param)) {
|
|
9031
9070
|
this.raise(param.start, FlowErrors.ThisParamNoDefault);
|
|
9032
9071
|
}
|
|
9033
9072
|
|
|
@@ -9063,9 +9102,9 @@ var flow = superClass => class extends superClass {
|
|
|
9063
9102
|
node.importKind = "value";
|
|
9064
9103
|
var kind = null;
|
|
9065
9104
|
|
|
9066
|
-
if (this.match(
|
|
9105
|
+
if (this.match(83)) {
|
|
9067
9106
|
kind = "typeof";
|
|
9068
|
-
} else if (this.isContextual(
|
|
9107
|
+
} else if (this.isContextual(122)) {
|
|
9069
9108
|
kind = "type";
|
|
9070
9109
|
}
|
|
9071
9110
|
|
|
@@ -9075,11 +9114,11 @@ var flow = superClass => class extends superClass {
|
|
|
9075
9114
|
type
|
|
9076
9115
|
} = lh;
|
|
9077
9116
|
|
|
9078
|
-
if (kind === "type" && type ===
|
|
9117
|
+
if (kind === "type" && type === 51) {
|
|
9079
9118
|
this.unexpected(lh.start);
|
|
9080
9119
|
}
|
|
9081
9120
|
|
|
9082
|
-
if (isMaybeDefaultImport(type) || type === 5 || type ===
|
|
9121
|
+
if (isMaybeDefaultImport(type) || type === 5 || type === 51) {
|
|
9083
9122
|
this.next();
|
|
9084
9123
|
node.importKind = kind;
|
|
9085
9124
|
}
|
|
@@ -9102,7 +9141,7 @@ var flow = superClass => class extends superClass {
|
|
|
9102
9141
|
|
|
9103
9142
|
var isBinding = false;
|
|
9104
9143
|
|
|
9105
|
-
if (this.isContextual(
|
|
9144
|
+
if (this.isContextual(89) && !this.isLookaheadContextual("as")) {
|
|
9106
9145
|
var as_ident = this.parseIdentifier(true);
|
|
9107
9146
|
|
|
9108
9147
|
if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
@@ -9127,7 +9166,7 @@ var flow = superClass => class extends superClass {
|
|
|
9127
9166
|
specifier.importKind = null;
|
|
9128
9167
|
}
|
|
9129
9168
|
|
|
9130
|
-
if (this.eatContextual(
|
|
9169
|
+
if (this.eatContextual(89)) {
|
|
9131
9170
|
specifier.local = this.parseIdentifier();
|
|
9132
9171
|
} else {
|
|
9133
9172
|
isBinding = true;
|
|
@@ -9155,7 +9194,7 @@ var flow = superClass => class extends superClass {
|
|
|
9155
9194
|
|
|
9156
9195
|
parseBindingAtom() {
|
|
9157
9196
|
switch (this.state.type) {
|
|
9158
|
-
case
|
|
9197
|
+
case 74:
|
|
9159
9198
|
return this.parseIdentifier(true);
|
|
9160
9199
|
|
|
9161
9200
|
default:
|
|
@@ -9166,7 +9205,7 @@ var flow = superClass => class extends superClass {
|
|
|
9166
9205
|
parseFunctionParams(node, allowModifiers) {
|
|
9167
9206
|
var kind = node.kind;
|
|
9168
9207
|
|
|
9169
|
-
if (kind !== "get" && kind !== "set" && this.match(
|
|
9208
|
+
if (kind !== "get" && kind !== "set" && this.match(45)) {
|
|
9170
9209
|
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
9171
9210
|
}
|
|
9172
9211
|
|
|
@@ -9203,23 +9242,21 @@ var flow = superClass => class extends superClass {
|
|
|
9203
9242
|
var state = null;
|
|
9204
9243
|
var jsx;
|
|
9205
9244
|
|
|
9206
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
9245
|
+
if (this.hasPlugin("jsx") && (this.match(134) || this.match(45))) {
|
|
9207
9246
|
state = this.state.clone();
|
|
9208
9247
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9209
9248
|
if (!jsx.error) return jsx.node;
|
|
9210
9249
|
var {
|
|
9211
9250
|
context
|
|
9212
9251
|
} = this.state;
|
|
9213
|
-
var
|
|
9252
|
+
var currentContext = context[context.length - 1];
|
|
9214
9253
|
|
|
9215
|
-
if (
|
|
9216
|
-
context.
|
|
9217
|
-
} else if (curContext === types.j_expr) {
|
|
9218
|
-
context.length -= 1;
|
|
9254
|
+
if (currentContext === types.j_oTag || currentContext === types.j_expr) {
|
|
9255
|
+
context.pop();
|
|
9219
9256
|
}
|
|
9220
9257
|
}
|
|
9221
9258
|
|
|
9222
|
-
if ((_jsx = jsx) != null && _jsx.error || this.match(
|
|
9259
|
+
if ((_jsx = jsx) != null && _jsx.error || this.match(45)) {
|
|
9223
9260
|
var _jsx2, _jsx3;
|
|
9224
9261
|
|
|
9225
9262
|
state = state || this.state.clone();
|
|
@@ -9329,7 +9366,7 @@ var flow = superClass => class extends superClass {
|
|
|
9329
9366
|
node.callee = base;
|
|
9330
9367
|
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
9331
9368
|
base = this.finishNode(node, "CallExpression");
|
|
9332
|
-
} else if (base.type === "Identifier" && base.name === "async" && this.match(
|
|
9369
|
+
} else if (base.type === "Identifier" && base.name === "async" && this.match(45)) {
|
|
9333
9370
|
var state = this.state.clone();
|
|
9334
9371
|
var arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || abort(), state);
|
|
9335
9372
|
if (!arrow.error && !arrow.aborted) return arrow.node;
|
|
@@ -9369,7 +9406,7 @@ var flow = superClass => class extends superClass {
|
|
|
9369
9406
|
node.arguments = this.parseCallExpressionArguments(11, false);
|
|
9370
9407
|
node.optional = true;
|
|
9371
9408
|
return this.finishCallExpression(node, true);
|
|
9372
|
-
} else if (!noCalls && this.shouldParseTypes() && this.match(
|
|
9409
|
+
} else if (!noCalls && this.shouldParseTypes() && this.match(45)) {
|
|
9373
9410
|
var _node4 = this.startNodeAt(startPos, startLoc);
|
|
9374
9411
|
|
|
9375
9412
|
_node4.callee = base;
|
|
@@ -9393,7 +9430,7 @@ var flow = superClass => class extends superClass {
|
|
|
9393
9430
|
parseNewArguments(node) {
|
|
9394
9431
|
var targs = null;
|
|
9395
9432
|
|
|
9396
|
-
if (this.shouldParseTypes() && this.match(
|
|
9433
|
+
if (this.shouldParseTypes() && this.match(45)) {
|
|
9397
9434
|
targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
|
|
9398
9435
|
}
|
|
9399
9436
|
|
|
@@ -9591,7 +9628,7 @@ var flow = superClass => class extends superClass {
|
|
|
9591
9628
|
var endOfInit = () => this.match(12) || this.match(8);
|
|
9592
9629
|
|
|
9593
9630
|
switch (this.state.type) {
|
|
9594
|
-
case
|
|
9631
|
+
case 126:
|
|
9595
9632
|
{
|
|
9596
9633
|
var literal = this.parseNumericLiteral(this.state.value);
|
|
9597
9634
|
|
|
@@ -9609,7 +9646,7 @@ var flow = superClass => class extends superClass {
|
|
|
9609
9646
|
};
|
|
9610
9647
|
}
|
|
9611
9648
|
|
|
9612
|
-
case
|
|
9649
|
+
case 125:
|
|
9613
9650
|
{
|
|
9614
9651
|
var _literal = this.parseStringLiteral(this.state.value);
|
|
9615
9652
|
|
|
@@ -9627,10 +9664,10 @@ var flow = superClass => class extends superClass {
|
|
|
9627
9664
|
};
|
|
9628
9665
|
}
|
|
9629
9666
|
|
|
9630
|
-
case
|
|
9631
|
-
case
|
|
9667
|
+
case 81:
|
|
9668
|
+
case 82:
|
|
9632
9669
|
{
|
|
9633
|
-
var _literal2 = this.parseBooleanLiteral(this.match(
|
|
9670
|
+
var _literal2 = this.parseBooleanLiteral(this.match(81));
|
|
9634
9671
|
|
|
9635
9672
|
if (endOfInit()) {
|
|
9636
9673
|
return {
|
|
@@ -9657,7 +9694,7 @@ var flow = superClass => class extends superClass {
|
|
|
9657
9694
|
flowEnumMemberRaw() {
|
|
9658
9695
|
var pos = this.state.start;
|
|
9659
9696
|
var id = this.parseIdentifier(true);
|
|
9660
|
-
var init = this.eat(
|
|
9697
|
+
var init = this.eat(29) ? this.flowEnumMemberInit() : {
|
|
9661
9698
|
type: "none",
|
|
9662
9699
|
pos
|
|
9663
9700
|
};
|
|
@@ -9825,7 +9862,7 @@ var flow = superClass => class extends superClass {
|
|
|
9825
9862
|
enumName
|
|
9826
9863
|
} = _ref16;
|
|
9827
9864
|
|
|
9828
|
-
if (this.eatContextual(
|
|
9865
|
+
if (this.eatContextual(97)) {
|
|
9829
9866
|
if (!tokenIsIdentifier(this.state.type)) {
|
|
9830
9867
|
throw this.flowEnumErrorInvalidExplicitType(this.state.start, {
|
|
9831
9868
|
enumName,
|
|
@@ -10242,9 +10279,6 @@ var JsxErrors = makeErrorTemplates({
|
|
|
10242
10279
|
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
10243
10280
|
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
10244
10281
|
}, ErrorCodes.SyntaxError, "jsx");
|
|
10245
|
-
types.j_oTag = new TokContext("<tag");
|
|
10246
|
-
types.j_cTag = new TokContext("</tag");
|
|
10247
|
-
types.j_expr = new TokContext("<tag>...</tag>", true);
|
|
10248
10282
|
|
|
10249
10283
|
function isFragment(object) {
|
|
10250
10284
|
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
|
|
@@ -10284,14 +10318,14 @@ var jsx = superClass => class extends superClass {
|
|
|
10284
10318
|
if (this.state.pos === this.state.start) {
|
|
10285
10319
|
if (ch === 60 && this.state.canStartJSXElement) {
|
|
10286
10320
|
++this.state.pos;
|
|
10287
|
-
return this.finishToken(
|
|
10321
|
+
return this.finishToken(134);
|
|
10288
10322
|
}
|
|
10289
10323
|
|
|
10290
10324
|
return super.getTokenFromCode(ch);
|
|
10291
10325
|
}
|
|
10292
10326
|
|
|
10293
10327
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
10294
|
-
return this.finishToken(
|
|
10328
|
+
return this.finishToken(133, out);
|
|
10295
10329
|
|
|
10296
10330
|
case 38:
|
|
10297
10331
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -10357,7 +10391,7 @@ var jsx = superClass => class extends superClass {
|
|
|
10357
10391
|
}
|
|
10358
10392
|
|
|
10359
10393
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
10360
|
-
return this.finishToken(
|
|
10394
|
+
return this.finishToken(125, out);
|
|
10361
10395
|
}
|
|
10362
10396
|
|
|
10363
10397
|
jsxReadEntity() {
|
|
@@ -10411,13 +10445,13 @@ var jsx = superClass => class extends superClass {
|
|
|
10411
10445
|
ch = this.input.charCodeAt(++this.state.pos);
|
|
10412
10446
|
} while (isIdentifierChar(ch) || ch === 45);
|
|
10413
10447
|
|
|
10414
|
-
return this.finishToken(
|
|
10448
|
+
return this.finishToken(132, this.input.slice(start, this.state.pos));
|
|
10415
10449
|
}
|
|
10416
10450
|
|
|
10417
10451
|
jsxParseIdentifier() {
|
|
10418
10452
|
var node = this.startNode();
|
|
10419
10453
|
|
|
10420
|
-
if (this.match(
|
|
10454
|
+
if (this.match(132)) {
|
|
10421
10455
|
node.name = this.state.value;
|
|
10422
10456
|
} else if (tokenIsKeyword(this.state.type)) {
|
|
10423
10457
|
node.name = tokenLabelName(this.state.type);
|
|
@@ -10465,8 +10499,9 @@ var jsx = superClass => class extends superClass {
|
|
|
10465
10499
|
switch (this.state.type) {
|
|
10466
10500
|
case 5:
|
|
10467
10501
|
node = this.startNode();
|
|
10502
|
+
this.setContext(types.brace);
|
|
10468
10503
|
this.next();
|
|
10469
|
-
node = this.jsxParseExpressionContainer(node);
|
|
10504
|
+
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
10470
10505
|
|
|
10471
10506
|
if (node.expression.type === "JSXEmptyExpression") {
|
|
10472
10507
|
this.raise(node.start, JsxErrors.AttributeIsEmpty);
|
|
@@ -10474,8 +10509,8 @@ var jsx = superClass => class extends superClass {
|
|
|
10474
10509
|
|
|
10475
10510
|
return node;
|
|
10476
10511
|
|
|
10477
|
-
case
|
|
10478
|
-
case
|
|
10512
|
+
case 134:
|
|
10513
|
+
case 125:
|
|
10479
10514
|
return this.parseExprAtom();
|
|
10480
10515
|
|
|
10481
10516
|
default:
|
|
@@ -10491,11 +10526,12 @@ var jsx = superClass => class extends superClass {
|
|
|
10491
10526
|
jsxParseSpreadChild(node) {
|
|
10492
10527
|
this.next();
|
|
10493
10528
|
node.expression = this.parseExpression();
|
|
10529
|
+
this.setContext(types.j_oTag);
|
|
10494
10530
|
this.expect(8);
|
|
10495
10531
|
return this.finishNode(node, "JSXSpreadChild");
|
|
10496
10532
|
}
|
|
10497
10533
|
|
|
10498
|
-
jsxParseExpressionContainer(node) {
|
|
10534
|
+
jsxParseExpressionContainer(node, previousContext) {
|
|
10499
10535
|
if (this.match(8)) {
|
|
10500
10536
|
node.expression = this.jsxParseEmptyExpression();
|
|
10501
10537
|
} else {
|
|
@@ -10503,6 +10539,7 @@ var jsx = superClass => class extends superClass {
|
|
|
10503
10539
|
node.expression = expression;
|
|
10504
10540
|
}
|
|
10505
10541
|
|
|
10542
|
+
this.setContext(previousContext);
|
|
10506
10543
|
this.expect(8);
|
|
10507
10544
|
return this.finishNode(node, "JSXExpressionContainer");
|
|
10508
10545
|
}
|
|
@@ -10510,23 +10547,26 @@ var jsx = superClass => class extends superClass {
|
|
|
10510
10547
|
jsxParseAttribute() {
|
|
10511
10548
|
var node = this.startNode();
|
|
10512
10549
|
|
|
10513
|
-
if (this.
|
|
10550
|
+
if (this.match(5)) {
|
|
10551
|
+
this.setContext(types.brace);
|
|
10552
|
+
this.next();
|
|
10514
10553
|
this.expect(21);
|
|
10515
10554
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
10555
|
+
this.setContext(types.j_oTag);
|
|
10516
10556
|
this.expect(8);
|
|
10517
10557
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
10518
10558
|
}
|
|
10519
10559
|
|
|
10520
10560
|
node.name = this.jsxParseNamespacedName();
|
|
10521
|
-
node.value = this.eat(
|
|
10561
|
+
node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
|
|
10522
10562
|
return this.finishNode(node, "JSXAttribute");
|
|
10523
10563
|
}
|
|
10524
10564
|
|
|
10525
10565
|
jsxParseOpeningElementAt(startPos, startLoc) {
|
|
10526
10566
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10527
10567
|
|
|
10528
|
-
if (this.match(
|
|
10529
|
-
this.expect(
|
|
10568
|
+
if (this.match(135)) {
|
|
10569
|
+
this.expect(135);
|
|
10530
10570
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
10531
10571
|
}
|
|
10532
10572
|
|
|
@@ -10537,26 +10577,26 @@ var jsx = superClass => class extends superClass {
|
|
|
10537
10577
|
jsxParseOpeningElementAfterName(node) {
|
|
10538
10578
|
var attributes = [];
|
|
10539
10579
|
|
|
10540
|
-
while (!this.match(
|
|
10580
|
+
while (!this.match(52) && !this.match(135)) {
|
|
10541
10581
|
attributes.push(this.jsxParseAttribute());
|
|
10542
10582
|
}
|
|
10543
10583
|
|
|
10544
10584
|
node.attributes = attributes;
|
|
10545
|
-
node.selfClosing = this.eat(
|
|
10546
|
-
this.expect(
|
|
10585
|
+
node.selfClosing = this.eat(52);
|
|
10586
|
+
this.expect(135);
|
|
10547
10587
|
return this.finishNode(node, "JSXOpeningElement");
|
|
10548
10588
|
}
|
|
10549
10589
|
|
|
10550
10590
|
jsxParseClosingElementAt(startPos, startLoc) {
|
|
10551
10591
|
var node = this.startNodeAt(startPos, startLoc);
|
|
10552
10592
|
|
|
10553
|
-
if (this.match(
|
|
10554
|
-
this.expect(
|
|
10593
|
+
if (this.match(135)) {
|
|
10594
|
+
this.expect(135);
|
|
10555
10595
|
return this.finishNode(node, "JSXClosingFragment");
|
|
10556
10596
|
}
|
|
10557
10597
|
|
|
10558
10598
|
node.name = this.jsxParseElementName();
|
|
10559
|
-
this.expect(
|
|
10599
|
+
this.expect(135);
|
|
10560
10600
|
return this.finishNode(node, "JSXClosingElement");
|
|
10561
10601
|
}
|
|
10562
10602
|
|
|
@@ -10569,12 +10609,12 @@ var jsx = superClass => class extends superClass {
|
|
|
10569
10609
|
if (!openingElement.selfClosing) {
|
|
10570
10610
|
contents: for (;;) {
|
|
10571
10611
|
switch (this.state.type) {
|
|
10572
|
-
case
|
|
10612
|
+
case 134:
|
|
10573
10613
|
startPos = this.state.start;
|
|
10574
10614
|
startLoc = this.state.startLoc;
|
|
10575
10615
|
this.next();
|
|
10576
10616
|
|
|
10577
|
-
if (this.eat(
|
|
10617
|
+
if (this.eat(52)) {
|
|
10578
10618
|
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
|
|
10579
10619
|
break contents;
|
|
10580
10620
|
}
|
|
@@ -10582,7 +10622,7 @@ var jsx = superClass => class extends superClass {
|
|
|
10582
10622
|
children.push(this.jsxParseElementAt(startPos, startLoc));
|
|
10583
10623
|
break;
|
|
10584
10624
|
|
|
10585
|
-
case
|
|
10625
|
+
case 133:
|
|
10586
10626
|
children.push(this.parseExprAtom());
|
|
10587
10627
|
break;
|
|
10588
10628
|
|
|
@@ -10590,12 +10630,13 @@ var jsx = superClass => class extends superClass {
|
|
|
10590
10630
|
{
|
|
10591
10631
|
var _node5 = this.startNode();
|
|
10592
10632
|
|
|
10633
|
+
this.setContext(types.brace);
|
|
10593
10634
|
this.next();
|
|
10594
10635
|
|
|
10595
10636
|
if (this.match(21)) {
|
|
10596
10637
|
children.push(this.jsxParseSpreadChild(_node5));
|
|
10597
10638
|
} else {
|
|
10598
|
-
children.push(this.jsxParseExpressionContainer(_node5));
|
|
10639
|
+
children.push(this.jsxParseExpressionContainer(_node5, types.j_expr));
|
|
10599
10640
|
}
|
|
10600
10641
|
|
|
10601
10642
|
break;
|
|
@@ -10627,7 +10668,7 @@ var jsx = superClass => class extends superClass {
|
|
|
10627
10668
|
|
|
10628
10669
|
node.children = children;
|
|
10629
10670
|
|
|
10630
|
-
if (this.match(
|
|
10671
|
+
if (this.match(45)) {
|
|
10631
10672
|
throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements);
|
|
10632
10673
|
}
|
|
10633
10674
|
|
|
@@ -10641,19 +10682,31 @@ var jsx = superClass => class extends superClass {
|
|
|
10641
10682
|
return this.jsxParseElementAt(startPos, startLoc);
|
|
10642
10683
|
}
|
|
10643
10684
|
|
|
10685
|
+
setContext(newContext) {
|
|
10686
|
+
var {
|
|
10687
|
+
context
|
|
10688
|
+
} = this.state;
|
|
10689
|
+
context[context.length - 1] = newContext;
|
|
10690
|
+
}
|
|
10691
|
+
|
|
10644
10692
|
parseExprAtom(refExpressionErrors) {
|
|
10645
|
-
if (this.match(
|
|
10693
|
+
if (this.match(133)) {
|
|
10646
10694
|
return this.parseLiteral(this.state.value, "JSXText");
|
|
10647
|
-
} else if (this.match(
|
|
10695
|
+
} else if (this.match(134)) {
|
|
10648
10696
|
return this.jsxParseElement();
|
|
10649
|
-
} else if (this.match(
|
|
10650
|
-
this.replaceToken(
|
|
10697
|
+
} else if (this.match(45) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
10698
|
+
this.replaceToken(134);
|
|
10651
10699
|
return this.jsxParseElement();
|
|
10652
10700
|
} else {
|
|
10653
10701
|
return super.parseExprAtom(refExpressionErrors);
|
|
10654
10702
|
}
|
|
10655
10703
|
}
|
|
10656
10704
|
|
|
10705
|
+
skipSpace() {
|
|
10706
|
+
var curContext = this.curContext();
|
|
10707
|
+
if (!curContext.preserveSpace) super.skipSpace();
|
|
10708
|
+
}
|
|
10709
|
+
|
|
10657
10710
|
getTokenFromCode(code) {
|
|
10658
10711
|
var context = this.curContext();
|
|
10659
10712
|
|
|
@@ -10668,7 +10721,7 @@ var jsx = superClass => class extends superClass {
|
|
|
10668
10721
|
|
|
10669
10722
|
if (code === 62) {
|
|
10670
10723
|
++this.state.pos;
|
|
10671
|
-
return this.finishToken(
|
|
10724
|
+
return this.finishToken(135);
|
|
10672
10725
|
}
|
|
10673
10726
|
|
|
10674
10727
|
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
@@ -10678,31 +10731,31 @@ var jsx = superClass => class extends superClass {
|
|
|
10678
10731
|
|
|
10679
10732
|
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
|
10680
10733
|
++this.state.pos;
|
|
10681
|
-
return this.finishToken(
|
|
10734
|
+
return this.finishToken(134);
|
|
10682
10735
|
}
|
|
10683
10736
|
|
|
10684
10737
|
return super.getTokenFromCode(code);
|
|
10685
10738
|
}
|
|
10686
10739
|
|
|
10687
10740
|
updateContext(prevType) {
|
|
10688
|
-
super.updateContext(prevType);
|
|
10689
10741
|
var {
|
|
10690
10742
|
context,
|
|
10691
10743
|
type
|
|
10692
10744
|
} = this.state;
|
|
10693
10745
|
|
|
10694
|
-
if (type ===
|
|
10746
|
+
if (type === 52 && prevType === 134) {
|
|
10695
10747
|
context.splice(-2, 2, types.j_cTag);
|
|
10696
10748
|
this.state.canStartJSXElement = false;
|
|
10697
|
-
} else if (type ===
|
|
10698
|
-
context.push(types.
|
|
10699
|
-
} else if (type ===
|
|
10700
|
-
var out = context.
|
|
10749
|
+
} else if (type === 134) {
|
|
10750
|
+
context.push(types.j_oTag);
|
|
10751
|
+
} else if (type === 135) {
|
|
10752
|
+
var out = context[context.length - 1];
|
|
10701
10753
|
|
|
10702
|
-
if (out === types.j_oTag && prevType ===
|
|
10754
|
+
if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
|
|
10703
10755
|
context.pop();
|
|
10704
10756
|
this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
|
|
10705
10757
|
} else {
|
|
10758
|
+
this.setContext(types.j_expr);
|
|
10706
10759
|
this.state.canStartJSXElement = true;
|
|
10707
10760
|
}
|
|
10708
10761
|
} else {
|
|
@@ -10914,7 +10967,7 @@ var typescript = superClass => class extends superClass {
|
|
|
10914
10967
|
}
|
|
10915
10968
|
|
|
10916
10969
|
tsTokenCanFollowModifier() {
|
|
10917
|
-
return (this.match(0) || this.match(5) || this.match(
|
|
10970
|
+
return (this.match(0) || this.match(5) || this.match(51) || this.match(21) || this.match(130) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
|
|
10918
10971
|
}
|
|
10919
10972
|
|
|
10920
10973
|
tsNextTokenCanFollowModifier() {
|
|
@@ -11003,7 +11056,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11003
11056
|
return this.match(3);
|
|
11004
11057
|
|
|
11005
11058
|
case "TypeParametersOrArguments":
|
|
11006
|
-
return this.match(
|
|
11059
|
+
return this.match(46);
|
|
11007
11060
|
}
|
|
11008
11061
|
|
|
11009
11062
|
throw new Error("Unreachable");
|
|
@@ -11069,7 +11122,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11069
11122
|
if (bracket) {
|
|
11070
11123
|
this.expect(0);
|
|
11071
11124
|
} else {
|
|
11072
|
-
this.expect(
|
|
11125
|
+
this.expect(45);
|
|
11073
11126
|
}
|
|
11074
11127
|
}
|
|
11075
11128
|
|
|
@@ -11078,7 +11131,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11078
11131
|
if (bracket) {
|
|
11079
11132
|
this.expect(3);
|
|
11080
11133
|
} else {
|
|
11081
|
-
this.expect(
|
|
11134
|
+
this.expect(46);
|
|
11082
11135
|
}
|
|
11083
11136
|
|
|
11084
11137
|
return result;
|
|
@@ -11086,10 +11139,10 @@ var typescript = superClass => class extends superClass {
|
|
|
11086
11139
|
|
|
11087
11140
|
tsParseImportType() {
|
|
11088
11141
|
var node = this.startNode();
|
|
11089
|
-
this.expect(
|
|
11142
|
+
this.expect(79);
|
|
11090
11143
|
this.expect(10);
|
|
11091
11144
|
|
|
11092
|
-
if (!this.match(
|
|
11145
|
+
if (!this.match(125)) {
|
|
11093
11146
|
this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument);
|
|
11094
11147
|
}
|
|
11095
11148
|
|
|
@@ -11100,7 +11153,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11100
11153
|
node.qualifier = this.tsParseEntityName(true);
|
|
11101
11154
|
}
|
|
11102
11155
|
|
|
11103
|
-
if (this.match(
|
|
11156
|
+
if (this.match(45)) {
|
|
11104
11157
|
node.typeParameters = this.tsParseTypeArguments();
|
|
11105
11158
|
}
|
|
11106
11159
|
|
|
@@ -11124,7 +11177,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11124
11177
|
var node = this.startNode();
|
|
11125
11178
|
node.typeName = this.tsParseEntityName(false);
|
|
11126
11179
|
|
|
11127
|
-
if (!this.hasPrecedingLineBreak() && this.match(
|
|
11180
|
+
if (!this.hasPrecedingLineBreak() && this.match(45)) {
|
|
11128
11181
|
node.typeParameters = this.tsParseTypeArguments();
|
|
11129
11182
|
}
|
|
11130
11183
|
|
|
@@ -11148,9 +11201,9 @@ var typescript = superClass => class extends superClass {
|
|
|
11148
11201
|
|
|
11149
11202
|
tsParseTypeQuery() {
|
|
11150
11203
|
var node = this.startNode();
|
|
11151
|
-
this.expect(
|
|
11204
|
+
this.expect(83);
|
|
11152
11205
|
|
|
11153
|
-
if (this.match(
|
|
11206
|
+
if (this.match(79)) {
|
|
11154
11207
|
node.exprName = this.tsParseImportType();
|
|
11155
11208
|
} else {
|
|
11156
11209
|
node.exprName = this.tsParseEntityName(true);
|
|
@@ -11162,13 +11215,13 @@ var typescript = superClass => class extends superClass {
|
|
|
11162
11215
|
tsParseTypeParameter() {
|
|
11163
11216
|
var node = this.startNode();
|
|
11164
11217
|
node.name = this.tsParseTypeParameterName();
|
|
11165
|
-
node.constraint = this.tsEatThenParseType(
|
|
11166
|
-
node.default = this.tsEatThenParseType(
|
|
11218
|
+
node.constraint = this.tsEatThenParseType(77);
|
|
11219
|
+
node.default = this.tsEatThenParseType(29);
|
|
11167
11220
|
return this.finishNode(node, "TSTypeParameter");
|
|
11168
11221
|
}
|
|
11169
11222
|
|
|
11170
11223
|
tsTryParseTypeParameters() {
|
|
11171
|
-
if (this.match(
|
|
11224
|
+
if (this.match(45)) {
|
|
11172
11225
|
return this.tsParseTypeParameters();
|
|
11173
11226
|
}
|
|
11174
11227
|
}
|
|
@@ -11176,7 +11229,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11176
11229
|
tsParseTypeParameters() {
|
|
11177
11230
|
var node = this.startNode();
|
|
11178
11231
|
|
|
11179
|
-
if (this.match(
|
|
11232
|
+
if (this.match(45) || this.match(134)) {
|
|
11180
11233
|
this.next();
|
|
11181
11234
|
} else {
|
|
11182
11235
|
this.unexpected();
|
|
@@ -11199,7 +11252,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11199
11252
|
}
|
|
11200
11253
|
|
|
11201
11254
|
tsTryNextParseConstantContext() {
|
|
11202
|
-
if (this.lookahead().type ===
|
|
11255
|
+
if (this.lookahead().type === 71) {
|
|
11203
11256
|
this.next();
|
|
11204
11257
|
return this.tsParseTypeReference();
|
|
11205
11258
|
}
|
|
@@ -11274,14 +11327,14 @@ var typescript = superClass => class extends superClass {
|
|
|
11274
11327
|
if (this.eat(17)) node.optional = true;
|
|
11275
11328
|
var nodeAny = node;
|
|
11276
11329
|
|
|
11277
|
-
if (this.match(10) || this.match(
|
|
11330
|
+
if (this.match(10) || this.match(45)) {
|
|
11278
11331
|
if (readonly) {
|
|
11279
11332
|
this.raise(node.start, TSErrors.ReadonlyForMethodSignature);
|
|
11280
11333
|
}
|
|
11281
11334
|
|
|
11282
11335
|
var method = nodeAny;
|
|
11283
11336
|
|
|
11284
|
-
if (method.kind && this.match(
|
|
11337
|
+
if (method.kind && this.match(45)) {
|
|
11285
11338
|
this.raise(this.state.pos, TSErrors.AccesorCannotHaveTypeParameters);
|
|
11286
11339
|
}
|
|
11287
11340
|
|
|
@@ -11336,15 +11389,15 @@ var typescript = superClass => class extends superClass {
|
|
|
11336
11389
|
tsParseTypeMember() {
|
|
11337
11390
|
var node = this.startNode();
|
|
11338
11391
|
|
|
11339
|
-
if (this.match(10) || this.match(
|
|
11392
|
+
if (this.match(10) || this.match(45)) {
|
|
11340
11393
|
return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
|
|
11341
11394
|
}
|
|
11342
11395
|
|
|
11343
|
-
if (this.match(
|
|
11396
|
+
if (this.match(73)) {
|
|
11344
11397
|
var id = this.startNode();
|
|
11345
11398
|
this.next();
|
|
11346
11399
|
|
|
11347
|
-
if (this.match(10) || this.match(
|
|
11400
|
+
if (this.match(10) || this.match(45)) {
|
|
11348
11401
|
return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
|
|
11349
11402
|
} else {
|
|
11350
11403
|
node.key = this.createIdentifier(id, "new");
|
|
@@ -11385,11 +11438,11 @@ var typescript = superClass => class extends superClass {
|
|
|
11385
11438
|
tsIsStartOfMappedType() {
|
|
11386
11439
|
this.next();
|
|
11387
11440
|
|
|
11388
|
-
if (this.eat(
|
|
11389
|
-
return this.isContextual(
|
|
11441
|
+
if (this.eat(49)) {
|
|
11442
|
+
return this.isContextual(114);
|
|
11390
11443
|
}
|
|
11391
11444
|
|
|
11392
|
-
if (this.isContextual(
|
|
11445
|
+
if (this.isContextual(114)) {
|
|
11393
11446
|
this.next();
|
|
11394
11447
|
}
|
|
11395
11448
|
|
|
@@ -11404,13 +11457,13 @@ var typescript = superClass => class extends superClass {
|
|
|
11404
11457
|
}
|
|
11405
11458
|
|
|
11406
11459
|
this.next();
|
|
11407
|
-
return this.match(
|
|
11460
|
+
return this.match(54);
|
|
11408
11461
|
}
|
|
11409
11462
|
|
|
11410
11463
|
tsParseMappedTypeParameter() {
|
|
11411
11464
|
var node = this.startNode();
|
|
11412
11465
|
node.name = this.tsParseTypeParameterName();
|
|
11413
|
-
node.constraint = this.tsExpectThenParseType(
|
|
11466
|
+
node.constraint = this.tsExpectThenParseType(54);
|
|
11414
11467
|
return this.finishNode(node, "TSTypeParameter");
|
|
11415
11468
|
}
|
|
11416
11469
|
|
|
@@ -11418,20 +11471,20 @@ var typescript = superClass => class extends superClass {
|
|
|
11418
11471
|
var node = this.startNode();
|
|
11419
11472
|
this.expect(5);
|
|
11420
11473
|
|
|
11421
|
-
if (this.match(
|
|
11474
|
+
if (this.match(49)) {
|
|
11422
11475
|
node.readonly = this.state.value;
|
|
11423
11476
|
this.next();
|
|
11424
|
-
this.expectContextual(
|
|
11425
|
-
} else if (this.eatContextual(
|
|
11477
|
+
this.expectContextual(114);
|
|
11478
|
+
} else if (this.eatContextual(114)) {
|
|
11426
11479
|
node.readonly = true;
|
|
11427
11480
|
}
|
|
11428
11481
|
|
|
11429
11482
|
this.expect(0);
|
|
11430
11483
|
node.typeParameter = this.tsParseMappedTypeParameter();
|
|
11431
|
-
node.nameType = this.eatContextual(
|
|
11484
|
+
node.nameType = this.eatContextual(89) ? this.tsParseType() : null;
|
|
11432
11485
|
this.expect(3);
|
|
11433
11486
|
|
|
11434
|
-
if (this.match(
|
|
11487
|
+
if (this.match(49)) {
|
|
11435
11488
|
node.optional = this.state.value;
|
|
11436
11489
|
this.next();
|
|
11437
11490
|
this.expect(17);
|
|
@@ -11542,11 +11595,11 @@ var typescript = superClass => class extends superClass {
|
|
|
11542
11595
|
|
|
11543
11596
|
node.literal = (() => {
|
|
11544
11597
|
switch (this.state.type) {
|
|
11545
|
-
case
|
|
11598
|
+
case 126:
|
|
11599
|
+
case 127:
|
|
11546
11600
|
case 125:
|
|
11547
|
-
case
|
|
11548
|
-
case
|
|
11549
|
-
case 80:
|
|
11601
|
+
case 81:
|
|
11602
|
+
case 82:
|
|
11550
11603
|
return this.parseExprAtom();
|
|
11551
11604
|
|
|
11552
11605
|
default:
|
|
@@ -11571,7 +11624,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11571
11624
|
tsParseThisTypeOrThisTypePredicate() {
|
|
11572
11625
|
var thisKeyword = this.tsParseThisTypeNode();
|
|
11573
11626
|
|
|
11574
|
-
if (this.isContextual(
|
|
11627
|
+
if (this.isContextual(109) && !this.hasPrecedingLineBreak()) {
|
|
11575
11628
|
return this.tsParseThisTypePredicate(thisKeyword);
|
|
11576
11629
|
} else {
|
|
11577
11630
|
return thisKeyword;
|
|
@@ -11580,19 +11633,19 @@ var typescript = superClass => class extends superClass {
|
|
|
11580
11633
|
|
|
11581
11634
|
tsParseNonArrayType() {
|
|
11582
11635
|
switch (this.state.type) {
|
|
11583
|
-
case 123:
|
|
11584
|
-
case 124:
|
|
11585
11636
|
case 125:
|
|
11586
|
-
case
|
|
11587
|
-
case
|
|
11637
|
+
case 126:
|
|
11638
|
+
case 127:
|
|
11639
|
+
case 81:
|
|
11640
|
+
case 82:
|
|
11588
11641
|
return this.tsParseLiteralTypeNode();
|
|
11589
11642
|
|
|
11590
|
-
case
|
|
11643
|
+
case 49:
|
|
11591
11644
|
if (this.state.value === "-") {
|
|
11592
11645
|
var node = this.startNode();
|
|
11593
11646
|
var nextToken = this.lookahead();
|
|
11594
11647
|
|
|
11595
|
-
if (nextToken.type !==
|
|
11648
|
+
if (nextToken.type !== 126 && nextToken.type !== 127) {
|
|
11596
11649
|
throw this.unexpected();
|
|
11597
11650
|
}
|
|
11598
11651
|
|
|
@@ -11602,13 +11655,13 @@ var typescript = superClass => class extends superClass {
|
|
|
11602
11655
|
|
|
11603
11656
|
break;
|
|
11604
11657
|
|
|
11605
|
-
case
|
|
11658
|
+
case 74:
|
|
11606
11659
|
return this.tsParseThisTypeOrThisTypePredicate();
|
|
11607
11660
|
|
|
11608
|
-
case
|
|
11661
|
+
case 83:
|
|
11609
11662
|
return this.tsParseTypeQuery();
|
|
11610
11663
|
|
|
11611
|
-
case
|
|
11664
|
+
case 79:
|
|
11612
11665
|
return this.tsParseImportType();
|
|
11613
11666
|
|
|
11614
11667
|
case 5:
|
|
@@ -11620,7 +11673,8 @@ var typescript = superClass => class extends superClass {
|
|
|
11620
11673
|
case 10:
|
|
11621
11674
|
return this.tsParseParenthesizedType();
|
|
11622
11675
|
|
|
11623
|
-
case
|
|
11676
|
+
case 25:
|
|
11677
|
+
case 24:
|
|
11624
11678
|
return this.tsParseTemplateLiteralType();
|
|
11625
11679
|
|
|
11626
11680
|
default:
|
|
@@ -11629,8 +11683,8 @@ var typescript = superClass => class extends superClass {
|
|
|
11629
11683
|
type
|
|
11630
11684
|
} = this.state;
|
|
11631
11685
|
|
|
11632
|
-
if (tokenIsIdentifier(type) || type ===
|
|
11633
|
-
var nodeType = type ===
|
|
11686
|
+
if (tokenIsIdentifier(type) || type === 84 || type === 80) {
|
|
11687
|
+
var nodeType = type === 84 ? "TSVoidKeyword" : type === 80 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
|
|
11634
11688
|
|
|
11635
11689
|
if (nodeType !== undefined && this.lookaheadCharCode() !== 46) {
|
|
11636
11690
|
var _node6 = this.startNode();
|
|
@@ -11696,7 +11750,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11696
11750
|
|
|
11697
11751
|
tsParseInferType() {
|
|
11698
11752
|
var node = this.startNode();
|
|
11699
|
-
this.expectContextual(
|
|
11753
|
+
this.expectContextual(108);
|
|
11700
11754
|
var typeParameter = this.startNode();
|
|
11701
11755
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
11702
11756
|
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
|
@@ -11705,7 +11759,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11705
11759
|
|
|
11706
11760
|
tsParseTypeOperatorOrHigher() {
|
|
11707
11761
|
var isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
|
|
11708
|
-
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(
|
|
11762
|
+
return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(108) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
|
|
11709
11763
|
}
|
|
11710
11764
|
|
|
11711
11765
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
@@ -11726,15 +11780,15 @@ var typescript = superClass => class extends superClass {
|
|
|
11726
11780
|
}
|
|
11727
11781
|
|
|
11728
11782
|
tsParseIntersectionTypeOrHigher() {
|
|
11729
|
-
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this),
|
|
11783
|
+
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 43);
|
|
11730
11784
|
}
|
|
11731
11785
|
|
|
11732
11786
|
tsParseUnionTypeOrHigher() {
|
|
11733
|
-
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this),
|
|
11787
|
+
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 41);
|
|
11734
11788
|
}
|
|
11735
11789
|
|
|
11736
11790
|
tsIsStartOfFunctionType() {
|
|
11737
|
-
if (this.match(
|
|
11791
|
+
if (this.match(45)) {
|
|
11738
11792
|
return true;
|
|
11739
11793
|
}
|
|
11740
11794
|
|
|
@@ -11742,7 +11796,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11742
11796
|
}
|
|
11743
11797
|
|
|
11744
11798
|
tsSkipParameterStart() {
|
|
11745
|
-
if (tokenIsIdentifier(this.state.type) || this.match(
|
|
11799
|
+
if (tokenIsIdentifier(this.state.type) || this.match(74)) {
|
|
11746
11800
|
this.next();
|
|
11747
11801
|
return true;
|
|
11748
11802
|
}
|
|
@@ -11792,7 +11846,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11792
11846
|
}
|
|
11793
11847
|
|
|
11794
11848
|
if (this.tsSkipParameterStart()) {
|
|
11795
|
-
if (this.match(14) || this.match(12) || this.match(17) || this.match(
|
|
11849
|
+
if (this.match(14) || this.match(12) || this.match(17) || this.match(29)) {
|
|
11796
11850
|
return true;
|
|
11797
11851
|
}
|
|
11798
11852
|
|
|
@@ -11815,7 +11869,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11815
11869
|
var node = this.startNode();
|
|
11816
11870
|
var asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
|
|
11817
11871
|
|
|
11818
|
-
if (asserts && this.match(
|
|
11872
|
+
if (asserts && this.match(74)) {
|
|
11819
11873
|
var thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
|
|
11820
11874
|
|
|
11821
11875
|
if (thisTypePredicate.type === "TSThisType") {
|
|
@@ -11870,21 +11924,21 @@ var typescript = superClass => class extends superClass {
|
|
|
11870
11924
|
tsParseTypePredicatePrefix() {
|
|
11871
11925
|
var id = this.parseIdentifier();
|
|
11872
11926
|
|
|
11873
|
-
if (this.isContextual(
|
|
11927
|
+
if (this.isContextual(109) && !this.hasPrecedingLineBreak()) {
|
|
11874
11928
|
this.next();
|
|
11875
11929
|
return id;
|
|
11876
11930
|
}
|
|
11877
11931
|
}
|
|
11878
11932
|
|
|
11879
11933
|
tsParseTypePredicateAsserts() {
|
|
11880
|
-
if (this.state.type !==
|
|
11934
|
+
if (this.state.type !== 102) {
|
|
11881
11935
|
return false;
|
|
11882
11936
|
}
|
|
11883
11937
|
|
|
11884
11938
|
var containsEsc = this.state.containsEsc;
|
|
11885
11939
|
this.next();
|
|
11886
11940
|
|
|
11887
|
-
if (!tokenIsIdentifier(this.state.type) && !this.match(
|
|
11941
|
+
if (!tokenIsIdentifier(this.state.type) && !this.match(74)) {
|
|
11888
11942
|
return false;
|
|
11889
11943
|
}
|
|
11890
11944
|
|
|
@@ -11909,7 +11963,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11909
11963
|
assert(this.state.inType);
|
|
11910
11964
|
var type = this.tsParseNonConditionalType();
|
|
11911
11965
|
|
|
11912
|
-
if (this.hasPrecedingLineBreak() || !this.eat(
|
|
11966
|
+
if (this.hasPrecedingLineBreak() || !this.eat(77)) {
|
|
11913
11967
|
return type;
|
|
11914
11968
|
}
|
|
11915
11969
|
|
|
@@ -11924,7 +11978,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11924
11978
|
}
|
|
11925
11979
|
|
|
11926
11980
|
isAbstractConstructorSignature() {
|
|
11927
|
-
return this.isContextual(
|
|
11981
|
+
return this.isContextual(116) && this.lookahead().type === 73;
|
|
11928
11982
|
}
|
|
11929
11983
|
|
|
11930
11984
|
tsParseNonConditionalType() {
|
|
@@ -11932,7 +11986,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11932
11986
|
return this.tsParseFunctionOrConstructorType("TSFunctionType");
|
|
11933
11987
|
}
|
|
11934
11988
|
|
|
11935
|
-
if (this.match(
|
|
11989
|
+
if (this.match(73)) {
|
|
11936
11990
|
return this.tsParseFunctionOrConstructorType("TSConstructorType");
|
|
11937
11991
|
} else if (this.isAbstractConstructorSignature()) {
|
|
11938
11992
|
return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
|
|
@@ -11951,7 +12005,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11951
12005
|
var _const = this.tsTryNextParseConstantContext();
|
|
11952
12006
|
|
|
11953
12007
|
node.typeAnnotation = _const || this.tsNextThenParseType();
|
|
11954
|
-
this.expect(
|
|
12008
|
+
this.expect(46);
|
|
11955
12009
|
node.expression = this.parseMaybeUnary();
|
|
11956
12010
|
return this.finishNode(node, "TSTypeAssertion");
|
|
11957
12011
|
}
|
|
@@ -11971,7 +12025,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11971
12025
|
var node = this.startNode();
|
|
11972
12026
|
node.expression = this.tsParseEntityName(false);
|
|
11973
12027
|
|
|
11974
|
-
if (this.match(
|
|
12028
|
+
if (this.match(45)) {
|
|
11975
12029
|
node.typeParameters = this.tsParseTypeArguments();
|
|
11976
12030
|
}
|
|
11977
12031
|
|
|
@@ -11989,7 +12043,7 @@ var typescript = superClass => class extends superClass {
|
|
|
11989
12043
|
|
|
11990
12044
|
node.typeParameters = this.tsTryParseTypeParameters();
|
|
11991
12045
|
|
|
11992
|
-
if (this.eat(
|
|
12046
|
+
if (this.eat(77)) {
|
|
11993
12047
|
node.extends = this.tsParseHeritageClause("extends");
|
|
11994
12048
|
}
|
|
11995
12049
|
|
|
@@ -12004,9 +12058,9 @@ var typescript = superClass => class extends superClass {
|
|
|
12004
12058
|
this.checkLVal(node.id, "typescript type alias", BIND_TS_TYPE);
|
|
12005
12059
|
node.typeParameters = this.tsTryParseTypeParameters();
|
|
12006
12060
|
node.typeAnnotation = this.tsInType(() => {
|
|
12007
|
-
this.expect(
|
|
12061
|
+
this.expect(29);
|
|
12008
12062
|
|
|
12009
|
-
if (this.isContextual(
|
|
12063
|
+
if (this.isContextual(107) && this.lookahead().type !== 16) {
|
|
12010
12064
|
var _node8 = this.startNode();
|
|
12011
12065
|
|
|
12012
12066
|
this.next();
|
|
@@ -12062,9 +12116,9 @@ var typescript = superClass => class extends superClass {
|
|
|
12062
12116
|
|
|
12063
12117
|
tsParseEnumMember() {
|
|
12064
12118
|
var node = this.startNode();
|
|
12065
|
-
node.id = this.match(
|
|
12119
|
+
node.id = this.match(125) ? this.parseExprAtom() : this.parseIdentifier(true);
|
|
12066
12120
|
|
|
12067
|
-
if (this.eat(
|
|
12121
|
+
if (this.eat(29)) {
|
|
12068
12122
|
node.initializer = this.parseMaybeAssignAllowIn();
|
|
12069
12123
|
}
|
|
12070
12124
|
|
|
@@ -12114,10 +12168,10 @@ var typescript = superClass => class extends superClass {
|
|
|
12114
12168
|
}
|
|
12115
12169
|
|
|
12116
12170
|
tsParseAmbientExternalModuleDeclaration(node) {
|
|
12117
|
-
if (this.isContextual(
|
|
12171
|
+
if (this.isContextual(105)) {
|
|
12118
12172
|
node.global = true;
|
|
12119
12173
|
node.id = this.parseIdentifier();
|
|
12120
|
-
} else if (this.match(
|
|
12174
|
+
} else if (this.match(125)) {
|
|
12121
12175
|
node.id = this.parseExprAtom();
|
|
12122
12176
|
} else {
|
|
12123
12177
|
this.unexpected();
|
|
@@ -12140,7 +12194,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12140
12194
|
node.isExport = isExport || false;
|
|
12141
12195
|
node.id = this.parseIdentifier();
|
|
12142
12196
|
this.checkLVal(node.id, "import equals declaration", BIND_LEXICAL);
|
|
12143
|
-
this.expect(
|
|
12197
|
+
this.expect(29);
|
|
12144
12198
|
var moduleReference = this.tsParseModuleReference();
|
|
12145
12199
|
|
|
12146
12200
|
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
|
|
@@ -12153,7 +12207,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12153
12207
|
}
|
|
12154
12208
|
|
|
12155
12209
|
tsIsExternalModuleReference() {
|
|
12156
|
-
return this.isContextual(
|
|
12210
|
+
return this.isContextual(112) && this.lookaheadCharCode() === 40;
|
|
12157
12211
|
}
|
|
12158
12212
|
|
|
12159
12213
|
tsParseModuleReference() {
|
|
@@ -12162,10 +12216,10 @@ var typescript = superClass => class extends superClass {
|
|
|
12162
12216
|
|
|
12163
12217
|
tsParseExternalModuleReference() {
|
|
12164
12218
|
var node = this.startNode();
|
|
12165
|
-
this.expectContextual(
|
|
12219
|
+
this.expectContextual(112);
|
|
12166
12220
|
this.expect(10);
|
|
12167
12221
|
|
|
12168
|
-
if (!this.match(
|
|
12222
|
+
if (!this.match(125)) {
|
|
12169
12223
|
throw this.unexpected();
|
|
12170
12224
|
}
|
|
12171
12225
|
|
|
@@ -12208,33 +12262,33 @@ var typescript = superClass => class extends superClass {
|
|
|
12208
12262
|
var starttype = this.state.type;
|
|
12209
12263
|
var kind;
|
|
12210
12264
|
|
|
12211
|
-
if (this.isContextual(
|
|
12212
|
-
starttype =
|
|
12265
|
+
if (this.isContextual(95)) {
|
|
12266
|
+
starttype = 70;
|
|
12213
12267
|
kind = "let";
|
|
12214
12268
|
}
|
|
12215
12269
|
|
|
12216
12270
|
return this.tsInAmbientContext(() => {
|
|
12217
12271
|
switch (starttype) {
|
|
12218
|
-
case
|
|
12272
|
+
case 64:
|
|
12219
12273
|
nany.declare = true;
|
|
12220
12274
|
return this.parseFunctionStatement(nany, false, true);
|
|
12221
12275
|
|
|
12222
|
-
case
|
|
12276
|
+
case 76:
|
|
12223
12277
|
nany.declare = true;
|
|
12224
12278
|
return this.parseClass(nany, true, false);
|
|
12225
12279
|
|
|
12226
|
-
case
|
|
12227
|
-
if (this.match(
|
|
12228
|
-
this.expect(
|
|
12229
|
-
this.expectContextual(
|
|
12280
|
+
case 71:
|
|
12281
|
+
if (this.match(71) && this.isLookaheadContextual("enum")) {
|
|
12282
|
+
this.expect(71);
|
|
12283
|
+
this.expectContextual(118);
|
|
12230
12284
|
return this.tsParseEnumDeclaration(nany, true);
|
|
12231
12285
|
}
|
|
12232
12286
|
|
|
12233
|
-
case
|
|
12287
|
+
case 70:
|
|
12234
12288
|
kind = kind || this.state.value;
|
|
12235
12289
|
return this.parseVarStatement(nany, kind);
|
|
12236
12290
|
|
|
12237
|
-
case
|
|
12291
|
+
case 105:
|
|
12238
12292
|
return this.tsParseAmbientExternalModuleDeclaration(nany);
|
|
12239
12293
|
|
|
12240
12294
|
default:
|
|
@@ -12288,7 +12342,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12288
12342
|
tsParseDeclaration(node, value, next) {
|
|
12289
12343
|
switch (value) {
|
|
12290
12344
|
case "abstract":
|
|
12291
|
-
if (this.tsCheckLineTerminator(next) && (this.match(
|
|
12345
|
+
if (this.tsCheckLineTerminator(next) && (this.match(76) || tokenIsIdentifier(this.state.type))) {
|
|
12292
12346
|
return this.tsParseAbstractDeclaration(node);
|
|
12293
12347
|
}
|
|
12294
12348
|
|
|
@@ -12311,7 +12365,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12311
12365
|
|
|
12312
12366
|
case "module":
|
|
12313
12367
|
if (this.tsCheckLineTerminator(next)) {
|
|
12314
|
-
if (this.match(
|
|
12368
|
+
if (this.match(125)) {
|
|
12315
12369
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
12316
12370
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
12317
12371
|
return this.tsParseModuleOrNamespaceDeclaration(node);
|
|
@@ -12347,7 +12401,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12347
12401
|
}
|
|
12348
12402
|
|
|
12349
12403
|
tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
|
|
12350
|
-
if (!this.match(
|
|
12404
|
+
if (!this.match(45)) {
|
|
12351
12405
|
return undefined;
|
|
12352
12406
|
}
|
|
12353
12407
|
|
|
@@ -12373,7 +12427,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12373
12427
|
tsParseTypeArguments() {
|
|
12374
12428
|
var node = this.startNode();
|
|
12375
12429
|
node.params = this.tsInType(() => this.tsInNoContext(() => {
|
|
12376
|
-
this.expect(
|
|
12430
|
+
this.expect(45);
|
|
12377
12431
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
12378
12432
|
}));
|
|
12379
12433
|
|
|
@@ -12381,7 +12435,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12381
12435
|
this.raise(node.start, TSErrors.EmptyTypeArguments);
|
|
12382
12436
|
}
|
|
12383
12437
|
|
|
12384
|
-
this.expect(
|
|
12438
|
+
this.expect(46);
|
|
12385
12439
|
return this.finishNode(node, "TSTypeParameterInstantiation");
|
|
12386
12440
|
}
|
|
12387
12441
|
|
|
@@ -12501,7 +12555,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12501
12555
|
}
|
|
12502
12556
|
|
|
12503
12557
|
parseSubscript(base, startPos, startLoc, noCalls, state) {
|
|
12504
|
-
if (!this.hasPrecedingLineBreak() && this.match(
|
|
12558
|
+
if (!this.hasPrecedingLineBreak() && this.match(35)) {
|
|
12505
12559
|
this.state.canStartJSXElement = false;
|
|
12506
12560
|
this.next();
|
|
12507
12561
|
var nonNullExpression = this.startNodeAt(startPos, startLoc);
|
|
@@ -12521,7 +12575,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12521
12575
|
this.next();
|
|
12522
12576
|
}
|
|
12523
12577
|
|
|
12524
|
-
if (this.match(
|
|
12578
|
+
if (this.match(45)) {
|
|
12525
12579
|
var missingParenErrorPos;
|
|
12526
12580
|
var result = this.tsTryParseAndCatch(() => {
|
|
12527
12581
|
if (!noCalls && this.atPossibleAsyncArrow(base)) {
|
|
@@ -12552,7 +12606,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12552
12606
|
}
|
|
12553
12607
|
|
|
12554
12608
|
return this.finishCallExpression(node, state.optionalChainMember);
|
|
12555
|
-
} else if (this.
|
|
12609
|
+
} else if (tokenIsTemplate(this.state.type)) {
|
|
12556
12610
|
var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
12557
12611
|
|
|
12558
12612
|
_result.typeParameters = typeArguments;
|
|
@@ -12574,7 +12628,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12574
12628
|
}
|
|
12575
12629
|
|
|
12576
12630
|
parseNewArguments(node) {
|
|
12577
|
-
if (this.match(
|
|
12631
|
+
if (this.match(45)) {
|
|
12578
12632
|
var typeParameters = this.tsTryParseAndCatch(() => {
|
|
12579
12633
|
var args = this.tsParseTypeArguments();
|
|
12580
12634
|
if (!this.match(10)) this.unexpected();
|
|
@@ -12590,7 +12644,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12590
12644
|
}
|
|
12591
12645
|
|
|
12592
12646
|
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
|
|
12593
|
-
if (tokenOperatorPrecedence(
|
|
12647
|
+
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual(89)) {
|
|
12594
12648
|
var node = this.startNodeAt(leftStartPos, leftStartLoc);
|
|
12595
12649
|
node.expression = left;
|
|
12596
12650
|
|
|
@@ -12617,16 +12671,16 @@ var typescript = superClass => class extends superClass {
|
|
|
12617
12671
|
parseImport(node) {
|
|
12618
12672
|
node.importKind = "value";
|
|
12619
12673
|
|
|
12620
|
-
if (tokenIsIdentifier(this.state.type) || this.match(
|
|
12674
|
+
if (tokenIsIdentifier(this.state.type) || this.match(51) || this.match(5)) {
|
|
12621
12675
|
var ahead = this.lookahead();
|
|
12622
12676
|
|
|
12623
|
-
if (this.isContextual(
|
|
12677
|
+
if (this.isContextual(122) && ahead.type !== 12 && ahead.type !== 93 && ahead.type !== 29) {
|
|
12624
12678
|
node.importKind = "type";
|
|
12625
12679
|
this.next();
|
|
12626
12680
|
ahead = this.lookahead();
|
|
12627
12681
|
}
|
|
12628
12682
|
|
|
12629
|
-
if (tokenIsIdentifier(this.state.type) && ahead.type ===
|
|
12683
|
+
if (tokenIsIdentifier(this.state.type) && ahead.type === 29) {
|
|
12630
12684
|
return this.tsParseImportEqualsDeclaration(node);
|
|
12631
12685
|
}
|
|
12632
12686
|
}
|
|
@@ -12641,10 +12695,10 @@ var typescript = superClass => class extends superClass {
|
|
|
12641
12695
|
}
|
|
12642
12696
|
|
|
12643
12697
|
parseExport(node) {
|
|
12644
|
-
if (this.match(
|
|
12698
|
+
if (this.match(79)) {
|
|
12645
12699
|
this.next();
|
|
12646
12700
|
|
|
12647
|
-
if (this.isContextual(
|
|
12701
|
+
if (this.isContextual(122) && this.lookaheadCharCode() !== 61) {
|
|
12648
12702
|
node.importKind = "type";
|
|
12649
12703
|
this.next();
|
|
12650
12704
|
} else {
|
|
@@ -12652,19 +12706,19 @@ var typescript = superClass => class extends superClass {
|
|
|
12652
12706
|
}
|
|
12653
12707
|
|
|
12654
12708
|
return this.tsParseImportEqualsDeclaration(node, true);
|
|
12655
|
-
} else if (this.eat(
|
|
12709
|
+
} else if (this.eat(29)) {
|
|
12656
12710
|
var assign = node;
|
|
12657
12711
|
assign.expression = this.parseExpression();
|
|
12658
12712
|
this.semicolon();
|
|
12659
12713
|
return this.finishNode(assign, "TSExportAssignment");
|
|
12660
|
-
} else if (this.eatContextual(
|
|
12714
|
+
} else if (this.eatContextual(89)) {
|
|
12661
12715
|
var decl = node;
|
|
12662
|
-
this.expectContextual(
|
|
12716
|
+
this.expectContextual(120);
|
|
12663
12717
|
decl.id = this.parseIdentifier();
|
|
12664
12718
|
this.semicolon();
|
|
12665
12719
|
return this.finishNode(decl, "TSNamespaceExportDeclaration");
|
|
12666
12720
|
} else {
|
|
12667
|
-
if (this.isContextual(
|
|
12721
|
+
if (this.isContextual(122) && this.lookahead().type === 5) {
|
|
12668
12722
|
this.next();
|
|
12669
12723
|
node.exportKind = "type";
|
|
12670
12724
|
} else {
|
|
@@ -12676,7 +12730,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12676
12730
|
}
|
|
12677
12731
|
|
|
12678
12732
|
isAbstractClass() {
|
|
12679
|
-
return this.isContextual(
|
|
12733
|
+
return this.isContextual(116) && this.lookahead().type === 76;
|
|
12680
12734
|
}
|
|
12681
12735
|
|
|
12682
12736
|
parseExportDefaultExpression() {
|
|
@@ -12688,7 +12742,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12688
12742
|
return cls;
|
|
12689
12743
|
}
|
|
12690
12744
|
|
|
12691
|
-
if (this.match(
|
|
12745
|
+
if (this.match(121)) {
|
|
12692
12746
|
var interfaceNode = this.startNode();
|
|
12693
12747
|
this.next();
|
|
12694
12748
|
var result = this.tsParseInterfaceDeclaration(interfaceNode);
|
|
@@ -12699,13 +12753,13 @@ var typescript = superClass => class extends superClass {
|
|
|
12699
12753
|
}
|
|
12700
12754
|
|
|
12701
12755
|
parseStatementContent(context, topLevel) {
|
|
12702
|
-
if (this.state.type ===
|
|
12756
|
+
if (this.state.type === 71) {
|
|
12703
12757
|
var ahead = this.lookahead();
|
|
12704
12758
|
|
|
12705
|
-
if (ahead.type ===
|
|
12759
|
+
if (ahead.type === 118) {
|
|
12706
12760
|
var node = this.startNode();
|
|
12707
12761
|
this.next();
|
|
12708
|
-
this.expectContextual(
|
|
12762
|
+
this.expectContextual(118);
|
|
12709
12763
|
return this.tsParseEnumDeclaration(node, true);
|
|
12710
12764
|
}
|
|
12711
12765
|
}
|
|
@@ -12728,7 +12782,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12728
12782
|
}
|
|
12729
12783
|
|
|
12730
12784
|
tsIsStartOfStaticBlocks() {
|
|
12731
|
-
return this.isContextual(
|
|
12785
|
+
return this.isContextual(100) && this.lookaheadCharCode() === 123;
|
|
12732
12786
|
}
|
|
12733
12787
|
|
|
12734
12788
|
parseClassMember(classBody, member, state) {
|
|
@@ -12858,9 +12912,9 @@ var typescript = superClass => class extends superClass {
|
|
|
12858
12912
|
parseExportDeclaration(node) {
|
|
12859
12913
|
var startPos = this.state.start;
|
|
12860
12914
|
var startLoc = this.state.startLoc;
|
|
12861
|
-
var isDeclare = this.eatContextual(
|
|
12915
|
+
var isDeclare = this.eatContextual(117);
|
|
12862
12916
|
|
|
12863
|
-
if (isDeclare && (this.isContextual(
|
|
12917
|
+
if (isDeclare && (this.isContextual(117) || !this.shouldParseExportDeclaration())) {
|
|
12864
12918
|
throw this.raise(this.state.start, TSErrors.ExpectedAmbientAfterExportDeclare);
|
|
12865
12919
|
}
|
|
12866
12920
|
|
|
@@ -12887,7 +12941,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12887
12941
|
}
|
|
12888
12942
|
|
|
12889
12943
|
parseClassId(node, isStatement, optionalId) {
|
|
12890
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
12944
|
+
if ((!isStatement || optionalId) && this.isContextual(106)) {
|
|
12891
12945
|
return;
|
|
12892
12946
|
}
|
|
12893
12947
|
|
|
@@ -12897,7 +12951,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12897
12951
|
}
|
|
12898
12952
|
|
|
12899
12953
|
parseClassPropertyAnnotation(node) {
|
|
12900
|
-
if (!node.optional && this.eat(
|
|
12954
|
+
if (!node.optional && this.eat(35)) {
|
|
12901
12955
|
node.definite = true;
|
|
12902
12956
|
}
|
|
12903
12957
|
|
|
@@ -12908,11 +12962,11 @@ var typescript = superClass => class extends superClass {
|
|
|
12908
12962
|
parseClassProperty(node) {
|
|
12909
12963
|
this.parseClassPropertyAnnotation(node);
|
|
12910
12964
|
|
|
12911
|
-
if (this.state.isAmbientContext && this.match(
|
|
12965
|
+
if (this.state.isAmbientContext && this.match(29)) {
|
|
12912
12966
|
this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer);
|
|
12913
12967
|
}
|
|
12914
12968
|
|
|
12915
|
-
if (node.abstract && this.match(
|
|
12969
|
+
if (node.abstract && this.match(29)) {
|
|
12916
12970
|
var {
|
|
12917
12971
|
key
|
|
12918
12972
|
} = node;
|
|
@@ -12965,11 +13019,11 @@ var typescript = superClass => class extends superClass {
|
|
|
12965
13019
|
parseClassSuper(node) {
|
|
12966
13020
|
super.parseClassSuper(node);
|
|
12967
13021
|
|
|
12968
|
-
if (node.superClass && this.match(
|
|
13022
|
+
if (node.superClass && this.match(45)) {
|
|
12969
13023
|
node.superTypeParameters = this.tsParseTypeArguments();
|
|
12970
13024
|
}
|
|
12971
13025
|
|
|
12972
|
-
if (this.eatContextual(
|
|
13026
|
+
if (this.eatContextual(106)) {
|
|
12973
13027
|
node.implements = this.tsParseHeritageClause("implements");
|
|
12974
13028
|
}
|
|
12975
13029
|
}
|
|
@@ -12994,7 +13048,7 @@ var typescript = superClass => class extends superClass {
|
|
|
12994
13048
|
parseVarId(decl, kind) {
|
|
12995
13049
|
super.parseVarId(decl, kind);
|
|
12996
13050
|
|
|
12997
|
-
if (decl.id.type === "Identifier" && this.eat(
|
|
13051
|
+
if (decl.id.type === "Identifier" && this.eat(35)) {
|
|
12998
13052
|
decl.definite = true;
|
|
12999
13053
|
}
|
|
13000
13054
|
|
|
@@ -13025,22 +13079,21 @@ var typescript = superClass => class extends superClass {
|
|
|
13025
13079
|
var jsx;
|
|
13026
13080
|
var typeCast;
|
|
13027
13081
|
|
|
13028
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
13082
|
+
if (this.hasPlugin("jsx") && (this.match(134) || this.match(45))) {
|
|
13029
13083
|
state = this.state.clone();
|
|
13030
13084
|
jsx = this.tryParse(() => super.parseMaybeAssign(...args), state);
|
|
13031
13085
|
if (!jsx.error) return jsx.node;
|
|
13032
13086
|
var {
|
|
13033
13087
|
context
|
|
13034
13088
|
} = this.state;
|
|
13089
|
+
var currentContext = context[context.length - 1];
|
|
13035
13090
|
|
|
13036
|
-
if (
|
|
13037
|
-
context.
|
|
13038
|
-
} else if (context[context.length - 1] === types.j_expr) {
|
|
13039
|
-
context.length -= 1;
|
|
13091
|
+
if (currentContext === types.j_oTag || currentContext === types.j_expr) {
|
|
13092
|
+
context.pop();
|
|
13040
13093
|
}
|
|
13041
13094
|
}
|
|
13042
13095
|
|
|
13043
|
-
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(
|
|
13096
|
+
if (!((_jsx = jsx) != null && _jsx.error) && !this.match(45)) {
|
|
13044
13097
|
return super.parseMaybeAssign(...args);
|
|
13045
13098
|
}
|
|
13046
13099
|
|
|
@@ -13106,7 +13159,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13106
13159
|
}
|
|
13107
13160
|
|
|
13108
13161
|
parseMaybeUnary(refExpressionErrors) {
|
|
13109
|
-
if (!this.hasPlugin("jsx") && this.match(
|
|
13162
|
+
if (!this.hasPlugin("jsx") && this.match(45)) {
|
|
13110
13163
|
return this.tsParseTypeAssertion();
|
|
13111
13164
|
} else {
|
|
13112
13165
|
return super.parseMaybeUnary(refExpressionErrors);
|
|
@@ -13234,7 +13287,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13234
13287
|
|
|
13235
13288
|
parseBindingAtom() {
|
|
13236
13289
|
switch (this.state.type) {
|
|
13237
|
-
case
|
|
13290
|
+
case 74:
|
|
13238
13291
|
return this.parseIdentifier(true);
|
|
13239
13292
|
|
|
13240
13293
|
default:
|
|
@@ -13243,7 +13296,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13243
13296
|
}
|
|
13244
13297
|
|
|
13245
13298
|
parseMaybeDecoratorArguments(expr) {
|
|
13246
|
-
if (this.match(
|
|
13299
|
+
if (this.match(45)) {
|
|
13247
13300
|
var typeArguments = this.tsParseTypeArguments();
|
|
13248
13301
|
|
|
13249
13302
|
if (this.match(10)) {
|
|
@@ -13267,11 +13320,11 @@ var typescript = superClass => class extends superClass {
|
|
|
13267
13320
|
}
|
|
13268
13321
|
|
|
13269
13322
|
isClassMethod() {
|
|
13270
|
-
return this.match(
|
|
13323
|
+
return this.match(45) || super.isClassMethod();
|
|
13271
13324
|
}
|
|
13272
13325
|
|
|
13273
13326
|
isClassProperty() {
|
|
13274
|
-
return this.match(
|
|
13327
|
+
return this.match(35) || this.match(14) || super.isClassProperty();
|
|
13275
13328
|
}
|
|
13276
13329
|
|
|
13277
13330
|
parseMaybeDefault() {
|
|
@@ -13287,11 +13340,11 @@ var typescript = superClass => class extends superClass {
|
|
|
13287
13340
|
getTokenFromCode(code) {
|
|
13288
13341
|
if (this.state.inType) {
|
|
13289
13342
|
if (code === 62) {
|
|
13290
|
-
return this.finishOp(
|
|
13343
|
+
return this.finishOp(46, 1);
|
|
13291
13344
|
}
|
|
13292
13345
|
|
|
13293
13346
|
if (code === 60) {
|
|
13294
|
-
return this.finishOp(
|
|
13347
|
+
return this.finishOp(45, 1);
|
|
13295
13348
|
}
|
|
13296
13349
|
}
|
|
13297
13350
|
|
|
@@ -13303,10 +13356,10 @@ var typescript = superClass => class extends superClass {
|
|
|
13303
13356
|
type
|
|
13304
13357
|
} = this.state;
|
|
13305
13358
|
|
|
13306
|
-
if (type ===
|
|
13359
|
+
if (type === 45) {
|
|
13307
13360
|
this.state.pos -= 1;
|
|
13308
13361
|
this.readToken_lt();
|
|
13309
|
-
} else if (type ===
|
|
13362
|
+
} else if (type === 46) {
|
|
13310
13363
|
this.state.pos -= 1;
|
|
13311
13364
|
this.readToken_gt();
|
|
13312
13365
|
}
|
|
@@ -13360,7 +13413,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13360
13413
|
}
|
|
13361
13414
|
|
|
13362
13415
|
jsxParseOpeningElementAfterName(node) {
|
|
13363
|
-
if (this.match(
|
|
13416
|
+
if (this.match(45)) {
|
|
13364
13417
|
var typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArguments());
|
|
13365
13418
|
if (typeArguments) node.typeParameters = typeArguments;
|
|
13366
13419
|
}
|
|
@@ -13415,10 +13468,10 @@ var typescript = superClass => class extends superClass {
|
|
|
13415
13468
|
}
|
|
13416
13469
|
|
|
13417
13470
|
tsParseAbstractDeclaration(node) {
|
|
13418
|
-
if (this.match(
|
|
13471
|
+
if (this.match(76)) {
|
|
13419
13472
|
node.abstract = true;
|
|
13420
13473
|
return this.parseClass(node, true, false);
|
|
13421
|
-
} else if (this.isContextual(
|
|
13474
|
+
} else if (this.isContextual(121)) {
|
|
13422
13475
|
if (!this.hasFollowingLineBreak()) {
|
|
13423
13476
|
node.abstract = true;
|
|
13424
13477
|
this.raise(node.start, TSErrors.NonClassMethodPropertyHasAbstractModifer);
|
|
@@ -13426,7 +13479,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13426
13479
|
return this.tsParseInterfaceDeclaration(node);
|
|
13427
13480
|
}
|
|
13428
13481
|
} else {
|
|
13429
|
-
this.unexpected(null,
|
|
13482
|
+
this.unexpected(null, 76);
|
|
13430
13483
|
}
|
|
13431
13484
|
}
|
|
13432
13485
|
|
|
@@ -13501,10 +13554,10 @@ var typescript = superClass => class extends superClass {
|
|
|
13501
13554
|
var canParseAsKeyword = true;
|
|
13502
13555
|
var pos = leftOfAs.start;
|
|
13503
13556
|
|
|
13504
|
-
if (this.isContextual(
|
|
13557
|
+
if (this.isContextual(89)) {
|
|
13505
13558
|
var firstAs = this.parseIdentifier();
|
|
13506
13559
|
|
|
13507
|
-
if (this.isContextual(
|
|
13560
|
+
if (this.isContextual(89)) {
|
|
13508
13561
|
var secondAs = this.parseIdentifier();
|
|
13509
13562
|
|
|
13510
13563
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
@@ -13537,7 +13590,7 @@ var typescript = superClass => class extends superClass {
|
|
|
13537
13590
|
var kindKey = isImport ? "importKind" : "exportKind";
|
|
13538
13591
|
node[kindKey] = hasTypeSpecifier ? "type" : "value";
|
|
13539
13592
|
|
|
13540
|
-
if (canParseAsKeyword && this.eatContextual(
|
|
13593
|
+
if (canParseAsKeyword && this.eatContextual(89)) {
|
|
13541
13594
|
node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
|
|
13542
13595
|
}
|
|
13543
13596
|
|
|
@@ -13558,13 +13611,13 @@ var PlaceHolderErrors = makeErrorTemplates({
|
|
|
13558
13611
|
|
|
13559
13612
|
var placeholders = superClass => class extends superClass {
|
|
13560
13613
|
parsePlaceholder(expectedNode) {
|
|
13561
|
-
if (this.match(
|
|
13614
|
+
if (this.match(136)) {
|
|
13562
13615
|
var node = this.startNode();
|
|
13563
13616
|
this.next();
|
|
13564
13617
|
this.assertNoSpace("Unexpected space in placeholder.");
|
|
13565
13618
|
node.name = super.parseIdentifier(true);
|
|
13566
13619
|
this.assertNoSpace("Unexpected space in placeholder.");
|
|
13567
|
-
this.expect(
|
|
13620
|
+
this.expect(136);
|
|
13568
13621
|
return this.finishPlaceholder(node, expectedNode);
|
|
13569
13622
|
}
|
|
13570
13623
|
}
|
|
@@ -13577,7 +13630,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
13577
13630
|
|
|
13578
13631
|
getTokenFromCode(code) {
|
|
13579
13632
|
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
13580
|
-
return this.finishOp(
|
|
13633
|
+
return this.finishOp(136, 2);
|
|
13581
13634
|
}
|
|
13582
13635
|
|
|
13583
13636
|
return super.getTokenFromCode(...arguments);
|
|
@@ -13617,14 +13670,14 @@ var placeholders = superClass => class extends superClass {
|
|
|
13617
13670
|
return true;
|
|
13618
13671
|
}
|
|
13619
13672
|
|
|
13620
|
-
if (!this.isContextual(
|
|
13673
|
+
if (!this.isContextual(95)) {
|
|
13621
13674
|
return false;
|
|
13622
13675
|
}
|
|
13623
13676
|
|
|
13624
13677
|
if (context) return false;
|
|
13625
13678
|
var nextToken = this.lookahead();
|
|
13626
13679
|
|
|
13627
|
-
if (nextToken.type ===
|
|
13680
|
+
if (nextToken.type === 136) {
|
|
13628
13681
|
return true;
|
|
13629
13682
|
}
|
|
13630
13683
|
|
|
@@ -13670,7 +13723,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
13670
13723
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
13671
13724
|
|
|
13672
13725
|
if (placeholder) {
|
|
13673
|
-
if (this.match(
|
|
13726
|
+
if (this.match(77) || this.match(136) || this.match(5)) {
|
|
13674
13727
|
node.id = placeholder;
|
|
13675
13728
|
} else if (optionalId || !isStatement) {
|
|
13676
13729
|
node.id = null;
|
|
@@ -13692,7 +13745,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
13692
13745
|
var placeholder = this.parsePlaceholder("Identifier");
|
|
13693
13746
|
if (!placeholder) return super.parseExport(...arguments);
|
|
13694
13747
|
|
|
13695
|
-
if (!this.isContextual(
|
|
13748
|
+
if (!this.isContextual(93) && !this.match(12)) {
|
|
13696
13749
|
node.specifiers = [];
|
|
13697
13750
|
node.source = null;
|
|
13698
13751
|
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
@@ -13707,11 +13760,11 @@ var placeholders = superClass => class extends superClass {
|
|
|
13707
13760
|
}
|
|
13708
13761
|
|
|
13709
13762
|
isExportDefaultSpecifier() {
|
|
13710
|
-
if (this.match(
|
|
13763
|
+
if (this.match(61)) {
|
|
13711
13764
|
var next = this.nextTokenStart();
|
|
13712
13765
|
|
|
13713
13766
|
if (this.isUnparsedContextual(next, "from")) {
|
|
13714
|
-
if (this.input.startsWith(tokenLabelName(
|
|
13767
|
+
if (this.input.startsWith(tokenLabelName(136), this.nextTokenStartSince(next + 4))) {
|
|
13715
13768
|
return true;
|
|
13716
13769
|
}
|
|
13717
13770
|
}
|
|
@@ -13746,7 +13799,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
13746
13799
|
if (!placeholder) return super.parseImport(...arguments);
|
|
13747
13800
|
node.specifiers = [];
|
|
13748
13801
|
|
|
13749
|
-
if (!this.isContextual(
|
|
13802
|
+
if (!this.isContextual(93) && !this.match(12)) {
|
|
13750
13803
|
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
|
13751
13804
|
this.semicolon();
|
|
13752
13805
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -13762,7 +13815,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
13762
13815
|
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
|
|
13763
13816
|
}
|
|
13764
13817
|
|
|
13765
|
-
this.expectContextual(
|
|
13818
|
+
this.expectContextual(93);
|
|
13766
13819
|
node.source = this.parseImportSource();
|
|
13767
13820
|
this.semicolon();
|
|
13768
13821
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -13776,7 +13829,7 @@ var placeholders = superClass => class extends superClass {
|
|
|
13776
13829
|
|
|
13777
13830
|
var v8intrinsic = superClass => class extends superClass {
|
|
13778
13831
|
parseV8Intrinsic() {
|
|
13779
|
-
if (this.match(
|
|
13832
|
+
if (this.match(50)) {
|
|
13780
13833
|
var v8IntrinsicStart = this.state.start;
|
|
13781
13834
|
var node = this.startNode();
|
|
13782
13835
|
this.next();
|
|
@@ -13801,12 +13854,27 @@ var v8intrinsic = superClass => class extends superClass {
|
|
|
13801
13854
|
|
|
13802
13855
|
};
|
|
13803
13856
|
|
|
13804
|
-
function hasPlugin(plugins,
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13857
|
+
function hasPlugin(plugins, expectedConfig) {
|
|
13858
|
+
var [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig;
|
|
13859
|
+
var expectedKeys = Object.keys(expectedOptions);
|
|
13860
|
+
var expectedOptionsIsEmpty = expectedKeys.length === 0;
|
|
13861
|
+
return plugins.some(p => {
|
|
13862
|
+
if (typeof p === "string") {
|
|
13863
|
+
return expectedOptionsIsEmpty && p === expectedName;
|
|
13808
13864
|
} else {
|
|
13809
|
-
|
|
13865
|
+
var [pluginName, pluginOptions] = p;
|
|
13866
|
+
|
|
13867
|
+
if (pluginName !== expectedName) {
|
|
13868
|
+
return false;
|
|
13869
|
+
}
|
|
13870
|
+
|
|
13871
|
+
for (var key of expectedKeys) {
|
|
13872
|
+
if (pluginOptions[key] !== expectedOptions[key]) {
|
|
13873
|
+
return false;
|
|
13874
|
+
}
|
|
13875
|
+
}
|
|
13876
|
+
|
|
13877
|
+
return true;
|
|
13810
13878
|
}
|
|
13811
13879
|
});
|
|
13812
13880
|
}
|
|
@@ -13862,7 +13930,9 @@ function validatePlugins(plugins) {
|
|
|
13862
13930
|
throw new Error("\"pipelineOperator\" requires \"proposal\" option whose value must be one of: ".concat(proposalList, "."));
|
|
13863
13931
|
}
|
|
13864
13932
|
|
|
13865
|
-
var tupleSyntaxIsHash = hasPlugin(plugins, "recordAndTuple"
|
|
13933
|
+
var tupleSyntaxIsHash = hasPlugin(plugins, ["recordAndTuple", {
|
|
13934
|
+
syntaxType: "hash"
|
|
13935
|
+
}]);
|
|
13866
13936
|
|
|
13867
13937
|
if (proposal === "hack") {
|
|
13868
13938
|
if (hasPlugin(plugins, "placeholders")) {
|
|
@@ -14199,11 +14269,11 @@ class LValParser extends NodeUtils {
|
|
|
14199
14269
|
} else {
|
|
14200
14270
|
var decorators = [];
|
|
14201
14271
|
|
|
14202
|
-
if (this.match(
|
|
14272
|
+
if (this.match(26) && this.hasPlugin("decorators")) {
|
|
14203
14273
|
this.raise(this.state.start, ErrorMessages.UnsupportedParameterDecorator);
|
|
14204
14274
|
}
|
|
14205
14275
|
|
|
14206
|
-
while (this.match(
|
|
14276
|
+
while (this.match(26)) {
|
|
14207
14277
|
decorators.push(this.parseDecorator());
|
|
14208
14278
|
}
|
|
14209
14279
|
|
|
@@ -14262,7 +14332,7 @@ class LValParser extends NodeUtils {
|
|
|
14262
14332
|
startLoc = (_startLoc = startLoc) != null ? _startLoc : this.state.startLoc;
|
|
14263
14333
|
startPos = (_startPos = startPos) != null ? _startPos : this.state.start;
|
|
14264
14334
|
left = (_left = left) != null ? _left : this.parseBindingAtom();
|
|
14265
|
-
if (!this.eat(
|
|
14335
|
+
if (!this.eat(29)) return left;
|
|
14266
14336
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14267
14337
|
node.left = left;
|
|
14268
14338
|
node.right = this.parseMaybeAssignAllowIn();
|
|
@@ -14414,7 +14484,7 @@ class ExpressionParser extends LValParser {
|
|
|
14414
14484
|
this.nextToken();
|
|
14415
14485
|
var expr = this.parseExpression();
|
|
14416
14486
|
|
|
14417
|
-
if (!this.match(
|
|
14487
|
+
if (!this.match(131)) {
|
|
14418
14488
|
this.unexpected();
|
|
14419
14489
|
}
|
|
14420
14490
|
|
|
@@ -14475,7 +14545,7 @@ class ExpressionParser extends LValParser {
|
|
|
14475
14545
|
var startPos = this.state.start;
|
|
14476
14546
|
var startLoc = this.state.startLoc;
|
|
14477
14547
|
|
|
14478
|
-
if (this.isContextual(
|
|
14548
|
+
if (this.isContextual(101)) {
|
|
14479
14549
|
if (this.prodParam.hasYield) {
|
|
14480
14550
|
var _left2 = this.parseYield();
|
|
14481
14551
|
|
|
@@ -14515,7 +14585,7 @@ class ExpressionParser extends LValParser {
|
|
|
14515
14585
|
var operator = this.state.value;
|
|
14516
14586
|
node.operator = operator;
|
|
14517
14587
|
|
|
14518
|
-
if (this.match(
|
|
14588
|
+
if (this.match(29)) {
|
|
14519
14589
|
node.left = this.toAssignable(left, true);
|
|
14520
14590
|
|
|
14521
14591
|
if (refExpressionErrors.doubleProto >= startPos) {
|
|
@@ -14567,7 +14637,7 @@ class ExpressionParser extends LValParser {
|
|
|
14567
14637
|
}
|
|
14568
14638
|
|
|
14569
14639
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
14570
|
-
return this.match(
|
|
14640
|
+
return this.match(130) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
14571
14641
|
}
|
|
14572
14642
|
|
|
14573
14643
|
parseExprOps(refExpressionErrors) {
|
|
@@ -14590,7 +14660,7 @@ class ExpressionParser extends LValParser {
|
|
|
14590
14660
|
start
|
|
14591
14661
|
} = left;
|
|
14592
14662
|
|
|
14593
|
-
if (minPrec >= tokenOperatorPrecedence(
|
|
14663
|
+
if (minPrec >= tokenOperatorPrecedence(54) || !this.prodParam.hasIn || !this.match(54)) {
|
|
14594
14664
|
this.raise(start, ErrorMessages.PrivateInExpectedIn, value);
|
|
14595
14665
|
}
|
|
14596
14666
|
|
|
@@ -14599,11 +14669,11 @@ class ExpressionParser extends LValParser {
|
|
|
14599
14669
|
|
|
14600
14670
|
var op = this.state.type;
|
|
14601
14671
|
|
|
14602
|
-
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(
|
|
14672
|
+
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(54))) {
|
|
14603
14673
|
var prec = tokenOperatorPrecedence(op);
|
|
14604
14674
|
|
|
14605
14675
|
if (prec > minPrec) {
|
|
14606
|
-
if (op ===
|
|
14676
|
+
if (op === 37) {
|
|
14607
14677
|
this.expectPlugin("pipelineOperator");
|
|
14608
14678
|
|
|
14609
14679
|
if (this.state.inFSharpPipelineDirectBody) {
|
|
@@ -14616,17 +14686,19 @@ class ExpressionParser extends LValParser {
|
|
|
14616
14686
|
var node = this.startNodeAt(leftStartPos, leftStartLoc);
|
|
14617
14687
|
node.left = left;
|
|
14618
14688
|
node.operator = this.state.value;
|
|
14619
|
-
var logical = op ===
|
|
14620
|
-
var coalesce = op ===
|
|
14689
|
+
var logical = op === 39 || op === 40;
|
|
14690
|
+
var coalesce = op === 38;
|
|
14621
14691
|
|
|
14622
14692
|
if (coalesce) {
|
|
14623
|
-
prec = tokenOperatorPrecedence(
|
|
14693
|
+
prec = tokenOperatorPrecedence(40);
|
|
14624
14694
|
}
|
|
14625
14695
|
|
|
14626
14696
|
this.next();
|
|
14627
14697
|
|
|
14628
|
-
if (op ===
|
|
14629
|
-
|
|
14698
|
+
if (op === 37 && this.hasPlugin(["pipelineOperator", {
|
|
14699
|
+
proposal: "minimal"
|
|
14700
|
+
}])) {
|
|
14701
|
+
if (this.state.type === 92 && this.prodParam.hasAwait) {
|
|
14630
14702
|
throw this.raise(this.state.start, ErrorMessages.UnexpectedAwaitAfterPipelineBody);
|
|
14631
14703
|
}
|
|
14632
14704
|
}
|
|
@@ -14635,7 +14707,7 @@ class ExpressionParser extends LValParser {
|
|
|
14635
14707
|
this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
14636
14708
|
var nextOp = this.state.type;
|
|
14637
14709
|
|
|
14638
|
-
if (coalesce && (nextOp ===
|
|
14710
|
+
if (coalesce && (nextOp === 39 || nextOp === 40) || logical && nextOp === 38) {
|
|
14639
14711
|
throw this.raise(this.state.start, ErrorMessages.MixingCoalesceWithLogical);
|
|
14640
14712
|
}
|
|
14641
14713
|
|
|
@@ -14651,7 +14723,7 @@ class ExpressionParser extends LValParser {
|
|
|
14651
14723
|
var startLoc = this.state.startLoc;
|
|
14652
14724
|
|
|
14653
14725
|
switch (op) {
|
|
14654
|
-
case
|
|
14726
|
+
case 37:
|
|
14655
14727
|
switch (this.getPluginOption("pipelineOperator", "proposal")) {
|
|
14656
14728
|
case "hack":
|
|
14657
14729
|
return this.withTopicBindingContext(() => {
|
|
@@ -14660,7 +14732,7 @@ class ExpressionParser extends LValParser {
|
|
|
14660
14732
|
|
|
14661
14733
|
case "smart":
|
|
14662
14734
|
return this.withTopicBindingContext(() => {
|
|
14663
|
-
if (this.prodParam.hasYield && this.isContextual(
|
|
14735
|
+
if (this.prodParam.hasYield && this.isContextual(101)) {
|
|
14664
14736
|
throw this.raise(this.state.start, ErrorMessages.PipeBodyIsTighter, this.state.value);
|
|
14665
14737
|
}
|
|
14666
14738
|
|
|
@@ -14704,7 +14776,7 @@ class ExpressionParser extends LValParser {
|
|
|
14704
14776
|
}
|
|
14705
14777
|
|
|
14706
14778
|
checkExponentialAfterUnary(node) {
|
|
14707
|
-
if (this.match(
|
|
14779
|
+
if (this.match(53)) {
|
|
14708
14780
|
this.raise(node.argument.start, ErrorMessages.UnexpectedTokenUnaryExponentiation);
|
|
14709
14781
|
}
|
|
14710
14782
|
}
|
|
@@ -14712,7 +14784,7 @@ class ExpressionParser extends LValParser {
|
|
|
14712
14784
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
14713
14785
|
var startPos = this.state.start;
|
|
14714
14786
|
var startLoc = this.state.startLoc;
|
|
14715
|
-
var isAwait = this.isContextual(
|
|
14787
|
+
var isAwait = this.isContextual(92);
|
|
14716
14788
|
|
|
14717
14789
|
if (isAwait && this.isAwaitAllowed()) {
|
|
14718
14790
|
this.next();
|
|
@@ -14723,18 +14795,18 @@ class ExpressionParser extends LValParser {
|
|
|
14723
14795
|
return _expr;
|
|
14724
14796
|
}
|
|
14725
14797
|
|
|
14726
|
-
var update = this.match(
|
|
14798
|
+
var update = this.match(34);
|
|
14727
14799
|
var node = this.startNode();
|
|
14728
14800
|
|
|
14729
14801
|
if (tokenIsPrefix(this.state.type)) {
|
|
14730
14802
|
node.operator = this.state.value;
|
|
14731
14803
|
node.prefix = true;
|
|
14732
14804
|
|
|
14733
|
-
if (this.match(
|
|
14805
|
+
if (this.match(68)) {
|
|
14734
14806
|
this.expectPlugin("throwExpressions");
|
|
14735
14807
|
}
|
|
14736
14808
|
|
|
14737
|
-
var isDelete = this.match(
|
|
14809
|
+
var isDelete = this.match(85);
|
|
14738
14810
|
this.next();
|
|
14739
14811
|
node.argument = this.parseMaybeUnary(null, true);
|
|
14740
14812
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
@@ -14762,7 +14834,7 @@ class ExpressionParser extends LValParser {
|
|
|
14762
14834
|
type
|
|
14763
14835
|
} = this.state;
|
|
14764
14836
|
|
|
14765
|
-
var _startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(
|
|
14837
|
+
var _startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(50);
|
|
14766
14838
|
|
|
14767
14839
|
if (_startsExpr && !this.isAmbiguousAwait()) {
|
|
14768
14840
|
this.raiseOverwrite(startPos, ErrorMessages.AwaitNotInAsyncContext);
|
|
@@ -14827,15 +14899,19 @@ class ExpressionParser extends LValParser {
|
|
|
14827
14899
|
}
|
|
14828
14900
|
|
|
14829
14901
|
parseSubscript(base, startPos, startLoc, noCalls, state) {
|
|
14830
|
-
|
|
14902
|
+
var {
|
|
14903
|
+
type
|
|
14904
|
+
} = this.state;
|
|
14905
|
+
|
|
14906
|
+
if (!noCalls && type === 15) {
|
|
14831
14907
|
return this.parseBind(base, startPos, startLoc, noCalls, state);
|
|
14832
|
-
} else if (
|
|
14908
|
+
} else if (tokenIsTemplate(type)) {
|
|
14833
14909
|
return this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
|
|
14834
14910
|
}
|
|
14835
14911
|
|
|
14836
14912
|
var optional = false;
|
|
14837
14913
|
|
|
14838
|
-
if (
|
|
14914
|
+
if (type === 18) {
|
|
14839
14915
|
if (noCalls && this.lookaheadCharCode() === 40) {
|
|
14840
14916
|
state.stop = true;
|
|
14841
14917
|
return base;
|
|
@@ -14863,21 +14939,19 @@ class ExpressionParser extends LValParser {
|
|
|
14863
14939
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14864
14940
|
node.object = base;
|
|
14865
14941
|
node.computed = computed;
|
|
14866
|
-
var privateName = !computed && this.match(128) && this.state.value;
|
|
14867
|
-
var property = computed ? this.parseExpression() : privateName ? this.parsePrivateName() : this.parseIdentifier(true);
|
|
14868
14942
|
|
|
14869
|
-
if (
|
|
14870
|
-
|
|
14943
|
+
if (computed) {
|
|
14944
|
+
node.property = this.parseExpression();
|
|
14945
|
+
this.expect(3);
|
|
14946
|
+
} else if (this.match(130)) {
|
|
14947
|
+
if (base.type === "Super") {
|
|
14871
14948
|
this.raise(startPos, ErrorMessages.SuperPrivateField);
|
|
14872
14949
|
}
|
|
14873
14950
|
|
|
14874
|
-
this.classScope.usePrivateName(
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
if (computed) {
|
|
14880
|
-
this.expect(3);
|
|
14951
|
+
this.classScope.usePrivateName(this.state.value, this.state.start);
|
|
14952
|
+
node.property = this.parsePrivateName();
|
|
14953
|
+
} else {
|
|
14954
|
+
node.property = this.parseIdentifier(true);
|
|
14881
14955
|
}
|
|
14882
14956
|
|
|
14883
14957
|
if (state.optionalChainMember) {
|
|
@@ -14891,6 +14965,7 @@ class ExpressionParser extends LValParser {
|
|
|
14891
14965
|
parseBind(base, startPos, startLoc, noCalls, state) {
|
|
14892
14966
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14893
14967
|
node.object = base;
|
|
14968
|
+
this.next();
|
|
14894
14969
|
node.callee = this.parseNoCallExpr();
|
|
14895
14970
|
state.stop = true;
|
|
14896
14971
|
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
|
|
@@ -15051,10 +15126,10 @@ class ExpressionParser extends LValParser {
|
|
|
15051
15126
|
} = this.state;
|
|
15052
15127
|
|
|
15053
15128
|
switch (type) {
|
|
15054
|
-
case
|
|
15129
|
+
case 75:
|
|
15055
15130
|
return this.parseSuper();
|
|
15056
15131
|
|
|
15057
|
-
case
|
|
15132
|
+
case 79:
|
|
15058
15133
|
node = this.startNode();
|
|
15059
15134
|
this.next();
|
|
15060
15135
|
|
|
@@ -15068,42 +15143,42 @@ class ExpressionParser extends LValParser {
|
|
|
15068
15143
|
|
|
15069
15144
|
return this.finishNode(node, "Import");
|
|
15070
15145
|
|
|
15071
|
-
case
|
|
15146
|
+
case 74:
|
|
15072
15147
|
node = this.startNode();
|
|
15073
15148
|
this.next();
|
|
15074
15149
|
return this.finishNode(node, "ThisExpression");
|
|
15075
15150
|
|
|
15076
|
-
case
|
|
15151
|
+
case 86:
|
|
15077
15152
|
{
|
|
15078
15153
|
return this.parseDo(this.startNode(), false);
|
|
15079
15154
|
}
|
|
15080
15155
|
|
|
15081
|
-
case
|
|
15082
|
-
case
|
|
15156
|
+
case 52:
|
|
15157
|
+
case 31:
|
|
15083
15158
|
{
|
|
15084
15159
|
this.readRegexp();
|
|
15085
15160
|
return this.parseRegExpLiteral(this.state.value);
|
|
15086
15161
|
}
|
|
15087
15162
|
|
|
15088
|
-
case
|
|
15163
|
+
case 126:
|
|
15089
15164
|
return this.parseNumericLiteral(this.state.value);
|
|
15090
15165
|
|
|
15091
|
-
case
|
|
15166
|
+
case 127:
|
|
15092
15167
|
return this.parseBigIntLiteral(this.state.value);
|
|
15093
15168
|
|
|
15094
|
-
case
|
|
15169
|
+
case 128:
|
|
15095
15170
|
return this.parseDecimalLiteral(this.state.value);
|
|
15096
15171
|
|
|
15097
|
-
case
|
|
15172
|
+
case 125:
|
|
15098
15173
|
return this.parseStringLiteral(this.state.value);
|
|
15099
15174
|
|
|
15100
|
-
case
|
|
15175
|
+
case 80:
|
|
15101
15176
|
return this.parseNullLiteral();
|
|
15102
15177
|
|
|
15103
|
-
case
|
|
15178
|
+
case 81:
|
|
15104
15179
|
return this.parseBooleanLiteral(true);
|
|
15105
15180
|
|
|
15106
|
-
case
|
|
15181
|
+
case 82:
|
|
15107
15182
|
return this.parseBooleanLiteral(false);
|
|
15108
15183
|
|
|
15109
15184
|
case 10:
|
|
@@ -15134,21 +15209,22 @@ class ExpressionParser extends LValParser {
|
|
|
15134
15209
|
return this.parseObjectLike(8, false, false, refExpressionErrors);
|
|
15135
15210
|
}
|
|
15136
15211
|
|
|
15137
|
-
case
|
|
15212
|
+
case 64:
|
|
15138
15213
|
return this.parseFunctionOrFunctionSent();
|
|
15139
15214
|
|
|
15140
|
-
case
|
|
15215
|
+
case 26:
|
|
15141
15216
|
this.parseDecorators();
|
|
15142
15217
|
|
|
15143
|
-
case
|
|
15218
|
+
case 76:
|
|
15144
15219
|
node = this.startNode();
|
|
15145
15220
|
this.takeDecorators(node);
|
|
15146
15221
|
return this.parseClass(node, false);
|
|
15147
15222
|
|
|
15148
|
-
case
|
|
15223
|
+
case 73:
|
|
15149
15224
|
return this.parseNewOrNewTarget();
|
|
15150
15225
|
|
|
15151
|
-
case
|
|
15226
|
+
case 25:
|
|
15227
|
+
case 24:
|
|
15152
15228
|
return this.parseTemplate(false);
|
|
15153
15229
|
|
|
15154
15230
|
case 15:
|
|
@@ -15165,25 +15241,25 @@ class ExpressionParser extends LValParser {
|
|
|
15165
15241
|
}
|
|
15166
15242
|
}
|
|
15167
15243
|
|
|
15168
|
-
case
|
|
15244
|
+
case 130:
|
|
15169
15245
|
{
|
|
15170
15246
|
this.raise(this.state.start, ErrorMessages.PrivateInExpectedIn, this.state.value);
|
|
15171
15247
|
return this.parsePrivateName();
|
|
15172
15248
|
}
|
|
15173
15249
|
|
|
15174
|
-
case
|
|
15250
|
+
case 33:
|
|
15175
15251
|
{
|
|
15176
|
-
return this.parseTopicReferenceThenEqualsSign(
|
|
15252
|
+
return this.parseTopicReferenceThenEqualsSign(50, "%");
|
|
15177
15253
|
}
|
|
15178
15254
|
|
|
15179
|
-
case
|
|
15255
|
+
case 32:
|
|
15180
15256
|
{
|
|
15181
|
-
return this.parseTopicReferenceThenEqualsSign(
|
|
15257
|
+
return this.parseTopicReferenceThenEqualsSign(42, "^");
|
|
15182
15258
|
}
|
|
15183
15259
|
|
|
15184
|
-
case
|
|
15185
|
-
case
|
|
15186
|
-
case
|
|
15260
|
+
case 42:
|
|
15261
|
+
case 50:
|
|
15262
|
+
case 27:
|
|
15187
15263
|
{
|
|
15188
15264
|
var pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
|
|
15189
15265
|
|
|
@@ -15194,7 +15270,7 @@ class ExpressionParser extends LValParser {
|
|
|
15194
15270
|
}
|
|
15195
15271
|
}
|
|
15196
15272
|
|
|
15197
|
-
case
|
|
15273
|
+
case 45:
|
|
15198
15274
|
{
|
|
15199
15275
|
var lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
15200
15276
|
|
|
@@ -15208,7 +15284,7 @@ class ExpressionParser extends LValParser {
|
|
|
15208
15284
|
|
|
15209
15285
|
default:
|
|
15210
15286
|
if (tokenIsIdentifier(type)) {
|
|
15211
|
-
if (this.isContextual(
|
|
15287
|
+
if (this.isContextual(119) && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) {
|
|
15212
15288
|
return this.parseModuleExpression();
|
|
15213
15289
|
}
|
|
15214
15290
|
|
|
@@ -15222,7 +15298,7 @@ class ExpressionParser extends LValParser {
|
|
|
15222
15298
|
type: _type
|
|
15223
15299
|
} = this.state;
|
|
15224
15300
|
|
|
15225
|
-
if (_type ===
|
|
15301
|
+
if (_type === 64) {
|
|
15226
15302
|
this.resetPreviousNodeTrailingComments(id);
|
|
15227
15303
|
this.next();
|
|
15228
15304
|
return this.parseFunction(this.startNodeAtNode(id), undefined, true);
|
|
@@ -15232,7 +15308,7 @@ class ExpressionParser extends LValParser {
|
|
|
15232
15308
|
} else {
|
|
15233
15309
|
return id;
|
|
15234
15310
|
}
|
|
15235
|
-
} else if (_type ===
|
|
15311
|
+
} else if (_type === 86) {
|
|
15236
15312
|
this.resetPreviousNodeTrailingComments(id);
|
|
15237
15313
|
return this.parseDo(this.startNodeAtNode(id), true);
|
|
15238
15314
|
}
|
|
@@ -15303,12 +15379,13 @@ class ExpressionParser extends LValParser {
|
|
|
15303
15379
|
switch (pipeProposal) {
|
|
15304
15380
|
case "hack":
|
|
15305
15381
|
{
|
|
15306
|
-
|
|
15307
|
-
|
|
15382
|
+
return this.hasPlugin(["pipelineOperator", {
|
|
15383
|
+
topicToken: tokenLabelName(tokenType)
|
|
15384
|
+
}]);
|
|
15308
15385
|
}
|
|
15309
15386
|
|
|
15310
15387
|
case "smart":
|
|
15311
|
-
return tokenType ===
|
|
15388
|
+
return tokenType === 27;
|
|
15312
15389
|
|
|
15313
15390
|
default:
|
|
15314
15391
|
throw this.raise(start, ErrorMessages.PipeTopicRequiresHackPipes);
|
|
@@ -15387,7 +15464,7 @@ class ExpressionParser extends LValParser {
|
|
|
15387
15464
|
var meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
15388
15465
|
this.next();
|
|
15389
15466
|
|
|
15390
|
-
if (this.match(
|
|
15467
|
+
if (this.match(98)) {
|
|
15391
15468
|
this.expectPlugin("functionSent");
|
|
15392
15469
|
} else if (!this.hasPlugin("functionSent")) {
|
|
15393
15470
|
this.unexpected();
|
|
@@ -15415,7 +15492,7 @@ class ExpressionParser extends LValParser {
|
|
|
15415
15492
|
var id = this.createIdentifier(this.startNodeAtNode(node), "import");
|
|
15416
15493
|
this.next();
|
|
15417
15494
|
|
|
15418
|
-
if (this.isContextual(
|
|
15495
|
+
if (this.isContextual(96)) {
|
|
15419
15496
|
if (!this.inModule) {
|
|
15420
15497
|
this.raise(id.start, SourceTypeModuleErrorMessages.ImportMetaOutsideModule);
|
|
15421
15498
|
}
|
|
@@ -15623,38 +15700,46 @@ class ExpressionParser extends LValParser {
|
|
|
15623
15700
|
}
|
|
15624
15701
|
|
|
15625
15702
|
parseTemplateElement(isTagged) {
|
|
15626
|
-
var
|
|
15703
|
+
var {
|
|
15704
|
+
start,
|
|
15705
|
+
end,
|
|
15706
|
+
value
|
|
15707
|
+
} = this.state;
|
|
15708
|
+
var elemStart = start + 1;
|
|
15709
|
+
var elem = this.startNodeAt(elemStart, createPositionWithColumnOffset(this.state.startLoc, 1));
|
|
15627
15710
|
|
|
15628
|
-
if (
|
|
15711
|
+
if (value === null) {
|
|
15629
15712
|
if (!isTagged) {
|
|
15630
|
-
this.raise(
|
|
15713
|
+
this.raise(start + 2, ErrorMessages.InvalidEscapeSequenceTemplate);
|
|
15631
15714
|
}
|
|
15632
15715
|
}
|
|
15633
15716
|
|
|
15717
|
+
var isTail = this.match(24);
|
|
15718
|
+
var endOffset = isTail ? -1 : -2;
|
|
15719
|
+
var elemEnd = end + endOffset;
|
|
15634
15720
|
elem.value = {
|
|
15635
|
-
raw: this.input.slice(
|
|
15636
|
-
cooked:
|
|
15721
|
+
raw: this.input.slice(elemStart, elemEnd).replace(/\r\n?/g, "\n"),
|
|
15722
|
+
cooked: value === null ? null : value.slice(1, endOffset)
|
|
15637
15723
|
};
|
|
15724
|
+
elem.tail = isTail;
|
|
15638
15725
|
this.next();
|
|
15639
|
-
|
|
15640
|
-
|
|
15726
|
+
this.finishNode(elem, "TemplateElement");
|
|
15727
|
+
this.resetEndLocation(elem, elemEnd, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
|
|
15728
|
+
return elem;
|
|
15641
15729
|
}
|
|
15642
15730
|
|
|
15643
15731
|
parseTemplate(isTagged) {
|
|
15644
15732
|
var node = this.startNode();
|
|
15645
|
-
this.next();
|
|
15646
15733
|
node.expressions = [];
|
|
15647
15734
|
var curElt = this.parseTemplateElement(isTagged);
|
|
15648
15735
|
node.quasis = [curElt];
|
|
15649
15736
|
|
|
15650
15737
|
while (!curElt.tail) {
|
|
15651
|
-
this.expect(23);
|
|
15652
15738
|
node.expressions.push(this.parseTemplateSubstitution());
|
|
15653
|
-
this.
|
|
15739
|
+
this.readTemplateContinuation();
|
|
15654
15740
|
node.quasis.push(curElt = this.parseTemplateElement(isTagged));
|
|
15655
15741
|
}
|
|
15656
15742
|
|
|
15657
|
-
this.next();
|
|
15658
15743
|
return this.finishNode(node, "TemplateLiteral");
|
|
15659
15744
|
}
|
|
15660
15745
|
|
|
@@ -15721,18 +15806,18 @@ class ExpressionParser extends LValParser {
|
|
|
15721
15806
|
}
|
|
15722
15807
|
|
|
15723
15808
|
maybeAsyncOrAccessorProp(prop) {
|
|
15724
|
-
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(
|
|
15809
|
+
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(51));
|
|
15725
15810
|
}
|
|
15726
15811
|
|
|
15727
15812
|
parsePropertyDefinition(refExpressionErrors) {
|
|
15728
15813
|
var decorators = [];
|
|
15729
15814
|
|
|
15730
|
-
if (this.match(
|
|
15815
|
+
if (this.match(26)) {
|
|
15731
15816
|
if (this.hasPlugin("decorators")) {
|
|
15732
15817
|
this.raise(this.state.start, ErrorMessages.UnsupportedPropertyDecorator);
|
|
15733
15818
|
}
|
|
15734
15819
|
|
|
15735
|
-
while (this.match(
|
|
15820
|
+
while (this.match(26)) {
|
|
15736
15821
|
decorators.push(this.parseDecorator());
|
|
15737
15822
|
}
|
|
15738
15823
|
}
|
|
@@ -15760,7 +15845,7 @@ class ExpressionParser extends LValParser {
|
|
|
15760
15845
|
startLoc = this.state.startLoc;
|
|
15761
15846
|
}
|
|
15762
15847
|
|
|
15763
|
-
var isGenerator = this.eat(
|
|
15848
|
+
var isGenerator = this.eat(51);
|
|
15764
15849
|
this.parsePropertyNamePrefixOperator(prop);
|
|
15765
15850
|
var containsEsc = this.state.containsEsc;
|
|
15766
15851
|
var key = this.parsePropertyName(prop);
|
|
@@ -15771,7 +15856,7 @@ class ExpressionParser extends LValParser {
|
|
|
15771
15856
|
if (keyName === "async" && !this.hasPrecedingLineBreak()) {
|
|
15772
15857
|
isAsync = true;
|
|
15773
15858
|
this.resetPreviousNodeTrailingComments(key);
|
|
15774
|
-
isGenerator = this.eat(
|
|
15859
|
+
isGenerator = this.eat(51);
|
|
15775
15860
|
this.parsePropertyName(prop);
|
|
15776
15861
|
}
|
|
15777
15862
|
|
|
@@ -15780,7 +15865,7 @@ class ExpressionParser extends LValParser {
|
|
|
15780
15865
|
this.resetPreviousNodeTrailingComments(key);
|
|
15781
15866
|
prop.kind = keyName;
|
|
15782
15867
|
|
|
15783
|
-
if (this.match(
|
|
15868
|
+
if (this.match(51)) {
|
|
15784
15869
|
isGenerator = true;
|
|
15785
15870
|
this.raise(this.state.pos, ErrorMessages.AccessorIsGenerator, keyName);
|
|
15786
15871
|
this.next();
|
|
@@ -15850,9 +15935,15 @@ class ExpressionParser extends LValParser {
|
|
|
15850
15935
|
|
|
15851
15936
|
if (isPattern) {
|
|
15852
15937
|
prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
|
|
15853
|
-
} else if (this.match(
|
|
15854
|
-
|
|
15855
|
-
|
|
15938
|
+
} else if (this.match(29)) {
|
|
15939
|
+
var shorthandAssign = this.state.start;
|
|
15940
|
+
|
|
15941
|
+
if (refExpressionErrors != null) {
|
|
15942
|
+
if (refExpressionErrors.shorthandAssign === -1) {
|
|
15943
|
+
refExpressionErrors.shorthandAssign = shorthandAssign;
|
|
15944
|
+
}
|
|
15945
|
+
} else {
|
|
15946
|
+
this.raise(shorthandAssign, ErrorMessages.InvalidCoverInitializedName);
|
|
15856
15947
|
}
|
|
15857
15948
|
|
|
15858
15949
|
prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
|
|
@@ -15887,23 +15978,23 @@ class ExpressionParser extends LValParser {
|
|
|
15887
15978
|
key = this.parseIdentifier(true);
|
|
15888
15979
|
} else {
|
|
15889
15980
|
switch (type) {
|
|
15890
|
-
case
|
|
15981
|
+
case 126:
|
|
15891
15982
|
key = this.parseNumericLiteral(value);
|
|
15892
15983
|
break;
|
|
15893
15984
|
|
|
15894
|
-
case
|
|
15985
|
+
case 125:
|
|
15895
15986
|
key = this.parseStringLiteral(value);
|
|
15896
15987
|
break;
|
|
15897
15988
|
|
|
15898
|
-
case
|
|
15989
|
+
case 127:
|
|
15899
15990
|
key = this.parseBigIntLiteral(value);
|
|
15900
15991
|
break;
|
|
15901
15992
|
|
|
15902
|
-
case
|
|
15993
|
+
case 128:
|
|
15903
15994
|
key = this.parseDecimalLiteral(value);
|
|
15904
15995
|
break;
|
|
15905
15996
|
|
|
15906
|
-
case
|
|
15997
|
+
case 130:
|
|
15907
15998
|
{
|
|
15908
15999
|
var privateKeyPos = this.state.start + 1;
|
|
15909
16000
|
this.raise(privateKeyPos, ErrorMessages.UnexpectedPrivateField);
|
|
@@ -15918,7 +16009,7 @@ class ExpressionParser extends LValParser {
|
|
|
15918
16009
|
|
|
15919
16010
|
prop.key = key;
|
|
15920
16011
|
|
|
15921
|
-
if (type !==
|
|
16012
|
+
if (type !== 130) {
|
|
15922
16013
|
prop.computed = false;
|
|
15923
16014
|
}
|
|
15924
16015
|
}
|
|
@@ -16132,7 +16223,7 @@ class ExpressionParser extends LValParser {
|
|
|
16132
16223
|
|
|
16133
16224
|
if (liberal) {
|
|
16134
16225
|
if (tokenIsKeyword) {
|
|
16135
|
-
this.replaceToken(
|
|
16226
|
+
this.replaceToken(124);
|
|
16136
16227
|
}
|
|
16137
16228
|
} else {
|
|
16138
16229
|
this.checkReservedWord(name, start, tokenIsKeyword, false);
|
|
@@ -16199,7 +16290,7 @@ class ExpressionParser extends LValParser {
|
|
|
16199
16290
|
var node = this.startNodeAt(startPos, startLoc);
|
|
16200
16291
|
this.expressionScope.recordParameterInitializerError(node.start, ErrorMessages.AwaitExpressionFormalParameter);
|
|
16201
16292
|
|
|
16202
|
-
if (this.eat(
|
|
16293
|
+
if (this.eat(51)) {
|
|
16203
16294
|
this.raise(node.start, ErrorMessages.ObsoleteAwaitStar);
|
|
16204
16295
|
}
|
|
16205
16296
|
|
|
@@ -16219,7 +16310,11 @@ class ExpressionParser extends LValParser {
|
|
|
16219
16310
|
}
|
|
16220
16311
|
|
|
16221
16312
|
isAmbiguousAwait() {
|
|
16222
|
-
|
|
16313
|
+
if (this.hasPrecedingLineBreak()) return true;
|
|
16314
|
+
var {
|
|
16315
|
+
type
|
|
16316
|
+
} = this.state;
|
|
16317
|
+
return type === 49 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 129 || type === 52 || this.hasPlugin("v8intrinsic") && type === 50;
|
|
16223
16318
|
}
|
|
16224
16319
|
|
|
16225
16320
|
parseYield() {
|
|
@@ -16230,11 +16325,11 @@ class ExpressionParser extends LValParser {
|
|
|
16230
16325
|
var argument = null;
|
|
16231
16326
|
|
|
16232
16327
|
if (!this.hasPrecedingLineBreak()) {
|
|
16233
|
-
delegating = this.eat(
|
|
16328
|
+
delegating = this.eat(51);
|
|
16234
16329
|
|
|
16235
16330
|
switch (this.state.type) {
|
|
16236
16331
|
case 13:
|
|
16237
|
-
case
|
|
16332
|
+
case 131:
|
|
16238
16333
|
case 8:
|
|
16239
16334
|
case 11:
|
|
16240
16335
|
case 3:
|
|
@@ -16254,7 +16349,9 @@ class ExpressionParser extends LValParser {
|
|
|
16254
16349
|
}
|
|
16255
16350
|
|
|
16256
16351
|
checkPipelineAtInfixOperator(left, leftStartPos) {
|
|
16257
|
-
if (this.
|
|
16352
|
+
if (this.hasPlugin(["pipelineOperator", {
|
|
16353
|
+
proposal: "smart"
|
|
16354
|
+
}])) {
|
|
16258
16355
|
if (left.type === "SequenceExpression") {
|
|
16259
16356
|
this.raise(leftStartPos, ErrorMessages.PipelineHeadSequenceExpression);
|
|
16260
16357
|
}
|
|
@@ -16316,9 +16413,9 @@ class ExpressionParser extends LValParser {
|
|
|
16316
16413
|
}
|
|
16317
16414
|
|
|
16318
16415
|
withSmartMixTopicForbiddingContext(callback) {
|
|
16319
|
-
|
|
16320
|
-
|
|
16321
|
-
|
|
16416
|
+
if (this.hasPlugin(["pipelineOperator", {
|
|
16417
|
+
proposal: "smart"
|
|
16418
|
+
}])) {
|
|
16322
16419
|
var outerContextTopicState = this.state.topicContext;
|
|
16323
16420
|
this.state.topicContext = {
|
|
16324
16421
|
maxNumOfResolvableTopics: 0,
|
|
@@ -16439,44 +16536,117 @@ var FUNC_NO_FLAGS = 0b000,
|
|
|
16439
16536
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
16440
16537
|
var keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
16441
16538
|
|
|
16442
|
-
function babel7CompatTokens(tokens) {
|
|
16539
|
+
function babel7CompatTokens(tokens, input) {
|
|
16443
16540
|
for (var i = 0; i < tokens.length; i++) {
|
|
16444
16541
|
var token = tokens[i];
|
|
16445
16542
|
var {
|
|
16446
16543
|
type
|
|
16447
16544
|
} = token;
|
|
16448
16545
|
|
|
16449
|
-
if (type ===
|
|
16546
|
+
if (typeof type === "number") {
|
|
16450
16547
|
{
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
|
|
16548
|
+
if (type === 130) {
|
|
16549
|
+
var {
|
|
16550
|
+
loc,
|
|
16551
|
+
start,
|
|
16552
|
+
value,
|
|
16553
|
+
end
|
|
16554
|
+
} = token;
|
|
16555
|
+
var hashEndPos = start + 1;
|
|
16556
|
+
var hashEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
|
16557
|
+
tokens.splice(i, 1, new Token({
|
|
16558
|
+
type: getExportedToken(27),
|
|
16559
|
+
value: "#",
|
|
16560
|
+
start: start,
|
|
16561
|
+
end: hashEndPos,
|
|
16562
|
+
startLoc: loc.start,
|
|
16563
|
+
endLoc: hashEndLoc
|
|
16564
|
+
}), new Token({
|
|
16565
|
+
type: getExportedToken(124),
|
|
16566
|
+
value: value,
|
|
16567
|
+
start: hashEndPos,
|
|
16568
|
+
end: end,
|
|
16569
|
+
startLoc: hashEndLoc,
|
|
16570
|
+
endLoc: loc.end
|
|
16571
|
+
}));
|
|
16572
|
+
i++;
|
|
16573
|
+
continue;
|
|
16574
|
+
}
|
|
16478
16575
|
|
|
16479
|
-
|
|
16576
|
+
if (tokenIsTemplate(type)) {
|
|
16577
|
+
var {
|
|
16578
|
+
loc: _loc,
|
|
16579
|
+
start: _start,
|
|
16580
|
+
value: _value,
|
|
16581
|
+
end: _end
|
|
16582
|
+
} = token;
|
|
16583
|
+
var backquoteEnd = _start + 1;
|
|
16584
|
+
var backquoteEndLoc = createPositionWithColumnOffset(_loc.start, 1);
|
|
16585
|
+
var startToken = void 0;
|
|
16586
|
+
|
|
16587
|
+
if (input.charCodeAt(_start) === 96) {
|
|
16588
|
+
startToken = new Token({
|
|
16589
|
+
type: getExportedToken(22),
|
|
16590
|
+
value: "`",
|
|
16591
|
+
start: _start,
|
|
16592
|
+
end: backquoteEnd,
|
|
16593
|
+
startLoc: _loc.start,
|
|
16594
|
+
endLoc: backquoteEndLoc
|
|
16595
|
+
});
|
|
16596
|
+
} else {
|
|
16597
|
+
startToken = new Token({
|
|
16598
|
+
type: getExportedToken(8),
|
|
16599
|
+
value: "}",
|
|
16600
|
+
start: _start,
|
|
16601
|
+
end: backquoteEnd,
|
|
16602
|
+
startLoc: _loc.start,
|
|
16603
|
+
endLoc: backquoteEndLoc
|
|
16604
|
+
});
|
|
16605
|
+
}
|
|
16606
|
+
|
|
16607
|
+
var templateValue = void 0,
|
|
16608
|
+
templateElementEnd = void 0,
|
|
16609
|
+
templateElementEndLoc = void 0,
|
|
16610
|
+
endToken = void 0;
|
|
16611
|
+
|
|
16612
|
+
if (type === 24) {
|
|
16613
|
+
templateElementEnd = _end - 1;
|
|
16614
|
+
templateElementEndLoc = createPositionWithColumnOffset(_loc.end, -1);
|
|
16615
|
+
templateValue = _value === null ? null : _value.slice(1, -1);
|
|
16616
|
+
endToken = new Token({
|
|
16617
|
+
type: getExportedToken(22),
|
|
16618
|
+
value: "`",
|
|
16619
|
+
start: templateElementEnd,
|
|
16620
|
+
end: _end,
|
|
16621
|
+
startLoc: templateElementEndLoc,
|
|
16622
|
+
endLoc: _loc.end
|
|
16623
|
+
});
|
|
16624
|
+
} else {
|
|
16625
|
+
templateElementEnd = _end - 2;
|
|
16626
|
+
templateElementEndLoc = createPositionWithColumnOffset(_loc.end, -2);
|
|
16627
|
+
templateValue = _value === null ? null : _value.slice(1, -2);
|
|
16628
|
+
endToken = new Token({
|
|
16629
|
+
type: getExportedToken(23),
|
|
16630
|
+
value: "${",
|
|
16631
|
+
start: templateElementEnd,
|
|
16632
|
+
end: _end,
|
|
16633
|
+
startLoc: templateElementEndLoc,
|
|
16634
|
+
endLoc: _loc.end
|
|
16635
|
+
});
|
|
16636
|
+
}
|
|
16637
|
+
|
|
16638
|
+
tokens.splice(i, 1, startToken, new Token({
|
|
16639
|
+
type: getExportedToken(20),
|
|
16640
|
+
value: templateValue,
|
|
16641
|
+
start: backquoteEnd,
|
|
16642
|
+
end: templateElementEnd,
|
|
16643
|
+
startLoc: backquoteEndLoc,
|
|
16644
|
+
endLoc: templateElementEndLoc
|
|
16645
|
+
}), endToken);
|
|
16646
|
+
i += 2;
|
|
16647
|
+
continue;
|
|
16648
|
+
}
|
|
16649
|
+
}
|
|
16480
16650
|
token.type = getExportedToken(type);
|
|
16481
16651
|
}
|
|
16482
16652
|
}
|
|
@@ -16488,12 +16658,16 @@ class StatementParser extends ExpressionParser {
|
|
|
16488
16658
|
parseTopLevel(file, program) {
|
|
16489
16659
|
file.program = this.parseProgram(program);
|
|
16490
16660
|
file.comments = this.state.comments;
|
|
16491
|
-
|
|
16661
|
+
|
|
16662
|
+
if (this.options.tokens) {
|
|
16663
|
+
file.tokens = babel7CompatTokens(this.tokens, this.input);
|
|
16664
|
+
}
|
|
16665
|
+
|
|
16492
16666
|
return this.finishNode(file, "File");
|
|
16493
16667
|
}
|
|
16494
16668
|
|
|
16495
16669
|
parseProgram(program) {
|
|
16496
|
-
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
16670
|
+
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 131;
|
|
16497
16671
|
var sourceType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.sourceType;
|
|
16498
16672
|
program.sourceType = sourceType;
|
|
16499
16673
|
program.interpreter = this.parseInterpreterDirective();
|
|
@@ -16526,7 +16700,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16526
16700
|
}
|
|
16527
16701
|
|
|
16528
16702
|
parseInterpreterDirective() {
|
|
16529
|
-
if (!this.match(
|
|
16703
|
+
if (!this.match(28)) {
|
|
16530
16704
|
return null;
|
|
16531
16705
|
}
|
|
16532
16706
|
|
|
@@ -16537,7 +16711,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16537
16711
|
}
|
|
16538
16712
|
|
|
16539
16713
|
isLet(context) {
|
|
16540
|
-
if (!this.isContextual(
|
|
16714
|
+
if (!this.isContextual(95)) {
|
|
16541
16715
|
return false;
|
|
16542
16716
|
}
|
|
16543
16717
|
|
|
@@ -16573,7 +16747,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16573
16747
|
}
|
|
16574
16748
|
|
|
16575
16749
|
parseStatement(context, topLevel) {
|
|
16576
|
-
if (this.match(
|
|
16750
|
+
if (this.match(26)) {
|
|
16577
16751
|
this.parseDecorators(true);
|
|
16578
16752
|
}
|
|
16579
16753
|
|
|
@@ -16586,27 +16760,27 @@ class StatementParser extends ExpressionParser {
|
|
|
16586
16760
|
var kind;
|
|
16587
16761
|
|
|
16588
16762
|
if (this.isLet(context)) {
|
|
16589
|
-
starttype =
|
|
16763
|
+
starttype = 70;
|
|
16590
16764
|
kind = "let";
|
|
16591
16765
|
}
|
|
16592
16766
|
|
|
16593
16767
|
switch (starttype) {
|
|
16594
|
-
case
|
|
16768
|
+
case 56:
|
|
16595
16769
|
return this.parseBreakContinueStatement(node, true);
|
|
16596
16770
|
|
|
16597
|
-
case
|
|
16771
|
+
case 59:
|
|
16598
16772
|
return this.parseBreakContinueStatement(node, false);
|
|
16599
16773
|
|
|
16600
|
-
case
|
|
16774
|
+
case 60:
|
|
16601
16775
|
return this.parseDebuggerStatement(node);
|
|
16602
16776
|
|
|
16603
|
-
case
|
|
16777
|
+
case 86:
|
|
16604
16778
|
return this.parseDoStatement(node);
|
|
16605
16779
|
|
|
16606
|
-
case
|
|
16780
|
+
case 87:
|
|
16607
16781
|
return this.parseForStatement(node);
|
|
16608
16782
|
|
|
16609
|
-
case
|
|
16783
|
+
case 64:
|
|
16610
16784
|
if (this.lookaheadCharCode() === 46) break;
|
|
16611
16785
|
|
|
16612
16786
|
if (context) {
|
|
@@ -16619,27 +16793,27 @@ class StatementParser extends ExpressionParser {
|
|
|
16619
16793
|
|
|
16620
16794
|
return this.parseFunctionStatement(node, false, !context);
|
|
16621
16795
|
|
|
16622
|
-
case
|
|
16796
|
+
case 76:
|
|
16623
16797
|
if (context) this.unexpected();
|
|
16624
16798
|
return this.parseClass(node, true);
|
|
16625
16799
|
|
|
16626
|
-
case
|
|
16800
|
+
case 65:
|
|
16627
16801
|
return this.parseIfStatement(node);
|
|
16628
16802
|
|
|
16629
|
-
case
|
|
16803
|
+
case 66:
|
|
16630
16804
|
return this.parseReturnStatement(node);
|
|
16631
16805
|
|
|
16632
|
-
case
|
|
16806
|
+
case 67:
|
|
16633
16807
|
return this.parseSwitchStatement(node);
|
|
16634
16808
|
|
|
16635
|
-
case
|
|
16809
|
+
case 68:
|
|
16636
16810
|
return this.parseThrowStatement(node);
|
|
16637
16811
|
|
|
16638
|
-
case
|
|
16812
|
+
case 69:
|
|
16639
16813
|
return this.parseTryStatement(node);
|
|
16640
16814
|
|
|
16641
|
-
case
|
|
16642
|
-
case
|
|
16815
|
+
case 71:
|
|
16816
|
+
case 70:
|
|
16643
16817
|
kind = kind || this.state.value;
|
|
16644
16818
|
|
|
16645
16819
|
if (context && kind !== "var") {
|
|
@@ -16648,10 +16822,10 @@ class StatementParser extends ExpressionParser {
|
|
|
16648
16822
|
|
|
16649
16823
|
return this.parseVarStatement(node, kind);
|
|
16650
16824
|
|
|
16651
|
-
case
|
|
16825
|
+
case 88:
|
|
16652
16826
|
return this.parseWhileStatement(node);
|
|
16653
16827
|
|
|
16654
|
-
case
|
|
16828
|
+
case 72:
|
|
16655
16829
|
return this.parseWithStatement(node);
|
|
16656
16830
|
|
|
16657
16831
|
case 5:
|
|
@@ -16660,7 +16834,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16660
16834
|
case 13:
|
|
16661
16835
|
return this.parseEmptyStatement(node);
|
|
16662
16836
|
|
|
16663
|
-
case
|
|
16837
|
+
case 79:
|
|
16664
16838
|
{
|
|
16665
16839
|
var nextTokenCharCode = this.lookaheadCharCode();
|
|
16666
16840
|
|
|
@@ -16669,7 +16843,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16669
16843
|
}
|
|
16670
16844
|
}
|
|
16671
16845
|
|
|
16672
|
-
case
|
|
16846
|
+
case 78:
|
|
16673
16847
|
{
|
|
16674
16848
|
if (!this.options.allowImportExportEverywhere && !topLevel) {
|
|
16675
16849
|
this.raise(this.state.start, ErrorMessages.UnexpectedImportExport);
|
|
@@ -16678,7 +16852,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16678
16852
|
this.next();
|
|
16679
16853
|
var result;
|
|
16680
16854
|
|
|
16681
|
-
if (starttype ===
|
|
16855
|
+
if (starttype === 79) {
|
|
16682
16856
|
result = this.parseImport(node);
|
|
16683
16857
|
|
|
16684
16858
|
if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
|
|
@@ -16736,18 +16910,18 @@ class StatementParser extends ExpressionParser {
|
|
|
16736
16910
|
}
|
|
16737
16911
|
|
|
16738
16912
|
canHaveLeadingDecorator() {
|
|
16739
|
-
return this.match(
|
|
16913
|
+
return this.match(76);
|
|
16740
16914
|
}
|
|
16741
16915
|
|
|
16742
16916
|
parseDecorators(allowExport) {
|
|
16743
16917
|
var currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
|
|
16744
16918
|
|
|
16745
|
-
while (this.match(
|
|
16919
|
+
while (this.match(26)) {
|
|
16746
16920
|
var decorator = this.parseDecorator();
|
|
16747
16921
|
currentContextDecorators.push(decorator);
|
|
16748
16922
|
}
|
|
16749
16923
|
|
|
16750
|
-
if (this.match(
|
|
16924
|
+
if (this.match(78)) {
|
|
16751
16925
|
if (!allowExport) {
|
|
16752
16926
|
this.unexpected();
|
|
16753
16927
|
}
|
|
@@ -16857,7 +17031,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16857
17031
|
this.state.labels.push(loopLabel);
|
|
16858
17032
|
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("do"));
|
|
16859
17033
|
this.state.labels.pop();
|
|
16860
|
-
this.expect(
|
|
17034
|
+
this.expect(88);
|
|
16861
17035
|
node.test = this.parseHeaderExpression();
|
|
16862
17036
|
this.eat(13);
|
|
16863
17037
|
return this.finishNode(node, "DoWhileStatement");
|
|
@@ -16868,7 +17042,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16868
17042
|
this.state.labels.push(loopLabel);
|
|
16869
17043
|
var awaitAt = -1;
|
|
16870
17044
|
|
|
16871
|
-
if (this.isAwaitAllowed() && this.eatContextual(
|
|
17045
|
+
if (this.isAwaitAllowed() && this.eatContextual(92)) {
|
|
16872
17046
|
awaitAt = this.state.lastTokStart;
|
|
16873
17047
|
}
|
|
16874
17048
|
|
|
@@ -16883,10 +17057,10 @@ class StatementParser extends ExpressionParser {
|
|
|
16883
17057
|
return this.parseFor(node, null);
|
|
16884
17058
|
}
|
|
16885
17059
|
|
|
16886
|
-
var startsWithLet = this.isContextual(
|
|
17060
|
+
var startsWithLet = this.isContextual(95);
|
|
16887
17061
|
var isLet = startsWithLet && this.isLetKeyword();
|
|
16888
17062
|
|
|
16889
|
-
if (this.match(
|
|
17063
|
+
if (this.match(70) || this.match(71) || isLet) {
|
|
16890
17064
|
var _init = this.startNode();
|
|
16891
17065
|
|
|
16892
17066
|
var kind = isLet ? "let" : this.state.value;
|
|
@@ -16894,7 +17068,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16894
17068
|
this.parseVar(_init, true, kind);
|
|
16895
17069
|
this.finishNode(_init, "VariableDeclaration");
|
|
16896
17070
|
|
|
16897
|
-
if ((this.match(
|
|
17071
|
+
if ((this.match(54) || this.isContextual(97)) && _init.declarations.length === 1) {
|
|
16898
17072
|
return this.parseForIn(node, _init, awaitAt);
|
|
16899
17073
|
}
|
|
16900
17074
|
|
|
@@ -16905,10 +17079,10 @@ class StatementParser extends ExpressionParser {
|
|
|
16905
17079
|
return this.parseFor(node, _init);
|
|
16906
17080
|
}
|
|
16907
17081
|
|
|
16908
|
-
var startsWithAsync = this.isContextual(
|
|
17082
|
+
var startsWithAsync = this.isContextual(91);
|
|
16909
17083
|
var refExpressionErrors = new ExpressionErrors();
|
|
16910
17084
|
var init = this.parseExpression(true, refExpressionErrors);
|
|
16911
|
-
var isForOf = this.isContextual(
|
|
17085
|
+
var isForOf = this.isContextual(97);
|
|
16912
17086
|
|
|
16913
17087
|
if (isForOf) {
|
|
16914
17088
|
if (startsWithLet) {
|
|
@@ -16918,7 +17092,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16918
17092
|
}
|
|
16919
17093
|
}
|
|
16920
17094
|
|
|
16921
|
-
if (isForOf || this.match(
|
|
17095
|
+
if (isForOf || this.match(54)) {
|
|
16922
17096
|
this.toAssignable(init, true);
|
|
16923
17097
|
var description = isForOf ? "for-of statement" : "for-in statement";
|
|
16924
17098
|
this.checkLVal(init, description);
|
|
@@ -16943,7 +17117,7 @@ class StatementParser extends ExpressionParser {
|
|
|
16943
17117
|
this.next();
|
|
16944
17118
|
node.test = this.parseHeaderExpression();
|
|
16945
17119
|
node.consequent = this.parseStatement("if");
|
|
16946
|
-
node.alternate = this.eat(
|
|
17120
|
+
node.alternate = this.eat(62) ? this.parseStatement("if") : null;
|
|
16947
17121
|
return this.finishNode(node, "IfStatement");
|
|
16948
17122
|
}
|
|
16949
17123
|
|
|
@@ -16974,8 +17148,8 @@ class StatementParser extends ExpressionParser {
|
|
|
16974
17148
|
var cur;
|
|
16975
17149
|
|
|
16976
17150
|
for (var sawDefault; !this.match(8);) {
|
|
16977
|
-
if (this.match(
|
|
16978
|
-
var isCase = this.match(
|
|
17151
|
+
if (this.match(57) || this.match(61)) {
|
|
17152
|
+
var isCase = this.match(57);
|
|
16979
17153
|
if (cur) this.finishNode(cur, "SwitchCase");
|
|
16980
17154
|
cases.push(cur = this.startNode());
|
|
16981
17155
|
cur.consequent = [];
|
|
@@ -17034,7 +17208,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17034
17208
|
node.block = this.parseBlock();
|
|
17035
17209
|
node.handler = null;
|
|
17036
17210
|
|
|
17037
|
-
if (this.match(
|
|
17211
|
+
if (this.match(58)) {
|
|
17038
17212
|
var clause = this.startNode();
|
|
17039
17213
|
this.next();
|
|
17040
17214
|
|
|
@@ -17052,7 +17226,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17052
17226
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
17053
17227
|
}
|
|
17054
17228
|
|
|
17055
|
-
node.finalizer = this.eat(
|
|
17229
|
+
node.finalizer = this.eat(63) ? this.parseBlock() : null;
|
|
17056
17230
|
|
|
17057
17231
|
if (!node.handler && !node.finalizer) {
|
|
17058
17232
|
this.raise(node.start, ErrorMessages.NoCatchOrFinally);
|
|
@@ -17100,7 +17274,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17100
17274
|
}
|
|
17101
17275
|
}
|
|
17102
17276
|
|
|
17103
|
-
var kind = tokenIsLoop(this.state.type) ? "loop" : this.match(
|
|
17277
|
+
var kind = tokenIsLoop(this.state.type) ? "loop" : this.match(67) ? "switch" : null;
|
|
17104
17278
|
|
|
17105
17279
|
for (var i = this.state.labels.length - 1; i >= 0; i--) {
|
|
17106
17280
|
var _label = this.state.labels[i];
|
|
@@ -17218,7 +17392,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17218
17392
|
}
|
|
17219
17393
|
|
|
17220
17394
|
parseForIn(node, init, awaitAt) {
|
|
17221
|
-
var isForIn = this.match(
|
|
17395
|
+
var isForIn = this.match(54);
|
|
17222
17396
|
this.next();
|
|
17223
17397
|
|
|
17224
17398
|
if (isForIn) {
|
|
@@ -17251,14 +17425,14 @@ class StatementParser extends ExpressionParser {
|
|
|
17251
17425
|
var decl = this.startNode();
|
|
17252
17426
|
this.parseVarId(decl, kind);
|
|
17253
17427
|
|
|
17254
|
-
if (this.eat(
|
|
17428
|
+
if (this.eat(29)) {
|
|
17255
17429
|
decl.init = isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
17256
17430
|
} else {
|
|
17257
|
-
if (kind === "const" && !(this.match(
|
|
17431
|
+
if (kind === "const" && !(this.match(54) || this.isContextual(97))) {
|
|
17258
17432
|
if (!isTypescript) {
|
|
17259
17433
|
this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Const declarations");
|
|
17260
17434
|
}
|
|
17261
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(
|
|
17435
|
+
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(54) || this.isContextual(97)))) {
|
|
17262
17436
|
this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Complex binding patterns");
|
|
17263
17437
|
}
|
|
17264
17438
|
|
|
@@ -17285,11 +17459,11 @@ class StatementParser extends ExpressionParser {
|
|
|
17285
17459
|
var requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID);
|
|
17286
17460
|
this.initFunction(node, isAsync);
|
|
17287
17461
|
|
|
17288
|
-
if (this.match(
|
|
17462
|
+
if (this.match(51) && isHangingStatement) {
|
|
17289
17463
|
this.raise(this.state.start, ErrorMessages.GeneratorInSingleStatementContext);
|
|
17290
17464
|
}
|
|
17291
17465
|
|
|
17292
|
-
node.generator = this.eat(
|
|
17466
|
+
node.generator = this.eat(51);
|
|
17293
17467
|
|
|
17294
17468
|
if (isStatement) {
|
|
17295
17469
|
node.id = this.parseFunctionId(requireId);
|
|
@@ -17347,7 +17521,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17347
17521
|
}
|
|
17348
17522
|
|
|
17349
17523
|
isClassProperty() {
|
|
17350
|
-
return this.match(
|
|
17524
|
+
return this.match(29) || this.match(13) || this.match(8);
|
|
17351
17525
|
}
|
|
17352
17526
|
|
|
17353
17527
|
isClassMethod() {
|
|
@@ -17378,7 +17552,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17378
17552
|
continue;
|
|
17379
17553
|
}
|
|
17380
17554
|
|
|
17381
|
-
if (this.match(
|
|
17555
|
+
if (this.match(26)) {
|
|
17382
17556
|
decorators.push(this.parseDecorator());
|
|
17383
17557
|
continue;
|
|
17384
17558
|
}
|
|
@@ -17434,7 +17608,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17434
17608
|
}
|
|
17435
17609
|
|
|
17436
17610
|
parseClassMember(classBody, member, state) {
|
|
17437
|
-
var isStatic = this.isContextual(
|
|
17611
|
+
var isStatic = this.isContextual(100);
|
|
17438
17612
|
|
|
17439
17613
|
if (isStatic) {
|
|
17440
17614
|
if (this.parseClassMemberFromModifier(classBody, member)) {
|
|
@@ -17460,9 +17634,9 @@ class StatementParser extends ExpressionParser {
|
|
|
17460
17634
|
member.static = isStatic;
|
|
17461
17635
|
this.parsePropertyNamePrefixOperator(member);
|
|
17462
17636
|
|
|
17463
|
-
if (this.eat(
|
|
17637
|
+
if (this.eat(51)) {
|
|
17464
17638
|
method.kind = "method";
|
|
17465
|
-
var isPrivateName = this.match(
|
|
17639
|
+
var isPrivateName = this.match(130);
|
|
17466
17640
|
this.parseClassElementName(method);
|
|
17467
17641
|
|
|
17468
17642
|
if (isPrivateName) {
|
|
@@ -17479,7 +17653,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17479
17653
|
}
|
|
17480
17654
|
|
|
17481
17655
|
var isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc;
|
|
17482
|
-
var isPrivate = this.match(
|
|
17656
|
+
var isPrivate = this.match(130);
|
|
17483
17657
|
var key = this.parseClassElementName(member);
|
|
17484
17658
|
var maybeQuestionTokenStart = this.state.start;
|
|
17485
17659
|
this.parsePostMemberNameModifiers(publicMember);
|
|
@@ -17519,7 +17693,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17519
17693
|
}
|
|
17520
17694
|
} else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
|
|
17521
17695
|
this.resetPreviousNodeTrailingComments(key);
|
|
17522
|
-
var isGenerator = this.eat(
|
|
17696
|
+
var isGenerator = this.eat(51);
|
|
17523
17697
|
|
|
17524
17698
|
if (publicMember.optional) {
|
|
17525
17699
|
this.unexpected(maybeQuestionTokenStart);
|
|
@@ -17527,7 +17701,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17527
17701
|
|
|
17528
17702
|
method.kind = "method";
|
|
17529
17703
|
|
|
17530
|
-
var _isPrivate = this.match(
|
|
17704
|
+
var _isPrivate = this.match(130);
|
|
17531
17705
|
|
|
17532
17706
|
this.parseClassElementName(method);
|
|
17533
17707
|
this.parsePostMemberNameModifiers(publicMember);
|
|
@@ -17541,11 +17715,11 @@ class StatementParser extends ExpressionParser {
|
|
|
17541
17715
|
|
|
17542
17716
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
17543
17717
|
}
|
|
17544
|
-
} else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(
|
|
17718
|
+
} else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(51) && this.isLineTerminator())) {
|
|
17545
17719
|
this.resetPreviousNodeTrailingComments(key);
|
|
17546
17720
|
method.kind = key.name;
|
|
17547
17721
|
|
|
17548
|
-
var _isPrivate2 = this.match(
|
|
17722
|
+
var _isPrivate2 = this.match(130);
|
|
17549
17723
|
|
|
17550
17724
|
this.parseClassElementName(publicMethod);
|
|
17551
17725
|
|
|
@@ -17578,11 +17752,11 @@ class StatementParser extends ExpressionParser {
|
|
|
17578
17752
|
start
|
|
17579
17753
|
} = this.state;
|
|
17580
17754
|
|
|
17581
|
-
if ((type ===
|
|
17755
|
+
if ((type === 124 || type === 125) && member.static && value === "prototype") {
|
|
17582
17756
|
this.raise(start, ErrorMessages.StaticPrototype);
|
|
17583
17757
|
}
|
|
17584
17758
|
|
|
17585
|
-
if (type ===
|
|
17759
|
+
if (type === 130) {
|
|
17586
17760
|
if (value === "constructor") {
|
|
17587
17761
|
this.raise(start, ErrorMessages.ConstructorClassPrivateField);
|
|
17588
17762
|
}
|
|
@@ -17661,7 +17835,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17661
17835
|
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
|
|
17662
17836
|
this.expressionScope.enter(newExpressionScope());
|
|
17663
17837
|
this.prodParam.enter(PARAM);
|
|
17664
|
-
node.value = this.eat(
|
|
17838
|
+
node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
|
|
17665
17839
|
this.expressionScope.exit();
|
|
17666
17840
|
this.prodParam.exit();
|
|
17667
17841
|
this.scope.exit();
|
|
@@ -17686,7 +17860,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17686
17860
|
}
|
|
17687
17861
|
|
|
17688
17862
|
parseClassSuper(node) {
|
|
17689
|
-
node.superClass = this.eat(
|
|
17863
|
+
node.superClass = this.eat(77) ? this.parseExprSubscripts() : null;
|
|
17690
17864
|
}
|
|
17691
17865
|
|
|
17692
17866
|
parseExport(node) {
|
|
@@ -17723,7 +17897,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17723
17897
|
return this.finishNode(node, "ExportNamedDeclaration");
|
|
17724
17898
|
}
|
|
17725
17899
|
|
|
17726
|
-
if (this.eat(
|
|
17900
|
+
if (this.eat(61)) {
|
|
17727
17901
|
node.declaration = this.parseExportDefaultExpression();
|
|
17728
17902
|
this.checkExport(node, true, true);
|
|
17729
17903
|
return this.finishNode(node, "ExportDefaultDeclaration");
|
|
@@ -17733,7 +17907,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17733
17907
|
}
|
|
17734
17908
|
|
|
17735
17909
|
eatExportStar(node) {
|
|
17736
|
-
return this.eat(
|
|
17910
|
+
return this.eat(51);
|
|
17737
17911
|
}
|
|
17738
17912
|
|
|
17739
17913
|
maybeParseExportDefaultSpecifier(node) {
|
|
@@ -17749,7 +17923,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17749
17923
|
}
|
|
17750
17924
|
|
|
17751
17925
|
maybeParseExportNamespaceSpecifier(node) {
|
|
17752
|
-
if (this.isContextual(
|
|
17926
|
+
if (this.isContextual(89)) {
|
|
17753
17927
|
if (!node.specifiers) node.specifiers = [];
|
|
17754
17928
|
var specifier = this.startNodeAt(this.state.lastTokStart, this.state.lastTokStartLoc);
|
|
17755
17929
|
this.next();
|
|
@@ -17796,7 +17970,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17796
17970
|
}
|
|
17797
17971
|
|
|
17798
17972
|
isAsyncFunction() {
|
|
17799
|
-
if (!this.isContextual(
|
|
17973
|
+
if (!this.isContextual(91)) return false;
|
|
17800
17974
|
var next = this.nextTokenStart();
|
|
17801
17975
|
return !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function");
|
|
17802
17976
|
}
|
|
@@ -17805,7 +17979,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17805
17979
|
var expr = this.startNode();
|
|
17806
17980
|
var isAsync = this.isAsyncFunction();
|
|
17807
17981
|
|
|
17808
|
-
if (this.match(
|
|
17982
|
+
if (this.match(64) || isAsync) {
|
|
17809
17983
|
this.next();
|
|
17810
17984
|
|
|
17811
17985
|
if (isAsync) {
|
|
@@ -17813,16 +17987,16 @@ class StatementParser extends ExpressionParser {
|
|
|
17813
17987
|
}
|
|
17814
17988
|
|
|
17815
17989
|
return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync);
|
|
17816
|
-
} else if (this.match(
|
|
17990
|
+
} else if (this.match(76)) {
|
|
17817
17991
|
return this.parseClass(expr, true, true);
|
|
17818
|
-
} else if (this.match(
|
|
17992
|
+
} else if (this.match(26)) {
|
|
17819
17993
|
if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport")) {
|
|
17820
17994
|
this.raise(this.state.start, ErrorMessages.DecoratorBeforeExport);
|
|
17821
17995
|
}
|
|
17822
17996
|
|
|
17823
17997
|
this.parseDecorators(false);
|
|
17824
17998
|
return this.parseClass(expr, true, true);
|
|
17825
|
-
} else if (this.match(
|
|
17999
|
+
} else if (this.match(71) || this.match(70) || this.isLet()) {
|
|
17826
18000
|
throw this.raise(this.state.start, ErrorMessages.UnsupportedDefaultExport);
|
|
17827
18001
|
} else {
|
|
17828
18002
|
var res = this.parseMaybeAssignAllowIn();
|
|
@@ -17841,21 +18015,21 @@ class StatementParser extends ExpressionParser {
|
|
|
17841
18015
|
} = this.state;
|
|
17842
18016
|
|
|
17843
18017
|
if (tokenIsIdentifier(type)) {
|
|
17844
|
-
if (type ===
|
|
18018
|
+
if (type === 91 && !this.state.containsEsc || type === 95) {
|
|
17845
18019
|
return false;
|
|
17846
18020
|
}
|
|
17847
18021
|
|
|
17848
|
-
if ((type ===
|
|
18022
|
+
if ((type === 122 || type === 121) && !this.state.containsEsc) {
|
|
17849
18023
|
var {
|
|
17850
18024
|
type: nextType
|
|
17851
18025
|
} = this.lookahead();
|
|
17852
18026
|
|
|
17853
|
-
if (tokenIsIdentifier(nextType) && nextType !==
|
|
18027
|
+
if (tokenIsIdentifier(nextType) && nextType !== 93 || nextType === 5) {
|
|
17854
18028
|
this.expectOnePlugin(["flow", "typescript"]);
|
|
17855
18029
|
return false;
|
|
17856
18030
|
}
|
|
17857
18031
|
}
|
|
17858
|
-
} else if (!this.match(
|
|
18032
|
+
} else if (!this.match(61)) {
|
|
17859
18033
|
return false;
|
|
17860
18034
|
}
|
|
17861
18035
|
|
|
@@ -17866,7 +18040,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17866
18040
|
return true;
|
|
17867
18041
|
}
|
|
17868
18042
|
|
|
17869
|
-
if (this.match(
|
|
18043
|
+
if (this.match(61) && hasFrom) {
|
|
17870
18044
|
var nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
|
|
17871
18045
|
return nextAfterFrom === 34 || nextAfterFrom === 39;
|
|
17872
18046
|
}
|
|
@@ -17875,7 +18049,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17875
18049
|
}
|
|
17876
18050
|
|
|
17877
18051
|
parseExportFrom(node, expect) {
|
|
17878
|
-
if (this.eatContextual(
|
|
18052
|
+
if (this.eatContextual(93)) {
|
|
17879
18053
|
node.source = this.parseImportSource();
|
|
17880
18054
|
this.checkExport(node);
|
|
17881
18055
|
var assertions = this.maybeParseImportAssertions();
|
|
@@ -17895,7 +18069,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17895
18069
|
type
|
|
17896
18070
|
} = this.state;
|
|
17897
18071
|
|
|
17898
|
-
if (type ===
|
|
18072
|
+
if (type === 26) {
|
|
17899
18073
|
this.expectOnePlugin(["decorators", "decorators-legacy"]);
|
|
17900
18074
|
|
|
17901
18075
|
if (this.hasPlugin("decorators")) {
|
|
@@ -17907,7 +18081,7 @@ class StatementParser extends ExpressionParser {
|
|
|
17907
18081
|
}
|
|
17908
18082
|
}
|
|
17909
18083
|
|
|
17910
|
-
return type ===
|
|
18084
|
+
return type === 70 || type === 71 || type === 64 || type === 76 || this.isLet() || this.isAsyncFunction();
|
|
17911
18085
|
}
|
|
17912
18086
|
|
|
17913
18087
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
@@ -18008,8 +18182,8 @@ class StatementParser extends ExpressionParser {
|
|
|
18008
18182
|
if (this.eat(8)) break;
|
|
18009
18183
|
}
|
|
18010
18184
|
|
|
18011
|
-
var isMaybeTypeOnly = this.isContextual(
|
|
18012
|
-
var isString = this.match(
|
|
18185
|
+
var isMaybeTypeOnly = this.isContextual(122);
|
|
18186
|
+
var isString = this.match(125);
|
|
18013
18187
|
var node = this.startNode();
|
|
18014
18188
|
node.local = this.parseModuleExportName();
|
|
18015
18189
|
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
@@ -18019,7 +18193,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18019
18193
|
}
|
|
18020
18194
|
|
|
18021
18195
|
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
18022
|
-
if (this.eatContextual(
|
|
18196
|
+
if (this.eatContextual(89)) {
|
|
18023
18197
|
node.exported = this.parseModuleExportName();
|
|
18024
18198
|
} else if (isString) {
|
|
18025
18199
|
node.exported = cloneStringLiteral(node.local);
|
|
@@ -18031,7 +18205,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18031
18205
|
}
|
|
18032
18206
|
|
|
18033
18207
|
parseModuleExportName() {
|
|
18034
|
-
if (this.match(
|
|
18208
|
+
if (this.match(125)) {
|
|
18035
18209
|
var result = this.parseStringLiteral(this.state.value);
|
|
18036
18210
|
var surrogate = result.value.match(loneSurrogate);
|
|
18037
18211
|
|
|
@@ -18048,12 +18222,12 @@ class StatementParser extends ExpressionParser {
|
|
|
18048
18222
|
parseImport(node) {
|
|
18049
18223
|
node.specifiers = [];
|
|
18050
18224
|
|
|
18051
|
-
if (!this.match(
|
|
18225
|
+
if (!this.match(125)) {
|
|
18052
18226
|
var hasDefault = this.maybeParseDefaultImportSpecifier(node);
|
|
18053
18227
|
var parseNext = !hasDefault || this.eat(12);
|
|
18054
18228
|
var hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
|
|
18055
18229
|
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
|
|
18056
|
-
this.expectContextual(
|
|
18230
|
+
this.expectContextual(93);
|
|
18057
18231
|
}
|
|
18058
18232
|
|
|
18059
18233
|
node.source = this.parseImportSource();
|
|
@@ -18074,7 +18248,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18074
18248
|
}
|
|
18075
18249
|
|
|
18076
18250
|
parseImportSource() {
|
|
18077
|
-
if (!this.match(
|
|
18251
|
+
if (!this.match(125)) this.unexpected();
|
|
18078
18252
|
return this.parseExprAtom();
|
|
18079
18253
|
}
|
|
18080
18254
|
|
|
@@ -18106,7 +18280,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18106
18280
|
|
|
18107
18281
|
attrNames.add(keyName);
|
|
18108
18282
|
|
|
18109
|
-
if (this.match(
|
|
18283
|
+
if (this.match(125)) {
|
|
18110
18284
|
node.key = this.parseStringLiteral(keyName);
|
|
18111
18285
|
} else {
|
|
18112
18286
|
node.key = this.parseIdentifier(true);
|
|
@@ -18114,7 +18288,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18114
18288
|
|
|
18115
18289
|
this.expect(14);
|
|
18116
18290
|
|
|
18117
|
-
if (!this.match(
|
|
18291
|
+
if (!this.match(125)) {
|
|
18118
18292
|
throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
|
|
18119
18293
|
}
|
|
18120
18294
|
|
|
@@ -18127,7 +18301,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18127
18301
|
}
|
|
18128
18302
|
|
|
18129
18303
|
maybeParseModuleAttributes() {
|
|
18130
|
-
if (this.match(
|
|
18304
|
+
if (this.match(72) && !this.hasPrecedingLineBreak()) {
|
|
18131
18305
|
this.expectPlugin("moduleAttributes");
|
|
18132
18306
|
this.next();
|
|
18133
18307
|
} else {
|
|
@@ -18153,7 +18327,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18153
18327
|
attributes.add(node.key.name);
|
|
18154
18328
|
this.expect(14);
|
|
18155
18329
|
|
|
18156
|
-
if (!this.match(
|
|
18330
|
+
if (!this.match(125)) {
|
|
18157
18331
|
throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
|
|
18158
18332
|
}
|
|
18159
18333
|
|
|
@@ -18166,7 +18340,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18166
18340
|
}
|
|
18167
18341
|
|
|
18168
18342
|
maybeParseImportAssertions() {
|
|
18169
|
-
if (this.isContextual(
|
|
18343
|
+
if (this.isContextual(90) && !this.hasPrecedingLineBreak()) {
|
|
18170
18344
|
this.expectPlugin("importAssertions");
|
|
18171
18345
|
this.next();
|
|
18172
18346
|
} else {
|
|
@@ -18190,10 +18364,10 @@ class StatementParser extends ExpressionParser {
|
|
|
18190
18364
|
}
|
|
18191
18365
|
|
|
18192
18366
|
maybeParseStarImportSpecifier(node) {
|
|
18193
|
-
if (this.match(
|
|
18367
|
+
if (this.match(51)) {
|
|
18194
18368
|
var specifier = this.startNode();
|
|
18195
18369
|
this.next();
|
|
18196
|
-
this.expectContextual(
|
|
18370
|
+
this.expectContextual(89);
|
|
18197
18371
|
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier", "import namespace specifier");
|
|
18198
18372
|
return true;
|
|
18199
18373
|
}
|
|
@@ -18218,8 +18392,8 @@ class StatementParser extends ExpressionParser {
|
|
|
18218
18392
|
}
|
|
18219
18393
|
|
|
18220
18394
|
var specifier = this.startNode();
|
|
18221
|
-
var importedIsString = this.match(
|
|
18222
|
-
var isMaybeTypeOnly = this.isContextual(
|
|
18395
|
+
var importedIsString = this.match(125);
|
|
18396
|
+
var isMaybeTypeOnly = this.isContextual(122);
|
|
18223
18397
|
specifier.imported = this.parseModuleExportName();
|
|
18224
18398
|
var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
|
|
18225
18399
|
node.specifiers.push(importSpecifier);
|
|
@@ -18227,7 +18401,7 @@ class StatementParser extends ExpressionParser {
|
|
|
18227
18401
|
}
|
|
18228
18402
|
|
|
18229
18403
|
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
18230
|
-
if (this.eatContextual(
|
|
18404
|
+
if (this.eatContextual(89)) {
|
|
18231
18405
|
specifier.local = this.parseIdentifier();
|
|
18232
18406
|
} else {
|
|
18233
18407
|
var {
|