meriyah 4.2.1 → 4.3.0

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.
@@ -874,7 +874,7 @@ System.register('meriyah', [], (function (exports) {
874
874
  break;
875
875
  case 117:
876
876
  if (mask & 16)
877
- report(parser, 34, 'g');
877
+ report(parser, 34, 'u');
878
878
  mask |= 16;
879
879
  break;
880
880
  case 121:
@@ -887,6 +887,11 @@ System.register('meriyah', [], (function (exports) {
887
887
  report(parser, 34, 's');
888
888
  mask |= 32;
889
889
  break;
890
+ case 100:
891
+ if (mask & 64)
892
+ report(parser, 34, 'd');
893
+ mask |= 64;
894
+ break;
890
895
  default:
891
896
  report(parser, 33);
892
897
  }
@@ -905,7 +910,13 @@ System.register('meriyah', [], (function (exports) {
905
910
  return new RegExp(pattern, flags);
906
911
  }
907
912
  catch (e) {
908
- report(parser, 32);
913
+ try {
914
+ new RegExp(pattern, flags.replace('d', ''));
915
+ return null;
916
+ }
917
+ catch (e) {
918
+ report(parser, 32);
919
+ }
909
920
  }
910
921
  }
911
922
 
@@ -1216,8 +1227,8 @@ System.register('meriyah', [], (function (exports) {
1216
1227
  digits++;
1217
1228
  char = advanceChar(parser);
1218
1229
  }
1219
- if (digits < 1 || !allowSeparator) {
1220
- report(parser, digits < 1 ? 19 : 147);
1230
+ if (digits === 0 || !allowSeparator) {
1231
+ report(parser, digits === 0 ? 19 : 147);
1221
1232
  }
1222
1233
  }
1223
1234
  else if ((char | 32) === 111) {
@@ -1237,8 +1248,8 @@ System.register('meriyah', [], (function (exports) {
1237
1248
  digits++;
1238
1249
  char = advanceChar(parser);
1239
1250
  }
1240
- if (digits < 1 || !allowSeparator) {
1241
- report(parser, digits < 1 ? 0 : 147);
1251
+ if (digits === 0 || !allowSeparator) {
1252
+ report(parser, digits === 0 ? 0 : 147);
1242
1253
  }
1243
1254
  }
1244
1255
  else if ((char | 32) === 98) {
@@ -1258,8 +1269,8 @@ System.register('meriyah', [], (function (exports) {
1258
1269
  digits++;
1259
1270
  char = advanceChar(parser);
1260
1271
  }
1261
- if (digits < 1 || !allowSeparator) {
1262
- report(parser, digits < 1 ? 0 : 147);
1272
+ if (digits === 0 || !allowSeparator) {
1273
+ report(parser, digits === 0 ? 0 : 147);
1263
1274
  }
1264
1275
  }
1265
1276
  else if (CharTypes[char] & 32) {
@@ -1335,7 +1346,7 @@ System.register('meriyah', [], (function (exports) {
1335
1346
  if (CharTypes[char] & 256)
1336
1347
  char = advanceChar(parser);
1337
1348
  const { index } = parser;
1338
- if ((CharTypes[char] & 16) < 1)
1349
+ if ((CharTypes[char] & 16) === 0)
1339
1350
  report(parser, 10);
1340
1351
  value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char);
1341
1352
  char = parser.currentChar;
@@ -1816,7 +1827,7 @@ System.register('meriyah', [], (function (exports) {
1816
1827
  return 8456258;
1817
1828
  }
1818
1829
  if (ch === 47) {
1819
- if ((context & 16) < 1)
1830
+ if ((context & 16) === 0)
1820
1831
  return 8456258;
1821
1832
  const index = parser.index + 1;
1822
1833
  if (index < parser.end) {
@@ -4922,7 +4933,7 @@ System.register('meriyah', [], (function (exports) {
4922
4933
  case 86106:
4923
4934
  report(parser, context & 1024
4924
4935
  ? 73
4925
- : (context & 256) < 1
4936
+ : (context & 256) === 0
4926
4937
  ? 75
4927
4938
  : 74);
4928
4939
  case 86096:
@@ -4968,7 +4979,7 @@ System.register('meriyah', [], (function (exports) {
4968
4979
  });
4969
4980
  }
4970
4981
  function parseReturnStatement(parser, context, start, line, column) {
4971
- if ((context & 32) < 1 && context & 8192)
4982
+ if ((context & 32) === 0 && context & 8192)
4972
4983
  report(parser, 89);
4973
4984
  nextToken(parser, context | 32768);
4974
4985
  const argument = parser.flags & 1 || parser.token & 1048576
@@ -4992,7 +5003,7 @@ System.register('meriyah', [], (function (exports) {
4992
5003
  validateAndDeclareLabel(parser, labels, value);
4993
5004
  nextToken(parser, context | 32768);
4994
5005
  const body = allowFuncDecl &&
4995
- (context & 1024) < 1 &&
5006
+ (context & 1024) === 0 &&
4996
5007
  context & 256 &&
4997
5008
  parser.token === 86106
4998
5009
  ? parseFunctionDeclaration(parser, context, addChildScope(scope, 2), origin, 0, 0, 0, parser.tokenPos, parser.linePos, parser.colPos)
@@ -5101,7 +5112,7 @@ System.register('meriyah', [], (function (exports) {
5101
5112
  }
5102
5113
  function parseConsequentOrAlternative(parser, context, scope, labels, start, line, column) {
5103
5114
  return context & 1024 ||
5104
- (context & 256) < 1 ||
5115
+ (context & 256) === 0 ||
5105
5116
  parser.token !== 86106
5106
5117
  ? parseStatement(parser, context, scope, 0, { $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos)
5107
5118
  : parseFunctionDeclaration(parser, context, addChildScope(scope, 2), 0, 0, 0, 0, start, line, column);
@@ -5166,11 +5177,11 @@ System.register('meriyah', [], (function (exports) {
5166
5177
  return parseStatement(parser, ((context | 134217728) ^ 134217728) | 131072, scope, 0, { loop: 1, $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos);
5167
5178
  }
5168
5179
  function parseContinueStatement(parser, context, labels, start, line, column) {
5169
- if ((context & 131072) < 1)
5180
+ if ((context & 131072) === 0)
5170
5181
  report(parser, 65);
5171
5182
  nextToken(parser, context);
5172
5183
  let label = null;
5173
- if ((parser.flags & 1) < 1 && parser.token & 143360) {
5184
+ if ((parser.flags & 1) === 0 && parser.token & 143360) {
5174
5185
  const { tokenValue } = parser;
5175
5186
  label = parseIdentifier(parser, context | 32768, 0);
5176
5187
  if (!isValidLabel(parser, labels, tokenValue, 1))
@@ -5185,13 +5196,13 @@ System.register('meriyah', [], (function (exports) {
5185
5196
  function parseBreakStatement(parser, context, labels, start, line, column) {
5186
5197
  nextToken(parser, context | 32768);
5187
5198
  let label = null;
5188
- if ((parser.flags & 1) < 1 && parser.token & 143360) {
5199
+ if ((parser.flags & 1) === 0 && parser.token & 143360) {
5189
5200
  const { tokenValue } = parser;
5190
5201
  label = parseIdentifier(parser, context | 32768, 0);
5191
5202
  if (!isValidLabel(parser, labels, tokenValue, 0))
5192
5203
  report(parser, 134, tokenValue);
5193
5204
  }
5194
- else if ((context & (4096 | 131072)) < 1) {
5205
+ else if ((context & (4096 | 131072)) === 0) {
5195
5206
  report(parser, 66);
5196
5207
  }
5197
5208
  matchOrInsertSemicolon(parser, context | 32768);
@@ -5271,6 +5282,17 @@ System.register('meriyah', [], (function (exports) {
5271
5282
  body
5272
5283
  });
5273
5284
  }
5285
+ function parseStaticBlock(parser, context, scope, start, line, column) {
5286
+ if (scope)
5287
+ scope = addChildScope(scope, 2);
5288
+ const ctorContext = 16384 | 524288;
5289
+ context = ((context | ctorContext) ^ ctorContext) | 262144;
5290
+ const { body } = parseBlock(parser, context, scope, {}, start, line, column);
5291
+ return finishNode(parser, context, start, line, column, {
5292
+ type: 'StaticBlock',
5293
+ body
5294
+ });
5295
+ }
5274
5296
  function parseDoWhileStatement(parser, context, scope, labels, start, line, column) {
5275
5297
  nextToken(parser, context | 32768);
5276
5298
  const body = parseIterationStatementBody(parser, context, scope, labels);
@@ -5358,10 +5380,10 @@ System.register('meriyah', [], (function (exports) {
5358
5380
  if (parser.token === 1077936157) {
5359
5381
  nextToken(parser, context | 32768);
5360
5382
  init = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos);
5361
- if (origin & 32 || (token & 2097152) < 1) {
5383
+ if (origin & 32 || (token & 2097152) === 0) {
5362
5384
  if (parser.token === 274549 ||
5363
5385
  (parser.token === 8738868 &&
5364
- (token & 2097152 || (kind & 4) < 1 || context & 1024))) {
5386
+ (token & 2097152 || (kind & 4) === 0 || context & 1024))) {
5365
5387
  reportMessageAt(tokenPos, parser.line, parser.index - 3, 57, parser.token === 274549 ? 'of' : 'in');
5366
5388
  }
5367
5389
  }
@@ -5378,7 +5400,8 @@ System.register('meriyah', [], (function (exports) {
5378
5400
  }
5379
5401
  function parseForStatement(parser, context, scope, labels, start, line, column) {
5380
5402
  nextToken(parser, context);
5381
- const forAwait = (context & 4194304) > 0 && consumeOpt(parser, context, 209008);
5403
+ const forAwait = ((context & 4194304) > 0 || ((context & 2048) > 0 && (context & 8192) > 0)) &&
5404
+ consumeOpt(parser, context, 209008);
5382
5405
  consume(parser, context | 32768, 67174411);
5383
5406
  if (scope)
5384
5407
  scope = addChildScope(scope, 1);
@@ -5667,7 +5690,7 @@ System.register('meriyah', [], (function (exports) {
5667
5690
  const { tokenPos, linePos, colPos } = parser;
5668
5691
  declaration = parseIdentifier(parser, context, 0);
5669
5692
  const { flags } = parser;
5670
- if ((flags & 1) < 1) {
5693
+ if ((flags & 1) === 0) {
5671
5694
  if (parser.token === 86106) {
5672
5695
  declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 1, 1, tokenPos, linePos, colPos);
5673
5696
  }
@@ -5791,7 +5814,7 @@ System.register('meriyah', [], (function (exports) {
5791
5814
  case 209007:
5792
5815
  const { tokenPos, linePos, colPos } = parser;
5793
5816
  nextToken(parser, context);
5794
- if ((parser.flags & 1) < 1 && parser.token === 86106) {
5817
+ if ((parser.flags & 1) === 0 && parser.token === 86106) {
5795
5818
  declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 2, 1, tokenPos, linePos, colPos);
5796
5819
  if (scope) {
5797
5820
  key = declaration.id ? declaration.id.name : '';
@@ -5948,7 +5971,7 @@ System.register('meriyah', [], (function (exports) {
5948
5971
  const { token } = parser;
5949
5972
  const expr = parseIdentifier(parser, context, isPattern);
5950
5973
  const { flags } = parser;
5951
- if ((flags & 1) < 1) {
5974
+ if ((flags & 1) === 0) {
5952
5975
  if (parser.token === 86106) {
5953
5976
  return parseFunctionExpression(parser, context, 1, inGroup, start, line, column);
5954
5977
  }
@@ -5982,7 +6005,7 @@ System.register('meriyah', [], (function (exports) {
5982
6005
  report(parser, 120);
5983
6006
  let argument = null;
5984
6007
  let delegate = false;
5985
- if ((parser.flags & 1) < 1) {
6008
+ if ((parser.flags & 1) === 0) {
5986
6009
  delegate = consumeOpt(parser, context | 32768, 8457014);
5987
6010
  if (parser.token & (12288 | 65536) || delegate) {
5988
6011
  argument = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos);
@@ -6059,8 +6082,8 @@ System.register('meriyah', [], (function (exports) {
6059
6082
  if (context & 64 &&
6060
6083
  scope &&
6061
6084
  scopeError !== void 0 &&
6062
- (prevContext & 1024) < 1 &&
6063
- (context & 8192) < 1) {
6085
+ (prevContext & 1024) === 0 &&
6086
+ (context & 8192) === 0) {
6064
6087
  reportScopeError(scopeError);
6065
6088
  }
6066
6089
  }
@@ -6086,7 +6109,7 @@ System.register('meriyah', [], (function (exports) {
6086
6109
  case 67108991:
6087
6110
  report(parser, 161);
6088
6111
  case 67174411: {
6089
- if ((context & 524288) < 1)
6112
+ if ((context & 524288) === 0)
6090
6113
  report(parser, 26);
6091
6114
  if (context & 16384)
6092
6115
  report(parser, 27);
@@ -6095,7 +6118,7 @@ System.register('meriyah', [], (function (exports) {
6095
6118
  }
6096
6119
  case 69271571:
6097
6120
  case 67108877: {
6098
- if ((context & 262144) < 1)
6121
+ if ((context & 262144) === 0)
6099
6122
  report(parser, 27);
6100
6123
  if (context & 16384)
6101
6124
  report(parser, 27);
@@ -6125,7 +6148,7 @@ System.register('meriyah', [], (function (exports) {
6125
6148
  });
6126
6149
  }
6127
6150
  function parseMemberOrUpdateExpression(parser, context, expr, inGroup, inChain, start, line, column) {
6128
- if ((parser.token & 33619968) === 33619968 && (parser.flags & 1) < 1) {
6151
+ if ((parser.token & 33619968) === 33619968 && (parser.flags & 1) === 0) {
6129
6152
  expr = parseUpdateExpression(parser, context, expr, start, line, column);
6130
6153
  }
6131
6154
  else if ((parser.token & 67108864) === 67108864) {
@@ -6252,7 +6275,7 @@ System.register('meriyah', [], (function (exports) {
6252
6275
  });
6253
6276
  }
6254
6277
  else {
6255
- if ((parser.token & (143360 | 4096)) < 1)
6278
+ if ((parser.token & (143360 | 4096)) === 0)
6256
6279
  report(parser, 154);
6257
6280
  const property = parseIdentifier(parser, context, 0);
6258
6281
  parser.assignable = 2;
@@ -6270,7 +6293,7 @@ System.register('meriyah', [], (function (exports) {
6270
6293
  return node;
6271
6294
  }
6272
6295
  function parsePropertyOrPrivatePropertyName(parser, context) {
6273
- if ((parser.token & (143360 | 4096)) < 1 && parser.token !== 131) {
6296
+ if ((parser.token & (143360 | 4096)) === 0 && parser.token !== 131) {
6274
6297
  report(parser, 154);
6275
6298
  }
6276
6299
  return context & 1 && parser.token === 131
@@ -6595,11 +6618,11 @@ System.register('meriyah', [], (function (exports) {
6595
6618
  let firstRestricted;
6596
6619
  let functionScope = scope ? createScope() : void 0;
6597
6620
  if (parser.token === 67174411) {
6598
- if ((flags & 1) < 1)
6621
+ if ((flags & 1) === 0)
6599
6622
  report(parser, 37, 'Function');
6600
6623
  }
6601
6624
  else {
6602
- const kind = origin & 4 && ((context & 8192) < 1 || (context & 2048) < 1)
6625
+ const kind = origin & 4 && ((context & 8192) === 0 || (context & 2048) === 0)
6603
6626
  ? 4
6604
6627
  : 64;
6605
6628
  validateFunctionName(parser, context | ((context & 3072) << 11), parser.token);
@@ -6745,7 +6768,7 @@ System.register('meriyah', [], (function (exports) {
6745
6768
  destructible |=
6746
6769
  kind & 1
6747
6770
  ? 32
6748
- : (kind & 2) < 1
6771
+ : (kind & 2) === 0
6749
6772
  ? 16
6750
6773
  : 0;
6751
6774
  left = parseMemberOrUpdateExpression(parser, context, left, inGroup, 0, tokenPos, linePos, colPos);
@@ -6804,7 +6827,7 @@ System.register('meriyah', [], (function (exports) {
6804
6827
  left = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos);
6805
6828
  if (parser.token !== 18 && parser.token !== 20) {
6806
6829
  left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left);
6807
- if ((kind & (2 | 1)) < 1 && token === 67174411)
6830
+ if ((kind & (2 | 1)) === 0 && token === 67174411)
6808
6831
  destructible |= 16;
6809
6832
  }
6810
6833
  else if (parser.assignable & 2) {
@@ -6993,7 +7016,7 @@ System.register('meriyah', [], (function (exports) {
6993
7016
  });
6994
7017
  }
6995
7018
  function parseMethodDefinition(parser, context, kind, inGroup, start, line, column) {
6996
- const modifierFlags = (kind & 64) < 1 ? 31981568 : 14680064;
7019
+ const modifierFlags = (kind & 64) === 0 ? 31981568 : 14680064;
6997
7020
  context =
6998
7021
  ((context | modifierFlags) ^ modifierFlags) |
6999
7022
  ((kind & 88) << 18) |
@@ -7561,7 +7584,7 @@ System.register('meriyah', [], (function (exports) {
7561
7584
  let left = null;
7562
7585
  const { tokenPos, linePos, colPos } = parser;
7563
7586
  if (parser.token & 143360) {
7564
- if ((context & 1024) < 1) {
7587
+ if ((context & 1024) === 0) {
7565
7588
  if ((parser.token & 36864) === 36864) {
7566
7589
  parser.flags |= 256;
7567
7590
  }
@@ -7822,7 +7845,7 @@ System.register('meriyah', [], (function (exports) {
7822
7845
  (134221824 | 8192 | 16384), scope, 16, void 0, void 0);
7823
7846
  switch (parser.token) {
7824
7847
  case 69271571:
7825
- if ((parser.flags & 1) < 1) {
7848
+ if ((parser.flags & 1) === 0) {
7826
7849
  report(parser, 112);
7827
7850
  }
7828
7851
  break;
@@ -7831,13 +7854,13 @@ System.register('meriyah', [], (function (exports) {
7831
7854
  case 22:
7832
7855
  report(parser, 113);
7833
7856
  case 67174411:
7834
- if ((parser.flags & 1) < 1) {
7857
+ if ((parser.flags & 1) === 0) {
7835
7858
  report(parser, 112);
7836
7859
  }
7837
7860
  parser.flags |= 1024;
7838
7861
  break;
7839
7862
  }
7840
- if ((parser.token & 8454144) === 8454144 && (parser.flags & 1) < 1)
7863
+ if ((parser.token & 8454144) === 8454144 && (parser.flags & 1) === 0)
7841
7864
  report(parser, 28, KeywordDescTable[parser.token & 255]);
7842
7865
  if ((parser.token & 33619968) === 33619968)
7843
7866
  report(parser, 121);
@@ -7863,7 +7886,7 @@ System.register('meriyah', [], (function (exports) {
7863
7886
  let left;
7864
7887
  const { tokenPos, linePos, colPos } = parser;
7865
7888
  if (parser.token & 143360) {
7866
- if ((context & 1024) < 1) {
7889
+ if ((context & 1024) === 0) {
7867
7890
  if ((parser.token & 36864) === 36864) {
7868
7891
  parser.flags |= 256;
7869
7892
  }
@@ -8183,7 +8206,7 @@ System.register('meriyah', [], (function (exports) {
8183
8206
  id = parseIdentifier(parser, context, 0);
8184
8207
  }
8185
8208
  else {
8186
- if ((flags & 1) < 1)
8209
+ if ((flags & 1) === 0)
8187
8210
  report(parser, 37, 'Class');
8188
8211
  }
8189
8212
  let inheritedContext = context;
@@ -8314,7 +8337,7 @@ System.register('meriyah', [], (function (exports) {
8314
8337
  }
8315
8338
  break;
8316
8339
  case 209007:
8317
- if (parser.token !== 67174411 && (parser.flags & 1) < 1) {
8340
+ if (parser.token !== 67174411 && (parser.flags & 1) === 0) {
8318
8341
  if (context & 1 && (parser.token & 1073741824) === 1073741824) {
8319
8342
  return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos);
8320
8343
  }
@@ -8357,6 +8380,9 @@ System.register('meriyah', [], (function (exports) {
8357
8380
  else if (context & 1 && (parser.token & 1073741824) === 1073741824) {
8358
8381
  kind |= 128;
8359
8382
  }
8383
+ else if (isStatic && token === 2162700) {
8384
+ return parseStaticBlock(parser, context, scope, tokenPos, linePos, colPos);
8385
+ }
8360
8386
  else if (token === 122) {
8361
8387
  key = parseIdentifier(parser, context, 0);
8362
8388
  if (parser.token !== 67174411)
@@ -8386,16 +8412,16 @@ System.register('meriyah', [], (function (exports) {
8386
8412
  else
8387
8413
  report(parser, 131);
8388
8414
  }
8389
- if ((kind & 2) < 1) {
8415
+ if ((kind & 2) === 0) {
8390
8416
  if (parser.tokenValue === 'constructor') {
8391
8417
  if ((parser.token & 1073741824) === 1073741824) {
8392
8418
  report(parser, 125);
8393
8419
  }
8394
- else if ((kind & 32) < 1 && parser.token === 67174411) {
8420
+ else if ((kind & 32) === 0 && parser.token === 67174411) {
8395
8421
  if (kind & (768 | 16 | 128 | 8)) {
8396
8422
  report(parser, 50, 'accessor');
8397
8423
  }
8398
- else if ((context & 524288) < 1) {
8424
+ else if ((context & 524288) === 0) {
8399
8425
  if (parser.flags & 32)
8400
8426
  report(parser, 51);
8401
8427
  else
@@ -8404,7 +8430,7 @@ System.register('meriyah', [], (function (exports) {
8404
8430
  }
8405
8431
  kind |= 64;
8406
8432
  }
8407
- else if ((kind & 4096) < 1 &&
8433
+ else if ((kind & 4096) === 0 &&
8408
8434
  kind & (32 | 768 | 8 | 16) &&
8409
8435
  parser.tokenValue === 'prototype') {
8410
8436
  report(parser, 49);
@@ -8417,7 +8443,7 @@ System.register('meriyah', [], (function (exports) {
8417
8443
  return finishNode(parser, context, start, line, column, context & 1
8418
8444
  ? {
8419
8445
  type: 'MethodDefinition',
8420
- kind: (kind & 32) < 1 && kind & 64
8446
+ kind: (kind & 32) === 0 && kind & 64
8421
8447
  ? 'constructor'
8422
8448
  : kind & 256
8423
8449
  ? 'get'
@@ -8432,7 +8458,7 @@ System.register('meriyah', [], (function (exports) {
8432
8458
  }
8433
8459
  : {
8434
8460
  type: 'MethodDefinition',
8435
- kind: (kind & 32) < 1 && kind & 64
8461
+ kind: (kind & 32) === 0 && kind & 64
8436
8462
  ? 'constructor'
8437
8463
  : kind & 256
8438
8464
  ? 'get'
@@ -8776,7 +8802,7 @@ System.register('meriyah', [], (function (exports) {
8776
8802
  });
8777
8803
  exports('ESTree', estree);
8778
8804
 
8779
- var version$1 = "4.2.1";
8805
+ var version$1 = "4.3.0";
8780
8806
 
8781
8807
  const version = exports('version', version$1);
8782
8808
  function parseScript(source, options) {