@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.
@@ -3136,18 +3136,46 @@
3136
3136
  return new Position(line, offset - lineStart);
3137
3137
  }
3138
3138
 
3139
+ function createPositionWithColumnOffset(position, columnOffset) {
3140
+ var {
3141
+ line,
3142
+ column
3143
+ } = position;
3144
+ return new Position(line, column + columnOffset);
3145
+ }
3146
+
3139
3147
  class BaseParser {
3140
3148
  constructor() {
3141
3149
  this.sawUnambiguousESM = false;
3142
3150
  this.ambiguousScriptDifferentAst = false;
3143
3151
  }
3144
3152
 
3145
- hasPlugin(name) {
3146
- return this.plugins.has(name);
3153
+ hasPlugin(pluginConfig) {
3154
+ if (typeof pluginConfig === "string") {
3155
+ return this.plugins.has(pluginConfig);
3156
+ } else {
3157
+ var [pluginName, pluginOptions] = pluginConfig;
3158
+
3159
+ if (!this.hasPlugin(pluginName)) {
3160
+ return false;
3161
+ }
3162
+
3163
+ var actualOptions = this.plugins.get(pluginName);
3164
+
3165
+ for (var key of Object.keys(pluginOptions)) {
3166
+ if ((actualOptions == null ? void 0 : actualOptions[key]) !== pluginOptions[key]) {
3167
+ return false;
3168
+ }
3169
+ }
3170
+
3171
+ return true;
3172
+ }
3147
3173
  }
3148
3174
 
3149
3175
  getPluginOption(plugin, name) {
3150
- if (this.hasPlugin(plugin)) return this.plugins.get(plugin)[name];
3176
+ var _this$plugins$get;
3177
+
3178
+ return (_this$plugins$get = this.plugins.get(plugin)) == null ? void 0 : _this$plugins$get[name];
3151
3179
  }
3152
3180
 
3153
3181
  }
@@ -3400,6 +3428,7 @@
3400
3428
  ImportCallSpreadArgument: "`...` is not allowed in `import()`.",
3401
3429
  InvalidBigIntLiteral: "Invalid BigIntLiteral.",
3402
3430
  InvalidCodePoint: "Code point out of bounds.",
3431
+ InvalidCoverInitializedName: "Invalid shorthand property initializer.",
3403
3432
  InvalidDecimal: "Invalid decimal.",
3404
3433
  InvalidDigit: "Expected number in radix %0.",
3405
3434
  InvalidEscapeSequence: "Bad character escape sequence.",
@@ -3485,7 +3514,7 @@
3485
3514
  UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
3486
3515
  UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
3487
3516
  UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
3488
- UnexpectedPrivateField: "Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).",
3517
+ UnexpectedPrivateField: "Unexpected private name.",
3489
3518
  UnexpectedReservedWord: "Unexpected reserved word '%0'.",
3490
3519
  UnexpectedSuper: "'super' is only allowed in object methods and classes.",
3491
3520
  UnexpectedToken: "Unexpected token '%0'.",
@@ -3986,8 +4015,13 @@
3986
4015
 
3987
4016
  var types = {
3988
4017
  brace: new TokContext("{"),
3989
- template: new TokContext("`", true)
4018
+ j_oTag: new TokContext("<tag"),
4019
+ j_cTag: new TokContext("</tag"),
4020
+ j_expr: new TokContext("<tag>...</tag>", true)
3990
4021
  };
4022
+ {
4023
+ types.template = new TokContext("`", true);
4024
+ }
3991
4025
  var beforeExpr = true;
3992
4026
  var startsExpr = true;
3993
4027
  var isLoop = true;
@@ -4148,6 +4182,13 @@
4148
4182
  beforeExpr,
4149
4183
  startsExpr
4150
4184
  }),
4185
+ templateTail: createToken("...`", {
4186
+ startsExpr
4187
+ }),
4188
+ templateNonTail: createToken("...${", {
4189
+ beforeExpr,
4190
+ startsExpr
4191
+ }),
4151
4192
  at: createToken("@"),
4152
4193
  hash: createToken("#", {
4153
4194
  startsExpr
@@ -4453,19 +4494,19 @@
4453
4494
  };
4454
4495
 
4455
4496
  function tokenIsIdentifier(token) {
4456
- return token >= 87 && token <= 122;
4497
+ return token >= 89 && token <= 124;
4457
4498
  }
4458
4499
 
4459
4500
  function tokenKeywordOrIdentifierIsKeyword(token) {
4460
- return token <= 86;
4501
+ return token <= 88;
4461
4502
  }
4462
4503
 
4463
4504
  function tokenIsKeywordOrIdentifier(token) {
4464
- return token >= 52 && token <= 122;
4505
+ return token >= 54 && token <= 124;
4465
4506
  }
4466
4507
 
4467
4508
  function tokenIsLiteralPropertyName(token) {
4468
- return token >= 52 && token <= 126;
4509
+ return token >= 54 && token <= 128;
4469
4510
  }
4470
4511
 
4471
4512
  function tokenComesBeforeExpression(token) {
@@ -4477,27 +4518,27 @@
4477
4518
  }
4478
4519
 
4479
4520
  function tokenIsAssignment(token) {
4480
- return token >= 27 && token <= 31;
4521
+ return token >= 29 && token <= 33;
4481
4522
  }
4482
4523
 
4483
4524
  function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
4484
- return token >= 119 && token <= 121;
4525
+ return token >= 121 && token <= 123;
4485
4526
  }
4486
4527
 
4487
4528
  function tokenIsLoop(token) {
4488
- return token >= 84 && token <= 86;
4529
+ return token >= 86 && token <= 88;
4489
4530
  }
4490
4531
 
4491
4532
  function tokenIsKeyword(token) {
4492
- return token >= 52 && token <= 86;
4533
+ return token >= 54 && token <= 88;
4493
4534
  }
4494
4535
 
4495
4536
  function tokenIsOperator(token) {
4496
- return token >= 35 && token <= 53;
4537
+ return token >= 37 && token <= 55;
4497
4538
  }
4498
4539
 
4499
4540
  function tokenIsPostfix(token) {
4500
- return token === 32;
4541
+ return token === 34;
4501
4542
  }
4502
4543
 
4503
4544
  function tokenIsPrefix(token) {
@@ -4505,11 +4546,11 @@
4505
4546
  }
4506
4547
 
4507
4548
  function tokenIsTSTypeOperator(token) {
4508
- return token >= 111 && token <= 113;
4549
+ return token >= 113 && token <= 115;
4509
4550
  }
4510
4551
 
4511
4552
  function tokenIsTSDeclarationStart(token) {
4512
- return token >= 114 && token <= 120;
4553
+ return token >= 116 && token <= 122;
4513
4554
  }
4514
4555
 
4515
4556
  function tokenLabelName(token) {
@@ -4521,7 +4562,11 @@
4521
4562
  }
4522
4563
 
4523
4564
  function tokenIsRightAssociative(token) {
4524
- return token === 51;
4565
+ return token === 53;
4566
+ }
4567
+
4568
+ function tokenIsTemplate(token) {
4569
+ return token >= 24 && token <= 25;
4525
4570
  }
4526
4571
 
4527
4572
  function getExportedToken(token) {
@@ -4549,7 +4594,7 @@
4549
4594
  }
4550
4595
  };
4551
4596
 
4552
- tokenTypes[132].updateContext = context => {
4597
+ tokenTypes[134].updateContext = context => {
4553
4598
  context.push(types.j_expr, types.j_oTag);
4554
4599
  };
4555
4600
  }
@@ -4935,7 +4980,7 @@
4935
4980
  this.comments = [];
4936
4981
  this.commentStack = [];
4937
4982
  this.pos = 0;
4938
- this.type = 129;
4983
+ this.type = 131;
4939
4984
  this.value = null;
4940
4985
  this.start = 0;
4941
4986
  this.end = 0;
@@ -5123,21 +5168,16 @@
5123
5168
  }
5124
5169
 
5125
5170
  nextToken() {
5126
- var curContext = this.curContext();
5127
- if (!curContext.preserveSpace) this.skipSpace();
5171
+ this.skipSpace();
5128
5172
  this.state.start = this.state.pos;
5129
5173
  if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
5130
5174
 
5131
5175
  if (this.state.pos >= this.length) {
5132
- this.finishToken(129);
5176
+ this.finishToken(131);
5133
5177
  return;
5134
5178
  }
5135
5179
 
5136
- if (curContext === types.template) {
5137
- this.readTmplToken();
5138
- } else {
5139
- this.getTokenFromCode(this.codePointAtPos(this.state.pos));
5140
- }
5180
+ this.getTokenFromCode(this.codePointAtPos(this.state.pos));
5141
5181
  }
5142
5182
 
5143
5183
  skipBlockComment() {
@@ -5346,12 +5386,12 @@
5346
5386
  }
5347
5387
  } else if (isIdentifierStart(next)) {
5348
5388
  ++this.state.pos;
5349
- this.finishToken(128, this.readWord1(next));
5389
+ this.finishToken(130, this.readWord1(next));
5350
5390
  } else if (next === 92) {
5351
5391
  ++this.state.pos;
5352
- this.finishToken(128, this.readWord1());
5392
+ this.finishToken(130, this.readWord1());
5353
5393
  } else {
5354
- this.finishOp(25, 1);
5394
+ this.finishOp(27, 1);
5355
5395
  }
5356
5396
  }
5357
5397
 
@@ -5376,9 +5416,9 @@
5376
5416
  var next = this.input.charCodeAt(this.state.pos + 1);
5377
5417
 
5378
5418
  if (next === 61) {
5379
- this.finishOp(29, 2);
5419
+ this.finishOp(31, 2);
5380
5420
  } else {
5381
- this.finishOp(50, 1);
5421
+ this.finishOp(52, 1);
5382
5422
  }
5383
5423
  }
5384
5424
 
@@ -5394,24 +5434,24 @@
5394
5434
  }
5395
5435
 
5396
5436
  var value = this.input.slice(start + 2, this.state.pos);
5397
- this.finishToken(26, value);
5437
+ this.finishToken(28, value);
5398
5438
  return true;
5399
5439
  }
5400
5440
 
5401
5441
  readToken_mult_modulo(code) {
5402
- var type = code === 42 ? 49 : 48;
5442
+ var type = code === 42 ? 51 : 50;
5403
5443
  var width = 1;
5404
5444
  var next = this.input.charCodeAt(this.state.pos + 1);
5405
5445
 
5406
5446
  if (code === 42 && next === 42) {
5407
5447
  width++;
5408
5448
  next = this.input.charCodeAt(this.state.pos + 2);
5409
- type = 51;
5449
+ type = 53;
5410
5450
  }
5411
5451
 
5412
5452
  if (next === 61 && !this.state.inType) {
5413
5453
  width++;
5414
- type = code === 37 ? 31 : 28;
5454
+ type = code === 37 ? 33 : 30;
5415
5455
  }
5416
5456
 
5417
5457
  this.finishOp(type, width);
@@ -5422,9 +5462,9 @@
5422
5462
 
5423
5463
  if (next === code) {
5424
5464
  if (this.input.charCodeAt(this.state.pos + 2) === 61) {
5425
- this.finishOp(28, 3);
5465
+ this.finishOp(30, 3);
5426
5466
  } else {
5427
- this.finishOp(code === 124 ? 37 : 38, 2);
5467
+ this.finishOp(code === 124 ? 39 : 40, 2);
5428
5468
  }
5429
5469
 
5430
5470
  return;
@@ -5432,7 +5472,7 @@
5432
5472
 
5433
5473
  if (code === 124) {
5434
5474
  if (next === 62) {
5435
- this.finishOp(35, 2);
5475
+ this.finishOp(37, 2);
5436
5476
  return;
5437
5477
  }
5438
5478
 
@@ -5458,20 +5498,20 @@
5458
5498
  }
5459
5499
 
5460
5500
  if (next === 61) {
5461
- this.finishOp(28, 2);
5501
+ this.finishOp(30, 2);
5462
5502
  return;
5463
5503
  }
5464
5504
 
5465
- this.finishOp(code === 124 ? 39 : 41, 1);
5505
+ this.finishOp(code === 124 ? 41 : 43, 1);
5466
5506
  }
5467
5507
 
5468
5508
  readToken_caret() {
5469
5509
  var next = this.input.charCodeAt(this.state.pos + 1);
5470
5510
 
5471
5511
  if (next === 61 && !this.state.inType) {
5472
- this.finishOp(30, 2);
5512
+ this.finishOp(32, 2);
5473
5513
  } else {
5474
- this.finishOp(40, 1);
5514
+ this.finishOp(42, 1);
5475
5515
  }
5476
5516
  }
5477
5517
 
@@ -5479,14 +5519,14 @@
5479
5519
  var next = this.input.charCodeAt(this.state.pos + 1);
5480
5520
 
5481
5521
  if (next === code) {
5482
- this.finishOp(32, 2);
5522
+ this.finishOp(34, 2);
5483
5523
  return;
5484
5524
  }
5485
5525
 
5486
5526
  if (next === 61) {
5487
- this.finishOp(28, 2);
5527
+ this.finishOp(30, 2);
5488
5528
  } else {
5489
- this.finishOp(47, 1);
5529
+ this.finishOp(49, 1);
5490
5530
  }
5491
5531
  }
5492
5532
 
@@ -5498,20 +5538,20 @@
5498
5538
 
5499
5539
  if (next === 60) {
5500
5540
  if (this.input.charCodeAt(pos + 2) === 61) {
5501
- this.finishOp(28, 3);
5541
+ this.finishOp(30, 3);
5502
5542
  return;
5503
5543
  }
5504
5544
 
5505
- this.finishOp(46, 2);
5545
+ this.finishOp(48, 2);
5506
5546
  return;
5507
5547
  }
5508
5548
 
5509
5549
  if (next === 61) {
5510
- this.finishOp(45, 2);
5550
+ this.finishOp(47, 2);
5511
5551
  return;
5512
5552
  }
5513
5553
 
5514
- this.finishOp(43, 1);
5554
+ this.finishOp(45, 1);
5515
5555
  }
5516
5556
 
5517
5557
  readToken_gt() {
@@ -5524,27 +5564,27 @@
5524
5564
  var size = this.input.charCodeAt(pos + 2) === 62 ? 3 : 2;
5525
5565
 
5526
5566
  if (this.input.charCodeAt(pos + size) === 61) {
5527
- this.finishOp(28, size + 1);
5567
+ this.finishOp(30, size + 1);
5528
5568
  return;
5529
5569
  }
5530
5570
 
5531
- this.finishOp(46, size);
5571
+ this.finishOp(48, size);
5532
5572
  return;
5533
5573
  }
5534
5574
 
5535
5575
  if (next === 61) {
5536
- this.finishOp(45, 2);
5576
+ this.finishOp(47, 2);
5537
5577
  return;
5538
5578
  }
5539
5579
 
5540
- this.finishOp(44, 1);
5580
+ this.finishOp(46, 1);
5541
5581
  }
5542
5582
 
5543
5583
  readToken_eq_excl(code) {
5544
5584
  var next = this.input.charCodeAt(this.state.pos + 1);
5545
5585
 
5546
5586
  if (next === 61) {
5547
- this.finishOp(42, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
5587
+ this.finishOp(44, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
5548
5588
  return;
5549
5589
  }
5550
5590
 
@@ -5554,7 +5594,7 @@
5554
5594
  return;
5555
5595
  }
5556
5596
 
5557
- this.finishOp(code === 61 ? 27 : 33, 1);
5597
+ this.finishOp(code === 61 ? 29 : 35, 1);
5558
5598
  }
5559
5599
 
5560
5600
  readToken_question() {
@@ -5563,9 +5603,9 @@
5563
5603
 
5564
5604
  if (next === 63) {
5565
5605
  if (next2 === 61) {
5566
- this.finishOp(28, 3);
5606
+ this.finishOp(30, 3);
5567
5607
  } else {
5568
- this.finishOp(36, 2);
5608
+ this.finishOp(38, 2);
5569
5609
  }
5570
5610
  } else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
5571
5611
  this.state.pos += 2;
@@ -5657,8 +5697,7 @@
5657
5697
  return;
5658
5698
 
5659
5699
  case 96:
5660
- ++this.state.pos;
5661
- this.finishToken(22);
5700
+ this.readTemplateToken();
5662
5701
  return;
5663
5702
 
5664
5703
  case 48:
@@ -5735,12 +5774,12 @@
5735
5774
  return;
5736
5775
 
5737
5776
  case 126:
5738
- this.finishOp(34, 1);
5777
+ this.finishOp(36, 1);
5739
5778
  return;
5740
5779
 
5741
5780
  case 64:
5742
5781
  ++this.state.pos;
5743
- this.finishToken(24);
5782
+ this.finishToken(26);
5744
5783
  return;
5745
5784
 
5746
5785
  case 35:
@@ -5824,7 +5863,7 @@
5824
5863
  }
5825
5864
 
5826
5865
  this.state.pos = pos;
5827
- this.finishToken(127, {
5866
+ this.finishToken(129, {
5828
5867
  pattern: content,
5829
5868
  flags: mods
5830
5869
  });
@@ -5918,11 +5957,11 @@
5918
5957
 
5919
5958
  if (isBigInt) {
5920
5959
  var str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
5921
- this.finishToken(125, str);
5960
+ this.finishToken(127, str);
5922
5961
  return;
5923
5962
  }
5924
5963
 
5925
- this.finishToken(124, val);
5964
+ this.finishToken(126, val);
5926
5965
  }
5927
5966
 
5928
5967
  readNumber(startsWithDot) {
@@ -6006,17 +6045,17 @@
6006
6045
  var str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
6007
6046
 
6008
6047
  if (isBigInt) {
6009
- this.finishToken(125, str);
6048
+ this.finishToken(127, str);
6010
6049
  return;
6011
6050
  }
6012
6051
 
6013
6052
  if (isDecimal) {
6014
- this.finishToken(126, str);
6053
+ this.finishToken(128, str);
6015
6054
  return;
6016
6055
  }
6017
6056
 
6018
6057
  var val = isOctal ? parseInt(str, 8) : parseFloat(str);
6019
- this.finishToken(124, val);
6058
+ this.finishToken(126, val);
6020
6059
  }
6021
6060
 
6022
6061
  readCodePoint(throwOnInvalid) {
@@ -6070,36 +6109,42 @@
6070
6109
  }
6071
6110
 
6072
6111
  out += this.input.slice(chunkStart, this.state.pos++);
6073
- this.finishToken(123, out);
6112
+ this.finishToken(125, out);
6113
+ }
6114
+
6115
+ readTemplateContinuation() {
6116
+ if (!this.match(8)) {
6117
+ this.unexpected(this.state.start, 8);
6118
+ }
6119
+
6120
+ this.state.pos--;
6121
+ this.readTemplateToken();
6074
6122
  }
6075
6123
 
6076
- readTmplToken() {
6124
+ readTemplateToken() {
6077
6125
  var out = "",
6078
6126
  chunkStart = this.state.pos,
6079
6127
  containsInvalid = false;
6128
+ ++this.state.pos;
6080
6129
 
6081
6130
  for (;;) {
6082
6131
  if (this.state.pos >= this.length) {
6083
- throw this.raise(this.state.start, ErrorMessages.UnterminatedTemplate);
6132
+ throw this.raise(this.state.start + 1, ErrorMessages.UnterminatedTemplate);
6084
6133
  }
6085
6134
 
6086
6135
  var ch = this.input.charCodeAt(this.state.pos);
6087
6136
 
6088
- if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
6089
- if (this.state.pos === this.state.start && this.match(20)) {
6090
- if (ch === 36) {
6091
- this.state.pos += 2;
6092
- this.finishToken(23);
6093
- return;
6094
- } else {
6095
- ++this.state.pos;
6096
- this.finishToken(22);
6097
- return;
6098
- }
6099
- }
6137
+ if (ch === 96) {
6138
+ ++this.state.pos;
6139
+ out += this.input.slice(chunkStart, this.state.pos);
6140
+ this.finishToken(24, containsInvalid ? null : out);
6141
+ return;
6142
+ }
6100
6143
 
6144
+ if (ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
6145
+ this.state.pos += 2;
6101
6146
  out += this.input.slice(chunkStart, this.state.pos);
6102
- this.finishToken(20, containsInvalid ? null : out);
6147
+ this.finishToken(25, containsInvalid ? null : out);
6103
6148
  return;
6104
6149
  }
6105
6150
 
@@ -6307,7 +6352,7 @@
6307
6352
  if (type !== undefined) {
6308
6353
  this.finishToken(type, tokenLabelName(type));
6309
6354
  } else {
6310
- this.finishToken(122, word);
6355
+ this.finishToken(124, word);
6311
6356
  }
6312
6357
  }
6313
6358
 
@@ -6321,33 +6366,7 @@
6321
6366
  }
6322
6367
  }
6323
6368
 
6324
- updateContext(prevType) {
6325
- var {
6326
- context,
6327
- type
6328
- } = this.state;
6329
-
6330
- switch (type) {
6331
- case 8:
6332
- context.pop();
6333
- break;
6334
-
6335
- case 5:
6336
- case 7:
6337
- case 23:
6338
- context.push(types.brace);
6339
- break;
6340
-
6341
- case 22:
6342
- if (context[context.length - 1] === types.template) {
6343
- context.pop();
6344
- } else {
6345
- context.push(types.template);
6346
- }
6347
-
6348
- break;
6349
- }
6350
- }
6369
+ updateContext(prevType) {}
6351
6370
 
6352
6371
  }
6353
6372
 
@@ -6391,11 +6410,15 @@
6391
6410
  }
6392
6411
 
6393
6412
  declarePrivateName(name, elementType, pos) {
6394
- var classScope = this.current();
6395
- var redefined = classScope.privateNames.has(name);
6413
+ var {
6414
+ privateNames,
6415
+ loneAccessors,
6416
+ undefinedPrivateNames
6417
+ } = this.current();
6418
+ var redefined = privateNames.has(name);
6396
6419
 
6397
6420
  if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) {
6398
- var accessor = redefined && classScope.loneAccessors.get(name);
6421
+ var accessor = redefined && loneAccessors.get(name);
6399
6422
 
6400
6423
  if (accessor) {
6401
6424
  var oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC;
@@ -6403,9 +6426,9 @@
6403
6426
  var oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR;
6404
6427
  var newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR;
6405
6428
  redefined = oldKind === newKind || oldStatic !== newStatic;
6406
- if (!redefined) classScope.loneAccessors.delete(name);
6429
+ if (!redefined) loneAccessors.delete(name);
6407
6430
  } else if (!redefined) {
6408
- classScope.loneAccessors.set(name, elementType);
6431
+ loneAccessors.set(name, elementType);
6409
6432
  }
6410
6433
  }
6411
6434
 
@@ -6413,8 +6436,8 @@
6413
6436
  this.raise(pos, ErrorMessages.PrivateNameRedeclaration, name);
6414
6437
  }
6415
6438
 
6416
- classScope.privateNames.add(name);
6417
- classScope.undefinedPrivateNames.delete(name);
6439
+ privateNames.add(name);
6440
+ undefinedPrivateNames.delete(name);
6418
6441
  }
6419
6442
 
6420
6443
  usePrivateName(name, pos) {
@@ -6662,7 +6685,7 @@
6662
6685
  }
