meriyah 4.3.8 → 4.4.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.
@@ -4369,7 +4369,9 @@
4369
4369
  !specDeviation) {
4370
4370
  report(parser, 28, KeywordDescTable[parser.token & 255]);
4371
4371
  }
4372
- consumeOpt(parser, context, 1074790417);
4372
+ if (!consumeOpt(parser, context, 1074790417)) {
4373
+ parser.onInsertedSemicolon?.(parser.startPos);
4374
+ }
4373
4375
  }
4374
4376
  function isValidStrictMode(parser, index, tokenPos, tokenValue) {
4375
4377
  if (index - tokenPos < 13 && tokenValue === 'use strict') {
@@ -4711,7 +4713,7 @@
4711
4713
  report(parser, 0);
4712
4714
  }
4713
4715
 
4714
- function create(source, sourceFile, onComment, onToken) {
4716
+ function create(source, sourceFile, onComment, onToken, onInsertedSemicolon) {
4715
4717
  return {
4716
4718
  source,
4717
4719
  flags: 0,
@@ -4737,12 +4739,14 @@
4737
4739
  destructible: 0,
4738
4740
  onComment,
4739
4741
  onToken,
4742
+ onInsertedSemicolon,
4740
4743
  leadingDecorators: []
4741
4744
  };
4742
4745
  }
4743
4746
  function parseSource(source, options, context) {
4744
4747
  let sourceFile = '';
4745
4748
  let onComment;
4749
+ let onInsertedSemicolon;
4746
4750
  let onToken;
4747
4751
  if (options != null) {
4748
4752
  if (options.module)
@@ -4780,11 +4784,13 @@
4780
4784
  if (options.onComment != null) {
4781
4785
  onComment = Array.isArray(options.onComment) ? pushComment(context, options.onComment) : options.onComment;
4782
4786
  }
4787
+ if (options.onInsertedSemicolon != null)
4788
+ onInsertedSemicolon = options.onInsertedSemicolon;
4783
4789
  if (options.onToken != null) {
4784
4790
  onToken = Array.isArray(options.onToken) ? pushToken(context, options.onToken) : options.onToken;
4785
4791
  }
4786
4792
  }
4787
- const parser = create(source, sourceFile, onComment, onToken);
4793
+ const parser = create(source, sourceFile, onComment, onToken, onInsertedSemicolon);
4788
4794
  if (context & 1)
4789
4795
  skipHashBang(parser);
4790
4796
  const scope = context & 64 ? createScope() : void 0;
@@ -5310,7 +5316,7 @@
5310
5316
  consume(parser, context | 32768, 67174411);
5311
5317
  const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
5312
5318
  consume(parser, context | 32768, 16);
5313
- consumeOpt(parser, context, 1074790417);
5319
+ consumeOpt(parser, context | 32768, 1074790417);
5314
5320
  return finishNode(parser, context, start, line, column, {
5315
5321
  type: 'DoWhileStatement',
5316
5322
  body,
@@ -8823,7 +8829,7 @@
8823
8829
  __proto__: null
8824
8830
  });
8825
8831
 
8826
- var version$1 = "4.3.8";
8832
+ var version$1 = "4.4.0";
8827
8833
 
8828
8834
  const version = version$1;
8829
8835
  function parseScript(source, options) {
@@ -4422,12 +4422,15 @@
4422
4422
  }
4423
4423
 
4424
4424
  function matchOrInsertSemicolon(parser, context, specDeviation) {
4425
+ var _a;
4425
4426
  if ((parser.flags & 1) === 0 &&
4426
4427
  (parser.token & 1048576) !== 1048576 &&
4427
4428
  !specDeviation) {
4428
4429
  report(parser, 28, KeywordDescTable[parser.token & 255]);
4429
4430
  }
4430
- consumeOpt(parser, context, 1074790417);
4431
+ if (!consumeOpt(parser, context, 1074790417)) {
4432
+ (_a = parser.onInsertedSemicolon) === null || _a === void 0 ? void 0 : _a.call(parser, parser.startPos);
4433
+ }
4431
4434
  }
4432
4435
  function isValidStrictMode(parser, index, tokenPos, tokenValue) {
4433
4436
  if (index - tokenPos < 13 && tokenValue === 'use strict') {
@@ -4773,7 +4776,7 @@
4773
4776
  report(parser, 0);
4774
4777
  }
4775
4778
 
4776
- function create(source, sourceFile, onComment, onToken) {
4779
+ function create(source, sourceFile, onComment, onToken, onInsertedSemicolon) {
4777
4780
  return {
4778
4781
  source: source,
4779
4782
  flags: 0,
@@ -4799,12 +4802,14 @@
4799
4802
  destructible: 0,
4800
4803
  onComment: onComment,
4801
4804
  onToken: onToken,
4805
+ onInsertedSemicolon: onInsertedSemicolon,
4802
4806
  leadingDecorators: []
4803
4807
  };
4804
4808
  }
4805
4809
  function parseSource(source, options, context) {
4806
4810
  var sourceFile = '';
4807
4811
  var onComment;
4812
+ var onInsertedSemicolon;
4808
4813
  var onToken;
4809
4814
  if (options != null) {
4810
4815
  if (options.module)
@@ -4842,11 +4847,13 @@
4842
4847
  if (options.onComment != null) {
4843
4848
  onComment = Array.isArray(options.onComment) ? pushComment(context, options.onComment) : options.onComment;
4844
4849
  }
4850
+ if (options.onInsertedSemicolon != null)
4851
+ onInsertedSemicolon = options.onInsertedSemicolon;
4845
4852
  if (options.onToken != null) {
4846
4853
  onToken = Array.isArray(options.onToken) ? pushToken(context, options.onToken) : options.onToken;
4847
4854
  }
4848
4855
  }
4849
- var parser = create(source, sourceFile, onComment, onToken);
4856
+ var parser = create(source, sourceFile, onComment, onToken, onInsertedSemicolon);
4850
4857
  if (context & 1)
4851
4858
  skipHashBang(parser);
4852
4859
  var scope = context & 64 ? createScope() : void 0;
@@ -5372,7 +5379,7 @@
5372
5379
  consume(parser, context | 32768, 67174411);
5373
5380
  var test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
5374
5381
  consume(parser, context | 32768, 16);
5375
- consumeOpt(parser, context, 1074790417);
5382
+ consumeOpt(parser, context | 32768, 1074790417);
5376
5383
  return finishNode(parser, context, start, line, column, {
5377
5384
  type: 'DoWhileStatement',
5378
5385
  body: body,
@@ -8886,7 +8893,7 @@
8886
8893
  __proto__: null
8887
8894
  });
8888
8895
 
8889
- var version$1 = "4.3.8";
8896
+ var version$1 = "4.4.0";
8890
8897
 
8891
8898
  var version = version$1;
8892
8899
  function parseScript(source, options) {