6663
6686
 
6664
6687
  canInsertSemicolon() {
6665
- return this.match(129) || this.match(8) || this.hasPrecedingLineBreak();
6688
+ return this.match(131) || this.match(8) || this.hasPrecedingLineBreak();
6666
6689
  }
6667
6690
 
6668
6691
  hasPrecedingLineBreak() {
@@ -6718,21 +6741,31 @@
6718
6741
  throw this.raise(pos != null ? pos : this.state.start, messageOrType);
6719
6742
  }
6720
6743
 
6721
- expectPlugin(name, pos) {
6722
- if (!this.hasPlugin(name)) {
6744
+ getPluginNamesFromConfigs(pluginConfigs) {
6745
+ return pluginConfigs.map(c => {
6746
+ if (typeof c === "string") {
6747
+ return c;
6748
+ } else {
6749
+ return c[0];
6750
+ }
6751
+ });
6752
+ }
6753
+
6754
+ expectPlugin(pluginConfig, pos) {
6755
+ if (!this.hasPlugin(pluginConfig)) {
6723
6756
  throw this.raiseWithData(pos != null ? pos : this.state.start, {
6724
- missingPlugin: [name]
6725
- }, "This experimental syntax requires enabling the parser plugin: '".concat(name, "'"));
6757
+ missingPlugin: this.getPluginNamesFromConfigs([pluginConfig])
6758
+ }, "This experimental syntax requires enabling the parser plugin: ".concat(JSON.stringify(pluginConfig), "."));
6726
6759
  }
6727
6760
 
6728
6761
  return true;
6729
6762
  }
6730
6763
 
6731
- expectOnePlugin(names, pos) {
6732
- if (!names.some(n => this.hasPlugin(n))) {
6764
+ expectOnePlugin(pluginConfigs, pos) {
6765
+ if (!pluginConfigs.some(c => this.hasPlugin(c))) {
6733
6766
  throw this.raiseWithData(pos != null ? pos : this.state.start, {
6734
- missingPlugin: names
6735
- }, "This experimental syntax requires enabling one of the following parser plugin(s): '".concat(names.join(", "), "'"));
6767
+ missingPlugin: this.getPluginNamesFromConfigs(pluginConfigs)
6768
+ }, "This experimental syntax requires enabling one of the following parser plugin(s): ".concat(pluginConfigs.map(c => JSON.stringify(c)).join(", "), "."));
6736
6769
  }
6737
6770
  }
6738
6771
 
@@ -6810,7 +6843,7 @@
6810
6843
  return hasErrors;
6811
6844
  } else if (hasErrors) {
6812
6845
  if (shorthandAssign >= 0) {
6813
- this.unexpected(shorthandAssign);
6846
+ this.raise(shorthandAssign, ErrorMessages.InvalidCoverInitializedName);
6814
6847
  }
6815
6848
 
6816
6849
  if (doubleProto >= 0) {
@@ -6976,12 +7009,18 @@
6976
7009
  }
6977
7010
 
6978
7011
  var cloned = Object.create(NodePrototype);
6979
- cloned.type = "StringLiteral";
7012
+ cloned.type = type;
6980
7013
  cloned.start = start;
6981
7014
  cloned.end = end;
6982
7015
  cloned.loc = loc;
6983
7016
  cloned.range = range;
6984
- cloned.extra = extra;
7017
+
7018
+ if (node.raw !== undefined) {
7019
+ cloned.raw = node.raw;
7020
+ } else {
7021
+ cloned.extra = extra;
7022
+ }
7023
+
6985
7024
  cloned.value = node.value;
6986
7025
  return cloned;
6987
7026
  }
@@ -7092,7 +7131,7 @@
7092
7131
  }
7093
7132
 
7094
7133
  function isMaybeDefaultImport(type) {
7095
- return tokenIsKeywordOrIdentifier(type) && type !== 91;
7134
+ return tokenIsKeywordOrIdentifier(type) && type !== 93;
7096
7135
  }
7097
7136
 
7098
7137
  var exportSuggestions = {
@@ -7134,7 +7173,7 @@
7134
7173
  }
7135
7174
 
7136
7175
  finishToken(type, val) {
7137
- if (type !== 123 && type !== 13 && type !== 26) {
7176
+ if (type !== 125 && type !== 13 && type !== 28) {
7138
7177
  if (this.flowPragma === undefined) {
7139
7178
  this.flowPragma = null;
7140
7179
  }
@@ -7171,7 +7210,7 @@
7171
7210
  var node = this.startNode();
7172
7211
  var moduloPos = this.state.start;
7173
7212
  this.next();
7174
- this.expectContextual(101);
7213
+ this.expectContextual(103);
7175
7214
 
7176
7215
  if (this.state.lastTokStart > moduloPos + 1) {
7177
7216
  this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks);
@@ -7193,14 +7232,14 @@
7193
7232
  var type = null;
7194
7233
  var predicate = null;
7195
7234
 
7196
- if (this.match(48)) {
7235
+ if (this.match(50)) {
7197
7236
  this.state.inType = oldInType;
7198
7237
  predicate = this.flowParsePredicate();
7199
7238
  } else {
7200
7239
  type = this.flowParseType();
7201
7240
  this.state.inType = oldInType;
7202
7241
 
7203
- if (this.match(48)) {
7242
+ if (this.match(50)) {
7204
7243
  predicate = this.flowParsePredicate();
7205
7244
  }
7206
7245
  }
@@ -7220,7 +7259,7 @@
7220
7259
  var typeNode = this.startNode();
7221
7260
  var typeContainer = this.startNode();
7222
7261
 
7223
- if (this.match(43)) {
7262
+ if (this.match(45)) {
7224
7263
  typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
7225
7264
  } else {
7226
7265
  typeNode.typeParameters = null;
@@ -7242,13 +7281,13 @@
7242
7281
  }
7243
7282
 
7244
7283
  flowParseDeclare(node, insideModule) {
7245
- if (this.match(74)) {
7284
+ if (this.match(76)) {
7246
7285
  return this.flowParseDeclareClass(node);
7247
- } else if (this.match(62)) {
7286
+ } else if (this.match(64)) {
7248
7287
  return this.flowParseDeclareFunction(node);
7249
- } else if (this.match(68)) {
7288
+ } else if (this.match(70)) {
7250
7289
  return this.flowParseDeclareVariable(node);
7251
- } else if (this.eatContextual(117)) {
7290
+ } else if (this.eatContextual(119)) {
7252
7291
  if (this.match(16)) {
7253
7292
  return this.flowParseDeclareModuleExports(node);
7254
7293
  } else {
@@ -7258,13 +7297,13 @@
7258
7297
 
7259
7298
  return this.flowParseDeclareModule(node);
7260
7299
  }
7261
- } else if (this.isContextual(120)) {
7300
+ } else if (this.isContextual(122)) {
7262
7301
  return this.flowParseDeclareTypeAlias(node);
7263
- } else if (this.isContextual(121)) {
7302
+ } else if (this.isContextual(123)) {
7264
7303
  return this.flowParseDeclareOpaqueType(node);
7265
- } else if (this.isContextual(119)) {
7304
+ } else if (this.isContextual(121)) {
7266
7305
  return this.flowParseDeclareInterface(node);
7267
- } else if (this.match(76)) {
7306
+ } else if (this.match(78)) {
7268
7307
  return this.flowParseDeclareExportDeclaration(node, insideModule);
7269
7308
  } else {
7270
7309
  throw this.unexpected();
@@ -7282,7 +7321,7 @@
7282
7321
  flowParseDeclareModule(node) {
7283
7322
  this.scope.enter(SCOPE_OTHER);
7284
7323
 
7285
- if (this.match(123)) {
7324
+ if (this.match(125)) {
7286
7325
  node.id = this.parseExprAtom();
7287
7326
  } else {
7288
7327
  node.id = this.parseIdentifier();
@@ -7295,16 +7334,16 @@
7295
7334
  while (!this.match(8)) {
7296
7335
  var _bodyNode = this.startNode();
7297
7336
 
7298
- if (this.match(77)) {
7337
+ if (this.match(79)) {
7299
7338
  this.next();
7300
7339
 
7301
- if (!this.isContextual(120) && !this.match(81)) {
7340
+ if (!this.isContextual(122) && !this.match(83)) {
7302
7341
  this.raise(this.state.lastTokStart, FlowErrors.InvalidNonTypeImportInDeclareModule);
7303
7342
  }
7304
7343
 
7305
7344
  this.parseImport(_bodyNode);
7306
7345
  } else {
7307
- this.expectContextual(115, FlowErrors.UnsupportedStatementInDeclareModule);
7346
+ this.expectContextual(117, FlowErrors.UnsupportedStatementInDeclareModule);
7308
7347
  _bodyNode = this.flowParseDeclare(_bodyNode, true);
7309
7348
  }
7310
7349
 
@@ -7341,10 +7380,10 @@
7341
7380
  }
7342
7381
 
7343
7382
  flowParseDeclareExportDeclaration(node, insideModule) {
7344
- this.expect(76);
7383
+ this.expect(78);
7345
7384
 
7346
- if (this.eat(59)) {
7347
- if (this.match(62) || this.match(74)) {
7385
+ if (this.eat(61)) {
7386
+ if (this.match(64) || this.match(76)) {
7348
7387
  node.declaration = this.flowParseDeclare(this.startNode());
7349
7388
  } else {
7350
7389
  node.declaration = this.flowParseType();
@@ -7354,17 +7393,17 @@
7354
7393
  node.default = true;
7355
7394
  return this.finishNode(node, "DeclareExportDeclaration");
7356
7395
  } else {
7357
- if (this.match(69) || this.isLet() || (this.isContextual(120) || this.isContextual(119)) && !insideModule) {
7396
+ if (this.match(71) || this.isLet() || (this.isContextual(122) || this.isContextual(121)) && !insideModule) {
7358
7397
  var label = this.state.value;
7359
7398
  var suggestion = exportSuggestions[label];
7360
7399
  throw this.raise(this.state.start, FlowErrors.UnsupportedDeclareExportKind, label, suggestion);
7361
7400
  }
7362
7401
 
7363
- if (this.match(68) || this.match(62) || this.match(74) || this.isContextual(121)) {
7402
+ if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(123)) {
7364
7403
  node.declaration = this.flowParseDeclare(this.startNode());
7365
7404
  node.default = false;
7366
7405
  return this.finishNode(node, "DeclareExportDeclaration");
7367
- } else if (this.match(49) || this.match(5) || this.isContextual(119) || this.isContextual(120) || this.isContextual(121)) {
7406
+ } else if (this.match(51) || this.match(5) || this.isContextual(121) || this.isContextual(122) || this.isContextual(123)) {
7368
7407
  node = this.parseExport(node);
7369
7408
 
7370
7409
  if (node.type === "ExportNamedDeclaration") {
@@ -7383,7 +7422,7 @@
7383
7422
 
7384
7423
  flowParseDeclareModuleExports(node) {
7385
7424
  this.next();
7386
- this.expectContextual(102);
7425
+ this.expectContextual(104);
7387
7426
  node.typeAnnotation = this.flowParseTypeAnnotation();
7388
7427
  this.semicolon();
7389
7428
  return this.finishNode(node, "DeclareModuleExports");
@@ -7414,7 +7453,7 @@
7414
7453
  node.id = this.flowParseRestrictedIdentifier(!isClass, true);
7415
7454
  this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.start);
7416
7455
 
7417
- if (this.match(43)) {
7456
+ if (this.match(45)) {
7418
7457
  node.typeParameters = this.flowParseTypeParameterDeclaration();
7419
7458
  } else {
7420
7459
  node.typeParameters = null;
@@ -7424,13 +7463,13 @@
7424
7463
  node.implements = [];
7425
7464
  node.mixins = [];
7426
7465
 
7427
- if (this.eat(75)) {
7466
+ if (this.eat(77)) {
7428
7467
  do {
7429
7468
  node.extends.push(this.flowParseInterfaceExtends());
7430
7469
  } while (!isClass && this.eat(12));
7431
7470
  }
7432
7471
 
7433
- if (this.isContextual(108)) {
7472
+ if (this.isContextual(110)) {
7434
7473
  this.next();
7435
7474
 
7436
7475
  do {
@@ -7438,7 +7477,7 @@
7438
7477
  } while (this.eat(12));
7439
7478
  }
7440
7479
 
7441
- if (this.isContextual(104)) {
7480
+ if (this.isContextual(106)) {
7442
7481
  this.next();
7443
7482
 
7444
7483
  do {
@@ -7459,7 +7498,7 @@
7459
7498
  var node = this.startNode();
7460
7499
  node.id = this.flowParseQualifiedTypeIdentifier();
7461
7500
 
7462
- if (this.match(43)) {
7501
+ if (this.match(45)) {
7463
7502
  node.typeParameters = this.flowParseTypeParameterInstantiation();
7464
7503
  } else {
7465
7504
  node.typeParameters = null;
@@ -7493,23 +7532,23 @@
7493
7532
  node.id = this.flowParseRestrictedIdentifier(false, true);
7494
7533
  this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
7495
7534
 
7496
- if (this.match(43)) {
7535
+ if (this.match(45)) {
7497
7536
  node.typeParameters = this.flowParseTypeParameterDeclaration();
7498
7537
  } else {
7499
7538
  node.typeParameters = null;
7500
7539
  }
7501
7540
 
7502
- node.right = this.flowParseTypeInitialiser(27);
7541
+ node.right = this.flowParseTypeInitialiser(29);
7503
7542
  this.semicolon();
7504
7543
  return this.finishNode(node, "TypeAlias");
7505
7544
  }
7506
7545
 
7507
7546
  flowParseOpaqueType(node, declare) {
7508
- this.expectContextual(120);
7547
+ this.expectContextual(122);
7509
7548
  node.id = this.flowParseRestrictedIdentifier(true, true);
7510
7549
  this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
7511
7550
 
7512
- if (this.match(43)) {
7551
+ if (this.match(45)) {
7513
7552
  node.typeParameters = this.flowParseTypeParameterDeclaration();
7514
7553
  } else {
7515
7554
  node.typeParameters = null;
@@ -7524,7 +7563,7 @@
7524
7563
  node.impltype = null;
7525
7564
 
7526
7565
  if (!declare) {
7527
- node.impltype = this.flowParseTypeInitialiser(27);
7566
+ node.impltype = this.flowParseTypeInitialiser(29);
7528
7567
  }
7529
7568
 
7530
7569
  this.semicolon();
@@ -7541,8 +7580,8 @@
7541
7580
  node.variance = variance;
7542
7581
  node.bound = ident.typeAnnotation;
7543
7582
 
7544
- if (this.match(27)) {
7545
- this.eat(27);
7583
+ if (this.match(29)) {
7584
+ this.eat(29);
7546
7585
  node.default = this.flowParseType();
7547
7586
  } else {
7548
7587
  if (requireDefault) {
@@ -7559,7 +7598,7 @@
7559
7598
  node.params = [];
7560
7599
  this.state.inType = true;
7561
7600
 
7562
- if (this.match(43) || this.match(132)) {
7601
+ if (this.match(45) || this.match(134)) {
7563
7602
  this.next();
7564
7603
  } else {
7565
7604
  this.unexpected();
@@ -7575,12 +7614,12 @@
7575
7614
  defaultRequired = true;
7576
7615
  }
7577
7616
 
7578
- if (!this.match(44)) {
7617
+ if (!this.match(46)) {
7579
7618
  this.expect(12);
7580
7619
  }
7581
- } while (!this.match(44));
7620
+ } while (!this.match(46));
7582
7621
 
7583
- this.expect(44);
7622
+ this.expect(46);
7584
7623
  this.state.inType = oldInType;
7585
7624
  return this.finishNode(node, "TypeParameterDeclaration");
7586
7625
  }
@@ -7590,20 +7629,20 @@
7590
7629
  var oldInType = this.state.inType;
7591
7630
  node.params = [];
7592
7631
  this.state.inType = true;
7593
- this.expect(43);
7632
+ this.expect(45);
7594
7633
  var oldNoAnonFunctionType = this.state.noAnonFunctionType;
7595
7634
  this.state.noAnonFunctionType = false;
7596
7635
 
7597
- while (!this.match(44)) {
7636
+ while (!this.match(46)) {
7598
7637
  node.params.push(this.flowParseType());
7599
7638
 
7600
- if (!this.match(44)) {
7639
+ if (!this.match(46)) {
7601
7640
  this.expect(12);
7602
7641
  }
7603
7642
  }
7604
7643
 
7605
7644
  this.state.noAnonFunctionType = oldNoAnonFunctionType;
7606
- this.expect(44);
7645
+ this.expect(46);
7607
7646
  this.state.inType = oldInType;
7608
7647
  return this.finishNode(node, "TypeParameterInstantiation");
7609
7648
  }
@@ -7613,27 +7652,27 @@
7613
7652
  var oldInType = this.state.inType;
7614
7653
  node.params = [];
7615
7654
  this.state.inType = true;
7616
- this.expect(43);
7655
+ this.expect(45);
7617
7656
 
7618
- while (!this.match(44)) {
7657
+ while (!this.match(46)) {
7619
7658
  node.params.push(this.flowParseTypeOrImplicitInstantiation());
7620
7659
 
7621
- if (!this.match(44)) {
7660
+ if (!this.match(46)) {
7622
7661
  this.expect(12);
7623
7662
  }
7624
7663
  }
7625
7664
 
7626
- this.expect(44);
7665
+ this.expect(46);
7627
7666
  this.state.inType = oldInType;
7628
7667
  return this.finishNode(node, "TypeParameterInstantiation");
7629
7668
  }
7630
7669
 
7631
7670
  flowParseInterfaceType() {
7632
7671
  var node = this.startNode();
7633
- this.expectContextual(119);
7672
+ this.expectContextual(121);
7634
7673
  node.extends = [];
7635
7674
 
7636
- if (this.eat(75)) {
7675
+ if (this.eat(77)) {
7637
7676
  do {
7638
7677
  node.extends.push(this.flowParseInterfaceExtends());
7639
7678
  } while (this.eat(12));
@@ -7650,7 +7689,7 @@
7650
7689
  }
7651
7690
 
7652
7691
  flowParseObjectPropertyKey() {
7653
- return this.match(124) || this.match(123) ? this.parseExprAtom() : this.parseIdentifier(true);
7692
+ return this.match(126) || this.match(125) ? this.parseExprAtom() : this.parseIdentifier(true);
7654
7693
  }
7655
7694
 
7656
7695
  flowParseObjectTypeIndexer(node, isStatic, variance) {
@@ -7676,7 +7715,7 @@
7676
7715
  this.expect(3);
7677
7716
  this.expect(3);
7678
7717
 
7679
- if (this.match(43) || this.match(10)) {
7718
+ if (this.match(45) || this.match(10)) {
7680
7719
  node.method = true;
7681
7720
  node.optional = false;
7682
7721
  node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
@@ -7699,13 +7738,13 @@
7699
7738
  node.typeParameters = null;
7700
7739
  node.this = null;
7701
7740
 
7702
- if (this.match(43)) {
7741
+ if (this.match(45)) {
7703
7742
  node.typeParameters = this.flowParseTypeParameterDeclaration();
7704
7743
  }
7705
7744
 
7706
7745
  this.expect(10);
7707
7746
 
7708
- if (this.match(72)) {
7747
+ if (this.match(74)) {
7709
7748
  node.this = this.flowParseFunctionTypeParam(true);
7710
7749
  node.this.name = null;
7711
7750
 
@@ -7775,7 +7814,7 @@
7775
7814
  var inexactStart = null;
7776
7815
  var node = this.startNode();
7777
7816
 
7778
- if (allowProto && this.isContextual(109)) {
7817
+ if (allowProto && this.isContextual(111)) {
7779
7818
  var lookahead = this.lookahead();
7780
7819
 
7781
7820
  if (lookahead.type !== 14 && lookahead.type !== 17) {
@@ -7785,7 +7824,7 @@
7785
7824
  }
7786
7825
  }
7787
7826
 
7788
- if (allowStatic && this.isContextual(98)) {
7827
+ if (allowStatic && this.isContextual(100)) {
7789
7828
  var _lookahead = this.lookahead();
7790
7829
 
7791
7830
  if (_lookahead.type !== 14 && _lookahead.type !== 17) {
@@ -7810,7 +7849,7 @@
7810
7849
  } else {
7811
7850
  nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
7812
7851
  }
7813
- } else if (this.match(10) || this.match(43)) {
7852
+ } else if (this.match(10) || this.match(45)) {
7814
7853
  if (protoStart != null) {
7815
7854
  this.unexpected(protoStart);
7816
7855
  }
@@ -7823,7 +7862,7 @@
7823
7862
  } else {
7824
7863
  var kind = "init";
7825
7864
 
7826
- if (this.isContextual(92) || this.isContextual(97)) {
7865
+ if (this.isContextual(94) || this.isContextual(99)) {
7827
7866
  var _lookahead2 = this.lookahead();
7828
7867
 
7829
7868
  if (tokenIsLiteralPropertyName(_lookahead2.type)) {
@@ -7899,7 +7938,7 @@
7899
7938
  node.kind = kind;
7900
7939
  var optional = false;
7901
7940
 
7902
- if (this.match(43) || this.match(10)) {
7941
+ if (this.match(45) || this.match(10)) {
7903
7942
  node.method = true;
7904
7943
 
7905
7944
  if (protoStart != null) {
@@ -7984,7 +8023,7 @@
7984
8023
  node.typeParameters = null;
7985
8024
  node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
7986
8025
 
7987
- if (this.match(43)) {
8026
+ if (this.match(45)) {
7988
8027
  node.typeParameters = this.flowParseTypeParameterInstantiation();
7989
8028
  }
7990
8029
 
@@ -7993,7 +8032,7 @@
7993
8032
 
7994
8033
  flowParseTypeofType() {
7995
8034
  var node = this.startNode();
7996
- this.expect(81);
8035
+ this.expect(83);
7997
8036
  node.argument = this.flowParsePrimaryType();
7998
8037
  return this.finishNode(node, "TypeofTypeAnnotation");
7999
8038
  }
@@ -8019,7 +8058,7 @@
8019
8058
  var typeAnnotation = null;
8020
8059
  var node = this.startNode();
8021
8060
  var lh = this.lookahead();
8022
- var isThis = this.state.type === 72;
8061
+ var isThis = this.state.type === 74;
8023
8062
 
8024
8063
  if (lh.type === 14 || lh.type === 17) {
8025
8064
  if (isThis && !first) {
@@ -8060,7 +8099,7 @@
8060
8099
  var rest = null;
8061
8100
  var _this = null;
8062
8101
 
8063
- if (this.match(72)) {
8102
+ if (this.match(74)) {
8064
8103
  _this = this.flowParseFunctionTypeParam(true);
8065
8104
  _this.name = null;
8066
8105
 
@@ -8152,7 +8191,7 @@
8152
8191
  this.state.noAnonFunctionType = oldNoAnonFunctionType;
8153
8192
  return type;
8154
8193
 
8155
- case 43:
8194
+ case 45:
8156
8195
  node.typeParameters = this.flowParseTypeParameterDeclaration();
8157
8196
  this.expect(10);
8158
8197
  tmp = this.flowParseFunctionTypeParams();
@@ -8168,7 +8207,7 @@
8168
8207
  this.next();
8169
8208
 
8170
8209
  if (!this.match(11) && !this.match(21)) {
8171
- if (tokenIsIdentifier(this.state.type) || this.match(72)) {
8210
+ if (tokenIsIdentifier(this.state.type) || this.match(74)) {
8172
8211
  var token = this.lookahead().type;
8173
8212
  isGroupedType = token !== 17 && token !== 14;
8174
8213
  } else {
@@ -8204,24 +8243,24 @@
8204
8243
  node.typeParameters = null;
8205
8244
  return this.finishNode(node, "FunctionTypeAnnotation");
8206
8245
 
8207
- case 123:
8246
+ case 125:
8208
8247
  return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
8209
8248
 
8210
- case 79:
8211
- case 80:
8212
- node.value = this.match(79);
8249
+ case 81:
8250
+ case 82:
8251
+ node.value = this.match(81);
8213
8252
  this.next();
8214
8253
  return this.finishNode(node, "BooleanLiteralTypeAnnotation");
8215
8254
 
8216
- case 47:
8255
+ case 49:
8217
8256
  if (this.state.value === "-") {
8218
8257
  this.next();
8219
8258
 
8220
- if (this.match(124)) {
8259
+ if (this.match(126)) {
8221
8260
  return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
8222
8261
  }
8223
8262
 
8224
- if (this.match(125)) {
8263
+ if (this.match(127)) {
8225
8264
  return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
8226
8265
  }
8227
8266
 
@@ -8230,29 +8269,29 @@
8230
8269
 
8231
8270
  throw this.unexpected();
8232
8271
 
8233
- case 124:
8272
+ case 126:
8234
8273
  return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
8235
8274
 
8236
- case 125:
8275
+ case 127:
8237
8276
  return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
8238
8277
 
8239
- case 82:
8278
+ case 84:
8240
8279
  this.next();
8241
8280
  return this.finishNode(node, "VoidTypeAnnotation");
8242
8281
 
8243
- case 78:
8282
+ case 80:
8244
8283
  this.next();
8245
8284
  return this.finishNode(node, "NullLiteralTypeAnnotation");
8246
8285
 
8247
- case 72:
8286
+ case 74:
8248
8287
  this.next();
8249
8288
  return this.finishNode(node, "ThisTypeAnnotation");
8250
8289
 
8251
- case 49:
8290
+ case 51:
8252
8291
  this.next();
8253
8292
  return this.finishNode(node, "ExistsTypeAnnotation");
8254
8293
 
8255
- case 81:
8294
+ case 83:
8256
8295
  return this.flowParseTypeofType();
8257
8296
 
8258
8297
  default:
@@ -8261,7 +8300,7 @@
8261
8300
  this.next();
8262
8301
  return super.createIdentifier(node, label);
8263
8302
  } else if (tokenIsIdentifier(this.state.type)) {
8264
- if (this.isContextual(119)) {
8303
+ if (this.isContextual(121)) {
8265
8304
  return this.flowParseInterfaceType();
8266
8305
  }
8267
8306
 
@@ -8335,11 +8374,11 @@
8335
8374
 
8336
8375
  flowParseIntersectionType() {
8337
8376
  var node = this.startNode();
8338
- this.eat(41);
8377
+ this.eat(43);
8339
8378
  var type = this.flowParseAnonFunctionWithoutParens();
8340
8379
  node.types = [type];
8341
8380
 
8342
- while (this.eat(41)) {
8381
+ while (this.eat(43)) {
8343
8382
  node.types.push(this.flowParseAnonFunctionWithoutParens());
8344
8383
  }
8345
8384
 
@@ -8348,11 +8387,11 @@
8348
8387
 
8349
8388
  flowParseUnionType() {
8350
8389
  var node = this.startNode();
8351
- this.eat(39);
8390
+ this.eat(41);
8352
8391
  var type = this.flowParseIntersectionType();
8353
8392
  node.types = [type];
8354
8393
 
8355
- while (this.eat(39)) {
8394
+ while (this.eat(41)) {
8356
8395
  node.types.push(this.flowParseIntersectionType());
8357
8396
  }
8358
8397
 
@@ -8368,7 +8407,7 @@
8368
8407
  }
8369
8408
 
8370
8409
  flowParseTypeOrImplicitInstantiation() {
8371
- if (this.state.type === 122 && this.state.value === "_") {
8410
+ if (this.state.type === 124 && this.state.value === "_") {
8372
8411
  var startPos = this.state.start;
8373
8412
  var startLoc = this.state.startLoc;
8374
8413
  var node = this.parseIdentifier();
@@ -8404,7 +8443,7 @@
8404
8443
  flowParseVariance() {
8405
8444
  var variance = null;
8406
8445
 
8407
- if (this.match(47)) {
8446
+ if (this.match(49)) {
8408
8447
  variance = this.startNode();
8409
8448
 
8410
8449
  if (this.state.value === "+") {
@@ -8443,7 +8482,7 @@
8443
8482
  }
8444
8483
 
8445
8484
  parseStatement(context, topLevel) {
8446
- if (this.state.strict && this.isContextual(119)) {
8485
+ if (this.state.strict && this.isContextual(121)) {
8447
8486
  var lookahead = this.lookahead();
8448
8487
 
8449
8488
  if (tokenIsKeywordOrIdentifier(lookahead.type)) {
@@ -8451,7 +8490,7 @@
8451
8490
  this.next();
8452
8491
  return this.flowParseInterface(node);
8453
8492
  }
8454
- } else if (this.shouldParseEnums() && this.isContextual(116)) {
8493
+ } else if (this.shouldParseEnums() && this.isContextual(118)) {
8455
8494
  var _node = this.startNode();
8456
8495
 
8457
8496
  this.next();
@@ -8470,7 +8509,7 @@
8470
8509
  parseExpressionStatement(node, expr) {
8471
8510
  if (expr.type === "Identifier") {
8472
8511
  if (expr.name === "declare") {
8473
- if (this.match(74) || tokenIsIdentifier(this.state.type) || this.match(62) || this.match(68) || this.match(76)) {
8512
+ if (this.match(76) || tokenIsIdentifier(this.state.type) || this.match(64) || this.match(70) || this.match(78)) {
8474
8513
  return this.flowParseDeclare(node);
8475
8514
  }
8476
8515
  } else if (tokenIsIdentifier(this.state.type)) {
@@ -8492,7 +8531,7 @@
8492
8531
  type
8493
8532
  } = this.state;
8494
8533
 
8495
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 116) {
8534
+ if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 118) {
8496
8535
  return !this.state.containsEsc;
8497
8536
  }
8498
8537
 
@@ -8504,7 +8543,7 @@
8504
8543
  type
8505
8544
  } = this.state;
8506
8545
 
8507
- if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 116) {
8546
+ if (tokenIsFlowInterfaceOrTypeOrOpaque(type) || this.shouldParseEnums() && type === 118) {
8508
8547
  return this.state.containsEsc;
8509
8548
  }
8510
8549
 
@@ -8512,7 +8551,7 @@
8512
8551
  }
8513
8552
 
8514
8553
  parseExportDefaultExpression() {
8515
- if (this.shouldParseEnums() && this.isContextual(116)) {
8554
+ if (this.shouldParseEnums() && this.isContextual(118)) {
8516
8555
  var node = this.startNode();
8517
8556
  this.next();
8518
8557
  return this.flowParseEnumDeclaration(node);
@@ -8685,7 +8724,7 @@
8685
8724
  }
8686
8725
 
8687
8726
  parseExportDeclaration(node) {
8688
- if (this.isContextual(120)) {
8727
+ if (this.isContextual(122)) {
8689
8728
  node.exportKind = "type";
8690
8729
  var declarationNode = this.startNode();
8691
8730
  this.next();
@@ -8697,21 +8736,21 @@
8697
8736
  } else {
8698
8737
  return this.flowParseTypeAlias(declarationNode);
8699
8738
  }
8700
- } else if (this.isContextual(121)) {
8739
+ } else if (this.isContextual(123)) {
8701
8740
  node.exportKind = "type";
8702
8741
 
8703
8742
  var _declarationNode = this.startNode();
8704
8743
 
8705
8744
  this.next();
8706
8745
  return this.flowParseOpaqueType(_declarationNode, false);
8707
- } else if (this.isContextual(119)) {
8746
+ } else if (this.isContextual(121)) {
8708
8747
  node.exportKind = "type";
8709
8748
 
8710
8749
  var _declarationNode2 = this.startNode();
8711
8750
 
8712
8751
  this.next();
8713
8752
  return this.flowParseInterface(_declarationNode2);
8714
- } else if (this.shouldParseEnums() && this.isContextual(116)) {
8753
+ } else if (this.shouldParseEnums() && this.isContextual(118)) {
8715
8754
  node.exportKind = "value";
8716
8755
 
8717
8756
  var _declarationNode3 = this.startNode();
@@ -8726,7 +8765,7 @@
8726
8765
  eatExportStar(node) {
8727
8766
  if (super.eatExportStar(...arguments)) return true;
8728
8767
 
8729
- if (this.isContextual(120) && this.lookahead().type === 49) {
8768
+ if (this.isContextual(122) && this.lookahead().type === 51) {
8730
8769
  node.exportKind = "type";
8731
8770
  this.next();
8732
8771
  this.next();
@@ -8750,7 +8789,7 @@
8750
8789
  parseClassId(node, isStatement, optionalId) {
8751
8790
  super.parseClassId(node, isStatement, optionalId);
8752
8791
 
8753
- if (this.match(43)) {
8792
+ if (this.match(45)) {
8754
8793
  node.typeParameters = this.flowParseTypeParameterDeclaration();
8755
8794
  }
8756
8795
  }
@@ -8758,7 +8797,7 @@
8758
8797
  parseClassMember(classBody, member, state) {
8759
8798
  var pos = this.state.start;
8760
8799
 
8761
- if (this.isContextual(115)) {
8800
+ if (this.isContextual(117)) {
8762
8801
  if (this.parseClassMemberFromModifier(classBody, member)) {
8763
8802
  return;
8764
8803
  }
@@ -8789,7 +8828,7 @@
8789
8828
  this.raise(this.state.pos, ErrorMessages.InvalidIdentifier, fullWord);
8790
8829
  }
8791
8830
 
8792
- this.finishToken(122, fullWord);
8831
+ this.finishToken(124, fullWord);
8793
8832
  }
8794
8833
 
8795
8834
  getTokenFromCode(code) {
@@ -8798,7 +8837,7 @@
8798
8837
  if (code === 123 && next === 124) {
8799
8838
  return this.finishOp(6, 2);
8800
8839
  } else if (this.state.inType && (code === 62 || code === 60)) {
8801
- return this.finishOp(code === 62 ? 44 : 43, 1);
8840
+ return this.finishOp(code === 62 ? 46 : 45, 1);
8802
8841
  } else if (this.state.inType && code === 63) {
8803
8842
  if (next === 46) {
8804
8843
  return this.finishOp(18, 2);
@@ -8894,7 +8933,7 @@
8894
8933
  }
8895
8934
 
8896
8935
  isClassMethod() {
8897
- return this.match(43) || super.isClassMethod();
8936
+ return this.match(45) || super.isClassMethod();
8898
8937
  }
8899
8938
 
8900
8939
  isClassProperty() {
@@ -8912,7 +8951,7 @@
8912
8951
 
8913
8952
  delete method.variance;
8914
8953
 
8915
- if (this.match(43)) {
8954
+ if (this.match(45)) {
8916
8955
  method.typeParameters = this.flowParseTypeParameterDeclaration();
8917
8956
  }
8918
8957
 
@@ -8940,7 +8979,7 @@
8940
8979
 
8941
8980
  delete method.variance;
8942
8981
 
8943
- if (this.match(43)) {
8982
+ if (this.match(45)) {
8944
8983
  method.typeParameters = this.flowParseTypeParameterDeclaration();
8945
8984
  }
8946
8985
 
@@ -8950,11 +8989,11 @@
8950
8989
  parseClassSuper(node) {
8951
8990
  super.parseClassSuper(node);
8952
8991
 
8953
- if (node.superClass && this.match(43)) {
8992
+ if (node.superClass && this.match(45)) {
8954
8993
  node.superTypeParameters = this.flowParseTypeParameterInstantiation();
8955
8994
  }
8956
8995
 
8957
- if (this.isContextual(104)) {
8996
+ if (this.isContextual(106)) {
8958
8997
  this.next();
8959
8998
  var implemented = node.implements = [];
8960
8999
 
@@ -8963,7 +9002,7 @@
8963
9002
 
8964
9003
  _node3.id = this.flowParseRestrictedIdentifier(true);
8965
9004
 
8966
- if (this.match(43)) {
9005
+ if (this.match(45)) {
8967
9006
  _node3.typeParameters = this.flowParseTypeParameterInstantiation();
8968
9007
  } else {
8969
9008
  _node3.typeParameters = null;
@@ -9001,7 +9040,7 @@
9001
9040
  delete prop.variance;
9002
9041
  var typeParameters;
9003
9042
 
9004
- if (this.match(43) && !isAccessor) {
9043
+ if (this.match(45) && !isAccessor) {
9005
9044
  typeParameters = this.flowParseTypeParameterDeclaration();
9006
9045
  if (!this.match(10)) this.unexpected();
9007
9046
  }
@@ -9032,7 +9071,7 @@
9032
9071
  this.raise(param.start, FlowErrors.ThisParamAnnotationRequired);
9033
9072
  }
9034
9073
 
9035
- if (this.match(27) && this.isThisParam(param)) {
9074
+ if (this.match(29) && this.isThisParam(param)) {
9036
9075
  this.raise(param.start, FlowErrors.ThisParamNoDefault);
9037
9076
  }
9038
9077
 
@@ -9068,9 +9107,9 @@
9068
9107
  node.importKind = "value";
9069
9108
  var kind = null;
9070
9109
 
9071
- if (this.match(81)) {
9110
+ if (this.match(83)) {
9072
9111
  kind = "typeof";
9073
- } else if (this.isContextual(120)) {
9112
+ } else if (this.isContextual(122)) {
9074
9113
  kind = "type";
9075
9114
  }
9076
9115
 
@@ -9080,11 +9119,11 @@
9080
9119
  type
9081
9120
  } = lh;
9082
9121
 
9083
- if (kind === "type" && type === 49) {
9122
+ if (kind === "type" && type === 51) {
9084
9123
  this.unexpected(lh.start);
9085
9124
  }
9086
9125
 
9087
- if (isMaybeDefaultImport(type) || type === 5 || type === 49) {
9126
+ if (isMaybeDefaultImport(type) || type === 5 || type === 51) {
9088
9127
  this.next();
9089
9128
  node.importKind = kind;
9090
9129
  }
@@ -9107,7 +9146,7 @@
9107
9146
 
9108
9147
  var isBinding = false;
9109
9148
 
9110
- if (this.isContextual(87) && !this.isLookaheadContextual("as")) {
9149
+ if (this.isContextual(89) && !this.isLookaheadContextual("as")) {
9111
9150
  var as_ident = this.parseIdentifier(true);
9112
9151
 
9113
9152
  if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
@@ -9132,7 +9171,7 @@
9132
9171
  specifier.importKind = null;
9133
9172
  }
9134
9173
 
9135
- if (this.eatContextual(87)) {
9174
+ if (this.eatContextual(89)) {
9136
9175
  specifier.local = this.parseIdentifier();
9137
9176
  } else {
9138
9177
  isBinding = true;
@@ -9160,7 +9199,7 @@
9160
9199
 
9161
9200
  parseBindingAtom() {
9162
9201
  switch (this.state.type) {
9163
- case 72:
9202
+ case 74:
9164
9203
  return this.parseIdentifier(true);
9165
9204
 
9166
9205
  default:
@@ -9171,7 +9210,7 @@
9171
9210
  parseFunctionParams(node, allowModifiers) {
9172
9211
  var kind = node.kind;
9173
9212
 
9174
- if (kind !== "get" && kind !== "set" && this.match(43)) {
9213
+ if (kind !== "get" && kind !== "set" && this.match(45)) {
9175
9214
  node.typeParameters = this.flowParseTypeParameterDeclaration();
9176
9215
  }
9177
9216
 
@@ -9208,23 +9247,21 @@
9208
9247
  var state = null;
9209
9248
  var jsx;
9210
9249
 
9211
- if (this.hasPlugin("jsx") && (this.match(132) || this.match(43))) {
9250
+ if (this.hasPlugin("jsx") && (this.match(134) || this.match(45))) {
9212
9251
  state = this.state.clone();
9213
9252
  jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
9214
9253
  if (!jsx.error) return jsx.node;
9215
9254
  var {
9216
9255
  context
9217
9256
  } = this.state;
9218
- var curContext = context[context.length - 1];
9257
+ var currentContext = context[context.length - 1];
9219
9258
 
9220
- if (curContext === types.j_oTag) {
9221
- context.length -= 2;
9222
- } else if (curContext === types.j_expr) {
9223
- context.length -= 1;
9259
+ if (currentContext === types.j_oTag || currentContext === types.j_expr) {
9260
+ context.pop();
9224
9261
  }
9225
9262
  }
9226
9263
 
9227
- if ((_jsx = jsx) != null && _jsx.error || this.match(43)) {
9264
+ if ((_jsx = jsx) != null && _jsx.error || this.match(45)) {
9228
9265
  var _jsx2, _jsx3;
9229
9266
 
9230
9267
  state = state || this.state.clone();
@@ -9334,7 +9371,7 @@
9334
9371
  node.callee = base;
9335
9372
  node.arguments = this.parseCallExpressionArguments(11, false);
9336
9373
  base = this.finishNode(node, "CallExpression");
9337
- } else if (base.type === "Identifier" && base.name === "async" && this.match(43)) {
9374
+ } else if (base.type === "Identifier" && base.name === "async" && this.match(45)) {
9338
9375
  var state = this.state.clone();
9339
9376
  var arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || abort(), state);
9340
9377
  if (!arrow.error && !arrow.aborted) return arrow.node;
@@ -9374,7 +9411,7 @@
9374
9411
  node.arguments = this.parseCallExpressionArguments(11, false);
9375
9412
  node.optional = true;
9376
9413
  return this.finishCallExpression(node, true);
9377
- } else if (!noCalls && this.shouldParseTypes() && this.match(43)) {
9414
+ } else if (!noCalls && this.shouldParseTypes() && this.match(45)) {
9378
9415
  var _node4 = this.startNodeAt(startPos, startLoc);
9379
9416
 
9380
9417
  _node4.callee = base;
@@ -9398,7 +9435,7 @@
9398
9435
  parseNewArguments(node) {
9399
9436
  var targs = null;
9400
9437
 
9401
- if (this.shouldParseTypes() && this.match(43)) {
9438
+ if (this.shouldParseTypes() && this.match(45)) {
9402
9439
  targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
9403
9440
  }
9404
9441
 
@@ -9596,7 +9633,7 @@
9596
9633
  var endOfInit = () => this.match(12) || this.match(8);
9597
9634
 
9598
9635
  switch (this.state.type) {
9599
- case 124:
9636
+ case 126:
9600
9637
  {
9601
9638
  var literal = this.parseNumericLiteral(this.state.value);
9602
9639
 
@@ -9614,7 +9651,7 @@
9614
9651
  };
9615
9652
  }
9616
9653
 
9617
- case 123:
9654
+ case 125:
9618
9655
  {
9619
9656
  var _literal = this.parseStringLiteral(this.state.value);
9620
9657
 
@@ -9632,10 +9669,10 @@
9632
9669
  };
9633
9670
  }
9634
9671
 
9635
- case 79:
9636
- case 80:
9672
+ case 81:
9673
+ case 82:
9637
9674
  {
9638
- var _literal2 = this.parseBooleanLiteral(this.match(79));
9675
+ var _literal2 = this.parseBooleanLiteral(this.match(81));
9639
9676
 
9640
9677
  if (endOfInit()) {
9641
9678
  return {
@@ -9662,7 +9699,7 @@
9662
9699
  flowEnumMemberRaw() {
9663
9700
  var pos = this.state.start;
9664
9701
  var id = this.parseIdentifier(true);
9665
- var init = this.eat(27) ? this.flowEnumMemberInit() : {
9702
+ var init = this.eat(29) ? this.flowEnumMemberInit() : {
9666
9703
  type: "none",
9667
9704
  pos
9668
9705
  };
@@ -9830,7 +9867,7 @@
9830
9867
  enumName
9831
9868
  } = _ref16;
9832
9869
 
9833
- if (this.eatContextual(95)) {
9870
+ if (this.eatContextual(97)) {
9834
9871
  if (!tokenIsIdentifier(this.state.type)) {
9835
9872
  throw this.flowEnumErrorInvalidExplicitType(this.state.start, {
9836
9873
  enumName,
@@ -10247,9 +10284,6 @@
10247
10284
  UnterminatedJsxContent: "Unterminated JSX contents.",
10248
10285
  UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
10249
10286
  }, ErrorCodes.SyntaxError, "jsx");
10250
- types.j_oTag = new TokContext("<tag");
10251
- types.j_cTag = new TokContext("</tag");
10252
- types.j_expr = new TokContext("<tag>...</tag>", true);
10253
10287
 
10254
10288
  function isFragment(object) {
10255
10289
  return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
@@ -10289,14 +10323,14 @@
10289
10323
  if (this.state.pos === this.state.start) {
10290
10324
  if (ch === 60 && this.state.canStartJSXElement) {
10291
10325
  ++this.state.pos;
10292
- return this.finishToken(132);
10326
+ return this.finishToken(134);
10293
10327
  }
10294
10328
 
10295
10329
  return super.getTokenFromCode(ch);
10296
10330
  }
10297
10331
 
10298
10332
  out += this.input.slice(chunkStart, this.state.pos);
10299
- return this.finishToken(131, out);
10333
+ return this.finishToken(133, out);
10300
10334
 
10301
10335
  case 38:
10302
10336
  out += this.input.slice(chunkStart, this.state.pos);
@@ -10362,7 +10396,7 @@
10362
10396
  }
10363
10397
 
10364
10398
  out += this.input.slice(chunkStart, this.state.pos++);
10365
- return this.finishToken(123, out);
10399
+ return this.finishToken(125, out);
10366
10400
  }
10367
10401
 
10368
10402
  jsxReadEntity() {
@@ -10416,13 +10450,13 @@
10416
10450
  ch = this.input.charCodeAt(++this.state.pos);
10417
10451
  } while (isIdentifierChar(ch) || ch === 45);
10418
10452
 
10419
- return this.finishToken(130, this.input.slice(start, this.state.pos));
10453
+ return this.finishToken(132, this.input.slice(start, this.state.pos));
10420
10454
  }
10421
10455
 
10422
10456
  jsxParseIdentifier() {
10423
10457
  var node = this.startNode();
10424
10458
 
10425
- if (this.match(130)) {
10459
+ if (this.match(132)) {
10426
10460
  node.name = this.state.value;
10427
10461
  } else if (tokenIsKeyword(this.state.type)) {
10428
10462
  node.name = tokenLabelName(this.state.type);
@@ -10470,8 +10504,9 @@
10470
10504
  switch (this.state.type) {
10471
10505
  case 5:
10472
10506
  node = this.startNode();
10507
+ this.setContext(types.brace);
10473
10508
  this.next();
10474
- node = this.jsxParseExpressionContainer(node);
10509
+ node = this.jsxParseExpressionContainer(node, types.j_oTag);
10475
10510
 
10476
10511
  if (node.expression.type === "JSXEmptyExpression") {
10477
10512
  this.raise(node.start, JsxErrors.AttributeIsEmpty);
@@ -10479,8 +10514,8 @@
10479
10514
 
10480
10515
  return node;
10481
10516
 
10482
- case 132:
10483
- case 123:
10517
+ case 134:
10518
+ case 125:
10484
10519
  return this.parseExprAtom();
10485
10520
 
10486
10521
  default:
@@ -10496,11 +10531,12 @@
10496
10531
  jsxParseSpreadChild(node) {
10497
10532
  this.next();
10498
10533
  node.expression = this.parseExpression();
10534
+ this.setContext(types.j_oTag);
10499
10535
  this.expect(8);
10500
10536
  return this.finishNode(node, "JSXSpreadChild");
10501
10537
  }
10502
10538
 
10503
- jsxParseExpressionContainer(node) {
10539
+ jsxParseExpressionContainer(node, previousContext) {
10504
10540
  if (this.match(8)) {
10505
10541
  node.expression = this.jsxParseEmptyExpression();
10506
10542
  } else {
@@ -10508,6 +10544,7 @@
10508
10544
  node.expression = expression;
10509
10545
  }
10510
10546
 
10547
+ this.setContext(previousContext);
10511
10548
  this.expect(8);
10512
10549
  return this.finishNode(node, "JSXExpressionContainer");
10513
10550
  }
@@ -10515,23 +10552,26 @@
10515
10552
  jsxParseAttribute() {
10516
10553
  var node = this.startNode();
10517
10554
 
10518
- if (this.eat(5)) {
10555
+ if (this.match(5)) {
10556
+ this.setContext(types.brace);
10557
+ this.next();
10519
10558
  this.expect(21);
10520
10559
  node.argument = this.parseMaybeAssignAllowIn();
10560
+ this.setContext(types.j_oTag);
10521
10561
  this.expect(8);
10522
10562
  return this.finishNode(node, "JSXSpreadAttribute");
10523
10563
  }
10524
10564
 
10525
10565
  node.name = this.jsxParseNamespacedName();
10526
- node.value = this.eat(27) ? this.jsxParseAttributeValue() : null;
10566
+ node.value = this.eat(29) ? this.jsxParseAttributeValue() : null;
10527
10567
  return this.finishNode(node, "JSXAttribute");
10528
10568
  }
10529
10569
 
10530
10570
  jsxParseOpeningElementAt(startPos, startLoc) {
10531
10571
  var node = this.startNodeAt(startPos, startLoc);
10532
10572
 
10533
- if (this.match(133)) {
10534
- this.expect(133);
10573
+ if (this.match(135)) {
10574
+ this.expect(135);
10535
10575
  return this.finishNode(node, "JSXOpeningFragment");
10536
10576
  }
10537
10577
 
@@ -10542,26 +10582,26 @@
10542
10582
  jsxParseOpeningElementAfterName(node) {
10543
10583
  var attributes = [];
10544
10584
 
10545
- while (!this.match(50) && !this.match(133)) {
10585
+ while (!this.match(52) && !this.match(135)) {
10546
10586
  attributes.push(this.jsxParseAttribute());
10547
10587
  }
10548
10588
 
10549
10589
  node.attributes = attributes;
10550
- node.selfClosing = this.eat(50);
10551
- this.expect(133);
10590
+ node.selfClosing = this.eat(52);
10591
+ this.expect(135);
10552
10592
  return this.finishNode(node, "JSXOpeningElement");
10553
10593
  }
10554
10594
 
10555
10595
  jsxParseClosingElementAt(startPos, startLoc) {
10556
10596
  var node = this.startNodeAt(startPos, startLoc);
10557
10597
 
10558
- if (this.match(133)) {
10559
- this.expect(133);
10598
+ if (this.match(135)) {
10599
+ this.expect(135);
10560
10600
  return this.finishNode(node, "JSXClosingFragment");
10561
10601
  }
10562
10602
 
10563
10603
  node.name = this.jsxParseElementName();
10564
- this.expect(133);
10604
+ this.expect(135);
10565
10605
  return this.finishNode(node, "JSXClosingElement");
10566
10606
  }
10567
10607
 
@@ -10574,12 +10614,12 @@
10574
10614
  if (!openingElement.selfClosing) {
10575
10615
  contents: for (;;) {
10576
10616
  switch (this.state.type) {
10577
- case 132:
10617
+ case 134:
10578
10618
  startPos = this.state.start;
10579
10619
  startLoc = this.state.startLoc;
10580
10620
  this.next();
10581
10621
 
10582
- if (this.eat(50)) {
10622
+ if (this.eat(52)) {
10583
10623
  closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
10584
10624
  break contents;
10585
10625
  }
@@ -10587,7 +10627,7 @@
10587
10627
  children.push(this.jsxParseElementAt(startPos, startLoc));
10588
10628
  break;
10589
10629
 
10590
- case 131:
10630
+ case 133:
10591
10631
  children.push(this.parseExprAtom());
10592
10632
  break;
10593
10633
 
@@ -10595,12 +10635,13 @@
10595
10635
  {
10596
10636
  var _node5 = this.startNode();
10597
10637
 
10638
+ this.setContext(types.brace);
10598
10639
  this.next();
10599
10640
 
10600
10641
  if (this.match(21)) {
10601
10642
  children.push(this.jsxParseSpreadChild(_node5));
10602
10643
  } else {
10603
- children.push(this.jsxParseExpressionContainer(_node5));
10644
+ children.push(this.jsxParseExpressionContainer(_node5, types.j_expr));
10604
10645
  }
10605
10646
 
10606
10647
  break;
@@ -10632,7 +10673,7 @@
10632
10673
 
10633
10674
  node.children = children;
10634
10675
 
10635
- if (this.match(43)) {
10676
+ if (this.match(45)) {
10636
10677
  throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements);
10637
10678
  }
10638
10679
 
@@ -10646,19 +10687,31 @@
10646
10687
  return this.jsxParseElementAt(startPos, startLoc);
10647
10688
  }
10648
10689
 
10690
+ setContext(newContext) {
10691
+ var {
10692
+ context
10693
+ } = this.state;
10694
+ context[context.length - 1] = newContext;
10695
+ }
10696
+
10649
10697
  parseExprAtom(refExpressionErrors) {
10650
- if (this.match(131)) {
10698
+ if (this.match(133)) {
10651
10699
  return this.parseLiteral(this.state.value, "JSXText");
10652
- } else if (this.match(132)) {
10700
+ } else if (this.match(134)) {
10653
10701
  return this.jsxParseElement();
10654
- } else if (this.match(43) && this.input.charCodeAt(this.state.pos) !== 33) {
10655
- this.replaceToken(132);
10702
+ } else if (this.match(45) && this.input.charCodeAt(this.state.pos) !== 33) {
10703
+ this.replaceToken(134);
10656
10704
  return this.jsxParseElement();
10657
10705
  } else {
10658
10706
  return super.parseExprAtom(refExpressionErrors);
10659
10707
  }
10660
10708
  }
10661
10709
 
10710
+ skipSpace() {
10711
+ var curContext = this.curContext();
10712
+ if (!curContext.preserveSpace) super.skipSpace();
10713
+ }
10714
+
10662
10715
  getTokenFromCode(code) {
10663
10716
  var context = this.curContext();
10664
10717
 
@@ -10673,7 +10726,7 @@
10673
10726
 
10674
10727
  if (code === 62) {
10675
10728
  ++this.state.pos;
10676
- return this.finishToken(133);
10729
+ return this.finishToken(135);
10677
10730
  }
10678
10731
 
10679
10732
  if ((code === 34 || code === 39) && context === types.j_oTag) {
@@ -10683,31 +10736,31 @@
10683
10736
 
10684
10737
  if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
10685
10738
  ++this.state.pos;
10686
- return this.finishToken(132);
10739
+ return this.finishToken(134);
10687
10740
  }
10688
10741
 
10689
10742
  return super.getTokenFromCode(code);
10690
10743
  }
10691
10744
 
10692
10745
  updateContext(prevType) {
10693
- super.updateContext(prevType);
10694
10746
  var {
10695
10747
  context,
10696
10748
  type
10697
10749
  } = this.state;
10698
10750
 
10699
- if (type === 50 && prevType === 132) {
10751
+ if (type === 52 && prevType === 134) {
10700
10752
  context.splice(-2, 2, types.j_cTag);
10701
10753
  this.state.canStartJSXElement = false;
10702
- } else if (type === 132) {
10703
- context.push(types.j_expr, types.j_oTag);
10704
- } else if (type === 133) {
10705
- var out = context.pop();
10754
+ } else if (type === 134) {
10755
+ context.push(types.j_oTag);
10756
+ } else if (type === 135) {
10757
+ var out = context[context.length - 1];
10706
10758
 
10707
- if (out === types.j_oTag && prevType === 50 || out === types.j_cTag) {
10759
+ if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
10708
10760
  context.pop();
10709
10761
  this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
10710
10762
  } else {
10763
+ this.setContext(types.j_expr);
10711
10764
  this.state.canStartJSXElement = true;
10712
10765
  }
10713
10766
  } else {
@@ -10919,7 +10972,7 @@
10919
10972
  }
10920
10973
 
10921
10974
  tsTokenCanFollowModifier() {
10922
- return (this.match(0) || this.match(5) || this.match(49) || this.match(21) || this.match(128) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
10975
+ return (this.match(0) || this.match(5) || this.match(51) || this.match(21) || this.match(130) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
10923
10976
  }
10924
10977
 
10925
10978
  tsNextTokenCanFollowModifier() {
@@ -11008,7 +11061,7 @@
11008
11061
  return this.match(3);
11009
11062
 
11010
11063
  case "TypeParametersOrArguments":
11011
- return this.match(44);
11064
+ return this.match(46);
11012
11065
  }
11013
11066
 
11014
11067
  throw new Error("Unreachable");
@@ -11074,7 +11127,7 @@
11074
11127
  if (bracket) {
11075
11128
  this.expect(0);
11076
11129
  } else {
11077
- this.expect(43);
11130
+ this.expect(45);
11078
11131
  }
11079
11132
  }
11080
11133
 
@@ -11083,7 +11136,7 @@
11083
11136
  if (bracket) {
11084
11137
  this.expect(3);
11085
11138
  } else {
11086
- this.expect(44);
11139
+ this.expect(46);
11087
11140
  }
11088
11141
 
11089
11142
  return result;
@@ -11091,10 +11144,10 @@
11091
11144
 
11092
11145
  tsParseImportType() {
11093
11146
  var node = this.startNode();
11094
- this.expect(77);
11147
+ this.expect(79);
11095
11148
  this.expect(10);
11096
11149
 
11097
- if (!this.match(123)) {
11150
+ if (!this.match(125)) {
11098
11151
  this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument);
11099
11152
  }
11100
11153
 
@@ -11105,7 +11158,7 @@
11105
11158
  node.qualifier = this.tsParseEntityName(true);
11106
11159
  }
11107
11160
 
11108
- if (this.match(43)) {
11161
+ if (this.match(45)) {
11109
11162
  node.typeParameters = this.tsParseTypeArguments();
11110
11163
  }
11111
11164
 
@@ -11129,7 +11182,7 @@
11129
11182
  var node = this.startNode();
11130
11183
  node.typeName = this.tsParseEntityName(false);
11131
11184
 
11132
- if (!this.hasPrecedingLineBreak() && this.match(43)) {
11185
+ if (!this.hasPrecedingLineBreak() && this.match(45)) {
11133
11186
  node.typeParameters = this.tsParseTypeArguments();
11134
11187
  }
11135
11188
 
@@ -11153,9 +11206,9 @@
11153
11206
 
11154
11207
  tsParseTypeQuery() {
11155
11208
  var node = this.startNode();
11156
- this.expect(81);
11209
+ this.expect(83);
11157
11210
 
11158
- if (this.match(77)) {
11211
+ if (this.match(79)) {
11159
11212
  node.exprName = this.tsParseImportType();
11160
11213
  } else {
11161
11214
  node.exprName = this.tsParseEntityName(true);
@@ -11167,13 +11220,13 @@
11167
11220
  tsParseTypeParameter() {
11168
11221
  var node = this.startNode();
11169
11222
  node.name = this.tsParseTypeParameterName();
11170
- node.constraint = this.tsEatThenParseType(75);
11171
- node.default = this.tsEatThenParseType(27);
11223
+ node.constraint = this.tsEatThenParseType(77);
11224
+ node.default = this.tsEatThenParseType(29);
11172
11225
  return this.finishNode(node, "TSTypeParameter");
11173
11226
  }
11174
11227
 
11175
11228
  tsTryParseTypeParameters() {
11176
- if (this.match(43)) {
11229
+ if (this.match(45)) {
11177
11230
  return this.tsParseTypeParameters();
11178
11231
  }
11179
11232
  }
@@ -11181,7 +11234,7 @@
11181
11234
  tsParseTypeParameters() {
11182
11235
  var node = this.startNode();
11183
11236
 
11184
- if (this.match(43) || this.match(132)) {
11237
+ if (this.match(45) || this.match(134)) {
11185
11238
  this.next();
11186
11239
  } else {
11187
11240
  this.unexpected();
@@ -11204,7 +11257,7 @@
11204
11257
  }
11205
11258
 
11206
11259
  tsTryNextParseConstantContext() {
11207
- if (this.lookahead().type === 69) {
11260
+ if (this.lookahead().type === 71) {
11208
11261
  this.next();
11209
11262
  return this.tsParseTypeReference();
11210
11263
  }
@@ -11279,14 +11332,14 @@
11279
11332
  if (this.eat(17)) node.optional = true;
11280
11333
  var nodeAny = node;
11281
11334
 
11282
- if (this.match(10) || this.match(43)) {
11335
+ if (this.match(10) || this.match(45)) {
11283
11336
  if (readonly) {
11284
11337
  this.raise(node.start, TSErrors.ReadonlyForMethodSignature);
11285
11338
  }
11286
11339
 
11287
11340
  var method = nodeAny;
11288
11341
 
11289
- if (method.kind && this.match(43)) {
11342
+ if (method.kind && this.match(45)) {
11290
11343
  this.raise(this.state.pos, TSErrors.AccesorCannotHaveTypeParameters);
11291
11344
  }
11292
11345
 
@@ -11341,15 +11394,15 @@
11341
11394
  tsParseTypeMember() {
11342
11395
  var node = this.startNode();
11343
11396
 
11344
- if (this.match(10) || this.match(43)) {
11397
+ if (this.match(10) || this.match(45)) {
11345
11398
  return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
11346
11399
  }
11347
11400
 
11348
- if (this.match(71)) {
11401
+ if (this.match(73)) {
11349
11402
  var id = this.startNode();
11350
11403
  this.next();
11351
11404
 
11352
- if (this.match(10) || this.match(43)) {
11405
+ if (this.match(10) || this.match(45)) {
11353
11406
  return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
11354
11407
  } else {
11355
11408
  node.key = this.createIdentifier(id, "new");
@@ -11390,11 +11443,11 @@
11390
11443
  tsIsStartOfMappedType() {
11391
11444
  this.next();
11392
11445
 
11393
- if (this.eat(47)) {
11394
- return this.isContextual(112);
11446
+ if (this.eat(49)) {
11447
+ return this.isContextual(114);
11395
11448
  }
11396
11449
 
11397
- if (this.isContextual(112)) {
11450
+ if (this.isContextual(114)) {
11398
11451
  this.next();
11399
11452
  }
11400
11453
 
@@ -11409,13 +11462,13 @@
11409
11462
  }
11410
11463
 
11411
11464
  this.next();
11412
- return this.match(52);
11465
+ return this.match(54);
11413
11466
  }
11414
11467
 
11415
11468
  tsParseMappedTypeParameter() {
11416
11469
  var node = this.startNode();
11417
11470
  node.name = this.tsParseTypeParameterName();
11418
- node.constraint = this.tsExpectThenParseType(52);
11471
+ node.constraint = this.tsExpectThenParseType(54);
11419
11472
  return this.finishNode(node, "TSTypeParameter");
11420
11473
  }
11421
11474
 
@@ -11423,20 +11476,20 @@
11423
11476
  var node = this.startNode();
11424
11477
  this.expect(5);
11425
11478
 
11426
- if (this.match(47)) {
11479
+ if (this.match(49)) {
11427
11480
  node.readonly = this.state.value;
11428
11481
  this.next();
11429
- this.expectContextual(112);
11430
- } else if (this.eatContextual(112)) {
11482
+ this.expectContextual(114);
11483
+ } else if (this.eatContextual(114)) {
11431
11484
  node.readonly = true;
11432
11485
  }
11433
11486
 
11434
11487
  this.expect(0);
11435
11488
  node.typeParameter = this.tsParseMappedTypeParameter();
11436
- node.nameType = this.eatContextual(87) ? this.tsParseType() : null;
11489
+ node.nameType = this.eatContextual(89) ? this.tsParseType() : null;
11437
11490
  this.expect(3);
11438
11491
 
11439
- if (this.match(47)) {
11492
+ if (this.match(49)) {
11440
11493
  node.optional = this.state.value;
11441
11494
  this.next();
11442
11495
  this.expect(17);
@@ -11547,11 +11600,11 @@
11547
11600
 
11548
11601
  node.literal = (() => {
11549
11602
  switch (this.state.type) {
11550
- case 124:
11603
+ case 126:
11604
+ case 127:
11551
11605
  case 125:
11552
- case 123:
11553
- case 79:
11554
- case 80:
11606
+ case 81:
11607
+ case 82:
11555
11608
  return this.parseExprAtom();
11556
11609
 
11557
11610
  default:
@@ -11576,7 +11629,7 @@
11576
11629
  tsParseThisTypeOrThisTypePredicate() {
11577
11630
  var thisKeyword = this.tsParseThisTypeNode();
11578
11631
 
11579
- if (this.isContextual(107) && !this.hasPrecedingLineBreak()) {
11632
+ if (this.isContextual(109) && !this.hasPrecedingLineBreak()) {
11580
11633
  return this.tsParseThisTypePredicate(thisKeyword);
11581
11634
  } else {
11582
11635
  return thisKeyword;
@@ -11585,19 +11638,19 @@
11585
11638
 
11586
11639
  tsParseNonArrayType() {
11587
11640
  switch (this.state.type) {
11588
- case 123:
11589
- case 124:
11590
11641
  case 125:
11591
- case 79:
11592
- case 80:
11642
+ case 126:
11643
+ case 127:
11644
+ case 81:
11645
+ case 82:
11593
11646
  return this.tsParseLiteralTypeNode();
11594
11647
 
11595
- case 47:
11648
+ case 49:
11596
11649
  if (this.state.value === "-") {
11597
11650
  var node = this.startNode();
11598
11651
  var nextToken = this.lookahead();
11599
11652
 
11600
- if (nextToken.type !== 124 && nextToken.type !== 125) {
11653
+ if (nextToken.type !== 126 && nextToken.type !== 127) {
11601
11654
  throw this.unexpected();
11602
11655
  }
11603
11656
 
@@ -11607,13 +11660,13 @@
11607
11660
 
11608
11661
  break;
11609
11662
 
11610
- case 72:
11663
+ case 74:
11611
11664
  return this.tsParseThisTypeOrThisTypePredicate();
11612
11665
 
11613
- case 81:
11666
+ case 83:
11614
11667
  return this.tsParseTypeQuery();
11615
11668
 
11616
- case 77:
11669
+ case 79:
11617
11670
  return this.tsParseImportType();
11618
11671
 
11619
11672
  case 5:
@@ -11625,7 +11678,8 @@
11625
11678
  case 10:
11626
11679
  return this.tsParseParenthesizedType();
11627
11680
 
11628
- case 22:
11681
+ case 25:
11682
+ case 24:
11629
11683
  return this.tsParseTemplateLiteralType();
11630
11684
 
11631
11685
  default:
@@ -11634,8 +11688,8 @@
11634
11688
  type
11635
11689
  } = this.state;
11636
11690
 
11637
- if (tokenIsIdentifier(type) || type === 82 || type === 78) {
11638
- var nodeType = type === 82 ? "TSVoidKeyword" : type === 78 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
11691
+ if (tokenIsIdentifier(type) || type === 84 || type === 80) {
11692
+ var nodeType = type === 84 ? "TSVoidKeyword" : type === 80 ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
11639
11693
 
11640
11694
  if (nodeType !== undefined && this.lookaheadCharCode() !== 46) {
11641
11695
  var _node6 = this.startNode();
@@ -11701,7 +11755,7 @@
11701
11755
 
11702
11756
  tsParseInferType() {
11703
11757
  var node = this.startNode();
11704
- this.expectContextual(106);
11758
+ this.expectContextual(108);
11705
11759
  var typeParameter = this.startNode();
11706
11760
  typeParameter.name = this.tsParseTypeParameterName();
11707
11761
  node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
@@ -11710,7 +11764,7 @@
11710
11764
 
11711
11765
  tsParseTypeOperatorOrHigher() {
11712
11766
  var isTypeOperator = tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc;
11713
- return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(106) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
11767
+ return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual(108) ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
11714
11768
  }
11715
11769
 
11716
11770
  tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
@@ -11731,15 +11785,15 @@
11731
11785
  }
11732
11786
 
11733
11787
  tsParseIntersectionTypeOrHigher() {
11734
- return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 41);
11788
+ return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 43);
11735
11789
  }
11736
11790
 
11737
11791
  tsParseUnionTypeOrHigher() {
11738
- return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 39);
11792
+ return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 41);
11739
11793
  }
11740
11794
 
11741
11795
  tsIsStartOfFunctionType() {
11742
- if (this.match(43)) {
11796
+ if (this.match(45)) {
11743
11797
  return true;
11744
11798
  }
11745
11799
 
@@ -11747,7 +11801,7 @@
11747
11801
  }
11748
11802
 
11749
11803
  tsSkipParameterStart() {
11750
- if (tokenIsIdentifier(this.state.type) || this.match(72)) {
11804
+ if (tokenIsIdentifier(this.state.type) || this.match(74)) {
11751
11805
  this.next();
11752
11806
  return true;
11753
11807
  }
@@ -11797,7 +11851,7 @@
11797
11851
  }
11798
11852
 
11799
11853
  if (this.tsSkipParameterStart()) {
11800
- if (this.match(14) || this.match(12) || this.match(17) || this.match(27)) {
11854
+ if (this.match(14) || this.match(12) || this.match(17) || this.match(29)) {
11801
11855
  return true;
11802
11856
  }
11803
11857
 
@@ -11820,7 +11874,7 @@
11820
11874
  var node = this.startNode();
11821
11875
  var asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
11822
11876
 
11823
- if (asserts && this.match(72)) {
11877
+ if (asserts && this.match(74)) {
11824
11878
  var thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
11825
11879
 
11826
11880
  if (thisTypePredicate.type === "TSThisType") {
@@ -11875,21 +11929,21 @@
11875
11929
  tsParseTypePredicatePrefix() {
11876
11930
  var id = this.parseIdentifier();
11877
11931
 
11878
- if (this.isContextual(107) && !this.hasPrecedingLineBreak()) {
11932
+ if (this.isContextual(109) && !this.hasPrecedingLineBreak()) {
11879
11933
  this.next();
11880
11934
  return id;
11881
11935
  }
11882
11936
  }
11883
11937
 
11884
11938
  tsParseTypePredicateAsserts() {
11885
- if (this.state.type !== 100) {
11939
+ if (this.state.type !== 102) {
11886
11940
  return false;
11887
11941
  }
11888
11942
 
11889
11943
  var containsEsc = this.state.containsEsc;
11890
11944
  this.next();
11891
11945
 
11892
- if (!tokenIsIdentifier(this.state.type) && !this.match(72)) {
11946
+ if (!tokenIsIdentifier(this.state.type) && !this.match(74)) {
11893
11947
  return false;
11894
11948
  }
11895
11949
 
@@ -11914,7 +11968,7 @@
11914
11968
  assert(this.state.inType);
11915
11969
  var type = this.tsParseNonConditionalType();
11916
11970
 
11917
- if (this.hasPrecedingLineBreak() || !this.eat(75)) {
11971
+ if (this.hasPrecedingLineBreak() || !this.eat(77)) {
11918
11972
  return type;
11919
11973
  }
11920
11974
 
@@ -11929,7 +11983,7 @@
11929
11983
  }
11930
11984
 
11931
11985
  isAbstractConstructorSignature() {
11932
- return this.isContextual(114) && this.lookahead().type === 71;
11986
+ return this.isContextual(116) && this.lookahead().type === 73;
11933
11987
  }
11934
11988
 
11935
11989
  tsParseNonConditionalType() {
@@ -11937,7 +11991,7 @@
11937
11991
  return this.tsParseFunctionOrConstructorType("TSFunctionType");
11938
11992
  }
11939
11993
 
11940
- if (this.match(71)) {
11994
+ if (this.match(73)) {
11941
11995
  return this.tsParseFunctionOrConstructorType("TSConstructorType");
11942
11996
  } else if (this.isAbstractConstructorSignature()) {
11943
11997
  return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
@@ -11956,7 +12010,7 @@
11956
12010
  var _const = this.tsTryNextParseConstantContext();
11957
12011
 
11958
12012
  node.typeAnnotation = _const || this.tsNextThenParseType();
11959
- this.expect(44);
12013
+ this.expect(46);
11960
12014
  node.expression = this.parseMaybeUnary();
11961
12015
  return this.finishNode(node, "TSTypeAssertion");
11962
12016
  }
@@ -11976,7 +12030,7 @@
11976
12030
  var node = this.startNode();
11977
12031
  node.expression = this.tsParseEntityName(false);
11978
12032
 
11979
- if (this.match(43)) {
12033
+ if (this.match(45)) {
11980
12034
  node.typeParameters = this.tsParseTypeArguments();
11981
12035
  }
11982
12036
 
@@ -11994,7 +12048,7 @@
11994
12048
 
11995
12049
  node.typeParameters = this.tsTryParseTypeParameters();
11996
12050
 
11997
- if (this.eat(75)) {
12051
+ if (this.eat(77)) {
11998
12052
  node.extends = this.tsParseHeritageClause("extends");
11999
12053
  }
12000
12054
 
@@ -12009,9 +12063,9 @@
12009
12063
  this.checkLVal(node.id, "typescript type alias", BIND_TS_TYPE);
12010
12064
  node.typeParameters = this.tsTryParseTypeParameters();
12011
12065
  node.typeAnnotation = this.tsInType(() => {
12012
- this.expect(27);
12066
+ this.expect(29);
12013
12067
 
12014
- if (this.isContextual(105) && this.lookahead().type !== 16) {
12068
+ if (this.isContextual(107) && this.lookahead().type !== 16) {
12015
12069
  var _node8 = this.startNode();
12016
12070
 
12017
12071
  this.next();
@@ -12067,9 +12121,9 @@
12067
12121
 
12068
12122
  tsParseEnumMember() {
12069
12123
  var node = this.startNode();
12070
- node.id = this.match(123) ? this.parseExprAtom() : this.parseIdentifier(true);
12124
+ node.id = this.match(125) ? this.parseExprAtom() : this.parseIdentifier(true);
12071
12125
 
12072
- if (this.eat(27)) {
12126
+ if (this.eat(29)) {
12073
12127
  node.initializer = this.parseMaybeAssignAllowIn();
12074
12128
  }
12075
12129
 
@@ -12119,10 +12173,10 @@
12119
12173
  }
12120
12174
 
12121
12175
  tsParseAmbientExternalModuleDeclaration(node) {
12122
- if (this.isContextual(103)) {
12176
+ if (this.isContextual(105)) {
12123
12177
  node.global = true;
12124
12178
  node.id = this.parseIdentifier();
12125
- } else if (this.match(123)) {
12179
+ } else if (this.match(125)) {
12126
12180
  node.id = this.parseExprAtom();
12127
12181
  } else {
12128
12182
  this.unexpected();
@@ -12145,7 +12199,7 @@
12145
12199
  node.isExport = isExport || false;
12146
12200
  node.id = this.parseIdentifier();
12147
12201
  this.checkLVal(node.id, "import equals declaration", BIND_LEXICAL);
12148
- this.expect(27);
12202
+ this.expect(29);
12149
12203
  var moduleReference = this.tsParseModuleReference();
12150
12204
 
12151
12205
  if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
@@ -12158,7 +12212,7 @@
12158
12212
  }
12159
12213
 
12160
12214
  tsIsExternalModuleReference() {
12161
- return this.isContextual(110) && this.lookaheadCharCode() === 40;
12215
+ return this.isContextual(112) && this.lookaheadCharCode() === 40;
12162
12216
  }
12163
12217
 
12164
12218
  tsParseModuleReference() {
@@ -12167,10 +12221,10 @@
12167
12221
 
12168
12222
  tsParseExternalModuleReference() {
12169
12223
  var node = this.startNode();
12170
- this.expectContextual(110);
12224
+ this.expectContextual(112);
12171
12225
  this.expect(10);
12172
12226
 
12173
- if (!this.match(123)) {
12227
+ if (!this.match(125)) {
12174
12228
  throw this.unexpected();
12175
12229
  }
12176
12230
 
@@ -12213,33 +12267,33 @@
12213
12267
  var starttype = this.state.type;
12214
12268
  var kind;
12215
12269
 
12216
- if (this.isContextual(93)) {
12217
- starttype = 68;
12270
+ if (this.isContextual(95)) {
12271
+ starttype = 70;
12218
12272
  kind = "let";
12219
12273
  }
12220
12274
 
12221
12275
  return this.tsInAmbientContext(() => {
12222
12276
  switch (starttype) {
12223
- case 62:
12277
+ case 64:
12224
12278
  nany.declare = true;
12225
12279
  return this.parseFunctionStatement(nany, false, true);
12226
12280
 
12227
- case 74:
12281
+ case 76:
12228
12282
  nany.declare = true;
12229
12283
  return this.parseClass(nany, true, false);
12230
12284
 
12231
- case 69:
12232
- if (this.match(69) && this.isLookaheadContextual("enum")) {
12233
- this.expect(69);
12234
- this.expectContextual(116);
12285
+ case 71:
12286
+ if (this.match(71) && this.isLookaheadContextual("enum")) {
12287
+ this.expect(71);
12288
+ this.expectContextual(118);
12235
12289
  return this.tsParseEnumDeclaration(nany, true);
12236
12290
  }
12237
12291
 
12238
- case 68:
12292
+ case 70:
12239
12293
  kind = kind || this.state.value;
12240
12294
  return this.parseVarStatement(nany, kind);
12241
12295
 
12242
- case 103:
12296
+ case 105:
12243
12297
  return this.tsParseAmbientExternalModuleDeclaration(nany);
12244
12298
 
12245
12299
  default:
@@ -12293,7 +12347,7 @@
12293
12347
  tsParseDeclaration(node, value, next) {
12294
12348
  switch (value) {
12295
12349
  case "abstract":
12296
- if (this.tsCheckLineTerminator(next) && (this.match(74) || tokenIsIdentifier(this.state.type))) {
12350
+ if (this.tsCheckLineTerminator(next) && (this.match(76) || tokenIsIdentifier(this.state.type))) {
12297
12351
  return this.tsParseAbstractDeclaration(node);
12298
12352
  }
12299
12353
 
@@ -12316,7 +12370,7 @@
12316
12370
 
12317
12371
  case "module":
12318
12372
  if (this.tsCheckLineTerminator(next)) {
12319
- if (this.match(123)) {
12373
+ if (this.match(125)) {
12320
12374
  return this.tsParseAmbientExternalModuleDeclaration(node);
12321
12375
  } else if (tokenIsIdentifier(this.state.type)) {
12322
12376
  return this.tsParseModuleOrNamespaceDeclaration(node);
@@ -12352,7 +12406,7 @@
12352
12406
  }
12353
12407
 
12354
12408
  tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
12355
- if (!this.match(43)) {
12409
+ if (!this.match(45)) {
12356
12410
  return undefined;
12357
12411
  }
12358
12412
 
@@ -12378,7 +12432,7 @@
12378
12432
  tsParseTypeArguments() {
12379
12433
  var node = this.startNode();
12380
12434
  node.params = this.tsInType(() => this.tsInNoContext(() => {
12381
- this.expect(43);
12435
+ this.expect(45);
12382
12436
  return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
12383
12437
  }));
12384
12438
 
@@ -12386,7 +12440,7 @@
12386
12440
  this.raise(node.start, TSErrors.EmptyTypeArguments);
12387
12441
  }
12388
12442
 
12389
- this.expect(44);
12443
+ this.expect(46);
12390
12444
  return this.finishNode(node, "TSTypeParameterInstantiation");
12391
12445
  }
12392
12446
 
@@ -12506,7 +12560,7 @@
12506
12560
  }
12507
12561
 
12508
12562
  parseSubscript(base, startPos, startLoc, noCalls, state) {
12509
- if (!this.hasPrecedingLineBreak() && this.match(33)) {
12563
+ if (!this.hasPrecedingLineBreak() && this.match(35)) {
12510
12564
  this.state.canStartJSXElement = false;
12511
12565
  this.next();
12512
12566
  var nonNullExpression = this.startNodeAt(startPos, startLoc);
@@ -12526,7 +12580,7 @@
12526
12580
  this.next();
12527
12581
  }
12528
12582
 
12529
- if (this.match(43)) {
12583
+ if (this.match(45)) {
12530
12584
  var missingParenErrorPos;
12531
12585
  var result = this.tsTryParseAndCatch(() => {
12532
12586
  if (!noCalls && this.atPossibleAsyncArrow(base)) {
@@ -12557,7 +12611,7 @@
12557
12611
  }
12558
12612
 
12559
12613
  return this.finishCallExpression(node, state.optionalChainMember);
12560
- } else if (this.match(22)) {
12614
+ } else if (tokenIsTemplate(this.state.type)) {
12561
12615
  var _result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
12562
12616
 
12563
12617
  _result.typeParameters = typeArguments;
@@ -12579,7 +12633,7 @@
12579
12633
  }
12580
12634
 
12581
12635
  parseNewArguments(node) {
12582
- if (this.match(43)) {
12636
+ if (this.match(45)) {
12583
12637
  var typeParameters = this.tsTryParseAndCatch(() => {
12584
12638
  var args = this.tsParseTypeArguments();
12585
12639
  if (!this.match(10)) this.unexpected();
@@ -12595,7 +12649,7 @@
12595
12649
  }
12596
12650
 
12597
12651
  parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
12598
- if (tokenOperatorPrecedence(52) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual(87)) {
12652
+ if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual(89)) {
12599
12653
  var node = this.startNodeAt(leftStartPos, leftStartLoc);
12600
12654
  node.expression = left;
12601
12655
 
@@ -12622,16 +12676,16 @@
12622
12676
  parseImport(node) {
12623
12677
  node.importKind = "value";
12624
12678
 
12625
- if (tokenIsIdentifier(this.state.type) || this.match(49) || this.match(5)) {
12679
+ if (tokenIsIdentifier(this.state.type) || this.match(51) || this.match(5)) {
12626
12680
  var ahead = this.lookahead();
12627
12681
 
12628
- if (this.isContextual(120) && ahead.type !== 12 && ahead.type !== 91 && ahead.type !== 27) {
12682
+ if (this.isContextual(122) && ahead.type !== 12 && ahead.type !== 93 && ahead.type !== 29) {
12629
12683
  node.importKind = "type";
12630
12684
  this.next();
12631
12685
  ahead = this.lookahead();
12632
12686
  }
12633
12687
 
12634
- if (tokenIsIdentifier(this.state.type) && ahead.type === 27) {
12688
+ if (tokenIsIdentifier(this.state.type) && ahead.type === 29) {
12635
12689
  return this.tsParseImportEqualsDeclaration(node);
12636
12690
  }
12637
12691
  }
@@ -12646,10 +12700,10 @@
12646
12700
  }
12647
12701
 
12648
12702
  parseExport(node) {
12649
- if (this.match(77)) {
12703
+ if (this.match(79)) {
12650
12704
  this.next();
12651
12705
 
12652
- if (this.isContextual(120) && this.lookaheadCharCode() !== 61) {
12706
+ if (this.isContextual(122) && this.lookaheadCharCode() !== 61) {
12653
12707
  node.importKind = "type";
12654
12708
  this.next();
12655
12709
  } else {
@@ -12657,19 +12711,19 @@
12657
12711
  }
12658
12712
 
12659
12713
  return this.tsParseImportEqualsDeclaration(node, true);
12660
- } else if (this.eat(27)) {
12714
+ } else if (this.eat(29)) {
12661
12715
  var assign = node;
12662
12716
  assign.expression = this.parseExpression();
12663
12717
  this.semicolon();
12664
12718
  return this.finishNode(assign, "TSExportAssignment");
12665
- } else if (this.eatContextual(87)) {
12719
+ } else if (this.eatContextual(89)) {
12666
12720
  var decl = node;
12667
- this.expectContextual(118);
12721
+ this.expectContextual(120);
12668
12722
  decl.id = this.parseIdentifier();
12669
12723
  this.semicolon();
12670
12724
  return this.finishNode(decl, "TSNamespaceExportDeclaration");
12671
12725
  } else {
12672
- if (this.isContextual(120) && this.lookahead().type === 5) {
12726
+ if (this.isContextual(122) && this.lookahead().type === 5) {
12673
12727
  this.next();
12674
12728
  node.exportKind = "type";
12675
12729
  } else {
@@ -12681,7 +12735,7 @@
12681
12735
  }
12682
12736
 
12683
12737
  isAbstractClass() {
12684
- return this.isContextual(114) && this.lookahead().type === 74;
12738
+ return this.isContextual(116) && this.lookahead().type === 76;
12685
12739
  }
12686
12740
 
12687
12741
  parseExportDefaultExpression() {
@@ -12693,7 +12747,7 @@
12693
12747
  return cls;
12694
12748
  }
12695
12749
 
12696
- if (this.match(119)) {
12750
+ if (this.match(121)) {
12697
12751
  var interfaceNode = this.startNode();
12698
12752
  this.next();
12699
12753
  var result = this.tsParseInterfaceDeclaration(interfaceNode);
@@ -12704,13 +12758,13 @@
12704
12758
  }
12705
12759
 
12706
12760
  parseStatementContent(context, topLevel) {
12707
- if (this.state.type === 69) {
12761
+ if (this.state.type === 71) {
12708
12762
  var ahead = this.lookahead();
12709
12763
 
12710
- if (ahead.type === 116) {
12764
+ if (ahead.type === 118) {
12711
12765
  var node = this.startNode();
12712
12766
  this.next();
12713
- this.expectContextual(116);
12767
+ this.expectContextual(118);
12714
12768
  return this.tsParseEnumDeclaration(node, true);
12715
12769
  }
12716
12770
  }
@@ -12733,7 +12787,7 @@
12733
12787
  }
12734
12788
 
12735
12789
  tsIsStartOfStaticBlocks() {
12736
- return this.isContextual(98) && this.lookaheadCharCode() === 123;
12790
+ return this.isContextual(100) && this.lookaheadCharCode() === 123;
12737
12791
  }
12738
12792
 
12739
12793
  parseClassMember(classBody, member, state) {
@@ -12863,9 +12917,9 @@
12863
12917
  parseExportDeclaration(node) {
12864
12918
  var startPos = this.state.start;
12865
12919
  var startLoc = this.state.startLoc;
12866
- var isDeclare = this.eatContextual(115);
12920
+ var isDeclare = this.eatContextual(117);
12867
12921
 
12868
- if (isDeclare && (this.isContextual(115) || !this.shouldParseExportDeclaration())) {
12922
+ if (isDeclare && (this.isContextual(117) || !this.shouldParseExportDeclaration())) {
12869
12923
  throw this.raise(this.state.start, TSErrors.ExpectedAmbientAfterExportDeclare);
12870
12924
  }
12871
12925
 
@@ -12892,7 +12946,7 @@
12892
12946
  }
12893
12947
 
12894
12948
  parseClassId(node, isStatement, optionalId) {
12895
- if ((!isStatement || optionalId) && this.isContextual(104)) {
12949
+ if ((!isStatement || optionalId) && this.isContextual(106)) {
12896
12950
  return;
12897
12951
  }
12898
12952
 
@@ -12902,7 +12956,7 @@
12902
12956
  }
12903
12957
 
12904
12958
  parseClassPropertyAnnotation(node) {
12905
- if (!node.optional && this.eat(33)) {
12959
+ if (!node.optional && this.eat(35)) {
12906
12960
  node.definite = true;
12907
12961
  }
12908
12962
 
@@ -12913,11 +12967,11 @@
12913
12967
  parseClassProperty(node) {
12914
12968
  this.parseClassPropertyAnnotation(node);
12915
12969
 
12916
- if (this.state.isAmbientContext && this.match(27)) {
12970
+ if (this.state.isAmbientContext && this.match(29)) {
12917
12971
  this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer);
12918
12972
  }
12919
12973
 
12920
- if (node.abstract && this.match(27)) {
12974
+ if (node.abstract && this.match(29)) {
12921
12975
  var {
12922
12976
  key
12923
12977
  } = node;
@@ -12970,11 +13024,11 @@
12970
13024
  parseClassSuper(node) {
12971
13025
  super.parseClassSuper(node);
12972
13026
 
12973
- if (node.superClass && this.match(43)) {
13027
+ if (node.superClass && this.match(45)) {
12974
13028
  node.superTypeParameters = this.tsParseTypeArguments();
12975
13029
  }
12976
13030
 
12977
- if (this.eatContextual(104)) {
13031
+ if (this.eatContextual(106)) {
12978
13032
  node.implements = this.tsParseHeritageClause("implements");
12979
13033
  }
12980
13034
  }
@@ -12999,7 +13053,7 @@
12999
13053
  parseVarId(decl, kind) {
13000
13054
  super.parseVarId(decl, kind);
13001
13055
 
13002
- if (decl.id.type === "Identifier" && this.eat(33)) {
13056
+ if (decl.id.type === "Identifier" && this.eat(35)) {
13003
13057
  decl.definite = true;
13004
13058
  }
13005
13059
 
@@ -13030,22 +13084,21 @@
13030
13084
  var jsx;
13031
13085
  var typeCast;
13032
13086
 
13033
- if (this.hasPlugin("jsx") && (this.match(132) || this.match(43))) {
13087
+ if (this.hasPlugin("jsx") && (this.match(134) || this.match(45))) {
13034
13088
  state = this.state.clone();
13035
13089
  jsx = this.tryParse(() => super.parseMaybeAssign(...args), state);
13036
13090
  if (!jsx.error) return jsx.node;
13037
13091
  var {
13038
13092
  context
13039
13093
  } = this.state;
13094
+ var currentContext = context[context.length - 1];
13040
13095
 
13041
- if (context[context.length - 1] === types.j_oTag) {
13042
- context.length -= 2;
13043
- } else if (context[context.length - 1] === types.j_expr) {
13044
- context.length -= 1;
13096
+ if (currentContext === types.j_oTag || currentContext === types.j_expr) {
13097
+ context.pop();
13045
13098
  }
13046
13099
  }
13047
13100
 
13048
- if (!((_jsx = jsx) != null && _jsx.error) && !this.match(43)) {
13101
+ if (!((_jsx = jsx) != null && _jsx.error) && !this.match(45)) {
13049
13102
  return super.parseMaybeAssign(...args);
13050
13103
  }
13051
13104
 
@@ -13111,7 +13164,7 @@
13111
13164
  }
13112
13165
 
13113
13166
  parseMaybeUnary(refExpressionErrors) {
13114
- if (!this.hasPlugin("jsx") && this.match(43)) {
13167
+ if (!this.hasPlugin("jsx") && this.match(45)) {
13115
13168
  return this.tsParseTypeAssertion();
13116
13169
  } else {
13117
13170
  return super.parseMaybeUnary(refExpressionErrors);
@@ -13239,7 +13292,7 @@
13239
13292
 
13240
13293
  parseBindingAtom() {
13241
13294
  switch (this.state.type) {
13242
- case 72:
13295
+ case 74:
13243
13296
  return this.parseIdentifier(true);
13244
13297
 
13245
13298
  default:
@@ -13248,7 +13301,7 @@
13248
13301
  }
13249
13302
 
13250
13303
  parseMaybeDecoratorArguments(expr) {
13251
- if (this.match(43)) {
13304
+ if (this.match(45)) {
13252
13305
  var typeArguments = this.tsParseTypeArguments();
13253
13306
 
13254
13307
  if (this.match(10)) {
@@ -13272,11 +13325,11 @@
13272
13325
  }
13273
13326
 
13274
13327
  isClassMethod() {
13275
- return this.match(43) || super.isClassMethod();
13328
+ return this.match(45) || super.isClassMethod();
13276
13329
  }
13277
13330
 
13278
13331
  isClassProperty() {
13279
- return this.match(33) || this.match(14) || super.isClassProperty();
13332
+ return this.match(35) || this.match(14) || super.isClassProperty();
13280
13333
  }
13281
13334
 
13282
13335
  parseMaybeDefault() {
@@ -13292,11 +13345,11 @@
13292
13345
  getTokenFromCode(code) {
13293
13346
  if (this.state.inType) {
13294
13347
  if (code === 62) {
13295
- return this.finishOp(44, 1);
13348
+ return this.finishOp(46, 1);
13296
13349
  }
13297
13350
 
13298
13351
  if (code === 60) {
13299
- return this.finishOp(43, 1);
13352
+ return this.finishOp(45, 1);
13300
13353
  }
13301
13354
  }
13302
13355
 
@@ -13308,10 +13361,10 @@
13308
13361
  type
13309
13362
  } = this.state;
13310
13363
 
13311
- if (type === 43) {
13364
+ if (type === 45) {
13312
13365
  this.state.pos -= 1;
13313
13366
  this.readToken_lt();
13314
- } else if (type === 44) {
13367
+ } else if (type === 46) {
13315
13368
  this.state.pos -= 1;
13316
13369
  this.readToken_gt();
13317
13370
  }
@@ -13365,7 +13418,7 @@
13365
13418
  }
13366
13419
 
13367
13420
  jsxParseOpeningElementAfterName(node) {
13368
- if (this.match(43)) {
13421
+ if (this.match(45)) {
13369
13422
  var typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArguments());
13370
13423
  if (typeArguments) node.typeParameters = typeArguments;
13371
13424
  }
@@ -13420,10 +13473,10 @@
13420
13473
  }
13421
13474
 
13422
13475
  tsParseAbstractDeclaration(node) {
13423
- if (this.match(74)) {
13476
+ if (this.match(76)) {
13424
13477
  node.abstract = true;
13425
13478
  return this.parseClass(node, true, false);
13426
- } else if (this.isContextual(119)) {
13479
+ } else if (this.isContextual(121)) {
13427
13480
  if (!this.hasFollowingLineBreak()) {
13428
13481
  node.abstract = true;
13429
13482
  this.raise(node.start, TSErrors.NonClassMethodPropertyHasAbstractModifer);
@@ -13431,7 +13484,7 @@
13431
13484
  return this.tsParseInterfaceDeclaration(node);
13432
13485
  }
13433
13486
  } else {
13434
- this.unexpected(null, 74);
13487
+ this.unexpected(null, 76);
13435
13488
  }
13436
13489
  }
13437
13490
 
@@ -13506,10 +13559,10 @@
13506
13559
  var canParseAsKeyword = true;
13507
13560
  var pos = leftOfAs.start;
13508
13561
 
13509
- if (this.isContextual(87)) {
13562
+ if (this.isContextual(89)) {
13510
13563
  var firstAs = this.parseIdentifier();
13511
13564
 
13512
- if (this.isContextual(87)) {
13565
+ if (this.isContextual(89)) {
13513
13566
  var secondAs = this.parseIdentifier();
13514
13567
 
13515
13568
  if (tokenIsKeywordOrIdentifier(this.state.type)) {
@@ -13542,7 +13595,7 @@
13542
13595
  var kindKey = isImport ? "importKind" : "exportKind";
13543
13596
  node[kindKey] = hasTypeSpecifier ? "type" : "value";
13544
13597
 
13545
- if (canParseAsKeyword && this.eatContextual(87)) {
13598
+ if (canParseAsKeyword && this.eatContextual(89)) {
13546
13599
  node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
13547
13600
  }
13548
13601
 
@@ -13563,13 +13616,13 @@
13563
13616
 
13564
13617
  var placeholders = superClass => class extends superClass {
13565
13618
  parsePlaceholder(expectedNode) {
13566
- if (this.match(134)) {
13619
+ if (this.match(136)) {
13567
13620
  var node = this.startNode();
13568
13621
  this.next();
13569
13622
  this.assertNoSpace("Unexpected space in placeholder.");
13570
13623
  node.name = super.parseIdentifier(true);
13571
13624
  this.assertNoSpace("Unexpected space in placeholder.");
13572
- this.expect(134);
13625
+ this.expect(136);
13573
13626
  return this.finishPlaceholder(node, expectedNode);
13574
13627
  }
13575
13628
  }
@@ -13582,7 +13635,7 @@
13582
13635
 
13583
13636
  getTokenFromCode(code) {
13584
13637
  if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
13585
- return this.finishOp(134, 2);
13638
+ return this.finishOp(136, 2);
13586
13639
  }
13587
13640
 
13588
13641
  return super.getTokenFromCode(...arguments);
@@ -13622,14 +13675,14 @@
13622
13675
  return true;
13623
13676
  }
13624
13677
 
13625
- if (!this.isContextual(93)) {
13678
+ if (!this.isContextual(95)) {
13626
13679
  return false;
13627
13680
  }
13628
13681
 
13629
13682
  if (context) return false;
13630
13683
  var nextToken = this.lookahead();
13631
13684
 
13632
- if (nextToken.type === 134) {
13685
+ if (nextToken.type === 136) {
13633
13686
  return true;
13634
13687
  }
13635
13688
 
@@ -13675,7 +13728,7 @@
13675
13728
  var placeholder = this.parsePlaceholder("Identifier");
13676
13729
 
13677
13730
  if (placeholder) {
13678
- if (this.match(75) || this.match(134) || this.match(5)) {
13731
+ if (this.match(77) || this.match(136) || this.match(5)) {
13679
13732
  node.id = placeholder;
13680
13733
  } else if (optionalId || !isStatement) {
13681
13734
  node.id = null;
@@ -13697,7 +13750,7 @@
13697
13750
  var placeholder = this.parsePlaceholder("Identifier");
13698
13751
  if (!placeholder) return super.parseExport(...arguments);
13699
13752
 
13700
- if (!this.isContextual(91) && !this.match(12)) {
13753
+ if (!this.isContextual(93) && !this.match(12)) {
13701
13754
  node.specifiers = [];
13702
13755
  node.source = null;
13703
13756
  node.declaration = this.finishPlaceholder(placeholder, "Declaration");
@@ -13712,11 +13765,11 @@
13712
13765
  }
13713
13766
 
13714
13767
  isExportDefaultSpecifier() {
13715
- if (this.match(59)) {
13768
+ if (this.match(61)) {
13716
13769
  var next = this.nextTokenStart();
13717
13770
 
13718
13771
  if (this.isUnparsedContextual(next, "from")) {
13719
- if (this.input.startsWith(tokenLabelName(134), this.nextTokenStartSince(next + 4))) {
13772
+ if (this.input.startsWith(tokenLabelName(136), this.nextTokenStartSince(next + 4))) {
13720
13773
  return true;
13721
13774
  }
13722
13775
  }
@@ -13751,7 +13804,7 @@
13751
13804
  if (!placeholder) return super.parseImport(...arguments);
13752
13805
  node.specifiers = [];
13753
13806
 
13754
- if (!this.isContextual(91) && !this.match(12)) {
13807
+ if (!this.isContextual(93) && !this.match(12)) {
13755
13808
  node.source = this.finishPlaceholder(placeholder, "StringLiteral");
13756
13809
  this.semicolon();
13757
13810
  return this.finishNode(node, "ImportDeclaration");
@@ -13767,7 +13820,7 @@
13767
13820
  if (!hasStarImport) this.parseNamedImportSpecifiers(node);
13768
13821
  }
13769
13822
 
13770
- this.expectContextual(91);
13823
+ this.expectContextual(93);
13771
13824
  node.source = this.parseImportSource();
13772
13825
  this.semicolon();
13773
13826
  return this.finishNode(node, "ImportDeclaration");
@@ -13781,7 +13834,7 @@
13781
13834
 
13782
13835
  var v8intrinsic = superClass => class extends superClass {
13783
13836
  parseV8Intrinsic() {
13784
- if (this.match(48)) {
13837
+ if (this.match(50)) {
13785
13838
  var v8IntrinsicStart = this.state.start;
13786
13839
  var node = this.startNode();
13787
13840
  this.next();
@@ -13806,12 +13859,27 @@
13806
13859
 
13807
13860
  };
13808
13861
 
13809
- function hasPlugin(plugins, name) {
13810
- return plugins.some(plugin => {
13811
- if (Array.isArray(plugin)) {
13812
- return plugin[0] === name;
13862
+ function hasPlugin(plugins, expectedConfig) {
13863
+ var [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig;
13864
+ var expectedKeys = Object.keys(expectedOptions);
13865
+ var expectedOptionsIsEmpty = expectedKeys.length === 0;
13866
+ return plugins.some(p => {
13867
+ if (typeof p === "string") {
13868
+ return expectedOptionsIsEmpty && p === expectedName;
13813
13869
  } else {
13814
- return plugin === name;
13870
+ var [pluginName, pluginOptions] = p;
13871
+
13872
+ if (pluginName !== expectedName) {
13873
+ return false;
13874
+ }
13875
+
13876
+ for (var key of expectedKeys) {
13877
+ if (pluginOptions[key] !== expectedOptions[key]) {
13878
+ return false;
13879
+ }
13880
+ }
13881
+
13882
+ return true;
13815
13883
  }
13816
13884
  });
13817
13885
  }
@@ -13867,7 +13935,9 @@
13867
13935
  throw new Error("\"pipelineOperator\" requires \"proposal\" option whose value must be one of: ".concat(proposalList, "."));
13868
13936
  }
13869
13937
 
13870
- var tupleSyntaxIsHash = hasPlugin(plugins, "recordAndTuple") && getPluginOption(plugins, "recordAndTuple", "syntaxType") === "hash";
13938
+ var tupleSyntaxIsHash = hasPlugin(plugins, ["recordAndTuple", {
13939
+ syntaxType: "hash"
13940
+ }]);
13871
13941
 
13872
13942
  if (proposal === "hack") {
13873
13943
  if (hasPlugin(plugins, "placeholders")) {
@@ -14204,11 +14274,11 @@
14204
14274
  } else {
14205
14275
  var decorators = [];
14206
14276
 
14207
- if (this.match(24) && this.hasPlugin("decorators")) {
14277
+ if (this.match(26) && this.hasPlugin("decorators")) {
14208
14278
  this.raise(this.state.start, ErrorMessages.UnsupportedParameterDecorator);
14209
14279
  }
14210
14280
 
14211
- while (this.match(24)) {
14281
+ while (this.match(26)) {
14212
14282
  decorators.push(this.parseDecorator());
14213
14283
  }
14214
14284
 
@@ -14267,7 +14337,7 @@
14267
14337
  startLoc = (_startLoc = startLoc) != null ? _startLoc : this.state.startLoc;
14268
14338
  startPos = (_startPos = startPos) != null ? _startPos : this.state.start;
14269
14339
  left = (_left = left) != null ? _left : this.parseBindingAtom();
14270
- if (!this.eat(27)) return left;
14340
+ if (!this.eat(29)) return left;
14271
14341
  var node = this.startNodeAt(startPos, startLoc);
14272
14342
  node.left = left;
14273
14343
  node.right = this.parseMaybeAssignAllowIn();
@@ -14419,7 +14489,7 @@
14419
14489
  this.nextToken();
14420
14490
  var expr = this.parseExpression();
14421
14491
 
14422
- if (!this.match(129)) {
14492
+ if (!this.match(131)) {
14423
14493
  this.unexpected();
14424
14494
  }
14425
14495
 
@@ -14480,7 +14550,7 @@
14480
14550
  var startPos = this.state.start;
14481
14551
  var startLoc = this.state.startLoc;
14482
14552
 
14483
- if (this.isContextual(99)) {
14553
+ if (this.isContextual(101)) {
14484
14554
  if (this.prodParam.hasYield) {
14485
14555
  var _left2 = this.parseYield();
14486
14556
 
@@ -14520,7 +14590,7 @@
14520
14590
  var operator = this.state.value;
14521
14591
  node.operator = operator;
14522
14592
 
14523
- if (this.match(27)) {
14593
+ if (this.match(29)) {
14524
14594
  node.left = this.toAssignable(left, true);
14525
14595
 
14526
14596
  if (refExpressionErrors.doubleProto >= startPos) {
@@ -14572,7 +14642,7 @@
14572
14642
  }
14573
14643
 
14574
14644
  parseMaybeUnaryOrPrivate(refExpressionErrors) {
14575
- return this.match(128) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
14645
+ return this.match(130) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
14576
14646
  }
14577
14647
 
14578
14648
  parseExprOps(refExpressionErrors) {
@@ -14595,7 +14665,7 @@
14595
14665
  start
14596
14666
  } = left;
14597
14667
 
14598
- if (minPrec >= tokenOperatorPrecedence(52) || !this.prodParam.hasIn || !this.match(52)) {
14668
+ if (minPrec >= tokenOperatorPrecedence(54) || !this.prodParam.hasIn || !this.match(54)) {
14599
14669
  this.raise(start, ErrorMessages.PrivateInExpectedIn, value);
14600
14670
  }
14601
14671
 
@@ -14604,11 +14674,11 @@
14604
14674
 
14605
14675
  var op = this.state.type;
14606
14676
 
14607
- if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(52))) {
14677
+ if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(54))) {
14608
14678
  var prec = tokenOperatorPrecedence(op);
14609
14679
 
14610
14680
  if (prec > minPrec) {
14611
- if (op === 35) {
14681
+ if (op === 37) {
14612
14682
  this.expectPlugin("pipelineOperator");
14613
14683
 
14614
14684
  if (this.state.inFSharpPipelineDirectBody) {
@@ -14621,17 +14691,19 @@
14621
14691
  var node = this.startNodeAt(leftStartPos, leftStartLoc);
14622
14692
  node.left = left;
14623
14693
  node.operator = this.state.value;
14624
- var logical = op === 37 || op === 38;
14625
- var coalesce = op === 36;
14694
+ var logical = op === 39 || op === 40;
14695
+ var coalesce = op === 38;
14626
14696
 
14627
14697
  if (coalesce) {
14628
- prec = tokenOperatorPrecedence(38);
14698
+ prec = tokenOperatorPrecedence(40);
14629
14699
  }
14630
14700
 
14631
14701
  this.next();
14632
14702
 
14633
- if (op === 35 && this.getPluginOption("pipelineOperator", "proposal") === "minimal") {
14634
- if (this.state.type === 90 && this.prodParam.hasAwait) {
14703
+ if (op === 37 && this.hasPlugin(["pipelineOperator", {
14704
+ proposal: "minimal"
14705
+ }])) {
14706
+ if (this.state.type === 92 && this.prodParam.hasAwait) {
14635
14707
  throw this.raise(this.state.start, ErrorMessages.UnexpectedAwaitAfterPipelineBody);
14636
14708
  }
14637
14709
  }
@@ -14640,7 +14712,7 @@
14640
14712
  this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
14641
14713
  var nextOp = this.state.type;
14642
14714
 
14643
- if (coalesce && (nextOp === 37 || nextOp === 38) || logical && nextOp === 36) {
14715
+ if (coalesce && (nextOp === 39 || nextOp === 40) || logical && nextOp === 38) {
14644
14716
  throw this.raise(this.state.start, ErrorMessages.MixingCoalesceWithLogical);
14645
14717
  }
14646
14718
 
@@ -14656,7 +14728,7 @@
14656
14728
  var startLoc = this.state.startLoc;
14657
14729
 
14658
14730
  switch (op) {
14659
- case 35:
14731
+ case 37:
14660
14732
  switch (this.getPluginOption("pipelineOperator", "proposal")) {
14661
14733
  case "hack":
14662
14734
  return this.withTopicBindingContext(() => {
@@ -14665,7 +14737,7 @@
14665
14737
 
14666
14738
  case "smart":
14667
14739
  return this.withTopicBindingContext(() => {
14668
- if (this.prodParam.hasYield && this.isContextual(99)) {
14740
+ if (this.prodParam.hasYield && this.isContextual(101)) {
14669
14741
  throw this.raise(this.state.start, ErrorMessages.PipeBodyIsTighter, this.state.value);
14670
14742
  }
14671
14743
 
@@ -14709,7 +14781,7 @@
14709
14781
  }
14710
14782
 
14711
14783
  checkExponentialAfterUnary(node) {
14712
- if (this.match(51)) {
14784
+ if (this.match(53)) {
14713
14785
  this.raise(node.argument.start, ErrorMessages.UnexpectedTokenUnaryExponentiation);
14714
14786
  }
14715
14787
  }
@@ -14717,7 +14789,7 @@
14717
14789
  parseMaybeUnary(refExpressionErrors, sawUnary) {
14718
14790
  var startPos = this.state.start;
14719
14791
  var startLoc = this.state.startLoc;
14720
- var isAwait = this.isContextual(90);
14792
+ var isAwait = this.isContextual(92);
14721
14793
 
14722
14794
  if (isAwait && this.isAwaitAllowed()) {
14723
14795
  this.next();
@@ -14728,18 +14800,18 @@
14728
14800
  return _expr;
14729
14801
  }
14730
14802
 
14731
- var update = this.match(32);
14803
+ var update = this.match(34);
14732
14804
  var node = this.startNode();
14733
14805
 
14734
14806
  if (tokenIsPrefix(this.state.type)) {
14735
14807
  node.operator = this.state.value;
14736
14808
  node.prefix = true;
14737
14809
 
14738
- if (this.match(66)) {
14810
+ if (this.match(68)) {
14739
14811
  this.expectPlugin("throwExpressions");
14740
14812
  }
14741
14813
 
14742
- var isDelete = this.match(83);
14814
+ var isDelete = this.match(85);
14743
14815
  this.next();
14744
14816
  node.argument = this.parseMaybeUnary(null, true);
14745
14817
  this.checkExpressionErrors(refExpressionErrors, true);
@@ -14767,7 +14839,7 @@
14767
14839
  type
14768
14840
  } = this.state;
14769
14841
 
14770
- var _startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(48);
14842
+ var _startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(50);
14771
14843
 
14772
14844
  if (_startsExpr && !this.isAmbiguousAwait()) {
14773
14845
  this.raiseOverwrite(startPos, ErrorMessages.AwaitNotInAsyncContext);
@@ -14832,15 +14904,19 @@
14832
14904
  }
14833
14905
 
14834
14906
  parseSubscript(base, startPos, startLoc, noCalls, state) {
14835
- if (!noCalls && this.eat(15)) {
14907
+ var {
14908
+ type
14909
+ } = this.state;
14910
+
14911
+ if (!noCalls && type === 15) {
14836
14912
  return this.parseBind(base, startPos, startLoc, noCalls, state);
14837
- } else if (this.match(22)) {
14913
+ } else if (tokenIsTemplate(type)) {
14838
14914
  return this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
14839
14915
  }
14840
14916
 
14841
14917
  var optional = false;
14842
14918
 
14843
- if (this.match(18)) {
14919
+ if (type === 18) {
14844
14920
  if (noCalls && this.lookaheadCharCode() === 40) {
14845
14921
  state.stop = true;
14846
14922
  return base;
@@ -14868,21 +14944,19 @@
14868
14944
  var node = this.startNodeAt(startPos, startLoc);
14869
14945
  node.object = base;
14870
14946
  node.computed = computed;
14871
- var privateName = !computed && this.match(128) && this.state.value;
14872
- var property = computed ? this.parseExpression() : privateName ? this.parsePrivateName() : this.parseIdentifier(true);
14873
14947
 
14874
- if (privateName !== false) {
14875
- if (node.object.type === "Super") {
14948
+ if (computed) {
14949
+ node.property = this.parseExpression();
14950
+ this.expect(3);
14951
+ } else if (this.match(130)) {
14952
+ if (base.type === "Super") {
14876
14953
  this.raise(startPos, ErrorMessages.SuperPrivateField);
14877
14954
  }
14878
14955
 
14879
- this.classScope.usePrivateName(privateName, property.start);
14880
- }
14881
-
14882
- node.property = property;
14883
-
14884
- if (computed) {
14885
- this.expect(3);
14956
+ this.classScope.usePrivateName(this.state.value, this.state.start);
14957
+ node.property = this.parsePrivateName();
14958
+ } else {
14959
+ node.property = this.parseIdentifier(true);
14886
14960
  }
14887
14961
 
14888
14962
  if (state.optionalChainMember) {
@@ -14896,6 +14970,7 @@
14896
14970
  parseBind(base, startPos, startLoc, noCalls, state) {
14897
14971
  var node = this.startNodeAt(startPos, startLoc);
14898
14972
  node.object = base;
14973
+ this.next();
14899
14974
  node.callee = this.parseNoCallExpr();
14900
14975
  state.stop = true;
14901
14976
  return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
@@ -15056,10 +15131,10 @@
15056
15131
  } = this.state;
15057
15132
 
15058
15133
  switch (type) {
15059
- case 73:
15134
+ case 75:
15060
15135
  return this.parseSuper();
15061
15136
 
15062
- case 77:
15137
+ case 79:
15063
15138
  node = this.startNode();
15064
15139
  this.next();
15065
15140
 
@@ -15073,42 +15148,42 @@
15073
15148
 
15074
15149
  return this.finishNode(node, "Import");
15075
15150
 
15076
- case 72:
15151
+ case 74:
15077
15152
  node = this.startNode();
15078
15153
  this.next();
15079
15154
  return this.finishNode(node, "ThisExpression");
15080
15155
 
15081
- case 84:
15156
+ case 86:
15082
15157
  {
15083
15158
  return this.parseDo(this.startNode(), false);
15084
15159
  }
15085
15160
 
15086
- case 50:
15087
- case 29:
15161
+ case 52:
15162
+ case 31:
15088
15163
  {
15089
15164
  this.readRegexp();
15090
15165
  return this.parseRegExpLiteral(this.state.value);
15091
15166
  }
15092
15167
 
15093
- case 124:
15168
+ case 126:
15094
15169
  return this.parseNumericLiteral(this.state.value);
15095
15170
 
15096
- case 125:
15171
+ case 127:
15097
15172
  return this.parseBigIntLiteral(this.state.value);
15098
15173
 
15099
- case 126:
15174
+ case 128:
15100
15175
  return this.parseDecimalLiteral(this.state.value);
15101
15176
 
15102
- case 123:
15177
+ case 125:
15103
15178
  return this.parseStringLiteral(this.state.value);
15104
15179
 
15105
- case 78:
15180
+ case 80:
15106
15181
  return this.parseNullLiteral();
15107
15182
 
15108
- case 79:
15183
+ case 81:
15109
15184
  return this.parseBooleanLiteral(true);
15110
15185
 
15111
- case 80:
15186
+ case 82:
15112
15187
  return this.parseBooleanLiteral(false);
15113
15188
 
15114
15189
  case 10:
@@ -15139,21 +15214,22 @@
15139
15214
  return this.parseObjectLike(8, false, false, refExpressionErrors);
15140
15215
  }
15141
15216
 
15142
- case 62:
15217
+ case 64:
15143
15218
  return this.parseFunctionOrFunctionSent();
15144
15219
 
15145
- case 24:
15220
+ case 26:
15146
15221
  this.parseDecorators();
15147
15222
 
15148
- case 74:
15223
+ case 76:
15149
15224
  node = this.startNode();
15150
15225
  this.takeDecorators(node);
15151
15226
  return this.parseClass(node, false);
15152
15227
 
15153
- case 71:
15228
+ case 73:
15154
15229
  return this.parseNewOrNewTarget();
15155
15230
 
15156
- case 22:
15231
+ case 25:
15232
+ case 24:
15157
15233
  return this.parseTemplate(false);
15158
15234
 
15159
15235
  case 15:
@@ -15170,25 +15246,25 @@
15170
15246
  }
15171
15247
  }
15172
15248
 
15173
- case 128:
15249
+ case 130:
15174
15250
  {
15175
15251
  this.raise(this.state.start, ErrorMessages.PrivateInExpectedIn, this.state.value);
15176
15252
  return this.parsePrivateName();
15177
15253
  }
15178
15254
 
15179
- case 31:
15255
+ case 33:
15180
15256
  {
15181
- return this.parseTopicReferenceThenEqualsSign(48, "%");
15257
+ return this.parseTopicReferenceThenEqualsSign(50, "%");
15182
15258
  }
15183
15259
 
15184
- case 30:
15260
+ case 32:
15185
15261
  {
15186
- return this.parseTopicReferenceThenEqualsSign(40, "^");
15262
+ return this.parseTopicReferenceThenEqualsSign(42, "^");
15187
15263
  }
15188
15264
 
15189
- case 40:
15190
- case 48:
15191
- case 25:
15265
+ case 42:
15266
+ case 50:
15267
+ case 27:
15192
15268
  {
15193
15269
  var pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
15194
15270
 
@@ -15199,7 +15275,7 @@
15199
15275
  }
15200
15276
  }
15201
15277
 
15202
- case 43:
15278
+ case 45:
15203
15279
  {
15204
15280
  var lookaheadCh = this.input.codePointAt(this.nextTokenStart());
15205
15281
 
@@ -15213,7 +15289,7 @@
15213
15289
 
15214
15290
  default:
15215
15291
  if (tokenIsIdentifier(type)) {
15216
- if (this.isContextual(117) && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) {
15292
+ if (this.isContextual(119) && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) {
15217
15293
  return this.parseModuleExpression();
15218
15294
  }
15219
15295
 
@@ -15227,7 +15303,7 @@
15227
15303
  type: _type
15228
15304
  } = this.state;
15229
15305
 
15230
- if (_type === 62) {
15306
+ if (_type === 64) {
15231
15307
  this.resetPreviousNodeTrailingComments(id);
15232
15308
  this.next();
15233
15309
  return this.parseFunction(this.startNodeAtNode(id), undefined, true);
@@ -15237,7 +15313,7 @@
15237
15313
  } else {
15238
15314
  return id;
15239
15315
  }
15240
- } else if (_type === 84) {
15316
+ } else if (_type === 86) {
15241
15317
  this.resetPreviousNodeTrailingComments(id);
15242
15318
  return this.parseDo(this.startNodeAtNode(id), true);
15243
15319
  }
@@ -15308,12 +15384,13 @@
15308
15384
  switch (pipeProposal) {
15309
15385
  case "hack":
15310
15386
  {
15311
- var pluginTopicToken = this.getPluginOption("pipelineOperator", "topicToken");
15312
- return tokenLabelName(tokenType) === pluginTopicToken;
15387
+ return this.hasPlugin(["pipelineOperator", {
15388
+ topicToken: tokenLabelName(tokenType)
15389
+ }]);
15313
15390
  }
15314
15391
 
15315
15392
  case "smart":
15316
- return tokenType === 25;
15393
+ return tokenType === 27;
15317
15394
 
15318
15395
  default:
15319
15396
  throw this.raise(start, ErrorMessages.PipeTopicRequiresHackPipes);
@@ -15392,7 +15469,7 @@
15392
15469
  var meta = this.createIdentifier(this.startNodeAtNode(node), "function");
15393
15470
  this.next();
15394
15471
 
15395
- if (this.match(96)) {
15472
+ if (this.match(98)) {
15396
15473
  this.expectPlugin("functionSent");
15397
15474
  } else if (!this.hasPlugin("functionSent")) {
15398
15475
  this.unexpected();
@@ -15420,7 +15497,7 @@
15420
15497
  var id = this.createIdentifier(this.startNodeAtNode(node), "import");
15421
15498
  this.next();
15422
15499
 
15423
- if (this.isContextual(94)) {
15500
+ if (this.isContextual(96)) {
15424
15501
  if (!this.inModule) {
15425
15502
  this.raise(id.start, SourceTypeModuleErrorMessages.ImportMetaOutsideModule);
15426
15503
  }
@@ -15628,38 +15705,46 @@
15628
15705
  }
15629
15706
 
15630
15707
  parseTemplateElement(isTagged) {
15631
- var elem = this.startNode();
15708
+ var {
15709
+ start,
15710
+ end,
15711
+ value
15712
+ } = this.state;
15713
+ var elemStart = start + 1;
15714
+ var elem = this.startNodeAt(elemStart, createPositionWithColumnOffset(this.state.startLoc, 1));
15632
15715
 
15633
- if (this.state.value === null) {
15716
+ if (value === null) {
15634
15717
  if (!isTagged) {
15635
- this.raise(this.state.start + 1, ErrorMessages.InvalidEscapeSequenceTemplate);
15718
+ this.raise(start + 2, ErrorMessages.InvalidEscapeSequenceTemplate);
15636
15719
  }
15637
15720
  }
15638
15721
 
15722
+ var isTail = this.match(24);
15723
+ var endOffset = isTail ? -1 : -2;
15724
+ var elemEnd = end + endOffset;
15639
15725
  elem.value = {
15640
- raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"),
15641
- cooked: this.state.value
15726
+ raw: this.input.slice(elemStart, elemEnd).replace(/\r\n?/g, "\n"),
15727
+ cooked: value === null ? null : value.slice(1, endOffset)
15642
15728
  };
15729
+ elem.tail = isTail;
15643
15730
  this.next();
15644
- elem.tail = this.match(22);
15645
- return this.finishNode(elem, "TemplateElement");
15731
+ this.finishNode(elem, "TemplateElement");
15732
+ this.resetEndLocation(elem, elemEnd, createPositionWithColumnOffset(this.state.lastTokEndLoc, endOffset));
15733
+ return elem;
15646
15734
  }
15647
15735
 
15648
15736
  parseTemplate(isTagged) {
15649
15737
  var node = this.startNode();
15650
- this.next();
15651
15738
  node.expressions = [];
15652
15739
  var curElt = this.parseTemplateElement(isTagged);
15653
15740
  node.quasis = [curElt];
15654
15741
 
15655
15742
  while (!curElt.tail) {
15656
- this.expect(23);
15657
15743
  node.expressions.push(this.parseTemplateSubstitution());
15658
- this.expect(8);
15744
+ this.readTemplateContinuation();
15659
15745
  node.quasis.push(curElt = this.parseTemplateElement(isTagged));
15660
15746
  }
15661
15747
 
15662
- this.next();
15663
15748
  return this.finishNode(node, "TemplateLiteral");
15664
15749
  }
15665
15750
 
@@ -15726,18 +15811,18 @@
15726
15811
  }
15727
15812
 
15728
15813
  maybeAsyncOrAccessorProp(prop) {
15729
- return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(49));
15814
+ return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(0) || this.match(51));
15730
15815
  }
15731
15816
 
15732
15817
  parsePropertyDefinition(refExpressionErrors) {
15733
15818
  var decorators = [];
15734
15819
 
15735
- if (this.match(24)) {
15820
+ if (this.match(26)) {
15736
15821
  if (this.hasPlugin("decorators")) {
15737
15822
  this.raise(this.state.start, ErrorMessages.UnsupportedPropertyDecorator);
15738
15823
  }
15739
15824
 
15740
- while (this.match(24)) {
15825
+ while (this.match(26)) {
15741
15826
  decorators.push(this.parseDecorator());
15742
15827
  }
15743
15828
  }
@@ -15765,7 +15850,7 @@
15765
15850
  startLoc = this.state.startLoc;
15766
15851
  }
15767
15852
 
15768
- var isGenerator = this.eat(49);
15853
+ var isGenerator = this.eat(51);
15769
15854
  this.parsePropertyNamePrefixOperator(prop);
15770
15855
  var containsEsc = this.state.containsEsc;
15771
15856
  var key = this.parsePropertyName(prop);
@@ -15776,7 +15861,7 @@
15776
15861
  if (keyName === "async" && !this.hasPrecedingLineBreak()) {
15777
15862
  isAsync = true;
15778
15863
  this.resetPreviousNodeTrailingComments(key);
15779
- isGenerator = this.eat(49);
15864
+ isGenerator = this.eat(51);
15780
15865
  this.parsePropertyName(prop);
15781
15866
  }
15782
15867
 
@@ -15785,7 +15870,7 @@
15785
15870
  this.resetPreviousNodeTrailingComments(key);
15786
15871
  prop.kind = keyName;
15787
15872
 
15788
- if (this.match(49)) {
15873
+ if (this.match(51)) {
15789
15874
  isGenerator = true;
15790
15875
  this.raise(this.state.pos, ErrorMessages.AccessorIsGenerator, keyName);
15791
15876
  this.next();
@@ -15855,9 +15940,15 @@
15855
15940
 
15856
15941
  if (isPattern) {
15857
15942
  prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
15858
- } else if (this.match(27) && refExpressionErrors) {
15859
- if (refExpressionErrors.shorthandAssign === -1) {
15860
- refExpressionErrors.shorthandAssign = this.state.start;
15943
+ } else if (this.match(29)) {
15944
+ var shorthandAssign = this.state.start;
15945
+
15946
+ if (refExpressionErrors != null) {
15947
+ if (refExpressionErrors.shorthandAssign === -1) {
15948
+ refExpressionErrors.shorthandAssign = shorthandAssign;
15949
+ }
15950
+ } else {
15951
+ this.raise(shorthandAssign, ErrorMessages.InvalidCoverInitializedName);
15861
15952
  }
15862
15953
 
15863
15954
  prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
@@ -15892,23 +15983,23 @@
15892
15983
  key = this.parseIdentifier(true);
15893
15984
  } else {
15894
15985
  switch (type) {
15895
- case 124:
15986
+ case 126:
15896
15987
  key = this.parseNumericLiteral(value);
15897
15988
  break;
15898
15989
 
15899
- case 123:
15990
+ case 125:
15900
15991
  key = this.parseStringLiteral(value);
15901
15992
  break;
15902
15993
 
15903
- case 125:
15994
+ case 127:
15904
15995
  key = this.parseBigIntLiteral(value);
15905
15996
  break;
15906
15997
 
15907
- case 126:
15998
+ case 128:
15908
15999
  key = this.parseDecimalLiteral(value);
15909
16000
  break;
15910
16001
 
15911
- case 128:
16002
+ case 130:
15912
16003
  {
15913
16004
  var privateKeyPos = this.state.start + 1;
15914
16005
  this.raise(privateKeyPos, ErrorMessages.UnexpectedPrivateField);
@@ -15923,7 +16014,7 @@
15923
16014
 
15924
16015
  prop.key = key;
15925
16016
 
15926
- if (type !== 128) {
16017
+ if (type !== 130) {
15927
16018
  prop.computed = false;
15928
16019
  }
15929
16020
  }
@@ -16137,7 +16228,7 @@
16137
16228
 
16138
16229
  if (liberal) {
16139
16230
  if (tokenIsKeyword) {
16140
- this.replaceToken(122);
16231
+ this.replaceToken(124);
16141
16232
  }
16142
16233
  } else {
16143
16234
  this.checkReservedWord(name, start, tokenIsKeyword, false);
@@ -16204,7 +16295,7 @@
16204
16295
  var node = this.startNodeAt(startPos, startLoc);
16205
16296
  this.expressionScope.recordParameterInitializerError(node.start, ErrorMessages.AwaitExpressionFormalParameter);
16206
16297
 
16207
- if (this.eat(49)) {
16298
+ if (this.eat(51)) {
16208
16299
  this.raise(node.start, ErrorMessages.ObsoleteAwaitStar);
16209
16300
  }
16210
16301
 
@@ -16224,7 +16315,11 @@
16224
16315
  }
16225
16316
 
16226
16317
  isAmbiguousAwait() {
16227
- return this.hasPrecedingLineBreak() || this.match(47) || this.match(10) || this.match(0) || this.match(22) || this.match(127) || this.match(50) || this.hasPlugin("v8intrinsic") && this.match(48);
16318
+ if (this.hasPrecedingLineBreak()) return true;
16319
+ var {
16320
+ type
16321
+ } = this.state;
16322
+ return type === 49 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 129 || type === 52 || this.hasPlugin("v8intrinsic") && type === 50;
16228
16323
  }
16229
16324
 
16230
16325
  parseYield() {
@@ -16235,11 +16330,11 @@
16235
16330
  var argument = null;
16236
16331
 
16237
16332
  if (!this.hasPrecedingLineBreak()) {
16238
- delegating = this.eat(49);
16333
+ delegating = this.eat(51);
16239
16334
 
16240
16335
  switch (this.state.type) {
16241
16336
  case 13:
16242
- case 129:
16337
+ case 131:
16243
16338
  case 8:
16244
16339
  case 11:
16245
16340
  case 3:
@@ -16259,7 +16354,9 @@
16259
16354
  }
16260
16355
 
16261
16356
  checkPipelineAtInfixOperator(left, leftStartPos) {
16262
- if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
16357
+ if (this.hasPlugin(["pipelineOperator", {
16358
+ proposal: "smart"
16359
+ }])) {
16263
16360
  if (left.type === "SequenceExpression") {
16264
16361
  this.raise(leftStartPos, ErrorMessages.PipelineHeadSequenceExpression);
16265
16362
  }
@@ -16321,9 +16418,9 @@
16321
16418
  }
16322
16419
 
16323
16420
  withSmartMixTopicForbiddingContext(callback) {
16324
- var proposal = this.getPluginOption("pipelineOperator", "proposal");
16325
-
16326
- if (proposal === "smart") {
16421
+ if (this.hasPlugin(["pipelineOperator", {
16422
+ proposal: "smart"
16423
+ }])) {
16327
16424
  var outerContextTopicState = this.state.topicContext;
16328
16425
  this.state.topicContext = {
16329
16426
  maxNumOfResolvableTopics: 0,
@@ -16444,44 +16541,117 @@
16444
16541
  var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
16445
16542
  var keywordRelationalOperator = /in(?:stanceof)?/y;
16446
16543
 
16447
- function babel7CompatTokens(tokens) {
16544
+ function babel7CompatTokens(tokens, input) {
16448
16545
  for (var i = 0; i < tokens.length; i++) {
16449
16546
  var token = tokens[i];
16450
16547
  var {
16451
16548
  type
16452
16549
  } = token;
16453
16550
 
16454
- if (type === 128) {
16551
+ if (typeof type === "number") {
16455
16552
  {
16456
- var {
16457
- loc,
16458
- start,
16459
- value,
16460
- end
16461
- } = token;
16462
- var hashEndPos = start + 1;
16463
- var hashEndLoc = new Position(loc.start.line, loc.start.column + 1);
16464
- tokens.splice(i, 1, new Token({
16465
- type: getExportedToken(25),
16466
- value: "#",
16467
- start: start,
16468
- end: hashEndPos,
16469
- startLoc: loc.start,
16470
- endLoc: hashEndLoc
16471
- }), new Token({
16472
- type: getExportedToken(122),
16473
- value: value,
16474
- start: hashEndPos,
16475
- end: end,
16476
- startLoc: hashEndLoc,
16477
- endLoc: loc.end
16478
- }));
16479
- i++;
16480
- continue;
16481
- }
16482
- }
16553
+ if (type === 130) {
16554
+ var {
16555
+ loc,
16556
+ start,
16557
+ value,
16558
+ end
16559
+ } = token;
16560
+ var hashEndPos = start + 1;
16561
+ var hashEndLoc = createPositionWithColumnOffset(loc.start, 1);
16562
+ tokens.splice(i, 1, new Token({
16563
+ type: getExportedToken(27),
16564
+ value: "#",
16565
+ start: start,
16566
+ end: hashEndPos,
16567
+ startLoc: loc.start,
16568
+ endLoc: hashEndLoc
16569
+ }), new Token({
16570
+ type: getExportedToken(124),
16571
+ value: value,
16572
+ start: hashEndPos,
16573
+ end: end,
16574
+ startLoc: hashEndLoc,
16575
+ endLoc: loc.end
16576
+ }));
16577
+ i++;
16578
+ continue;
16579
+ }
16483
16580
 
16484
- if (typeof type === "number") {
16581
+ if (tokenIsTemplate(type)) {
16582
+ var {
16583
+ loc: _loc,
16584
+ start: _start,
16585
+ value: _value,
16586
+ end: _end
16587
+ } = token;
16588
+ var backquoteEnd = _start + 1;
16589
+ var backquoteEndLoc = createPositionWithColumnOffset(_loc.start, 1);
16590
+ var startToken = void 0;
16591
+
16592
+ if (input.charCodeAt(_start) === 96) {
16593
+ startToken = new Token({
16594
+ type: getExportedToken(22),
16595
+ value: "`",
16596
+ start: _start,
16597
+ end: backquoteEnd,
16598
+ startLoc: _loc.start,
16599
+ endLoc: backquoteEndLoc
16600
+ });
16601
+ } else {
16602
+ startToken = new Token({
16603
+ type: getExportedToken(8),
16604
+ value: "}",
16605
+ start: _start,
16606
+ end: backquoteEnd,
16607
+ startLoc: _loc.start,
16608
+ endLoc: backquoteEndLoc
16609
+ });
16610
+ }
16611
+
16612
+ var templateValue = void 0,
16613
+ templateElementEnd = void 0,
16614
+ templateElementEndLoc = void 0,
16615
+ endToken = void 0;
16616
+
16617
+ if (type === 24) {
16618
+ templateElementEnd = _end - 1;
16619
+ templateElementEndLoc = createPositionWithColumnOffset(_loc.end, -1);
16620
+ templateValue = _value === null ? null : _value.slice(1, -1);
16621
+ endToken = new Token({
16622
+ type: getExportedToken(22),
16623
+ value: "`",
16624
+ start: templateElementEnd,
16625
+ end: _end,
16626
+ startLoc: templateElementEndLoc,
16627
+ endLoc: _loc.end
16628
+ });
16629
+ } else {
16630
+ templateElementEnd = _end - 2;
16631
+ templateElementEndLoc = createPositionWithColumnOffset(_loc.end, -2);
16632
+ templateValue = _value === null ? null : _value.slice(1, -2);
16633
+ endToken = new Token({
16634
+ type: getExportedToken(23),
16635
+ value: "${",
16636
+ start: templateElementEnd,
16637
+ end: _end,
16638
+ startLoc: templateElementEndLoc,
16639
+ endLoc: _loc.end
16640
+ });
16641
+ }
16642
+
16643
+ tokens.splice(i, 1, startToken, new Token({
16644
+ type: getExportedToken(20),
16645
+ value: templateValue,
16646
+ start: backquoteEnd,
16647
+ end: templateElementEnd,
16648
+ startLoc: backquoteEndLoc,
16649
+ endLoc: templateElementEndLoc
16650
+ }), endToken);
16651
+ i += 2;
16652
+ continue;
16653
+ }
16654
+ }
16485
16655
  token.type = getExportedToken(type);
16486
16656
  }
16487
16657
  }
@@ -16493,12 +16663,16 @@
16493
16663
  parseTopLevel(file, program) {
16494
16664
  file.program = this.parseProgram(program);
16495
16665
  file.comments = this.state.comments;
16496
- if (this.options.tokens) file.tokens = babel7CompatTokens(this.tokens);
16666
+
16667
+ if (this.options.tokens) {
16668
+ file.tokens = babel7CompatTokens(this.tokens, this.input);
16669
+ }
16670
+
16497
16671
  return this.finishNode(file, "File");
16498
16672
  }
16499
16673
 
16500
16674
  parseProgram(program) {
16501
- var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 129;
16675
+ var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 131;
16502
16676
  var sourceType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.sourceType;
16503
16677
  program.sourceType = sourceType;
16504
16678
  program.interpreter = this.parseInterpreterDirective();
@@ -16531,7 +16705,7 @@
16531
16705
  }
16532
16706
 
16533
16707
  parseInterpreterDirective() {
16534
- if (!this.match(26)) {
16708
+ if (!this.match(28)) {
16535
16709
  return null;
16536
16710
  }
16537
16711
 
@@ -16542,7 +16716,7 @@
16542
16716
  }
16543
16717
 
16544
16718
  isLet(context) {
16545
- if (!this.isContextual(93)) {
16719
+ if (!this.isContextual(95)) {
16546
16720
  return false;
16547
16721
  }
16548
16722
 
@@ -16578,7 +16752,7 @@
16578
16752
  }
16579
16753
 
16580
16754
  parseStatement(context, topLevel) {
16581
- if (this.match(24)) {
16755
+ if (this.match(26)) {
16582
16756
  this.parseDecorators(true);
16583
16757
  }
16584
16758
 
@@ -16591,27 +16765,27 @@
16591
16765
  var kind;
16592
16766
 
16593
16767
  if (this.isLet(context)) {
16594
- starttype = 68;
16768
+ starttype = 70;
16595
16769
  kind = "let";
16596
16770
  }
16597
16771
 
16598
16772
  switch (starttype) {
16599
- case 54:
16773
+ case 56:
16600
16774
  return this.parseBreakContinueStatement(node, true);
16601
16775
 
16602
- case 57:
16776
+ case 59:
16603
16777
  return this.parseBreakContinueStatement(node, false);
16604
16778
 
16605
- case 58:
16779
+ case 60:
16606
16780
  return this.parseDebuggerStatement(node);
16607
16781
 
16608
- case 84:
16782
+ case 86:
16609
16783
  return this.parseDoStatement(node);
16610
16784
 
16611
- case 85:
16785
+ case 87:
16612
16786
  return this.parseForStatement(node);
16613
16787
 
16614
- case 62:
16788
+ case 64:
16615
16789
  if (this.lookaheadCharCode() === 46) break;
16616
16790
 
16617
16791
  if (context) {
@@ -16624,27 +16798,27 @@
16624
16798
 
16625
16799
  return this.parseFunctionStatement(node, false, !context);
16626
16800
 
16627
- case 74:
16801
+ case 76:
16628
16802
  if (context) this.unexpected();
16629
16803
  return this.parseClass(node, true);
16630
16804
 
16631
- case 63:
16805
+ case 65:
16632
16806
  return this.parseIfStatement(node);
16633
16807
 
16634
- case 64:
16808
+ case 66:
16635
16809
  return this.parseReturnStatement(node);
16636
16810
 
16637
- case 65:
16811
+ case 67:
16638
16812
  return this.parseSwitchStatement(node);
16639
16813
 
16640
- case 66:
16814
+ case 68:
16641
16815
  return this.parseThrowStatement(node);
16642
16816
 
16643
- case 67:
16817
+ case 69:
16644
16818
  return this.parseTryStatement(node);
16645
16819
 
16646
- case 69:
16647
- case 68:
16820
+ case 71:
16821
+ case 70:
16648
16822
  kind = kind || this.state.value;
16649
16823
 
16650
16824
  if (context && kind !== "var") {
@@ -16653,10 +16827,10 @@
16653
16827
 
16654
16828
  return this.parseVarStatement(node, kind);
16655
16829
 
16656
- case 86:
16830
+ case 88:
16657
16831
  return this.parseWhileStatement(node);
16658
16832
 
16659
- case 70:
16833
+ case 72:
16660
16834
  return this.parseWithStatement(node);
16661
16835
 
16662
16836
  case 5:
@@ -16665,7 +16839,7 @@
16665
16839
  case 13:
16666
16840
  return this.parseEmptyStatement(node);
16667
16841
 
16668
- case 77:
16842
+ case 79:
16669
16843
  {
16670
16844
  var nextTokenCharCode = this.lookaheadCharCode();
16671
16845
 
@@ -16674,7 +16848,7 @@
16674
16848
  }
16675
16849
  }
16676
16850
 
16677
- case 76:
16851
+ case 78:
16678
16852
  {
16679
16853
  if (!this.options.allowImportExportEverywhere && !topLevel) {
16680
16854
  this.raise(this.state.start, ErrorMessages.UnexpectedImportExport);
@@ -16683,7 +16857,7 @@
16683
16857
  this.next();
16684
16858
  var result;
16685
16859
 
16686
- if (starttype === 77) {
16860
+ if (starttype === 79) {
16687
16861
  result = this.parseImport(node);
16688
16862
 
16689
16863
  if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
@@ -16741,18 +16915,18 @@
16741
16915
  }
16742
16916
 
16743
16917
  canHaveLeadingDecorator() {
16744
- return this.match(74);
16918
+ return this.match(76);
16745
16919
  }
16746
16920
 
16747
16921
  parseDecorators(allowExport) {
16748
16922
  var currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
16749
16923
 
16750
- while (this.match(24)) {
16924
+ while (this.match(26)) {
16751
16925
  var decorator = this.parseDecorator();
16752
16926
  currentContextDecorators.push(decorator);
16753
16927
  }
16754
16928
 
16755
- if (this.match(76)) {
16929
+ if (this.match(78)) {
16756
16930
  if (!allowExport) {
16757
16931
  this.unexpected();
16758
16932
  }
@@ -16862,7 +17036,7 @@
16862
17036
  this.state.labels.push(loopLabel);
16863
17037
  node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("do"));
16864
17038
  this.state.labels.pop();
16865
- this.expect(86);
17039
+ this.expect(88);
16866
17040
  node.test = this.parseHeaderExpression();
16867
17041
  this.eat(13);
16868
17042
  return this.finishNode(node, "DoWhileStatement");
@@ -16873,7 +17047,7 @@
16873
17047
  this.state.labels.push(loopLabel);
16874
17048
  var awaitAt = -1;
16875
17049
 
16876
- if (this.isAwaitAllowed() && this.eatContextual(90)) {
17050
+ if (this.isAwaitAllowed() && this.eatContextual(92)) {
16877
17051
  awaitAt = this.state.lastTokStart;
16878
17052
  }
16879
17053
 
@@ -16888,10 +17062,10 @@
16888
17062
  return this.parseFor(node, null);
16889
17063
  }
16890
17064
 
16891
- var startsWithLet = this.isContextual(93);
17065
+ var startsWithLet = this.isContextual(95);
16892
17066
  var isLet = startsWithLet && this.isLetKeyword();
16893
17067
 
16894
- if (this.match(68) || this.match(69) || isLet) {
17068
+ if (this.match(70) || this.match(71) || isLet) {
16895
17069
  var _init = this.startNode();
16896
17070
 
16897
17071
  var kind = isLet ? "let" : this.state.value;
@@ -16899,7 +17073,7 @@
16899
17073
  this.parseVar(_init, true, kind);
16900
17074
  this.finishNode(_init, "VariableDeclaration");
16901
17075
 
16902
- if ((this.match(52) || this.isContextual(95)) && _init.declarations.length === 1) {
17076
+ if ((this.match(54) || this.isContextual(97)) && _init.declarations.length === 1) {
16903
17077
  return this.parseForIn(node, _init, awaitAt);
16904
17078
  }
16905
17079
 
@@ -16910,10 +17084,10 @@
16910
17084
  return this.parseFor(node, _init);
16911
17085
  }
16912
17086
 
16913
- var startsWithAsync = this.isContextual(89);
17087
+ var startsWithAsync = this.isContextual(91);
16914
17088
  var refExpressionErrors = new ExpressionErrors();
16915
17089
  var init = this.parseExpression(true, refExpressionErrors);
16916
- var isForOf = this.isContextual(95);
17090
+ var isForOf = this.isContextual(97);
16917
17091
 
16918
17092
  if (isForOf) {
16919
17093
  if (startsWithLet) {
@@ -16923,7 +17097,7 @@
16923
17097
  }
16924
17098
  }
16925
17099
 
16926
- if (isForOf || this.match(52)) {
17100
+ if (isForOf || this.match(54)) {
16927
17101
  this.toAssignable(init, true);
16928
17102
  var description = isForOf ? "for-of statement" : "for-in statement";
16929
17103
  this.checkLVal(init, description);
@@ -16948,7 +17122,7 @@
16948
17122
  this.next();
16949
17123
  node.test = this.parseHeaderExpression();
16950
17124
  node.consequent = this.parseStatement("if");
16951
- node.alternate = this.eat(60) ? this.parseStatement("if") : null;
17125
+ node.alternate = this.eat(62) ? this.parseStatement("if") : null;
16952
17126
  return this.finishNode(node, "IfStatement");
16953
17127
  }
16954
17128
 
@@ -16979,8 +17153,8 @@
16979
17153
  var cur;
16980
17154
 
16981
17155
  for (var sawDefault; !this.match(8);) {
16982
- if (this.match(55) || this.match(59)) {
16983
- var isCase = this.match(55);
17156
+ if (this.match(57) || this.match(61)) {
17157
+ var isCase = this.match(57);
16984
17158
  if (cur) this.finishNode(cur, "SwitchCase");
16985
17159
  cases.push(cur = this.startNode());
16986
17160
  cur.consequent = [];
@@ -17039,7 +17213,7 @@
17039
17213
  node.block = this.parseBlock();
17040
17214
  node.handler = null;
17041
17215
 
17042
- if (this.match(56)) {
17216
+ if (this.match(58)) {
17043
17217
  var clause = this.startNode();
17044
17218
  this.next();
17045
17219
 
@@ -17057,7 +17231,7 @@
17057
17231
  node.handler = this.finishNode(clause, "CatchClause");
17058
17232
  }
17059
17233
 
17060
- node.finalizer = this.eat(61) ? this.parseBlock() : null;
17234
+ node.finalizer = this.eat(63) ? this.parseBlock() : null;
17061
17235
 
17062
17236
  if (!node.handler && !node.finalizer) {
17063
17237
  this.raise(node.start, ErrorMessages.NoCatchOrFinally);
@@ -17105,7 +17279,7 @@
17105
17279
  }
17106
17280
  }
17107
17281
 
17108
- var kind = tokenIsLoop(this.state.type) ? "loop" : this.match(65) ? "switch" : null;
17282
+ var kind = tokenIsLoop(this.state.type) ? "loop" : this.match(67) ? "switch" : null;
17109
17283
 
17110
17284
  for (var i = this.state.labels.length - 1; i >= 0; i--) {
17111
17285
  var _label = this.state.labels[i];
@@ -17223,7 +17397,7 @@
17223
17397
  }
17224
17398
 
17225
17399
  parseForIn(node, init, awaitAt) {
17226
- var isForIn = this.match(52);
17400
+ var isForIn = this.match(54);
17227
17401
  this.next();
17228
17402
 
17229
17403
  if (isForIn) {
@@ -17256,14 +17430,14 @@
17256
17430
  var decl = this.startNode();
17257
17431
  this.parseVarId(decl, kind);
17258
17432
 
17259
- if (this.eat(27)) {
17433
+ if (this.eat(29)) {
17260
17434
  decl.init = isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
17261
17435
  } else {
17262
- if (kind === "const" && !(this.match(52) || this.isContextual(95))) {
17436
+ if (kind === "const" && !(this.match(54) || this.isContextual(97))) {
17263
17437
  if (!isTypescript) {
17264
17438
  this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Const declarations");
17265
17439
  }
17266
- } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(52) || this.isContextual(95)))) {
17440
+ } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(54) || this.isContextual(97)))) {
17267
17441
  this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Complex binding patterns");
17268
17442
  }
17269
17443
 
@@ -17290,11 +17464,11 @@
17290
17464
  var requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID);
17291
17465
  this.initFunction(node, isAsync);
17292
17466
 
17293
- if (this.match(49) && isHangingStatement) {
17467
+ if (this.match(51) && isHangingStatement) {
17294
17468
  this.raise(this.state.start, ErrorMessages.GeneratorInSingleStatementContext);
17295
17469
  }
17296
17470
 
17297
- node.generator = this.eat(49);
17471
+ node.generator = this.eat(51);
17298
17472
 
17299
17473
  if (isStatement) {
17300
17474
  node.id = this.parseFunctionId(requireId);
@@ -17352,7 +17526,7 @@
17352
17526
  }
17353
17527
 
17354
17528
  isClassProperty() {
17355
- return this.match(27) || this.match(13) || this.match(8);
17529
+ return this.match(29) || this.match(13) || this.match(8);
17356
17530
  }
17357
17531
 
17358
17532
  isClassMethod() {
@@ -17383,7 +17557,7 @@
17383
17557
  continue;
17384
17558
  }
17385
17559
 
17386
- if (this.match(24)) {
17560
+ if (this.match(26)) {
17387
17561
  decorators.push(this.parseDecorator());
17388
17562
  continue;
17389
17563
  }
@@ -17439,7 +17613,7 @@
17439
17613
  }
17440
17614
 
17441
17615
  parseClassMember(classBody, member, state) {
17442
- var isStatic = this.isContextual(98);
17616
+ var isStatic = this.isContextual(100);
17443
17617
 
17444
17618
  if (isStatic) {
17445
17619
  if (this.parseClassMemberFromModifier(classBody, member)) {
@@ -17465,9 +17639,9 @@
17465
17639
  member.static = isStatic;
17466
17640
  this.parsePropertyNamePrefixOperator(member);
17467
17641
 
17468
- if (this.eat(49)) {
17642
+ if (this.eat(51)) {
17469
17643
  method.kind = "method";
17470
- var isPrivateName = this.match(128);
17644
+ var isPrivateName = this.match(130);
17471
17645
  this.parseClassElementName(method);
17472
17646
 
17473
17647
  if (isPrivateName) {
@@ -17484,7 +17658,7 @@
17484
17658
  }
17485
17659
 
17486
17660
  var isContextual = tokenIsIdentifier(this.state.type) && !this.state.containsEsc;
17487
- var isPrivate = this.match(128);
17661
+ var isPrivate = this.match(130);
17488
17662
  var key = this.parseClassElementName(member);
17489
17663
  var maybeQuestionTokenStart = this.state.start;
17490
17664
  this.parsePostMemberNameModifiers(publicMember);
@@ -17524,7 +17698,7 @@
17524
17698
  }
17525
17699
  } else if (isContextual && key.name === "async" && !this.isLineTerminator()) {
17526
17700
  this.resetPreviousNodeTrailingComments(key);
17527
- var isGenerator = this.eat(49);
17701
+ var isGenerator = this.eat(51);
17528
17702
 
17529
17703
  if (publicMember.optional) {
17530
17704
  this.unexpected(maybeQuestionTokenStart);
@@ -17532,7 +17706,7 @@
17532
17706
 
17533
17707
  method.kind = "method";
17534
17708
 
17535
- var _isPrivate = this.match(128);
17709
+ var _isPrivate = this.match(130);
17536
17710
 
17537
17711
  this.parseClassElementName(method);
17538
17712
  this.parsePostMemberNameModifiers(publicMember);
@@ -17546,11 +17720,11 @@
17546
17720
 
17547
17721
  this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
17548
17722
  }
17549
- } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(49) && this.isLineTerminator())) {
17723
+ } else if (isContextual && (key.name === "get" || key.name === "set") && !(this.match(51) && this.isLineTerminator())) {
17550
17724
  this.resetPreviousNodeTrailingComments(key);
17551
17725
  method.kind = key.name;
17552
17726
 
17553
- var _isPrivate2 = this.match(128);
17727
+ var _isPrivate2 = this.match(130);
17554
17728
 
17555
17729
  this.parseClassElementName(publicMethod);
17556
17730
 
@@ -17583,11 +17757,11 @@
17583
17757
  start
17584
17758
  } = this.state;
17585
17759
 
17586
- if ((type === 122 || type === 123) && member.static && value === "prototype") {
17760
+ if ((type === 124 || type === 125) && member.static && value === "prototype") {
17587
17761
  this.raise(start, ErrorMessages.StaticPrototype);
17588
17762
  }
17589
17763
 
17590
- if (type === 128) {
17764
+ if (type === 130) {
17591
17765
  if (value === "constructor") {
17592
17766
  this.raise(start, ErrorMessages.ConstructorClassPrivateField);
17593
17767
  }
@@ -17666,7 +17840,7 @@
17666
17840
  this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
17667
17841
  this.expressionScope.enter(newExpressionScope());
17668
17842
  this.prodParam.enter(PARAM);
17669
- node.value = this.eat(27) ? this.parseMaybeAssignAllowIn() : null;
17843
+ node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
17670
17844
  this.expressionScope.exit();
17671
17845
  this.prodParam.exit();
17672
17846
  this.scope.exit();
@@ -17691,7 +17865,7 @@
17691
17865
  }
17692
17866
 
17693
17867
  parseClassSuper(node) {
17694
- node.superClass = this.eat(75) ? this.parseExprSubscripts() : null;
17868
+ node.superClass = this.eat(77) ? this.parseExprSubscripts() : null;
17695
17869
  }
17696
17870
 
17697
17871
  parseExport(node) {
@@ -17728,7 +17902,7 @@
17728
17902
  return this.finishNode(node, "ExportNamedDeclaration");
17729
17903
  }
17730
17904
 
17731
- if (this.eat(59)) {
17905
+ if (this.eat(61)) {
17732
17906
  node.declaration = this.parseExportDefaultExpression();
17733
17907
  this.checkExport(node, true, true);
17734
17908
  return this.finishNode(node, "ExportDefaultDeclaration");
@@ -17738,7 +17912,7 @@
17738
17912
  }
17739
17913
 
17740
17914
  eatExportStar(node) {
17741
- return this.eat(49);
17915
+ return this.eat(51);
17742
17916
  }
17743
17917
 
17744
17918
  maybeParseExportDefaultSpecifier(node) {
@@ -17754,7 +17928,7 @@
17754
17928
  }
17755
17929
 
17756
17930
  maybeParseExportNamespaceSpecifier(node) {
17757
- if (this.isContextual(87)) {
17931
+ if (this.isContextual(89)) {
17758
17932
  if (!node.specifiers) node.specifiers = [];
17759
17933
  var specifier = this.startNodeAt(this.state.lastTokStart, this.state.lastTokStartLoc);
17760
17934
  this.next();
@@ -17801,7 +17975,7 @@
17801
17975
  }
17802
17976
 
17803
17977
  isAsyncFunction() {
17804
- if (!this.isContextual(89)) return false;
17978
+ if (!this.isContextual(91)) return false;
17805
17979
  var next = this.nextTokenStart();
17806
17980
  return !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function");
17807
17981
  }
@@ -17810,7 +17984,7 @@
17810
17984
  var expr = this.startNode();
17811
17985
  var isAsync = this.isAsyncFunction();
17812
17986
 
17813
- if (this.match(62) || isAsync) {
17987
+ if (this.match(64) || isAsync) {
17814
17988
  this.next();
17815
17989
 
17816
17990
  if (isAsync) {
@@ -17818,16 +17992,16 @@
17818
17992
  }
17819
17993
 
17820
17994
  return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync);
17821
- } else if (this.match(74)) {
17995
+ } else if (this.match(76)) {
17822
17996
  return this.parseClass(expr, true, true);
17823
- } else if (this.match(24)) {
17997
+ } else if (this.match(26)) {
17824
17998
  if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport")) {
17825
17999
  this.raise(this.state.start, ErrorMessages.DecoratorBeforeExport);
17826
18000
  }
17827
18001
 
17828
18002
  this.parseDecorators(false);
17829
18003
  return this.parseClass(expr, true, true);
17830
- } else if (this.match(69) || this.match(68) || this.isLet()) {
18004
+ } else if (this.match(71) || this.match(70) || this.isLet()) {
17831
18005
  throw this.raise(this.state.start, ErrorMessages.UnsupportedDefaultExport);
17832
18006
  } else {
17833
18007
  var res = this.parseMaybeAssignAllowIn();
@@ -17846,21 +18020,21 @@
17846
18020
  } = this.state;
17847
18021
 
17848
18022
  if (tokenIsIdentifier(type)) {
17849
- if (type === 89 && !this.state.containsEsc || type === 93) {
18023
+ if (type === 91 && !this.state.containsEsc || type === 95) {
17850
18024
  return false;
17851
18025
  }
17852
18026
 
17853
- if ((type === 120 || type === 119) && !this.state.containsEsc) {
18027
+ if ((type === 122 || type === 121) && !this.state.containsEsc) {
17854
18028
  var {
17855
18029
  type: nextType
17856
18030
  } = this.lookahead();
17857
18031
 
17858
- if (tokenIsIdentifier(nextType) && nextType !== 91 || nextType === 5) {
18032
+ if (tokenIsIdentifier(nextType) && nextType !== 93 || nextType === 5) {
17859
18033
  this.expectOnePlugin(["flow", "typescript"]);
17860
18034
  return false;
17861
18035
  }
17862
18036
  }
17863
- } else if (!this.match(59)) {
18037
+ } else if (!this.match(61)) {
17864
18038
  return false;
17865
18039
  }
17866
18040
 
@@ -17871,7 +18045,7 @@
17871
18045
  return true;
17872
18046
  }
17873
18047
 
17874
- if (this.match(59) && hasFrom) {
18048
+ if (this.match(61) && hasFrom) {
17875
18049
  var nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
17876
18050
  return nextAfterFrom === 34 || nextAfterFrom === 39;
17877
18051
  }
@@ -17880,7 +18054,7 @@
17880
18054
  }
17881
18055
 
17882
18056
  parseExportFrom(node, expect) {
17883
- if (this.eatContextual(91)) {
18057
+ if (this.eatContextual(93)) {
17884
18058
  node.source = this.parseImportSource();
17885
18059
  this.checkExport(node);
17886
18060
  var assertions = this.maybeParseImportAssertions();
@@ -17900,7 +18074,7 @@
17900
18074
  type
17901
18075
  } = this.state;
17902
18076
 
17903
- if (type === 24) {
18077
+ if (type === 26) {
17904
18078
  this.expectOnePlugin(["decorators", "decorators-legacy"]);
17905
18079
 
17906
18080
  if (this.hasPlugin("decorators")) {
@@ -17912,7 +18086,7 @@
17912
18086
  }
17913
18087
  }
17914
18088
 
17915
- return type === 68 || type === 69 || type === 62 || type === 74 || this.isLet() || this.isAsyncFunction();
18089
+ return type === 70 || type === 71 || type === 64 || type === 76 || this.isLet() || this.isAsyncFunction();
17916
18090
  }
17917
18091
 
17918
18092
  checkExport(node, checkNames, isDefault, isFrom) {
@@ -18013,8 +18187,8 @@
18013
18187
  if (this.eat(8)) break;
18014
18188
  }
18015
18189
 
18016
- var isMaybeTypeOnly = this.isContextual(120);
18017
- var isString = this.match(123);
18190
+ var isMaybeTypeOnly = this.isContextual(122);
18191
+ var isString = this.match(125);
18018
18192
  var node = this.startNode();
18019
18193
  node.local = this.parseModuleExportName();
18020
18194
  nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
@@ -18024,7 +18198,7 @@
18024
18198
  }
18025
18199
 
18026
18200
  parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
18027
- if (this.eatContextual(87)) {
18201
+ if (this.eatContextual(89)) {
18028
18202
  node.exported = this.parseModuleExportName();
18029
18203
  } else if (isString) {
18030
18204
  node.exported = cloneStringLiteral(node.local);
@@ -18036,7 +18210,7 @@
18036
18210
  }
18037
18211
 
18038
18212
  parseModuleExportName() {
18039
- if (this.match(123)) {
18213
+ if (this.match(125)) {
18040
18214
  var result = this.parseStringLiteral(this.state.value);
18041
18215
  var surrogate = result.value.match(loneSurrogate);
18042
18216
 
@@ -18053,12 +18227,12 @@
18053
18227
  parseImport(node) {
18054
18228
  node.specifiers = [];
18055
18229
 
18056
- if (!this.match(123)) {
18230
+ if (!this.match(125)) {
18057
18231
  var hasDefault = this.maybeParseDefaultImportSpecifier(node);
18058
18232
  var parseNext = !hasDefault || this.eat(12);
18059
18233
  var hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
18060
18234
  if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
18061
- this.expectContextual(91);
18235
+ this.expectContextual(93);
18062
18236
  }
18063
18237
 
18064
18238
  node.source = this.parseImportSource();
@@ -18079,7 +18253,7 @@
18079
18253
  }
18080
18254
 
18081
18255
  parseImportSource() {
18082
- if (!this.match(123)) this.unexpected();
18256
+ if (!this.match(125)) this.unexpected();
18083
18257
  return this.parseExprAtom();
18084
18258
  }
18085
18259
 
@@ -18111,7 +18285,7 @@
18111
18285
 
18112
18286
  attrNames.add(keyName);
18113
18287
 
18114
- if (this.match(123)) {
18288
+ if (this.match(125)) {
18115
18289
  node.key = this.parseStringLiteral(keyName);
18116
18290
  } else {
18117
18291
  node.key = this.parseIdentifier(true);
@@ -18119,7 +18293,7 @@
18119
18293
 
18120
18294
  this.expect(14);
18121
18295
 
18122
- if (!this.match(123)) {
18296
+ if (!this.match(125)) {
18123
18297
  throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
18124
18298
  }
18125
18299
 
@@ -18132,7 +18306,7 @@
18132
18306
  }
18133
18307
 
18134
18308
  maybeParseModuleAttributes() {
18135
- if (this.match(70) && !this.hasPrecedingLineBreak()) {
18309
+ if (this.match(72) && !this.hasPrecedingLineBreak()) {
18136
18310
  this.expectPlugin("moduleAttributes");
18137
18311
  this.next();
18138
18312
  } else {
@@ -18158,7 +18332,7 @@
18158
18332
  attributes.add(node.key.name);
18159
18333
  this.expect(14);
18160
18334
 
18161
- if (!this.match(123)) {
18335
+ if (!this.match(125)) {
18162
18336
  throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
18163
18337
  }
18164
18338
 
@@ -18171,7 +18345,7 @@
18171
18345
  }
18172
18346
 
18173
18347
  maybeParseImportAssertions() {
18174
- if (this.isContextual(88) && !this.hasPrecedingLineBreak()) {
18348
+ if (this.isContextual(90) && !this.hasPrecedingLineBreak()) {
18175
18349
  this.expectPlugin("importAssertions");
18176
18350
  this.next();
18177
18351
  } else {
@@ -18195,10 +18369,10 @@
18195
18369
  }
18196
18370
 
18197
18371
  maybeParseStarImportSpecifier(node) {
18198
- if (this.match(49)) {
18372
+ if (this.match(51)) {
18199
18373
  var specifier = this.startNode();
18200
18374
  this.next();
18201
- this.expectContextual(87);
18375
+ this.expectContextual(89);
18202
18376
  this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier", "import namespace specifier");
18203
18377
  return true;
18204
18378
  }
@@ -18223,8 +18397,8 @@
18223
18397
  }
18224
18398
 
18225
18399
  var specifier = this.startNode();
18226
- var importedIsString = this.match(123);
18227
- var isMaybeTypeOnly = this.isContextual(120);
18400
+ var importedIsString = this.match(125);
18401
+ var isMaybeTypeOnly = this.isContextual(122);
18228
18402
  specifier.imported = this.parseModuleExportName();
18229
18403
  var importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
18230
18404
  node.specifiers.push(importSpecifier);
@@ -18232,7 +18406,7 @@
18232
18406
  }
18233
18407
 
18234
18408
  parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
18235
- if (this.eatContextual(87)) {
18409
+ if (this.eatContextual(89)) {
18236
18410
  specifier.local = this.parseIdentifier();
18237
18411
  } else {
18238
18412
  var {