oxlint 1.56.0 → 1.57.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.
- package/dist/lint.js +963 -697
- package/dist/plugins-dev.d.ts +55 -28
- package/package.json +20 -20
package/dist/lint.js
CHANGED
|
@@ -330,7 +330,8 @@ var keys_default = freeze({
|
|
|
330
330
|
});
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src-js/plugins/location.ts
|
|
333
|
-
const LINE_BREAK_PATTERN = /\r\n|[\r\n\u2028\u2029]/gu, lines = [], lineStartIndices = [0];
|
|
333
|
+
const LINE_BREAK_PATTERN = /\r\n|[\r\n\u2028\u2029]/gu, lines = [], lineStartIndices = [0], cachedLocations = [];
|
|
334
|
+
let activeLocationsCount = 0;
|
|
334
335
|
/**
|
|
335
336
|
* Split source text into lines.
|
|
336
337
|
*/
|
|
@@ -342,9 +343,10 @@ function initLines() {
|
|
|
342
343
|
}
|
|
343
344
|
/**
|
|
344
345
|
* Reset lines after file has been linted, to free memory.
|
|
346
|
+
* Reset `Location` object pool.
|
|
345
347
|
*/
|
|
346
|
-
function
|
|
347
|
-
lines.length = 0, lineStartIndices.length = 1;
|
|
348
|
+
function resetLinesAndLocs() {
|
|
349
|
+
lines.length = 0, lineStartIndices.length = 1, activeLocationsCount = 0;
|
|
348
350
|
}
|
|
349
351
|
/**
|
|
350
352
|
* Convert a source text index into a (line, column) pair.
|
|
@@ -355,20 +357,9 @@ function resetLines() {
|
|
|
355
357
|
function getLineColumnFromOffset(offset) {
|
|
356
358
|
if (typeof offset != "number" || offset < 0 || (offset | 0) !== offset) throw TypeError("Expected `offset` to be a non-negative integer.");
|
|
357
359
|
if (lines.length === 0 && initLines(), offset > sourceText.length) throw RangeError(`Index out of range (requested index ${offset}, but source text has length ${sourceText.length}).`);
|
|
358
|
-
return getLineColumnFromOffsetUnchecked(offset);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Convert a source text index into a (line, column) pair without:
|
|
362
|
-
* 1. Checking type of `offset`, or that it's in range.
|
|
363
|
-
* 2. Initializing `lineStartIndices`. Caller must do that before calling this method.
|
|
364
|
-
*
|
|
365
|
-
* @param offset - The index of a character in a file.
|
|
366
|
-
* @returns `{line, column}` location object with 1-indexed line and 0-indexed column.
|
|
367
|
-
*/
|
|
368
|
-
function getLineColumnFromOffsetUnchecked(offset) {
|
|
369
360
|
let low = 0, high = lineStartIndices.length, mid;
|
|
370
361
|
do
|
|
371
|
-
mid =
|
|
362
|
+
mid = low + high >>> 1, offset < lineStartIndices[mid] ? high = mid : low = mid + 1;
|
|
372
363
|
while (low < high);
|
|
373
364
|
return {
|
|
374
365
|
line: low,
|
|
@@ -431,15 +422,18 @@ function getLoc$1(nodeOrToken) {
|
|
|
431
422
|
*/
|
|
432
423
|
function getNodeLoc(node) {
|
|
433
424
|
let loc = computeLoc(node.start, node.end);
|
|
434
|
-
return ObjectDefineProperty(node, "loc",
|
|
435
|
-
value: loc,
|
|
436
|
-
writable: !0
|
|
437
|
-
}), loc;
|
|
425
|
+
return LOC_DESCRIPTOR.value = loc, ObjectDefineProperty(node, "loc", LOC_DESCRIPTOR), loc;
|
|
438
426
|
}
|
|
427
|
+
const LOC_DESCRIPTOR = {
|
|
428
|
+
value: null,
|
|
429
|
+
writable: !0,
|
|
430
|
+
enumerable: !1,
|
|
431
|
+
configurable: !1
|
|
432
|
+
};
|
|
439
433
|
/**
|
|
440
434
|
* Compute a `Location` from `start` and `end` source offsets.
|
|
441
435
|
*
|
|
442
|
-
*
|
|
436
|
+
* Returns a recycled `Location` object from the pool when possible, allocating only during warmup.
|
|
443
437
|
* Initializes `lines` and `lineStartIndices` tables if they haven't been already.
|
|
444
438
|
*
|
|
445
439
|
* @param start - Start offset
|
|
@@ -447,10 +441,31 @@ function getNodeLoc(node) {
|
|
|
447
441
|
* @returns Location
|
|
448
442
|
*/
|
|
449
443
|
function computeLoc(start, end) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
444
|
+
lines.length === 0 && initLines();
|
|
445
|
+
let loc;
|
|
446
|
+
activeLocationsCount < cachedLocations.length ? loc = cachedLocations[activeLocationsCount] : cachedLocations.push(loc = {
|
|
447
|
+
start: {
|
|
448
|
+
line: 0,
|
|
449
|
+
column: 0
|
|
450
|
+
},
|
|
451
|
+
end: {
|
|
452
|
+
line: 0,
|
|
453
|
+
column: 0
|
|
454
|
+
}
|
|
455
|
+
}), activeLocationsCount++;
|
|
456
|
+
let linesLen = lineStartIndices.length, line = 0, high = linesLen, mid;
|
|
457
|
+
do
|
|
458
|
+
mid = line + high >>> 1, start < lineStartIndices[mid] ? high = mid : line = mid + 1;
|
|
459
|
+
while (line < high);
|
|
460
|
+
let lineStart = lineStartIndices[line - 1], locStart = loc.start;
|
|
461
|
+
locStart.line = line, locStart.column = start - lineStart;
|
|
462
|
+
let locEnd = loc.end;
|
|
463
|
+
if (line === linesLen || end < lineStartIndices[line]) locEnd.line = line, locEnd.column = end - lineStart;
|
|
464
|
+
else {
|
|
465
|
+
for (line++, high = linesLen; line < high;) mid = line + high >>> 1, end < lineStartIndices[mid] ? high = mid : line = mid + 1;
|
|
466
|
+
locEnd.line = line, locEnd.column = end - lineStartIndices[line - 1];
|
|
467
|
+
}
|
|
468
|
+
return loc;
|
|
454
469
|
}
|
|
455
470
|
/**
|
|
456
471
|
* Get the deepest node containing a range index.
|
|
@@ -487,75 +502,17 @@ function traverse(node) {
|
|
|
487
502
|
return node;
|
|
488
503
|
}
|
|
489
504
|
//#endregion
|
|
490
|
-
//#region src-js/
|
|
491
|
-
|
|
492
|
-
const cachedComments = [];
|
|
493
|
-
let previousComments = [];
|
|
494
|
-
const commentsWithLoc = [], emptyComments = ObjectFreeze([]);
|
|
495
|
-
let resetCommentLoc;
|
|
496
|
-
/**
|
|
497
|
-
* Comment class.
|
|
498
|
-
*
|
|
499
|
-
* Creates `loc` lazily and caches it in a private field.
|
|
500
|
-
* Using a class with a private `#loc` field avoids hidden class transitions that would occur
|
|
501
|
-
* with `Object.defineProperty` / `delete` on plain objects.
|
|
502
|
-
* All `Comment` instances always have the same V8 hidden class, keeping property access monomorphic.
|
|
503
|
-
*/
|
|
504
|
-
var Comment = class {
|
|
505
|
-
type = null;
|
|
506
|
-
value = null;
|
|
507
|
-
start = 0;
|
|
508
|
-
end = 0;
|
|
509
|
-
range = [0, 0];
|
|
510
|
-
#loc = null;
|
|
511
|
-
get loc() {
|
|
512
|
-
let loc = this.#loc;
|
|
513
|
-
return loc === null ? (commentsWithLoc.push(this), this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
514
|
-
}
|
|
515
|
-
static {
|
|
516
|
-
resetCommentLoc = (comment) => {
|
|
517
|
-
comment.#loc = null;
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
};
|
|
521
|
-
ObjectDefineProperty(Comment.prototype, "loc", { enumerable: !0 });
|
|
522
|
-
/**
|
|
523
|
-
* Initialize comments for current file.
|
|
524
|
-
*
|
|
525
|
-
* Deserializes comments from the buffer using object pooling.
|
|
526
|
-
* If the program has a hashbang, sets first comment to a `Shebang` comment.
|
|
527
|
-
*/
|
|
528
|
-
function initComments() {
|
|
529
|
-
sourceText === null && initSourceText();
|
|
530
|
-
let { uint32 } = buffer, programPos32 = uint32[DATA_POINTER_POS_32] >> 2, commentsPos = uint32[programPos32 + 6], commentsLen = uint32[programPos32 + 8];
|
|
531
|
-
if (commentsLen === 0) {
|
|
532
|
-
comments = emptyComments;
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
for (; cachedComments.length < commentsLen;) cachedComments.push(new Comment());
|
|
536
|
-
for (let i = 0; i < commentsLen; i++) {
|
|
537
|
-
let comment = cachedComments[i], pos = commentsPos + i * 16, pos32 = pos >> 2, start = uint32[pos32], end = uint32[pos32 + 1], isBlock = buffer[pos + 12] !== 0;
|
|
538
|
-
comment.type = isBlock ? "Block" : "Line", comment.value = sourceText.slice(start + 2, end - (isBlock << 1)), comment.range[0] = comment.start = start, comment.range[1] = comment.end = end;
|
|
539
|
-
}
|
|
540
|
-
uint32[commentsPos >> 2] === 0 && sourceText.startsWith("#!") && (cachedComments[0].type = "Shebang"), previousComments.length >= commentsLen ? (previousComments.length = commentsLen, comments = previousComments) : comments = previousComments = cachedComments.slice(0, commentsLen);
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Reset comments after file has been linted.
|
|
544
|
-
*
|
|
545
|
-
* Clears cached `loc` on comments that had it accessed, so the getter
|
|
546
|
-
* will recalculate it when the comment is reused for a different file.
|
|
547
|
-
*/
|
|
548
|
-
function resetComments() {
|
|
549
|
-
for (let i = 0, len = commentsWithLoc.length; i < len; i++) resetCommentLoc(commentsWithLoc[i]);
|
|
550
|
-
commentsWithLoc.length = 0, comments = null;
|
|
551
|
-
}
|
|
505
|
+
//#region src-js/utils/typed_arrays.ts
|
|
506
|
+
const EMPTY_UINT8_ARRAY = new Uint8Array(), EMPTY_UINT32_ARRAY = new Uint32Array();
|
|
552
507
|
//#endregion
|
|
553
508
|
//#region src-js/plugins/tokens.ts
|
|
554
|
-
let tokens = null,
|
|
509
|
+
let tokens = null, tokensUint8 = null, tokensUint32 = null, tokensLen = 0, allTokensDeserialized = !1;
|
|
555
510
|
const cachedTokens = [];
|
|
556
511
|
let previousTokens = [];
|
|
557
|
-
const tokensWithLoc = []
|
|
558
|
-
let
|
|
512
|
+
const tokensWithLoc = [];
|
|
513
|
+
let activeTokensWithLocCount = 0;
|
|
514
|
+
const regexObjects = [];
|
|
515
|
+
let tokensWithRegexIndexes = EMPTY_UINT32_ARRAY, activeTokensWithRegexCount = 0, deserializedTokenIndexes = EMPTY_UINT32_ARRAY, deserializedTokensLen = 0, resetLoc;
|
|
559
516
|
/**
|
|
560
517
|
* Token implementation with lazy `loc` caching via private field.
|
|
561
518
|
*
|
|
@@ -573,7 +530,13 @@ var Token = class {
|
|
|
573
530
|
#loc = null;
|
|
574
531
|
get loc() {
|
|
575
532
|
let loc = this.#loc;
|
|
576
|
-
return loc === null ? (tokensWithLoc.push(this), this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
533
|
+
return loc === null ? (activeTokensWithLocCount < tokensWithLoc.length ? tokensWithLoc[activeTokensWithLocCount] = this : tokensWithLoc.push(this), activeTokensWithLocCount++, this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
534
|
+
}
|
|
535
|
+
toJSON() {
|
|
536
|
+
return {
|
|
537
|
+
...this,
|
|
538
|
+
loc: this.loc
|
|
539
|
+
};
|
|
577
540
|
}
|
|
578
541
|
static {
|
|
579
542
|
resetLoc = (token) => {
|
|
@@ -582,7 +545,6 @@ var Token = class {
|
|
|
582
545
|
}
|
|
583
546
|
};
|
|
584
547
|
ObjectDefineProperty(Token.prototype, "loc", { enumerable: !0 });
|
|
585
|
-
let tokensUint8 = null, tokensUint32 = null;
|
|
586
548
|
const TOKEN_TYPES = [
|
|
587
549
|
"Identifier",
|
|
588
550
|
"Keyword",
|
|
@@ -598,33 +560,88 @@ const TOKEN_TYPES = [
|
|
|
598
560
|
"JSXIdentifier"
|
|
599
561
|
];
|
|
600
562
|
/**
|
|
601
|
-
*
|
|
563
|
+
* Deserialize all tokens and build the `tokens` array.
|
|
564
|
+
* Called by `ast.tokens` getter.
|
|
602
565
|
*/
|
|
603
566
|
function initTokens() {
|
|
567
|
+
allTokensDeserialized || deserializeTokens(), previousTokens.length >= tokensLen ? (previousTokens.length = tokensLen, tokens = previousTokens) : tokens = previousTokens = cachedTokens.slice(0, tokensLen);
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Deserialize all tokens into `cachedTokens`.
|
|
571
|
+
* Does NOT build the `tokens` array - use `initTokens` for that.
|
|
572
|
+
*/
|
|
573
|
+
function deserializeTokens() {
|
|
574
|
+
tokensUint32 === null && initTokensBuffer();
|
|
575
|
+
for (let i = 0; i < tokensLen; i++) deserializeTokenIfNeeded(i);
|
|
576
|
+
allTokensDeserialized = !0, deserializedTokensLen = 0;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Initialize typed array views over the tokens region of the buffer.
|
|
580
|
+
*
|
|
581
|
+
* Populates `tokensUint8`, `tokensUint32`, and `tokensLen`, and grows `cachedTokens` if needed.
|
|
582
|
+
* Does NOT deserialize tokens - they are deserialized lazily via `deserializeTokenIfNeeded`.
|
|
583
|
+
*/
|
|
584
|
+
function initTokensBuffer() {
|
|
604
585
|
sourceText === null && initSourceText();
|
|
605
|
-
let { uint32 } = buffer, tokensPos = uint32[536870901]
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
tokensUint8 =
|
|
586
|
+
let { uint32 } = buffer, tokensPos = uint32[536870901];
|
|
587
|
+
tokensLen = uint32[536870902];
|
|
588
|
+
let arrayBuffer = buffer.buffer, absolutePos = buffer.byteOffset + tokensPos;
|
|
589
|
+
if (tokensUint8 = new Uint8Array(arrayBuffer, absolutePos, tokensLen << 4), tokensUint32 = new Uint32Array(arrayBuffer, absolutePos, tokensLen << 2), cachedTokens.length < tokensLen) {
|
|
590
|
+
do
|
|
591
|
+
cachedTokens.push(new Token());
|
|
592
|
+
while (cachedTokens.length < tokensLen);
|
|
593
|
+
let indexesLen = deserializedTokenIndexes.length;
|
|
594
|
+
indexesLen < tokensLen && (deserializedTokenIndexes = new Uint32Array(MathMax(tokensLen, indexesLen === 0 ? 16 : indexesLen << 1)));
|
|
595
|
+
}
|
|
609
596
|
}
|
|
610
597
|
/**
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
598
|
+
* Get token at `index`, deserializing if needed.
|
|
599
|
+
*
|
|
600
|
+
* Caller must ensure `initTokensBuffer()` has been called before calling this function.
|
|
601
|
+
*
|
|
602
|
+
* @param index - Token index in the tokens buffer
|
|
603
|
+
* @returns Deserialized token
|
|
614
604
|
*/
|
|
615
|
-
function
|
|
616
|
-
|
|
605
|
+
function getToken(index) {
|
|
606
|
+
if (!allTokensDeserialized) {
|
|
607
|
+
let token = deserializeTokenIfNeeded(index);
|
|
608
|
+
if (token !== null) return deserializedTokenIndexes[deserializedTokensLen++] = index, token;
|
|
609
|
+
}
|
|
610
|
+
return cachedTokens[index];
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Deserialize token at `index` if not already deserialized.
|
|
614
|
+
*
|
|
615
|
+
* Caller must ensure `initTokensBuffer()` has been called before calling this function.
|
|
616
|
+
*
|
|
617
|
+
* @param index - Token index in the tokens buffer
|
|
618
|
+
* @returns `Token` object if newly deserialized, or `null` if already deserialized
|
|
619
|
+
*/
|
|
620
|
+
function deserializeTokenIfNeeded(index) {
|
|
621
|
+
let pos = index << 4, flagPos = pos + 15;
|
|
622
|
+
if (tokensUint8[flagPos] !== 0) return null;
|
|
623
|
+
tokensUint8[flagPos] = 1;
|
|
624
|
+
let token = cachedTokens[index], kind = tokensUint8[pos + 8], pos32 = pos >> 2, start = tokensUint32[pos32], end = tokensUint32[pos32 + 1], value = sourceText.slice(start + +(kind === 2), end);
|
|
617
625
|
if (kind <= 2) tokensUint8[pos + 10] === 1 && (value = unescapeIdentifier(value));
|
|
618
626
|
else if (kind === 8) {
|
|
619
|
-
let regex
|
|
620
|
-
regexObjects.length
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
627
|
+
let regex;
|
|
628
|
+
if (activeTokensWithRegexCount < regexObjects.length) regex = regexObjects[activeTokensWithRegexCount];
|
|
629
|
+
else {
|
|
630
|
+
regexObjects.push(regex = {
|
|
631
|
+
pattern: null,
|
|
632
|
+
flags: null
|
|
633
|
+
});
|
|
634
|
+
let indexesLen = tokensWithRegexIndexes.length;
|
|
635
|
+
if (indexesLen === activeTokensWithRegexCount) {
|
|
636
|
+
let newArr = new Uint32Array(indexesLen === 0 ? 16 : indexesLen << 1);
|
|
637
|
+
newArr.set(tokensWithRegexIndexes, 0), tokensWithRegexIndexes = newArr;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
token.regex = regex, tokensWithRegexIndexes[activeTokensWithRegexCount++] = index;
|
|
624
641
|
let patternEnd = value.lastIndexOf("/");
|
|
625
|
-
regex.pattern = value.slice(1, patternEnd), regex.flags = value.slice(patternEnd + 1)
|
|
642
|
+
regex.pattern = value.slice(1, patternEnd), regex.flags = value.slice(patternEnd + 1);
|
|
626
643
|
}
|
|
627
|
-
token.type = TOKEN_TYPES[kind], token.value = value, token.range[0] = token.start = start, token.range[1] = token.end = end;
|
|
644
|
+
return token.type = TOKEN_TYPES[kind], token.value = value, token.range[0] = token.start = start, token.range[1] = token.end = end, token;
|
|
628
645
|
}
|
|
629
646
|
/**
|
|
630
647
|
* Unescape an identifier.
|
|
@@ -639,60 +656,159 @@ function unescapeIdentifier(name) {
|
|
|
639
656
|
return name.replace(/\\u(?:\{([0-9a-fA-F]+)\}|([0-9a-fA-F]{4}))/g, (_, hex1, hex2) => StringFromCodePoint(parseInt(hex1 ?? hex2, 16)));
|
|
640
657
|
}
|
|
641
658
|
/**
|
|
642
|
-
*
|
|
659
|
+
* Reset tokens after file has been linted.
|
|
643
660
|
*
|
|
644
|
-
*
|
|
645
|
-
*
|
|
661
|
+
* Clears cached `loc` on tokens that had it accessed, so the getter
|
|
662
|
+
* will recalculate it when the token is reused for a different file.
|
|
646
663
|
*/
|
|
647
|
-
function
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
664
|
+
function resetTokens() {
|
|
665
|
+
if (tokensUint32 !== null) {
|
|
666
|
+
if (allTokensDeserialized === !1) {
|
|
667
|
+
for (let i = 0; i < deserializedTokensLen; i++) cachedTokens[deserializedTokenIndexes[i]].value = null;
|
|
668
|
+
deserializedTokensLen = 0;
|
|
669
|
+
} else {
|
|
670
|
+
for (let i = 0; i < tokensLen; i++) cachedTokens[i].value = null;
|
|
671
|
+
allTokensDeserialized = !1;
|
|
672
|
+
}
|
|
673
|
+
for (let i = 0; i < activeTokensWithLocCount; i++) resetLoc(tokensWithLoc[i]);
|
|
674
|
+
activeTokensWithLocCount = 0;
|
|
675
|
+
for (let i = 0; i < activeTokensWithRegexCount; i++) {
|
|
676
|
+
let token = cachedTokens[tokensWithRegexIndexes[i]], regex = token.regex;
|
|
677
|
+
regex.pattern = null, regex.flags = null, token.regex = void 0;
|
|
678
|
+
}
|
|
679
|
+
activeTokensWithRegexCount = 0, tokens = null, tokensUint8 = null, tokensUint32 = null, tokensLen = 0;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src-js/plugins/comments.ts
|
|
684
|
+
let comments = null, commentsUint8 = null, commentsUint32 = null, commentsLen = 0, allCommentsDeserialized = !1;
|
|
685
|
+
const cachedComments = [];
|
|
686
|
+
let previousComments = [];
|
|
687
|
+
const commentsWithLoc = [];
|
|
688
|
+
let activeCommentsWithLocCount = 0, deserializedCommentIndexes = EMPTY_UINT32_ARRAY, deserializedCommentsLen = 0;
|
|
689
|
+
const EMPTY_COMMENTS = ObjectFreeze([]);
|
|
690
|
+
let resetCommentLoc;
|
|
691
|
+
/**
|
|
692
|
+
* Comment class.
|
|
693
|
+
*
|
|
694
|
+
* Creates `loc` lazily and caches it in a private field.
|
|
695
|
+
* Using a class with a private `#loc` field avoids hidden class transitions that would occur
|
|
696
|
+
* with `Object.defineProperty` / `delete` on plain objects.
|
|
697
|
+
* All `Comment` instances always have the same V8 hidden class, keeping property access monomorphic.
|
|
698
|
+
*/
|
|
699
|
+
var Comment = class {
|
|
700
|
+
type = null;
|
|
701
|
+
value = null;
|
|
702
|
+
start = 0;
|
|
703
|
+
end = 0;
|
|
704
|
+
range = [0, 0];
|
|
705
|
+
#loc = null;
|
|
706
|
+
get loc() {
|
|
707
|
+
let loc = this.#loc;
|
|
708
|
+
return loc === null ? (activeCommentsWithLocCount < commentsWithLoc.length ? commentsWithLoc[activeCommentsWithLocCount] = this : commentsWithLoc.push(this), activeCommentsWithLocCount++, this.#loc = computeLoc(this.start, this.end)) : loc;
|
|
709
|
+
}
|
|
710
|
+
toJSON() {
|
|
711
|
+
return {
|
|
712
|
+
...this,
|
|
713
|
+
loc: this.loc
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
static {
|
|
717
|
+
resetCommentLoc = (comment) => {
|
|
718
|
+
comment.#loc = null;
|
|
719
|
+
};
|
|
653
720
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
721
|
+
};
|
|
722
|
+
ObjectDefineProperty(Comment.prototype, "loc", { enumerable: !0 });
|
|
723
|
+
/**
|
|
724
|
+
* Deserialize all comments and build the `comments` array.
|
|
725
|
+
* Called by `ast.comments` getter.
|
|
726
|
+
*/
|
|
727
|
+
function initComments() {
|
|
728
|
+
allCommentsDeserialized || deserializeComments(), comments === null && (previousComments.length >= commentsLen ? (previousComments.length = commentsLen, comments = previousComments) : comments = previousComments = cachedComments.slice(0, commentsLen));
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Deserialize all comments into `cachedComments`.
|
|
732
|
+
* Does NOT build the `comments` array - use `initComments` for that.
|
|
733
|
+
*/
|
|
734
|
+
function deserializeComments() {
|
|
735
|
+
commentsUint32 === null && initCommentsBuffer();
|
|
736
|
+
for (let i = 0; i < commentsLen; i++) deserializeCommentIfNeeded(i);
|
|
737
|
+
allCommentsDeserialized = !0, deserializedCommentsLen = 0;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Initialize typed array views over the comments region of the buffer.
|
|
741
|
+
*
|
|
742
|
+
* Populates `commentsUint8`, `commentsUint32`, and `commentsLen`, and grows `cachedComments` if needed.
|
|
743
|
+
* Does NOT deserialize comments - they are deserialized lazily via `deserializeCommentIfNeeded`.
|
|
744
|
+
*
|
|
745
|
+
* Exception: If the file has a hashbang, eagerly deserializes the first comment and sets its type to `Shebang`.
|
|
746
|
+
*/
|
|
747
|
+
function initCommentsBuffer() {
|
|
748
|
+
sourceText === null && initSourceText();
|
|
749
|
+
let { uint32 } = buffer, programPos32 = uint32[DATA_POINTER_POS_32] >> 2, commentsPos = uint32[programPos32 + 8];
|
|
750
|
+
if (commentsLen = uint32[programPos32 + 10], commentsLen === 0) {
|
|
751
|
+
comments = EMPTY_COMMENTS, commentsUint8 = EMPTY_UINT8_ARRAY, commentsUint32 = EMPTY_UINT32_ARRAY, allCommentsDeserialized = !0;
|
|
657
752
|
return;
|
|
658
753
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
comment = comments[commentIndex], commentStart = comment.start;
|
|
754
|
+
let arrayBuffer = buffer.buffer, absolutePos = buffer.byteOffset + commentsPos;
|
|
755
|
+
if (commentsUint8 = new Uint8Array(arrayBuffer, absolutePos, commentsLen * 16), commentsUint32 = new Uint32Array(arrayBuffer, absolutePos, commentsLen * 4), cachedComments.length < commentsLen) {
|
|
756
|
+
do
|
|
757
|
+
cachedComments.push(new Comment());
|
|
758
|
+
while (cachedComments.length < commentsLen);
|
|
759
|
+
let indexesLen = deserializedCommentIndexes.length;
|
|
760
|
+
indexesLen < commentsLen && (deserializedCommentIndexes = new Uint32Array(MathMax(commentsLen, indexesLen === 0 ? 16 : indexesLen << 1)));
|
|
667
761
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
} while (commentStart < tokenStart);
|
|
762
|
+
commentsUint32[0] === 0 && sourceText.startsWith("#!") && (getComment(0).type = "Shebang");
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Get comment at `index`, deserializing if needed.
|
|
766
|
+
*
|
|
767
|
+
* Caller must ensure `initCommentsBuffer()` has been called before calling this function.
|
|
768
|
+
*
|
|
769
|
+
* @param index - Comment index in the comments buffer
|
|
770
|
+
* @returns Deserialized comment
|
|
771
|
+
*/
|
|
772
|
+
function getComment(index) {
|
|
773
|
+
if (!allCommentsDeserialized) {
|
|
774
|
+
let comment = deserializeCommentIfNeeded(index);
|
|
775
|
+
if (comment !== null) return deserializedCommentIndexes[deserializedCommentsLen++] = index, comment;
|
|
683
776
|
}
|
|
777
|
+
return cachedComments[index];
|
|
684
778
|
}
|
|
685
779
|
/**
|
|
686
|
-
*
|
|
780
|
+
* Deserialize comment at `index` if not already deserialized.
|
|
687
781
|
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
782
|
+
* Caller must ensure `initCommentsBuffer()` has been called before calling this function.
|
|
783
|
+
*
|
|
784
|
+
* @param index - Comment index in the comments buffer
|
|
785
|
+
* @returns `Comment` object if newly deserialized, or `null` if already deserialized
|
|
690
786
|
*/
|
|
691
|
-
function
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
787
|
+
function deserializeCommentIfNeeded(index) {
|
|
788
|
+
let pos = index << 4, flagPos = pos + 15;
|
|
789
|
+
if (commentsUint8[flagPos] !== 0) return null;
|
|
790
|
+
commentsUint8[flagPos] = 1;
|
|
791
|
+
let comment = cachedComments[index], isBlock = commentsUint8[pos + 12] !== 0, pos32 = pos >> 2, start = commentsUint32[pos32], end = commentsUint32[pos32 + 1];
|
|
792
|
+
return comment.type = isBlock ? "Block" : "Line", comment.value = sourceText.slice(start + 2, end - (isBlock << 1)), comment.range[0] = comment.start = start, comment.range[1] = comment.end = end, comment;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Reset comments after file has been linted.
|
|
796
|
+
*
|
|
797
|
+
* Clears cached `loc` on comments that had it accessed, so the getter
|
|
798
|
+
* will recalculate it when the comment is reused for a different file.
|
|
799
|
+
*/
|
|
800
|
+
function resetComments() {
|
|
801
|
+
if (commentsUint32 !== null) {
|
|
802
|
+
if (allCommentsDeserialized === !1) {
|
|
803
|
+
for (let i = 0; i < deserializedCommentsLen; i++) cachedComments[deserializedCommentIndexes[i]].value = null;
|
|
804
|
+
deserializedCommentsLen = 0;
|
|
805
|
+
} else {
|
|
806
|
+
for (let i = 0; i < commentsLen; i++) cachedComments[i].value = null;
|
|
807
|
+
allCommentsDeserialized = !1;
|
|
808
|
+
}
|
|
809
|
+
for (let i = 0; i < activeCommentsWithLocCount; i++) resetCommentLoc(commentsWithLoc[i]);
|
|
810
|
+
activeCommentsWithLocCount = 0, comments = null, commentsUint8 = null, commentsUint32 = null, commentsLen = 0;
|
|
811
|
+
}
|
|
696
812
|
}
|
|
697
813
|
//#endregion
|
|
698
814
|
//#region src-js/generated/deserialize.js
|
|
@@ -728,8 +844,8 @@ function deserializeProgram(pos) {
|
|
|
728
844
|
end,
|
|
729
845
|
range: [0, end],
|
|
730
846
|
parent: null
|
|
731
|
-
}, body = program.body = deserializeVecDirective(pos +
|
|
732
|
-
body.push(...deserializeVecStatement(pos +
|
|
847
|
+
}, body = program.body = deserializeVecDirective(pos + 88);
|
|
848
|
+
body.push(...deserializeVecStatement(pos + 112));
|
|
733
849
|
{
|
|
734
850
|
let start;
|
|
735
851
|
if (body.length > 0) {
|
|
@@ -799,7 +915,7 @@ function deserializeIdentifierName(pos) {
|
|
|
799
915
|
__proto__: NodeProto,
|
|
800
916
|
type: "Identifier",
|
|
801
917
|
decorators: null,
|
|
802
|
-
name: deserializeStr(pos +
|
|
918
|
+
name: deserializeStr(pos + 16),
|
|
803
919
|
optional: null,
|
|
804
920
|
typeAnnotation: null,
|
|
805
921
|
start: start = deserializeU32(pos),
|
|
@@ -814,7 +930,7 @@ function deserializeIdentifierReference(pos) {
|
|
|
814
930
|
__proto__: NodeProto,
|
|
815
931
|
type: "Identifier",
|
|
816
932
|
decorators: null,
|
|
817
|
-
name: deserializeStr(pos +
|
|
933
|
+
name: deserializeStr(pos + 16),
|
|
818
934
|
optional: null,
|
|
819
935
|
typeAnnotation: null,
|
|
820
936
|
start: start = deserializeU32(pos),
|
|
@@ -829,7 +945,7 @@ function deserializeBindingIdentifier(pos) {
|
|
|
829
945
|
__proto__: NodeProto,
|
|
830
946
|
type: "Identifier",
|
|
831
947
|
decorators: null,
|
|
832
|
-
name: deserializeStr(pos +
|
|
948
|
+
name: deserializeStr(pos + 16),
|
|
833
949
|
optional: null,
|
|
834
950
|
typeAnnotation: null,
|
|
835
951
|
start: start = deserializeU32(pos),
|
|
@@ -844,7 +960,7 @@ function deserializeLabelIdentifier(pos) {
|
|
|
844
960
|
__proto__: NodeProto,
|
|
845
961
|
type: "Identifier",
|
|
846
962
|
decorators: null,
|
|
847
|
-
name: deserializeStr(pos +
|
|
963
|
+
name: deserializeStr(pos + 16),
|
|
848
964
|
optional: null,
|
|
849
965
|
typeAnnotation: null,
|
|
850
966
|
start: start = deserializeU32(pos),
|
|
@@ -875,7 +991,7 @@ function deserializeArrayExpression(pos) {
|
|
|
875
991
|
range: [start, end],
|
|
876
992
|
parent
|
|
877
993
|
};
|
|
878
|
-
return node.elements = deserializeVecArrayExpressionElement(pos +
|
|
994
|
+
return node.elements = deserializeVecArrayExpressionElement(pos + 16), parent = previousParent, node;
|
|
879
995
|
}
|
|
880
996
|
function deserializeArrayExpressionElement(pos) {
|
|
881
997
|
switch (uint8[pos]) {
|
|
@@ -940,7 +1056,7 @@ function deserializeObjectExpression(pos) {
|
|
|
940
1056
|
range: [start, end],
|
|
941
1057
|
parent
|
|
942
1058
|
};
|
|
943
|
-
return node.properties = deserializeVecObjectPropertyKind(pos +
|
|
1059
|
+
return node.properties = deserializeVecObjectPropertyKind(pos + 16), parent = previousParent, node;
|
|
944
1060
|
}
|
|
945
1061
|
function deserializeObjectPropertyKind(pos) {
|
|
946
1062
|
switch (uint8[pos]) {
|
|
@@ -953,19 +1069,19 @@ function deserializeObjectProperty(pos) {
|
|
|
953
1069
|
let start, end, previousParent = parent, node = parent = {
|
|
954
1070
|
__proto__: NodeProto,
|
|
955
1071
|
type: "Property",
|
|
956
|
-
kind: deserializePropertyKind(pos +
|
|
1072
|
+
kind: deserializePropertyKind(pos + 12),
|
|
957
1073
|
key: null,
|
|
958
1074
|
value: null,
|
|
959
|
-
method: deserializeBool(pos +
|
|
960
|
-
shorthand: deserializeBool(pos +
|
|
961
|
-
computed: deserializeBool(pos +
|
|
1075
|
+
method: deserializeBool(pos + 13),
|
|
1076
|
+
shorthand: deserializeBool(pos + 14),
|
|
1077
|
+
computed: deserializeBool(pos + 15),
|
|
962
1078
|
optional: null,
|
|
963
1079
|
start: start = deserializeU32(pos),
|
|
964
1080
|
end: end = deserializeU32(pos + 4),
|
|
965
1081
|
range: [start, end],
|
|
966
1082
|
parent
|
|
967
1083
|
};
|
|
968
|
-
return node.key = deserializePropertyKey(pos +
|
|
1084
|
+
return node.key = deserializePropertyKey(pos + 16), node.value = deserializeExpression(pos + 32), node.optional = !1, parent = previousParent, node;
|
|
969
1085
|
}
|
|
970
1086
|
function deserializePropertyKey(pos) {
|
|
971
1087
|
switch (uint8[pos]) {
|
|
@@ -1036,7 +1152,7 @@ function deserializeTemplateLiteral(pos) {
|
|
|
1036
1152
|
range: [start, end],
|
|
1037
1153
|
parent
|
|
1038
1154
|
};
|
|
1039
|
-
return node.quasis = deserializeVecTemplateElement(pos +
|
|
1155
|
+
return node.quasis = deserializeVecTemplateElement(pos + 16), node.expressions = deserializeVecExpression(pos + 40), parent = previousParent, node;
|
|
1040
1156
|
}
|
|
1041
1157
|
function deserializeTaggedTemplateExpression(pos) {
|
|
1042
1158
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1050,11 +1166,11 @@ function deserializeTaggedTemplateExpression(pos) {
|
|
|
1050
1166
|
range: [start, end],
|
|
1051
1167
|
parent
|
|
1052
1168
|
};
|
|
1053
|
-
return node.tag = deserializeExpression(pos +
|
|
1169
|
+
return node.tag = deserializeExpression(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), node.quasi = deserializeTemplateLiteral(pos + 40), parent = previousParent, node;
|
|
1054
1170
|
}
|
|
1055
1171
|
function deserializeTemplateElement(pos) {
|
|
1056
|
-
let tail = deserializeBool(pos +
|
|
1057
|
-
return value.cooked !== null && deserializeBool(pos +
|
|
1172
|
+
let tail = deserializeBool(pos + 12), start = deserializeU32(pos) - 1, end = deserializeU32(pos + 4) + 2 - tail, value = deserializeTemplateElementValue(pos + 16);
|
|
1173
|
+
return value.cooked !== null && deserializeBool(pos + 13) && (value.cooked = value.cooked.replace(/\uFFFD(.{4})/g, (_, hex) => StringFromCodePoint(parseInt(hex, 16)))), {
|
|
1058
1174
|
__proto__: NodeProto,
|
|
1059
1175
|
type: "TemplateElement",
|
|
1060
1176
|
value,
|
|
@@ -1077,14 +1193,14 @@ function deserializeComputedMemberExpression(pos) {
|
|
|
1077
1193
|
type: "MemberExpression",
|
|
1078
1194
|
object: null,
|
|
1079
1195
|
property: null,
|
|
1080
|
-
optional: deserializeBool(pos +
|
|
1196
|
+
optional: deserializeBool(pos + 12),
|
|
1081
1197
|
computed: null,
|
|
1082
1198
|
start: start = deserializeU32(pos),
|
|
1083
1199
|
end: end = deserializeU32(pos + 4),
|
|
1084
1200
|
range: [start, end],
|
|
1085
1201
|
parent
|
|
1086
1202
|
};
|
|
1087
|
-
return node.object = deserializeExpression(pos +
|
|
1203
|
+
return node.object = deserializeExpression(pos + 16), node.property = deserializeExpression(pos + 32), node.computed = !0, parent = previousParent, node;
|
|
1088
1204
|
}
|
|
1089
1205
|
function deserializeStaticMemberExpression(pos) {
|
|
1090
1206
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1092,14 +1208,14 @@ function deserializeStaticMemberExpression(pos) {
|
|
|
1092
1208
|
type: "MemberExpression",
|
|
1093
1209
|
object: null,
|
|
1094
1210
|
property: null,
|
|
1095
|
-
optional: deserializeBool(pos +
|
|
1211
|
+
optional: deserializeBool(pos + 12),
|
|
1096
1212
|
computed: null,
|
|
1097
1213
|
start: start = deserializeU32(pos),
|
|
1098
1214
|
end: end = deserializeU32(pos + 4),
|
|
1099
1215
|
range: [start, end],
|
|
1100
1216
|
parent
|
|
1101
1217
|
};
|
|
1102
|
-
return node.object = deserializeExpression(pos +
|
|
1218
|
+
return node.object = deserializeExpression(pos + 16), node.property = deserializeIdentifierName(pos + 32), node.computed = !1, parent = previousParent, node;
|
|
1103
1219
|
}
|
|
1104
1220
|
function deserializePrivateFieldExpression(pos) {
|
|
1105
1221
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1107,14 +1223,14 @@ function deserializePrivateFieldExpression(pos) {
|
|
|
1107
1223
|
type: "MemberExpression",
|
|
1108
1224
|
object: null,
|
|
1109
1225
|
property: null,
|
|
1110
|
-
optional: deserializeBool(pos +
|
|
1226
|
+
optional: deserializeBool(pos + 12),
|
|
1111
1227
|
computed: null,
|
|
1112
1228
|
start: start = deserializeU32(pos),
|
|
1113
1229
|
end: end = deserializeU32(pos + 4),
|
|
1114
1230
|
range: [start, end],
|
|
1115
1231
|
parent
|
|
1116
1232
|
};
|
|
1117
|
-
return node.object = deserializeExpression(pos +
|
|
1233
|
+
return node.object = deserializeExpression(pos + 16), node.property = deserializePrivateIdentifier(pos + 32), node.computed = !1, parent = previousParent, node;
|
|
1118
1234
|
}
|
|
1119
1235
|
function deserializeCallExpression(pos) {
|
|
1120
1236
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1123,13 +1239,13 @@ function deserializeCallExpression(pos) {
|
|
|
1123
1239
|
callee: null,
|
|
1124
1240
|
typeArguments: null,
|
|
1125
1241
|
arguments: null,
|
|
1126
|
-
optional: deserializeBool(pos +
|
|
1242
|
+
optional: deserializeBool(pos + 12),
|
|
1127
1243
|
start: start = deserializeU32(pos),
|
|
1128
1244
|
end: end = deserializeU32(pos + 4),
|
|
1129
1245
|
range: [start, end],
|
|
1130
1246
|
parent
|
|
1131
1247
|
};
|
|
1132
|
-
return node.callee = deserializeExpression(pos +
|
|
1248
|
+
return node.callee = deserializeExpression(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), node.arguments = deserializeVecArgument(pos + 40), parent = previousParent, node;
|
|
1133
1249
|
}
|
|
1134
1250
|
function deserializeNewExpression(pos) {
|
|
1135
1251
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1143,7 +1259,7 @@ function deserializeNewExpression(pos) {
|
|
|
1143
1259
|
range: [start, end],
|
|
1144
1260
|
parent
|
|
1145
1261
|
};
|
|
1146
|
-
return node.callee = deserializeExpression(pos +
|
|
1262
|
+
return node.callee = deserializeExpression(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), node.arguments = deserializeVecArgument(pos + 40), parent = previousParent, node;
|
|
1147
1263
|
}
|
|
1148
1264
|
function deserializeMetaProperty(pos) {
|
|
1149
1265
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1156,7 +1272,7 @@ function deserializeMetaProperty(pos) {
|
|
|
1156
1272
|
range: [start, end],
|
|
1157
1273
|
parent
|
|
1158
1274
|
};
|
|
1159
|
-
return node.meta = deserializeIdentifierName(pos +
|
|
1275
|
+
return node.meta = deserializeIdentifierName(pos + 16), node.property = deserializeIdentifierName(pos + 48), parent = previousParent, node;
|
|
1160
1276
|
}
|
|
1161
1277
|
function deserializeSpreadElement(pos) {
|
|
1162
1278
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1168,7 +1284,7 @@ function deserializeSpreadElement(pos) {
|
|
|
1168
1284
|
range: [start, end],
|
|
1169
1285
|
parent
|
|
1170
1286
|
};
|
|
1171
|
-
return node.argument = deserializeExpression(pos +
|
|
1287
|
+
return node.argument = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
1172
1288
|
}
|
|
1173
1289
|
function deserializeArgument(pos) {
|
|
1174
1290
|
switch (uint8[pos]) {
|
|
@@ -1223,21 +1339,21 @@ function deserializeUpdateExpression(pos) {
|
|
|
1223
1339
|
let start, end, previousParent = parent, node = parent = {
|
|
1224
1340
|
__proto__: NodeProto,
|
|
1225
1341
|
type: "UpdateExpression",
|
|
1226
|
-
operator: deserializeUpdateOperator(pos +
|
|
1227
|
-
prefix: deserializeBool(pos +
|
|
1342
|
+
operator: deserializeUpdateOperator(pos + 12),
|
|
1343
|
+
prefix: deserializeBool(pos + 13),
|
|
1228
1344
|
argument: null,
|
|
1229
1345
|
start: start = deserializeU32(pos),
|
|
1230
1346
|
end: end = deserializeU32(pos + 4),
|
|
1231
1347
|
range: [start, end],
|
|
1232
1348
|
parent
|
|
1233
1349
|
};
|
|
1234
|
-
return node.argument = deserializeSimpleAssignmentTarget(pos +
|
|
1350
|
+
return node.argument = deserializeSimpleAssignmentTarget(pos + 16), parent = previousParent, node;
|
|
1235
1351
|
}
|
|
1236
1352
|
function deserializeUnaryExpression(pos) {
|
|
1237
1353
|
let start, end, previousParent = parent, node = parent = {
|
|
1238
1354
|
__proto__: NodeProto,
|
|
1239
1355
|
type: "UnaryExpression",
|
|
1240
|
-
operator: deserializeUnaryOperator(pos +
|
|
1356
|
+
operator: deserializeUnaryOperator(pos + 12),
|
|
1241
1357
|
argument: null,
|
|
1242
1358
|
prefix: null,
|
|
1243
1359
|
start: start = deserializeU32(pos),
|
|
@@ -1245,21 +1361,21 @@ function deserializeUnaryExpression(pos) {
|
|
|
1245
1361
|
range: [start, end],
|
|
1246
1362
|
parent
|
|
1247
1363
|
};
|
|
1248
|
-
return node.argument = deserializeExpression(pos +
|
|
1364
|
+
return node.argument = deserializeExpression(pos + 16), node.prefix = !0, parent = previousParent, node;
|
|
1249
1365
|
}
|
|
1250
1366
|
function deserializeBinaryExpression(pos) {
|
|
1251
1367
|
let start, end, previousParent = parent, node = parent = {
|
|
1252
1368
|
__proto__: NodeProto,
|
|
1253
1369
|
type: "BinaryExpression",
|
|
1254
1370
|
left: null,
|
|
1255
|
-
operator: deserializeBinaryOperator(pos +
|
|
1371
|
+
operator: deserializeBinaryOperator(pos + 12),
|
|
1256
1372
|
right: null,
|
|
1257
1373
|
start: start = deserializeU32(pos),
|
|
1258
1374
|
end: end = deserializeU32(pos + 4),
|
|
1259
1375
|
range: [start, end],
|
|
1260
1376
|
parent
|
|
1261
1377
|
};
|
|
1262
|
-
return node.left = deserializeExpression(pos +
|
|
1378
|
+
return node.left = deserializeExpression(pos + 16), node.right = deserializeExpression(pos + 32), parent = previousParent, node;
|
|
1263
1379
|
}
|
|
1264
1380
|
function deserializePrivateInExpression(pos) {
|
|
1265
1381
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1273,21 +1389,21 @@ function deserializePrivateInExpression(pos) {
|
|
|
1273
1389
|
range: [start, end],
|
|
1274
1390
|
parent
|
|
1275
1391
|
};
|
|
1276
|
-
return node.left = deserializePrivateIdentifier(pos +
|
|
1392
|
+
return node.left = deserializePrivateIdentifier(pos + 16), node.operator = "in", node.right = deserializeExpression(pos + 48), parent = previousParent, node;
|
|
1277
1393
|
}
|
|
1278
1394
|
function deserializeLogicalExpression(pos) {
|
|
1279
1395
|
let start, end, previousParent = parent, node = parent = {
|
|
1280
1396
|
__proto__: NodeProto,
|
|
1281
1397
|
type: "LogicalExpression",
|
|
1282
1398
|
left: null,
|
|
1283
|
-
operator: deserializeLogicalOperator(pos +
|
|
1399
|
+
operator: deserializeLogicalOperator(pos + 12),
|
|
1284
1400
|
right: null,
|
|
1285
1401
|
start: start = deserializeU32(pos),
|
|
1286
1402
|
end: end = deserializeU32(pos + 4),
|
|
1287
1403
|
range: [start, end],
|
|
1288
1404
|
parent
|
|
1289
1405
|
};
|
|
1290
|
-
return node.left = deserializeExpression(pos +
|
|
1406
|
+
return node.left = deserializeExpression(pos + 16), node.right = deserializeExpression(pos + 32), parent = previousParent, node;
|
|
1291
1407
|
}
|
|
1292
1408
|
function deserializeConditionalExpression(pos) {
|
|
1293
1409
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1301,13 +1417,13 @@ function deserializeConditionalExpression(pos) {
|
|
|
1301
1417
|
range: [start, end],
|
|
1302
1418
|
parent
|
|
1303
1419
|
};
|
|
1304
|
-
return node.test = deserializeExpression(pos +
|
|
1420
|
+
return node.test = deserializeExpression(pos + 16), node.consequent = deserializeExpression(pos + 32), node.alternate = deserializeExpression(pos + 48), parent = previousParent, node;
|
|
1305
1421
|
}
|
|
1306
1422
|
function deserializeAssignmentExpression(pos) {
|
|
1307
1423
|
let start, end, previousParent = parent, node = parent = {
|
|
1308
1424
|
__proto__: NodeProto,
|
|
1309
1425
|
type: "AssignmentExpression",
|
|
1310
|
-
operator: deserializeAssignmentOperator(pos +
|
|
1426
|
+
operator: deserializeAssignmentOperator(pos + 12),
|
|
1311
1427
|
left: null,
|
|
1312
1428
|
right: null,
|
|
1313
1429
|
start: start = deserializeU32(pos),
|
|
@@ -1315,7 +1431,7 @@ function deserializeAssignmentExpression(pos) {
|
|
|
1315
1431
|
range: [start, end],
|
|
1316
1432
|
parent
|
|
1317
1433
|
};
|
|
1318
|
-
return node.left = deserializeAssignmentTarget(pos +
|
|
1434
|
+
return node.left = deserializeAssignmentTarget(pos + 16), node.right = deserializeExpression(pos + 32), parent = previousParent, node;
|
|
1319
1435
|
}
|
|
1320
1436
|
function deserializeAssignmentTarget(pos) {
|
|
1321
1437
|
switch (uint8[pos]) {
|
|
@@ -1357,7 +1473,7 @@ function deserializeArrayAssignmentTarget(pos) {
|
|
|
1357
1473
|
end: end = deserializeU32(pos + 4),
|
|
1358
1474
|
range: [start, end],
|
|
1359
1475
|
parent
|
|
1360
|
-
}, elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos +
|
|
1476
|
+
}, elements = deserializeVecOptionAssignmentTargetMaybeDefault(pos + 16), rest = deserializeOptionBoxAssignmentTargetRest(pos + 40);
|
|
1361
1477
|
return rest !== null && elements.push(rest), node.decorators = [], node.elements = elements, node.optional = !1, parent = previousParent, node;
|
|
1362
1478
|
}
|
|
1363
1479
|
function deserializeObjectAssignmentTarget(pos) {
|
|
@@ -1372,7 +1488,7 @@ function deserializeObjectAssignmentTarget(pos) {
|
|
|
1372
1488
|
end: end = deserializeU32(pos + 4),
|
|
1373
1489
|
range: [start, end],
|
|
1374
1490
|
parent
|
|
1375
|
-
}, properties = deserializeVecAssignmentTargetProperty(pos +
|
|
1491
|
+
}, properties = deserializeVecAssignmentTargetProperty(pos + 16), rest = deserializeOptionBoxAssignmentTargetRest(pos + 40);
|
|
1376
1492
|
return rest !== null && properties.push(rest), node.decorators = [], node.properties = properties, node.optional = !1, parent = previousParent, node;
|
|
1377
1493
|
}
|
|
1378
1494
|
function deserializeAssignmentTargetRest(pos) {
|
|
@@ -1389,7 +1505,7 @@ function deserializeAssignmentTargetRest(pos) {
|
|
|
1389
1505
|
range: [start, end],
|
|
1390
1506
|
parent
|
|
1391
1507
|
};
|
|
1392
|
-
return node.decorators = [], node.argument = deserializeAssignmentTarget(pos +
|
|
1508
|
+
return node.decorators = [], node.argument = deserializeAssignmentTarget(pos + 16), node.optional = !1, parent = previousParent, node;
|
|
1393
1509
|
}
|
|
1394
1510
|
function deserializeAssignmentTargetMaybeDefault(pos) {
|
|
1395
1511
|
switch (uint8[pos]) {
|
|
@@ -1421,7 +1537,7 @@ function deserializeAssignmentTargetWithDefault(pos) {
|
|
|
1421
1537
|
range: [start, end],
|
|
1422
1538
|
parent
|
|
1423
1539
|
};
|
|
1424
|
-
return node.decorators = [], node.left = deserializeAssignmentTarget(pos +
|
|
1540
|
+
return node.decorators = [], node.left = deserializeAssignmentTarget(pos + 16), node.right = deserializeExpression(pos + 32), node.optional = !1, parent = previousParent, node;
|
|
1425
1541
|
}
|
|
1426
1542
|
function deserializeAssignmentTargetProperty(pos) {
|
|
1427
1543
|
switch (uint8[pos]) {
|
|
@@ -1445,7 +1561,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) {
|
|
|
1445
1561
|
end,
|
|
1446
1562
|
range: [start, end],
|
|
1447
1563
|
parent
|
|
1448
|
-
}, key = deserializeIdentifierReference(pos +
|
|
1564
|
+
}, key = deserializeIdentifierReference(pos + 16), keyStart, keyEnd, value = {
|
|
1449
1565
|
__proto__: NodeProto,
|
|
1450
1566
|
type: "Identifier",
|
|
1451
1567
|
decorators: [],
|
|
@@ -1456,7 +1572,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) {
|
|
|
1456
1572
|
end: keyEnd = key.end,
|
|
1457
1573
|
range: [keyStart, keyEnd],
|
|
1458
1574
|
parent
|
|
1459
|
-
}, init = deserializeOptionExpression(pos +
|
|
1575
|
+
}, init = deserializeOptionExpression(pos + 48);
|
|
1460
1576
|
if (init !== null) {
|
|
1461
1577
|
let left = value;
|
|
1462
1578
|
value = {
|
|
@@ -1484,14 +1600,14 @@ function deserializeAssignmentTargetPropertyProperty(pos) {
|
|
|
1484
1600
|
value: null,
|
|
1485
1601
|
method: null,
|
|
1486
1602
|
shorthand: null,
|
|
1487
|
-
computed: deserializeBool(pos +
|
|
1603
|
+
computed: deserializeBool(pos + 12),
|
|
1488
1604
|
optional: null,
|
|
1489
1605
|
start: start = deserializeU32(pos),
|
|
1490
1606
|
end: end = deserializeU32(pos + 4),
|
|
1491
1607
|
range: [start, end],
|
|
1492
1608
|
parent
|
|
1493
1609
|
};
|
|
1494
|
-
return node.kind = "init", node.key = deserializePropertyKey(pos +
|
|
1610
|
+
return node.kind = "init", node.key = deserializePropertyKey(pos + 16), node.value = deserializeAssignmentTargetMaybeDefault(pos + 32), node.method = !1, node.shorthand = !1, node.optional = !1, parent = previousParent, node;
|
|
1495
1611
|
}
|
|
1496
1612
|
function deserializeSequenceExpression(pos) {
|
|
1497
1613
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1503,7 +1619,7 @@ function deserializeSequenceExpression(pos) {
|
|
|
1503
1619
|
range: [start, end],
|
|
1504
1620
|
parent
|
|
1505
1621
|
};
|
|
1506
|
-
return node.expressions = deserializeVecExpression(pos +
|
|
1622
|
+
return node.expressions = deserializeVecExpression(pos + 16), parent = previousParent, node;
|
|
1507
1623
|
}
|
|
1508
1624
|
function deserializeSuper(pos) {
|
|
1509
1625
|
let start, end;
|
|
@@ -1526,7 +1642,7 @@ function deserializeAwaitExpression(pos) {
|
|
|
1526
1642
|
range: [start, end],
|
|
1527
1643
|
parent
|
|
1528
1644
|
};
|
|
1529
|
-
return node.argument = deserializeExpression(pos +
|
|
1645
|
+
return node.argument = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
1530
1646
|
}
|
|
1531
1647
|
function deserializeChainExpression(pos) {
|
|
1532
1648
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1538,7 +1654,7 @@ function deserializeChainExpression(pos) {
|
|
|
1538
1654
|
range: [start, end],
|
|
1539
1655
|
parent
|
|
1540
1656
|
};
|
|
1541
|
-
return node.expression = deserializeChainElement(pos +
|
|
1657
|
+
return node.expression = deserializeChainElement(pos + 16), parent = previousParent, node;
|
|
1542
1658
|
}
|
|
1543
1659
|
function deserializeChainElement(pos) {
|
|
1544
1660
|
switch (uint8[pos]) {
|
|
@@ -1552,7 +1668,7 @@ function deserializeChainElement(pos) {
|
|
|
1552
1668
|
}
|
|
1553
1669
|
function deserializeParenthesizedExpression(pos) {
|
|
1554
1670
|
let node;
|
|
1555
|
-
return node = deserializeExpression(pos +
|
|
1671
|
+
return node = deserializeExpression(pos + 16), node;
|
|
1556
1672
|
}
|
|
1557
1673
|
function deserializeStatement(pos) {
|
|
1558
1674
|
switch (uint8[pos]) {
|
|
@@ -1597,13 +1713,13 @@ function deserializeDirective(pos) {
|
|
|
1597
1713
|
__proto__: NodeProto,
|
|
1598
1714
|
type: "ExpressionStatement",
|
|
1599
1715
|
expression: null,
|
|
1600
|
-
directive: deserializeStr(pos +
|
|
1716
|
+
directive: deserializeStr(pos + 64),
|
|
1601
1717
|
start: start = deserializeU32(pos),
|
|
1602
1718
|
end: end = deserializeU32(pos + 4),
|
|
1603
1719
|
range: [start, end],
|
|
1604
1720
|
parent
|
|
1605
1721
|
};
|
|
1606
|
-
return node.expression = deserializeStringLiteral(pos +
|
|
1722
|
+
return node.expression = deserializeStringLiteral(pos + 16), parent = previousParent, node;
|
|
1607
1723
|
}
|
|
1608
1724
|
function deserializeBlockStatement(pos) {
|
|
1609
1725
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1615,7 +1731,7 @@ function deserializeBlockStatement(pos) {
|
|
|
1615
1731
|
range: [start, end],
|
|
1616
1732
|
parent
|
|
1617
1733
|
};
|
|
1618
|
-
return node.body = deserializeVecStatement(pos +
|
|
1734
|
+
return node.body = deserializeVecStatement(pos + 16), parent = previousParent, node;
|
|
1619
1735
|
}
|
|
1620
1736
|
function deserializeDeclaration(pos) {
|
|
1621
1737
|
switch (uint8[pos]) {
|
|
@@ -1635,15 +1751,15 @@ function deserializeVariableDeclaration(pos) {
|
|
|
1635
1751
|
let start, end, previousParent = parent, node = parent = {
|
|
1636
1752
|
__proto__: NodeProto,
|
|
1637
1753
|
type: "VariableDeclaration",
|
|
1638
|
-
kind: deserializeVariableDeclarationKind(pos +
|
|
1754
|
+
kind: deserializeVariableDeclarationKind(pos + 12),
|
|
1639
1755
|
declarations: null,
|
|
1640
|
-
declare: deserializeBool(pos +
|
|
1756
|
+
declare: deserializeBool(pos + 13),
|
|
1641
1757
|
start: start = deserializeU32(pos),
|
|
1642
1758
|
end: end = deserializeU32(pos + 4),
|
|
1643
1759
|
range: [start, end],
|
|
1644
1760
|
parent
|
|
1645
1761
|
};
|
|
1646
|
-
return node.declarations = deserializeVecVariableDeclarator(pos +
|
|
1762
|
+
return node.declarations = deserializeVecVariableDeclarator(pos + 16), parent = previousParent, node;
|
|
1647
1763
|
}
|
|
1648
1764
|
function deserializeVariableDeclarationKind(pos) {
|
|
1649
1765
|
switch (uint8[pos]) {
|
|
@@ -1656,24 +1772,24 @@ function deserializeVariableDeclarationKind(pos) {
|
|
|
1656
1772
|
}
|
|
1657
1773
|
}
|
|
1658
1774
|
function deserializeVariableDeclarator(pos) {
|
|
1659
|
-
let previousParent = parent,
|
|
1775
|
+
let start, end, previousParent = parent, node = parent = {
|
|
1660
1776
|
__proto__: NodeProto,
|
|
1661
1777
|
type: "VariableDeclarator",
|
|
1662
1778
|
id: null,
|
|
1663
1779
|
init: null,
|
|
1664
|
-
definite:
|
|
1665
|
-
start: deserializeU32(pos),
|
|
1666
|
-
end: deserializeU32(pos + 4),
|
|
1667
|
-
range: [
|
|
1668
|
-
parent
|
|
1669
|
-
};
|
|
1670
|
-
variableDeclarator.id = deserializeBindingPattern(pos + 8);
|
|
1780
|
+
definite: deserializeBool(pos + 13),
|
|
1781
|
+
start: start = deserializeU32(pos),
|
|
1782
|
+
end: end = deserializeU32(pos + 4),
|
|
1783
|
+
range: [start, end],
|
|
1784
|
+
parent
|
|
1785
|
+
}, pattern = deserializeBindingPattern(pos + 16);
|
|
1671
1786
|
{
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1787
|
+
let previousParent = parent;
|
|
1788
|
+
parent = pattern;
|
|
1789
|
+
let typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 32);
|
|
1790
|
+
typeAnnotation !== null && (pattern.typeAnnotation = typeAnnotation, pattern.range[1] = pattern.end = typeAnnotation.end), parent = previousParent;
|
|
1675
1791
|
}
|
|
1676
|
-
return
|
|
1792
|
+
return node.id = pattern, node.init = deserializeOptionExpression(pos + 40), parent = previousParent, node;
|
|
1677
1793
|
}
|
|
1678
1794
|
function deserializeEmptyStatement(pos) {
|
|
1679
1795
|
let start, end;
|
|
@@ -1697,7 +1813,7 @@ function deserializeExpressionStatement(pos) {
|
|
|
1697
1813
|
range: [start, end],
|
|
1698
1814
|
parent
|
|
1699
1815
|
};
|
|
1700
|
-
return node.expression = deserializeExpression(pos +
|
|
1816
|
+
return node.expression = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
1701
1817
|
}
|
|
1702
1818
|
function deserializeIfStatement(pos) {
|
|
1703
1819
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1711,7 +1827,7 @@ function deserializeIfStatement(pos) {
|
|
|
1711
1827
|
range: [start, end],
|
|
1712
1828
|
parent
|
|
1713
1829
|
};
|
|
1714
|
-
return node.test = deserializeExpression(pos +
|
|
1830
|
+
return node.test = deserializeExpression(pos + 16), node.consequent = deserializeStatement(pos + 32), node.alternate = deserializeOptionStatement(pos + 48), parent = previousParent, node;
|
|
1715
1831
|
}
|
|
1716
1832
|
function deserializeDoWhileStatement(pos) {
|
|
1717
1833
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1724,7 +1840,7 @@ function deserializeDoWhileStatement(pos) {
|
|
|
1724
1840
|
range: [start, end],
|
|
1725
1841
|
parent
|
|
1726
1842
|
};
|
|
1727
|
-
return node.body = deserializeStatement(pos +
|
|
1843
|
+
return node.body = deserializeStatement(pos + 16), node.test = deserializeExpression(pos + 32), parent = previousParent, node;
|
|
1728
1844
|
}
|
|
1729
1845
|
function deserializeWhileStatement(pos) {
|
|
1730
1846
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1737,7 +1853,7 @@ function deserializeWhileStatement(pos) {
|
|
|
1737
1853
|
range: [start, end],
|
|
1738
1854
|
parent
|
|
1739
1855
|
};
|
|
1740
|
-
return node.test = deserializeExpression(pos +
|
|
1856
|
+
return node.test = deserializeExpression(pos + 16), node.body = deserializeStatement(pos + 32), parent = previousParent, node;
|
|
1741
1857
|
}
|
|
1742
1858
|
function deserializeForStatement(pos) {
|
|
1743
1859
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1752,7 +1868,7 @@ function deserializeForStatement(pos) {
|
|
|
1752
1868
|
range: [start, end],
|
|
1753
1869
|
parent
|
|
1754
1870
|
};
|
|
1755
|
-
return node.init = deserializeOptionForStatementInit(pos +
|
|
1871
|
+
return node.init = deserializeOptionForStatementInit(pos + 16), node.test = deserializeOptionExpression(pos + 32), node.update = deserializeOptionExpression(pos + 48), node.body = deserializeStatement(pos + 64), parent = previousParent, node;
|
|
1756
1872
|
}
|
|
1757
1873
|
function deserializeForStatementInit(pos) {
|
|
1758
1874
|
switch (uint8[pos]) {
|
|
@@ -1815,7 +1931,7 @@ function deserializeForInStatement(pos) {
|
|
|
1815
1931
|
range: [start, end],
|
|
1816
1932
|
parent
|
|
1817
1933
|
};
|
|
1818
|
-
return node.left = deserializeForStatementLeft(pos +
|
|
1934
|
+
return node.left = deserializeForStatementLeft(pos + 16), node.right = deserializeExpression(pos + 32), node.body = deserializeStatement(pos + 48), parent = previousParent, node;
|
|
1819
1935
|
}
|
|
1820
1936
|
function deserializeForStatementLeft(pos) {
|
|
1821
1937
|
switch (uint8[pos]) {
|
|
@@ -1846,7 +1962,7 @@ function deserializeForOfStatement(pos) {
|
|
|
1846
1962
|
range: [start, end],
|
|
1847
1963
|
parent
|
|
1848
1964
|
};
|
|
1849
|
-
return node.left = deserializeForStatementLeft(pos +
|
|
1965
|
+
return node.left = deserializeForStatementLeft(pos + 16), node.right = deserializeExpression(pos + 32), node.body = deserializeStatement(pos + 48), parent = previousParent, node;
|
|
1850
1966
|
}
|
|
1851
1967
|
function deserializeContinueStatement(pos) {
|
|
1852
1968
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1858,7 +1974,7 @@ function deserializeContinueStatement(pos) {
|
|
|
1858
1974
|
range: [start, end],
|
|
1859
1975
|
parent
|
|
1860
1976
|
};
|
|
1861
|
-
return node.label = deserializeOptionLabelIdentifier(pos +
|
|
1977
|
+
return node.label = deserializeOptionLabelIdentifier(pos + 16), parent = previousParent, node;
|
|
1862
1978
|
}
|
|
1863
1979
|
function deserializeBreakStatement(pos) {
|
|
1864
1980
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1870,7 +1986,7 @@ function deserializeBreakStatement(pos) {
|
|
|
1870
1986
|
range: [start, end],
|
|
1871
1987
|
parent
|
|
1872
1988
|
};
|
|
1873
|
-
return node.label = deserializeOptionLabelIdentifier(pos +
|
|
1989
|
+
return node.label = deserializeOptionLabelIdentifier(pos + 16), parent = previousParent, node;
|
|
1874
1990
|
}
|
|
1875
1991
|
function deserializeReturnStatement(pos) {
|
|
1876
1992
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1882,7 +1998,7 @@ function deserializeReturnStatement(pos) {
|
|
|
1882
1998
|
range: [start, end],
|
|
1883
1999
|
parent
|
|
1884
2000
|
};
|
|
1885
|
-
return node.argument = deserializeOptionExpression(pos +
|
|
2001
|
+
return node.argument = deserializeOptionExpression(pos + 16), parent = previousParent, node;
|
|
1886
2002
|
}
|
|
1887
2003
|
function deserializeWithStatement(pos) {
|
|
1888
2004
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1895,7 +2011,7 @@ function deserializeWithStatement(pos) {
|
|
|
1895
2011
|
range: [start, end],
|
|
1896
2012
|
parent
|
|
1897
2013
|
};
|
|
1898
|
-
return node.object = deserializeExpression(pos +
|
|
2014
|
+
return node.object = deserializeExpression(pos + 16), node.body = deserializeStatement(pos + 32), parent = previousParent, node;
|
|
1899
2015
|
}
|
|
1900
2016
|
function deserializeSwitchStatement(pos) {
|
|
1901
2017
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1908,7 +2024,7 @@ function deserializeSwitchStatement(pos) {
|
|
|
1908
2024
|
range: [start, end],
|
|
1909
2025
|
parent
|
|
1910
2026
|
};
|
|
1911
|
-
return node.discriminant = deserializeExpression(pos +
|
|
2027
|
+
return node.discriminant = deserializeExpression(pos + 16), node.cases = deserializeVecSwitchCase(pos + 32), parent = previousParent, node;
|
|
1912
2028
|
}
|
|
1913
2029
|
function deserializeSwitchCase(pos) {
|
|
1914
2030
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1921,7 +2037,7 @@ function deserializeSwitchCase(pos) {
|
|
|
1921
2037
|
range: [start, end],
|
|
1922
2038
|
parent
|
|
1923
2039
|
};
|
|
1924
|
-
return node.test = deserializeOptionExpression(pos +
|
|
2040
|
+
return node.test = deserializeOptionExpression(pos + 16), node.consequent = deserializeVecStatement(pos + 32), parent = previousParent, node;
|
|
1925
2041
|
}
|
|
1926
2042
|
function deserializeLabeledStatement(pos) {
|
|
1927
2043
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1934,7 +2050,7 @@ function deserializeLabeledStatement(pos) {
|
|
|
1934
2050
|
range: [start, end],
|
|
1935
2051
|
parent
|
|
1936
2052
|
};
|
|
1937
|
-
return node.label = deserializeLabelIdentifier(pos +
|
|
2053
|
+
return node.label = deserializeLabelIdentifier(pos + 16), node.body = deserializeStatement(pos + 48), parent = previousParent, node;
|
|
1938
2054
|
}
|
|
1939
2055
|
function deserializeThrowStatement(pos) {
|
|
1940
2056
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1946,7 +2062,7 @@ function deserializeThrowStatement(pos) {
|
|
|
1946
2062
|
range: [start, end],
|
|
1947
2063
|
parent
|
|
1948
2064
|
};
|
|
1949
|
-
return node.argument = deserializeExpression(pos +
|
|
2065
|
+
return node.argument = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
1950
2066
|
}
|
|
1951
2067
|
function deserializeTryStatement(pos) {
|
|
1952
2068
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1960,7 +2076,7 @@ function deserializeTryStatement(pos) {
|
|
|
1960
2076
|
range: [start, end],
|
|
1961
2077
|
parent
|
|
1962
2078
|
};
|
|
1963
|
-
return node.block = deserializeBoxBlockStatement(pos +
|
|
2079
|
+
return node.block = deserializeBoxBlockStatement(pos + 16), node.handler = deserializeOptionBoxCatchClause(pos + 24), node.finalizer = deserializeOptionBoxBlockStatement(pos + 32), parent = previousParent, node;
|
|
1964
2080
|
}
|
|
1965
2081
|
function deserializeCatchClause(pos) {
|
|
1966
2082
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -1973,13 +2089,13 @@ function deserializeCatchClause(pos) {
|
|
|
1973
2089
|
range: [start, end],
|
|
1974
2090
|
parent
|
|
1975
2091
|
};
|
|
1976
|
-
return node.param = deserializeOptionCatchParameter(pos +
|
|
2092
|
+
return node.param = deserializeOptionCatchParameter(pos + 16), node.body = deserializeBoxBlockStatement(pos + 56), parent = previousParent, node;
|
|
1977
2093
|
}
|
|
1978
2094
|
function deserializeCatchParameter(pos) {
|
|
1979
|
-
let previousParent = parent, pattern = deserializeBindingPattern(pos +
|
|
2095
|
+
let previousParent = parent, pattern = deserializeBindingPattern(pos + 16);
|
|
1980
2096
|
{
|
|
1981
2097
|
parent = pattern;
|
|
1982
|
-
let typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos +
|
|
2098
|
+
let typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 32);
|
|
1983
2099
|
pattern.typeAnnotation = typeAnnotation, typeAnnotation !== null && (pattern.end = typeAnnotation.end, pattern.range[1] = typeAnnotation.end), parent = previousParent;
|
|
1984
2100
|
}
|
|
1985
2101
|
return pattern;
|
|
@@ -2018,7 +2134,7 @@ function deserializeAssignmentPattern(pos) {
|
|
|
2018
2134
|
range: [start, end],
|
|
2019
2135
|
parent
|
|
2020
2136
|
};
|
|
2021
|
-
return node.decorators = [], node.left = deserializeBindingPattern(pos +
|
|
2137
|
+
return node.decorators = [], node.left = deserializeBindingPattern(pos + 16), node.right = deserializeExpression(pos + 32), node.optional = !1, parent = previousParent, node;
|
|
2022
2138
|
}
|
|
2023
2139
|
function deserializeObjectPattern(pos) {
|
|
2024
2140
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2032,7 +2148,7 @@ function deserializeObjectPattern(pos) {
|
|
|
2032
2148
|
end: end = deserializeU32(pos + 4),
|
|
2033
2149
|
range: [start, end],
|
|
2034
2150
|
parent
|
|
2035
|
-
}, properties = deserializeVecBindingProperty(pos +
|
|
2151
|
+
}, properties = deserializeVecBindingProperty(pos + 16), rest = deserializeOptionBoxBindingRestElement(pos + 40);
|
|
2036
2152
|
return rest !== null && properties.push(rest), node.decorators = [], node.properties = properties, node.optional = !1, parent = previousParent, node;
|
|
2037
2153
|
}
|
|
2038
2154
|
function deserializeBindingProperty(pos) {
|
|
@@ -2043,15 +2159,15 @@ function deserializeBindingProperty(pos) {
|
|
|
2043
2159
|
key: null,
|
|
2044
2160
|
value: null,
|
|
2045
2161
|
method: null,
|
|
2046
|
-
shorthand: deserializeBool(pos +
|
|
2047
|
-
computed: deserializeBool(pos +
|
|
2162
|
+
shorthand: deserializeBool(pos + 12),
|
|
2163
|
+
computed: deserializeBool(pos + 13),
|
|
2048
2164
|
optional: null,
|
|
2049
2165
|
start: start = deserializeU32(pos),
|
|
2050
2166
|
end: end = deserializeU32(pos + 4),
|
|
2051
2167
|
range: [start, end],
|
|
2052
2168
|
parent
|
|
2053
2169
|
};
|
|
2054
|
-
return node.kind = "init", node.key = deserializePropertyKey(pos +
|
|
2170
|
+
return node.kind = "init", node.key = deserializePropertyKey(pos + 16), node.value = deserializeBindingPattern(pos + 32), node.method = !1, node.optional = !1, parent = previousParent, node;
|
|
2055
2171
|
}
|
|
2056
2172
|
function deserializeArrayPattern(pos) {
|
|
2057
2173
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2065,7 +2181,7 @@ function deserializeArrayPattern(pos) {
|
|
|
2065
2181
|
end: end = deserializeU32(pos + 4),
|
|
2066
2182
|
range: [start, end],
|
|
2067
2183
|
parent
|
|
2068
|
-
}, elements = deserializeVecOptionBindingPattern(pos +
|
|
2184
|
+
}, elements = deserializeVecOptionBindingPattern(pos + 16), rest = deserializeOptionBoxBindingRestElement(pos + 40);
|
|
2069
2185
|
return rest !== null && elements.push(rest), node.decorators = [], node.elements = elements, node.optional = !1, parent = previousParent, node;
|
|
2070
2186
|
}
|
|
2071
2187
|
function deserializeBindingRestElement(pos) {
|
|
@@ -2082,7 +2198,7 @@ function deserializeBindingRestElement(pos) {
|
|
|
2082
2198
|
range: [start, end],
|
|
2083
2199
|
parent
|
|
2084
2200
|
};
|
|
2085
|
-
return node.decorators = [], node.argument = deserializeBindingPattern(pos +
|
|
2201
|
+
return node.decorators = [], node.argument = deserializeBindingPattern(pos + 16), node.optional = !1, parent = previousParent, node;
|
|
2086
2202
|
}
|
|
2087
2203
|
function deserializeFunction(pos) {
|
|
2088
2204
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2101,12 +2217,12 @@ function deserializeFunction(pos) {
|
|
|
2101
2217
|
end: end = deserializeU32(pos + 4),
|
|
2102
2218
|
range: [start, end],
|
|
2103
2219
|
parent
|
|
2104
|
-
}, params = deserializeBoxFormalParameters(pos +
|
|
2220
|
+
}, params = deserializeBoxFormalParameters(pos + 64);
|
|
2105
2221
|
{
|
|
2106
|
-
let thisParam = deserializeOptionBoxTSThisParameter(pos +
|
|
2222
|
+
let thisParam = deserializeOptionBoxTSThisParameter(pos + 56);
|
|
2107
2223
|
thisParam !== null && params.unshift(thisParam);
|
|
2108
2224
|
}
|
|
2109
|
-
return node.id = deserializeOptionBindingIdentifier(pos +
|
|
2225
|
+
return node.id = deserializeOptionBindingIdentifier(pos + 16), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 48), node.params = params, node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 72), node.body = deserializeOptionBoxFunctionBody(pos + 80), node.expression = !1, parent = previousParent, node;
|
|
2110
2226
|
}
|
|
2111
2227
|
function deserializeFunctionType(pos) {
|
|
2112
2228
|
switch (uint8[pos]) {
|
|
@@ -2118,9 +2234,9 @@ function deserializeFunctionType(pos) {
|
|
|
2118
2234
|
}
|
|
2119
2235
|
}
|
|
2120
2236
|
function deserializeFormalParameters(pos) {
|
|
2121
|
-
let params = deserializeVecFormalParameter(pos +
|
|
2122
|
-
if (uint32[pos +
|
|
2123
|
-
pos = uint32[pos +
|
|
2237
|
+
let params = deserializeVecFormalParameter(pos + 16);
|
|
2238
|
+
if (uint32[pos + 40 >> 2] !== 0 && uint32[pos + 44 >> 2] !== 0) {
|
|
2239
|
+
pos = uint32[pos + 40 >> 2];
|
|
2124
2240
|
let start, end, previousParent = parent, rest = parent = {
|
|
2125
2241
|
__proto__: NodeProto,
|
|
2126
2242
|
type: "RestElement",
|
|
@@ -2129,21 +2245,21 @@ function deserializeFormalParameters(pos) {
|
|
|
2129
2245
|
optional: !1,
|
|
2130
2246
|
typeAnnotation: null,
|
|
2131
2247
|
value: null,
|
|
2132
|
-
start: start = deserializeU32(pos +
|
|
2133
|
-
end: end = deserializeU32(pos +
|
|
2248
|
+
start: start = deserializeU32(pos + 40),
|
|
2249
|
+
end: end = deserializeU32(pos + 44),
|
|
2134
2250
|
range: [start, end],
|
|
2135
2251
|
parent: previousParent
|
|
2136
2252
|
};
|
|
2137
|
-
rest.argument = deserializeBindingPattern(pos +
|
|
2253
|
+
rest.argument = deserializeBindingPattern(pos + 56), rest.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 72), rest.typeAnnotation !== null && (end = rest.typeAnnotation.end, rest.end = end, rest.range[1] = end), params.push(rest), parent = previousParent;
|
|
2138
2254
|
}
|
|
2139
2255
|
return params;
|
|
2140
2256
|
}
|
|
2141
2257
|
function deserializeFormalParameter(pos) {
|
|
2142
|
-
let param, previousParent = parent, hasInitializer = uint32[pos +
|
|
2258
|
+
let param, previousParent = parent, hasInitializer = uint32[pos + 64 >> 2] !== 0 && uint32[pos + 68 >> 2] !== 0;
|
|
2143
2259
|
{
|
|
2144
|
-
let accessibility = deserializeOptionTSAccessibility(pos +
|
|
2260
|
+
let accessibility = deserializeOptionTSAccessibility(pos + 13), readonly = deserializeBool(pos + 14), override = deserializeBool(pos + 15);
|
|
2145
2261
|
if (accessibility === null && !readonly && !override) {
|
|
2146
|
-
let optional = deserializeBool(pos +
|
|
2262
|
+
let optional = deserializeBool(pos + 12);
|
|
2147
2263
|
if (hasInitializer) {
|
|
2148
2264
|
let start, end;
|
|
2149
2265
|
param = parent = {
|
|
@@ -2158,12 +2274,12 @@ function deserializeFormalParameter(pos) {
|
|
|
2158
2274
|
end: end = deserializeU32(pos + 4),
|
|
2159
2275
|
range: [start, end],
|
|
2160
2276
|
parent: previousParent
|
|
2161
|
-
}, param.decorators = deserializeVecDecorator(pos +
|
|
2162
|
-
let leftTypeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos +
|
|
2163
|
-
param.left.typeAnnotation = leftTypeAnnotation, leftTypeAnnotation !== null && (param.left.end = leftTypeAnnotation.end, param.left.range[1] = leftTypeAnnotation.end), parent = param, param.right = deserializeOptionBoxExpression(pos +
|
|
2277
|
+
}, param.decorators = deserializeVecDecorator(pos + 16), param.left = deserializeBindingPattern(pos + 40), param.left.decorators = [], param.left.optional = !1, parent = param.left;
|
|
2278
|
+
let leftTypeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 56);
|
|
2279
|
+
param.left.typeAnnotation = leftTypeAnnotation, leftTypeAnnotation !== null && (param.left.end = leftTypeAnnotation.end, param.left.range[1] = leftTypeAnnotation.end), parent = param, param.right = deserializeOptionBoxExpression(pos + 64);
|
|
2164
2280
|
} else {
|
|
2165
|
-
param = deserializeBindingPattern(pos +
|
|
2166
|
-
let typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos +
|
|
2281
|
+
param = deserializeBindingPattern(pos + 40), param.parent = previousParent, parent = param, param.decorators = deserializeVecDecorator(pos + 16), param.optional = optional;
|
|
2282
|
+
let typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 56);
|
|
2167
2283
|
param.typeAnnotation = typeAnnotation, typeAnnotation === null ? optional && (param.end = deserializeU32(pos + 4), param.range[1] = deserializeU32(pos + 4)) : (param.end = typeAnnotation.end, param.range[1] = typeAnnotation.end), parent = previousParent;
|
|
2168
2284
|
}
|
|
2169
2285
|
} else {
|
|
@@ -2181,8 +2297,8 @@ function deserializeFormalParameter(pos) {
|
|
|
2181
2297
|
end: end = deserializeU32(pos + 4),
|
|
2182
2298
|
range: [start, end],
|
|
2183
2299
|
parent: previousParent
|
|
2184
|
-
}, param.decorators = deserializeVecDecorator(pos +
|
|
2185
|
-
let pattern = deserializeBindingPattern(pos +
|
|
2300
|
+
}, param.decorators = deserializeVecDecorator(pos + 16), hasInitializer) {
|
|
2301
|
+
let pattern = deserializeBindingPattern(pos + 40), initializer = deserializeOptionBoxExpression(pos + 64), assignStart, assignEnd, assignParam = parent = {
|
|
2186
2302
|
__proto__: NodeProto,
|
|
2187
2303
|
type: "AssignmentPattern",
|
|
2188
2304
|
decorators: [],
|
|
@@ -2196,13 +2312,13 @@ function deserializeFormalParameter(pos) {
|
|
|
2196
2312
|
parent: param
|
|
2197
2313
|
};
|
|
2198
2314
|
assignParam.left = pattern, pattern.parent = assignParam, pattern.decorators = [], pattern.optional = !1, parent = pattern;
|
|
2199
|
-
let patternTypeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos +
|
|
2315
|
+
let patternTypeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 56);
|
|
2200
2316
|
pattern.typeAnnotation = patternTypeAnnotation, patternTypeAnnotation !== null && (pattern.end = patternTypeAnnotation.end, pattern.range[1] = patternTypeAnnotation.end), parent = assignParam, assignParam.right = initializer, initializer !== null && (initializer.parent = assignParam), param.parameter = assignParam;
|
|
2201
2317
|
} else {
|
|
2202
|
-
param.parameter = deserializeBindingPattern(pos +
|
|
2203
|
-
let paramOptional = deserializeBool(pos +
|
|
2318
|
+
param.parameter = deserializeBindingPattern(pos + 40), param.parameter.decorators = [];
|
|
2319
|
+
let paramOptional = deserializeBool(pos + 12);
|
|
2204
2320
|
param.parameter.optional = paramOptional, parent = param.parameter;
|
|
2205
|
-
let paramTypeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos +
|
|
2321
|
+
let paramTypeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 56);
|
|
2206
2322
|
if (param.parameter.typeAnnotation = paramTypeAnnotation, paramTypeAnnotation !== null) param.parameter.end = paramTypeAnnotation.end, param.parameter.range[1] = paramTypeAnnotation.end;
|
|
2207
2323
|
else if (paramOptional) {
|
|
2208
2324
|
let paramEnd = deserializeU32(pos + 4);
|
|
@@ -2223,8 +2339,8 @@ function deserializeFunctionBody(pos) {
|
|
|
2223
2339
|
end: end = deserializeU32(pos + 4),
|
|
2224
2340
|
range: [start, end],
|
|
2225
2341
|
parent
|
|
2226
|
-
}, body = deserializeVecDirective(pos +
|
|
2227
|
-
return body.push(...deserializeVecStatement(pos +
|
|
2342
|
+
}, body = deserializeVecDirective(pos + 16);
|
|
2343
|
+
return body.push(...deserializeVecStatement(pos + 40)), node.body = body, parent = previousParent, node;
|
|
2228
2344
|
}
|
|
2229
2345
|
function deserializeArrowFunctionExpression(pos) {
|
|
2230
2346
|
let expression = deserializeBool(pos + 48), start, end, previousParent = parent, node = parent = {
|
|
@@ -2242,21 +2358,21 @@ function deserializeArrowFunctionExpression(pos) {
|
|
|
2242
2358
|
end: end = deserializeU32(pos + 4),
|
|
2243
2359
|
range: [start, end],
|
|
2244
2360
|
parent
|
|
2245
|
-
}, body = deserializeBoxFunctionBody(pos +
|
|
2246
|
-
return expression === !0 && (body = body.body[0].expression, body.parent = parent), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos +
|
|
2361
|
+
}, body = deserializeBoxFunctionBody(pos + 40);
|
|
2362
|
+
return expression === !0 && (body = body.body[0].expression, body.parent = parent), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 16), node.params = deserializeBoxFormalParameters(pos + 24), node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 32), node.body = body, node.generator = !1, parent = previousParent, node;
|
|
2247
2363
|
}
|
|
2248
2364
|
function deserializeYieldExpression(pos) {
|
|
2249
2365
|
let start, end, previousParent = parent, node = parent = {
|
|
2250
2366
|
__proto__: NodeProto,
|
|
2251
2367
|
type: "YieldExpression",
|
|
2252
|
-
delegate: deserializeBool(pos +
|
|
2368
|
+
delegate: deserializeBool(pos + 12),
|
|
2253
2369
|
argument: null,
|
|
2254
2370
|
start: start = deserializeU32(pos),
|
|
2255
2371
|
end: end = deserializeU32(pos + 4),
|
|
2256
2372
|
range: [start, end],
|
|
2257
2373
|
parent
|
|
2258
2374
|
};
|
|
2259
|
-
return node.argument = deserializeOptionExpression(pos +
|
|
2375
|
+
return node.argument = deserializeOptionExpression(pos + 16), parent = previousParent, node;
|
|
2260
2376
|
}
|
|
2261
2377
|
function deserializeClass(pos) {
|
|
2262
2378
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2276,7 +2392,7 @@ function deserializeClass(pos) {
|
|
|
2276
2392
|
range: [start, end],
|
|
2277
2393
|
parent
|
|
2278
2394
|
};
|
|
2279
|
-
return node.decorators = deserializeVecDecorator(pos +
|
|
2395
|
+
return node.decorators = deserializeVecDecorator(pos + 16), node.id = deserializeOptionBindingIdentifier(pos + 40), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 72), node.superClass = deserializeOptionExpression(pos + 80), node.superTypeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 96), node.implements = deserializeVecTSClassImplements(pos + 104), node.body = deserializeBoxClassBody(pos + 128), parent = previousParent, node;
|
|
2280
2396
|
}
|
|
2281
2397
|
function deserializeClassType(pos) {
|
|
2282
2398
|
switch (uint8[pos]) {
|
|
@@ -2295,7 +2411,7 @@ function deserializeClassBody(pos) {
|
|
|
2295
2411
|
range: [start, end],
|
|
2296
2412
|
parent
|
|
2297
2413
|
};
|
|
2298
|
-
return node.body = deserializeVecClassElement(pos +
|
|
2414
|
+
return node.body = deserializeVecClassElement(pos + 16), parent = previousParent, node;
|
|
2299
2415
|
}
|
|
2300
2416
|
function deserializeClassElement(pos) {
|
|
2301
2417
|
switch (uint8[pos]) {
|
|
@@ -2310,13 +2426,13 @@ function deserializeClassElement(pos) {
|
|
|
2310
2426
|
function deserializeMethodDefinition(pos) {
|
|
2311
2427
|
let start, end, previousParent = parent, node = parent = {
|
|
2312
2428
|
__proto__: NodeProto,
|
|
2313
|
-
type: deserializeMethodDefinitionType(pos +
|
|
2429
|
+
type: deserializeMethodDefinitionType(pos + 12),
|
|
2314
2430
|
decorators: null,
|
|
2315
2431
|
key: null,
|
|
2316
2432
|
value: null,
|
|
2317
|
-
kind: deserializeMethodDefinitionKind(pos +
|
|
2318
|
-
computed: deserializeBool(pos +
|
|
2319
|
-
static: deserializeBool(pos +
|
|
2433
|
+
kind: deserializeMethodDefinitionKind(pos + 13),
|
|
2434
|
+
computed: deserializeBool(pos + 14),
|
|
2435
|
+
static: deserializeBool(pos + 15),
|
|
2320
2436
|
override: deserializeBool(pos + 64),
|
|
2321
2437
|
optional: deserializeBool(pos + 65),
|
|
2322
2438
|
accessibility: deserializeOptionTSAccessibility(pos + 66),
|
|
@@ -2325,7 +2441,7 @@ function deserializeMethodDefinition(pos) {
|
|
|
2325
2441
|
range: [start, end],
|
|
2326
2442
|
parent
|
|
2327
2443
|
};
|
|
2328
|
-
return node.decorators = deserializeVecDecorator(pos +
|
|
2444
|
+
return node.decorators = deserializeVecDecorator(pos + 16), node.key = deserializePropertyKey(pos + 40), node.value = deserializeBoxFunction(pos + 56), parent = previousParent, node;
|
|
2329
2445
|
}
|
|
2330
2446
|
function deserializeMethodDefinitionType(pos) {
|
|
2331
2447
|
switch (uint8[pos]) {
|
|
@@ -2337,14 +2453,14 @@ function deserializeMethodDefinitionType(pos) {
|
|
|
2337
2453
|
function deserializePropertyDefinition(pos) {
|
|
2338
2454
|
let start, end, previousParent = parent, node = parent = {
|
|
2339
2455
|
__proto__: NodeProto,
|
|
2340
|
-
type: deserializePropertyDefinitionType(pos +
|
|
2456
|
+
type: deserializePropertyDefinitionType(pos + 12),
|
|
2341
2457
|
decorators: null,
|
|
2342
2458
|
key: null,
|
|
2343
2459
|
typeAnnotation: null,
|
|
2344
2460
|
value: null,
|
|
2345
|
-
computed: deserializeBool(pos +
|
|
2346
|
-
static: deserializeBool(pos +
|
|
2347
|
-
declare: deserializeBool(pos +
|
|
2461
|
+
computed: deserializeBool(pos + 13),
|
|
2462
|
+
static: deserializeBool(pos + 14),
|
|
2463
|
+
declare: deserializeBool(pos + 15),
|
|
2348
2464
|
override: deserializeBool(pos + 80),
|
|
2349
2465
|
optional: deserializeBool(pos + 81),
|
|
2350
2466
|
definite: deserializeBool(pos + 82),
|
|
@@ -2355,7 +2471,7 @@ function deserializePropertyDefinition(pos) {
|
|
|
2355
2471
|
range: [start, end],
|
|
2356
2472
|
parent
|
|
2357
2473
|
};
|
|
2358
|
-
return node.decorators = deserializeVecDecorator(pos +
|
|
2474
|
+
return node.decorators = deserializeVecDecorator(pos + 16), node.key = deserializePropertyKey(pos + 40), node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 56), node.value = deserializeOptionExpression(pos + 64), parent = previousParent, node;
|
|
2359
2475
|
}
|
|
2360
2476
|
function deserializePropertyDefinitionType(pos) {
|
|
2361
2477
|
switch (uint8[pos]) {
|
|
@@ -2378,7 +2494,7 @@ function deserializePrivateIdentifier(pos) {
|
|
|
2378
2494
|
return {
|
|
2379
2495
|
__proto__: NodeProto,
|
|
2380
2496
|
type: "PrivateIdentifier",
|
|
2381
|
-
name: deserializeStr(pos +
|
|
2497
|
+
name: deserializeStr(pos + 16),
|
|
2382
2498
|
start: start = deserializeU32(pos),
|
|
2383
2499
|
end: end = deserializeU32(pos + 4),
|
|
2384
2500
|
range: [start, end],
|
|
@@ -2395,7 +2511,7 @@ function deserializeStaticBlock(pos) {
|
|
|
2395
2511
|
range: [start, end],
|
|
2396
2512
|
parent
|
|
2397
2513
|
};
|
|
2398
|
-
return node.body = deserializeVecStatement(pos +
|
|
2514
|
+
return node.body = deserializeVecStatement(pos + 16), parent = previousParent, node;
|
|
2399
2515
|
}
|
|
2400
2516
|
function deserializeAccessorPropertyType(pos) {
|
|
2401
2517
|
switch (uint8[pos]) {
|
|
@@ -2407,14 +2523,14 @@ function deserializeAccessorPropertyType(pos) {
|
|
|
2407
2523
|
function deserializeAccessorProperty(pos) {
|
|
2408
2524
|
let start, end, previousParent = parent, node = parent = {
|
|
2409
2525
|
__proto__: NodeProto,
|
|
2410
|
-
type: deserializeAccessorPropertyType(pos +
|
|
2526
|
+
type: deserializeAccessorPropertyType(pos + 12),
|
|
2411
2527
|
decorators: null,
|
|
2412
2528
|
key: null,
|
|
2413
2529
|
typeAnnotation: null,
|
|
2414
2530
|
value: null,
|
|
2415
|
-
computed: deserializeBool(pos +
|
|
2416
|
-
static: deserializeBool(pos +
|
|
2417
|
-
override: deserializeBool(pos +
|
|
2531
|
+
computed: deserializeBool(pos + 13),
|
|
2532
|
+
static: deserializeBool(pos + 14),
|
|
2533
|
+
override: deserializeBool(pos + 15),
|
|
2418
2534
|
definite: deserializeBool(pos + 80),
|
|
2419
2535
|
accessibility: deserializeOptionTSAccessibility(pos + 81),
|
|
2420
2536
|
declare: null,
|
|
@@ -2425,7 +2541,7 @@ function deserializeAccessorProperty(pos) {
|
|
|
2425
2541
|
range: [start, end],
|
|
2426
2542
|
parent
|
|
2427
2543
|
};
|
|
2428
|
-
return node.decorators = deserializeVecDecorator(pos +
|
|
2544
|
+
return node.decorators = deserializeVecDecorator(pos + 16), node.key = deserializePropertyKey(pos + 40), node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 56), node.value = deserializeOptionExpression(pos + 64), node.declare = !1, node.optional = !1, node.readonly = !1, parent = previousParent, node;
|
|
2429
2545
|
}
|
|
2430
2546
|
function deserializeImportExpression(pos) {
|
|
2431
2547
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2433,13 +2549,13 @@ function deserializeImportExpression(pos) {
|
|
|
2433
2549
|
type: "ImportExpression",
|
|
2434
2550
|
source: null,
|
|
2435
2551
|
options: null,
|
|
2436
|
-
phase: deserializeOptionImportPhase(pos +
|
|
2552
|
+
phase: deserializeOptionImportPhase(pos + 12),
|
|
2437
2553
|
start: start = deserializeU32(pos),
|
|
2438
2554
|
end: end = deserializeU32(pos + 4),
|
|
2439
2555
|
range: [start, end],
|
|
2440
2556
|
parent
|
|
2441
2557
|
};
|
|
2442
|
-
return node.source = deserializeExpression(pos +
|
|
2558
|
+
return node.source = deserializeExpression(pos + 16), node.options = deserializeOptionExpression(pos + 32), parent = previousParent, node;
|
|
2443
2559
|
}
|
|
2444
2560
|
function deserializeImportDeclaration(pos) {
|
|
2445
2561
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2447,17 +2563,17 @@ function deserializeImportDeclaration(pos) {
|
|
|
2447
2563
|
type: "ImportDeclaration",
|
|
2448
2564
|
specifiers: null,
|
|
2449
2565
|
source: null,
|
|
2450
|
-
phase: deserializeOptionImportPhase(pos +
|
|
2566
|
+
phase: deserializeOptionImportPhase(pos + 12),
|
|
2451
2567
|
attributes: null,
|
|
2452
|
-
importKind: deserializeImportOrExportKind(pos +
|
|
2568
|
+
importKind: deserializeImportOrExportKind(pos + 13),
|
|
2453
2569
|
start: start = deserializeU32(pos),
|
|
2454
2570
|
end: end = deserializeU32(pos + 4),
|
|
2455
2571
|
range: [start, end],
|
|
2456
2572
|
parent
|
|
2457
|
-
}, specifiers = deserializeOptionVecImportDeclarationSpecifier(pos +
|
|
2573
|
+
}, specifiers = deserializeOptionVecImportDeclarationSpecifier(pos + 16);
|
|
2458
2574
|
specifiers === null && (specifiers = []);
|
|
2459
|
-
let withClause = deserializeOptionBoxWithClause(pos +
|
|
2460
|
-
return node.specifiers = specifiers, node.source = deserializeStringLiteral(pos +
|
|
2575
|
+
let withClause = deserializeOptionBoxWithClause(pos + 88);
|
|
2576
|
+
return node.specifiers = specifiers, node.source = deserializeStringLiteral(pos + 40), node.attributes = withClause === null ? [] : withClause.attributes, parent = previousParent, node;
|
|
2461
2577
|
}
|
|
2462
2578
|
function deserializeImportPhase(pos) {
|
|
2463
2579
|
switch (uint8[pos]) {
|
|
@@ -2480,13 +2596,13 @@ function deserializeImportSpecifier(pos) {
|
|
|
2480
2596
|
type: "ImportSpecifier",
|
|
2481
2597
|
imported: null,
|
|
2482
2598
|
local: null,
|
|
2483
|
-
importKind: deserializeImportOrExportKind(pos +
|
|
2599
|
+
importKind: deserializeImportOrExportKind(pos + 12),
|
|
2484
2600
|
start: start = deserializeU32(pos),
|
|
2485
2601
|
end: end = deserializeU32(pos + 4),
|
|
2486
2602
|
range: [start, end],
|
|
2487
2603
|
parent
|
|
2488
2604
|
};
|
|
2489
|
-
return node.imported = deserializeModuleExportName(pos +
|
|
2605
|
+
return node.imported = deserializeModuleExportName(pos + 16), node.local = deserializeBindingIdentifier(pos + 72), parent = previousParent, node;
|
|
2490
2606
|
}
|
|
2491
2607
|
function deserializeImportDefaultSpecifier(pos) {
|
|
2492
2608
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2498,7 +2614,7 @@ function deserializeImportDefaultSpecifier(pos) {
|
|
|
2498
2614
|
range: [start, end],
|
|
2499
2615
|
parent
|
|
2500
2616
|
};
|
|
2501
|
-
return node.local = deserializeBindingIdentifier(pos +
|
|
2617
|
+
return node.local = deserializeBindingIdentifier(pos + 16), parent = previousParent, node;
|
|
2502
2618
|
}
|
|
2503
2619
|
function deserializeImportNamespaceSpecifier(pos) {
|
|
2504
2620
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2510,17 +2626,10 @@ function deserializeImportNamespaceSpecifier(pos) {
|
|
|
2510
2626
|
range: [start, end],
|
|
2511
2627
|
parent
|
|
2512
2628
|
};
|
|
2513
|
-
return node.local = deserializeBindingIdentifier(pos +
|
|
2629
|
+
return node.local = deserializeBindingIdentifier(pos + 16), parent = previousParent, node;
|
|
2514
2630
|
}
|
|
2515
2631
|
function deserializeWithClause(pos) {
|
|
2516
|
-
|
|
2517
|
-
return {
|
|
2518
|
-
__proto__: NodeProto,
|
|
2519
|
-
attributes: deserializeVecImportAttribute(pos + 8),
|
|
2520
|
-
start: start = deserializeU32(pos),
|
|
2521
|
-
end: end = deserializeU32(pos + 4),
|
|
2522
|
-
range: [start, end]
|
|
2523
|
-
};
|
|
2632
|
+
return { attributes: deserializeVecImportAttribute(pos + 16) };
|
|
2524
2633
|
}
|
|
2525
2634
|
function deserializeImportAttribute(pos) {
|
|
2526
2635
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2533,7 +2642,7 @@ function deserializeImportAttribute(pos) {
|
|
|
2533
2642
|
range: [start, end],
|
|
2534
2643
|
parent
|
|
2535
2644
|
};
|
|
2536
|
-
return node.key = deserializeImportAttributeKey(pos +
|
|
2645
|
+
return node.key = deserializeImportAttributeKey(pos + 16), node.value = deserializeStringLiteral(pos + 72), parent = previousParent, node;
|
|
2537
2646
|
}
|
|
2538
2647
|
function deserializeImportAttributeKey(pos) {
|
|
2539
2648
|
switch (uint8[pos]) {
|
|
@@ -2549,14 +2658,14 @@ function deserializeExportNamedDeclaration(pos) {
|
|
|
2549
2658
|
declaration: null,
|
|
2550
2659
|
specifiers: null,
|
|
2551
2660
|
source: null,
|
|
2552
|
-
exportKind: deserializeImportOrExportKind(pos +
|
|
2661
|
+
exportKind: deserializeImportOrExportKind(pos + 12),
|
|
2553
2662
|
attributes: null,
|
|
2554
2663
|
start: start = deserializeU32(pos),
|
|
2555
2664
|
end: end = deserializeU32(pos + 4),
|
|
2556
2665
|
range: [start, end],
|
|
2557
2666
|
parent
|
|
2558
|
-
}, withClause = deserializeOptionBoxWithClause(pos +
|
|
2559
|
-
return node.declaration = deserializeOptionDeclaration(pos +
|
|
2667
|
+
}, withClause = deserializeOptionBoxWithClause(pos + 104);
|
|
2668
|
+
return node.declaration = deserializeOptionDeclaration(pos + 16), node.specifiers = deserializeVecExportSpecifier(pos + 32), node.source = deserializeOptionStringLiteral(pos + 56), node.attributes = withClause === null ? [] : withClause.attributes, parent = previousParent, node;
|
|
2560
2669
|
}
|
|
2561
2670
|
function deserializeExportDefaultDeclaration(pos) {
|
|
2562
2671
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2569,7 +2678,7 @@ function deserializeExportDefaultDeclaration(pos) {
|
|
|
2569
2678
|
range: [start, end],
|
|
2570
2679
|
parent
|
|
2571
2680
|
};
|
|
2572
|
-
return node.declaration = deserializeExportDefaultDeclarationKind(pos +
|
|
2681
|
+
return node.declaration = deserializeExportDefaultDeclarationKind(pos + 16), node.exportKind = "value", parent = previousParent, node;
|
|
2573
2682
|
}
|
|
2574
2683
|
function deserializeExportAllDeclaration(pos) {
|
|
2575
2684
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2578,13 +2687,13 @@ function deserializeExportAllDeclaration(pos) {
|
|
|
2578
2687
|
exported: null,
|
|
2579
2688
|
source: null,
|
|
2580
2689
|
attributes: null,
|
|
2581
|
-
exportKind: deserializeImportOrExportKind(pos +
|
|
2690
|
+
exportKind: deserializeImportOrExportKind(pos + 12),
|
|
2582
2691
|
start: start = deserializeU32(pos),
|
|
2583
2692
|
end: end = deserializeU32(pos + 4),
|
|
2584
2693
|
range: [start, end],
|
|
2585
2694
|
parent
|
|
2586
|
-
}, withClause = deserializeOptionBoxWithClause(pos +
|
|
2587
|
-
return node.exported = deserializeOptionModuleExportName(pos +
|
|
2695
|
+
}, withClause = deserializeOptionBoxWithClause(pos + 120);
|
|
2696
|
+
return node.exported = deserializeOptionModuleExportName(pos + 16), node.source = deserializeStringLiteral(pos + 72), node.attributes = withClause === null ? [] : withClause.attributes, parent = previousParent, node;
|
|
2588
2697
|
}
|
|
2589
2698
|
function deserializeExportSpecifier(pos) {
|
|
2590
2699
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2592,13 +2701,13 @@ function deserializeExportSpecifier(pos) {
|
|
|
2592
2701
|
type: "ExportSpecifier",
|
|
2593
2702
|
local: null,
|
|
2594
2703
|
exported: null,
|
|
2595
|
-
exportKind: deserializeImportOrExportKind(pos +
|
|
2704
|
+
exportKind: deserializeImportOrExportKind(pos + 12),
|
|
2596
2705
|
start: start = deserializeU32(pos),
|
|
2597
2706
|
end: end = deserializeU32(pos + 4),
|
|
2598
2707
|
range: [start, end],
|
|
2599
2708
|
parent
|
|
2600
2709
|
};
|
|
2601
|
-
return node.local = deserializeModuleExportName(pos +
|
|
2710
|
+
return node.local = deserializeModuleExportName(pos + 16), node.exported = deserializeModuleExportName(pos + 72), parent = previousParent, node;
|
|
2602
2711
|
}
|
|
2603
2712
|
function deserializeExportDefaultDeclarationKind(pos) {
|
|
2604
2713
|
switch (uint8[pos]) {
|
|
@@ -2670,7 +2779,7 @@ function deserializeV8IntrinsicExpression(pos) {
|
|
|
2670
2779
|
range: [start, end],
|
|
2671
2780
|
parent
|
|
2672
2781
|
};
|
|
2673
|
-
return node.name = deserializeIdentifierName(pos +
|
|
2782
|
+
return node.name = deserializeIdentifierName(pos + 16), node.arguments = deserializeVecArgument(pos + 48), parent = previousParent, node;
|
|
2674
2783
|
}
|
|
2675
2784
|
function deserializeBooleanLiteral(pos) {
|
|
2676
2785
|
let value = deserializeBool(pos + 12), start = deserializeU32(pos), end = deserializeU32(pos + 4), previousParent = parent, node = parent = {
|
|
@@ -2703,7 +2812,7 @@ function deserializeNumericLiteral(pos) {
|
|
|
2703
2812
|
return {
|
|
2704
2813
|
__proto__: NodeProto,
|
|
2705
2814
|
type: "Literal",
|
|
2706
|
-
value: deserializeF64(pos +
|
|
2815
|
+
value: deserializeF64(pos + 32),
|
|
2707
2816
|
raw: deserializeOptionStr(pos + 16),
|
|
2708
2817
|
start: start = deserializeU32(pos),
|
|
2709
2818
|
end: end = deserializeU32(pos + 4),
|
|
@@ -2716,26 +2825,26 @@ function deserializeStringLiteral(pos) {
|
|
|
2716
2825
|
__proto__: NodeProto,
|
|
2717
2826
|
type: "Literal",
|
|
2718
2827
|
value: null,
|
|
2719
|
-
raw: deserializeOptionStr(pos +
|
|
2828
|
+
raw: deserializeOptionStr(pos + 32),
|
|
2720
2829
|
start: start = deserializeU32(pos),
|
|
2721
2830
|
end: end = deserializeU32(pos + 4),
|
|
2722
2831
|
range: [start, end],
|
|
2723
2832
|
parent
|
|
2724
|
-
}, value = deserializeStr(pos +
|
|
2725
|
-
return deserializeBool(pos +
|
|
2833
|
+
}, value = deserializeStr(pos + 16);
|
|
2834
|
+
return deserializeBool(pos + 12) && (value = value.replace(/\uFFFD(.{4})/g, (_, hex) => StringFromCodePoint(parseInt(hex, 16)))), node.value = value, parent = previousParent, node;
|
|
2726
2835
|
}
|
|
2727
2836
|
function deserializeBigIntLiteral(pos) {
|
|
2728
2837
|
let start, end, previousParent = parent, node = parent = {
|
|
2729
2838
|
__proto__: NodeProto,
|
|
2730
2839
|
type: "Literal",
|
|
2731
2840
|
value: null,
|
|
2732
|
-
raw: deserializeOptionStr(pos +
|
|
2841
|
+
raw: deserializeOptionStr(pos + 32),
|
|
2733
2842
|
bigint: null,
|
|
2734
2843
|
start: start = deserializeU32(pos),
|
|
2735
2844
|
end: end = deserializeU32(pos + 4),
|
|
2736
2845
|
range: [start, end],
|
|
2737
2846
|
parent
|
|
2738
|
-
}, bigint = deserializeStr(pos +
|
|
2847
|
+
}, bigint = deserializeStr(pos + 16);
|
|
2739
2848
|
return node.value = BigInt(bigint), node.bigint = bigint, parent = previousParent, node;
|
|
2740
2849
|
}
|
|
2741
2850
|
function deserializeRegExpLiteral(pos) {
|
|
@@ -2743,13 +2852,13 @@ function deserializeRegExpLiteral(pos) {
|
|
|
2743
2852
|
__proto__: NodeProto,
|
|
2744
2853
|
type: "Literal",
|
|
2745
2854
|
value: null,
|
|
2746
|
-
raw: deserializeOptionStr(pos +
|
|
2855
|
+
raw: deserializeOptionStr(pos + 48),
|
|
2747
2856
|
regex: null,
|
|
2748
2857
|
start: start = deserializeU32(pos),
|
|
2749
2858
|
end: end = deserializeU32(pos + 4),
|
|
2750
2859
|
range: [start, end],
|
|
2751
2860
|
parent
|
|
2752
|
-
}, regex = deserializeRegExp(pos +
|
|
2861
|
+
}, regex = deserializeRegExp(pos + 16), value = null;
|
|
2753
2862
|
try {
|
|
2754
2863
|
value = new RegExp(regex.pattern, regex.flags);
|
|
2755
2864
|
} catch {}
|
|
@@ -2776,8 +2885,8 @@ function deserializeJSXElement(pos) {
|
|
|
2776
2885
|
end: end = deserializeU32(pos + 4),
|
|
2777
2886
|
range: [start, end],
|
|
2778
2887
|
parent
|
|
2779
|
-
}, closingElement = deserializeOptionBoxJSXClosingElement(pos +
|
|
2780
|
-
return closingElement === null && (openingElement.selfClosing = !0), node.openingElement = openingElement, node.children = deserializeVecJSXChild(pos +
|
|
2888
|
+
}, closingElement = deserializeOptionBoxJSXClosingElement(pos + 48), openingElement = deserializeBoxJSXOpeningElement(pos + 16);
|
|
2889
|
+
return closingElement === null && (openingElement.selfClosing = !0), node.openingElement = openingElement, node.children = deserializeVecJSXChild(pos + 24), node.closingElement = closingElement, parent = previousParent, node;
|
|
2781
2890
|
}
|
|
2782
2891
|
function deserializeJSXOpeningElement(pos) {
|
|
2783
2892
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2792,7 +2901,7 @@ function deserializeJSXOpeningElement(pos) {
|
|
|
2792
2901
|
range: [start, end],
|
|
2793
2902
|
parent
|
|
2794
2903
|
};
|
|
2795
|
-
return node.name = deserializeJSXElementName(pos +
|
|
2904
|
+
return node.name = deserializeJSXElementName(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), node.attributes = deserializeVecJSXAttributeItem(pos + 40), node.selfClosing = !1, parent = previousParent, node;
|
|
2796
2905
|
}
|
|
2797
2906
|
function deserializeJSXClosingElement(pos) {
|
|
2798
2907
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2804,7 +2913,7 @@ function deserializeJSXClosingElement(pos) {
|
|
|
2804
2913
|
range: [start, end],
|
|
2805
2914
|
parent
|
|
2806
2915
|
};
|
|
2807
|
-
return node.name = deserializeJSXElementName(pos +
|
|
2916
|
+
return node.name = deserializeJSXElementName(pos + 16), parent = previousParent, node;
|
|
2808
2917
|
}
|
|
2809
2918
|
function deserializeJSXFragment(pos) {
|
|
2810
2919
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2818,7 +2927,7 @@ function deserializeJSXFragment(pos) {
|
|
|
2818
2927
|
range: [start, end],
|
|
2819
2928
|
parent
|
|
2820
2929
|
};
|
|
2821
|
-
return node.openingFragment = deserializeJSXOpeningFragment(pos +
|
|
2930
|
+
return node.openingFragment = deserializeJSXOpeningFragment(pos + 16), node.children = deserializeVecJSXChild(pos + 32), node.closingFragment = deserializeJSXClosingFragment(pos + 56), parent = previousParent, node;
|
|
2822
2931
|
}
|
|
2823
2932
|
function deserializeJSXOpeningFragment(pos) {
|
|
2824
2933
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2883,7 +2992,7 @@ function deserializeJSXNamespacedName(pos) {
|
|
|
2883
2992
|
range: [start, end],
|
|
2884
2993
|
parent
|
|
2885
2994
|
};
|
|
2886
|
-
return node.namespace = deserializeJSXIdentifier(pos +
|
|
2995
|
+
return node.namespace = deserializeJSXIdentifier(pos + 16), node.name = deserializeJSXIdentifier(pos + 48), parent = previousParent, node;
|
|
2887
2996
|
}
|
|
2888
2997
|
function deserializeJSXMemberExpression(pos) {
|
|
2889
2998
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -2896,7 +3005,7 @@ function deserializeJSXMemberExpression(pos) {
|
|
|
2896
3005
|
range: [start, end],
|
|
2897
3006
|
parent
|
|
2898
3007
|
};
|
|
2899
|
-
return node.object = deserializeJSXMemberExpressionObject(pos +
|
|
3008
|
+
return node.object = deserializeJSXMemberExpressionObject(pos + 16), node.property = deserializeJSXIdentifier(pos + 32), parent = previousParent, node;
|
|
2900
3009
|
}
|
|
2901
3010
|
function deserializeJSXMemberExpressionObject(pos) {
|
|
2902
3011
|
switch (uint8[pos]) {
|
|
@@ -2936,7 +3045,7 @@ function deserializeJSXExpressionContainer(pos) {
|
|
|
2936
3045
|
range: [start, end],
|
|
2937
3046
|
parent
|
|
2938
3047
|
};
|
|
2939
|
-
return node.expression = deserializeJSXExpression(pos +
|
|
3048
|
+
return node.expression = deserializeJSXExpression(pos + 16), parent = previousParent, node;
|
|
2940
3049
|
}
|
|
2941
3050
|
function deserializeJSXExpression(pos) {
|
|
2942
3051
|
switch (uint8[pos]) {
|
|
@@ -3016,7 +3125,7 @@ function deserializeJSXAttribute(pos) {
|
|
|
3016
3125
|
range: [start, end],
|
|
3017
3126
|
parent
|
|
3018
3127
|
};
|
|
3019
|
-
return node.name = deserializeJSXAttributeName(pos +
|
|
3128
|
+
return node.name = deserializeJSXAttributeName(pos + 16), node.value = deserializeOptionJSXAttributeValue(pos + 32), parent = previousParent, node;
|
|
3020
3129
|
}
|
|
3021
3130
|
function deserializeJSXSpreadAttribute(pos) {
|
|
3022
3131
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3028,7 +3137,7 @@ function deserializeJSXSpreadAttribute(pos) {
|
|
|
3028
3137
|
range: [start, end],
|
|
3029
3138
|
parent
|
|
3030
3139
|
};
|
|
3031
|
-
return node.argument = deserializeExpression(pos +
|
|
3140
|
+
return node.argument = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
3032
3141
|
}
|
|
3033
3142
|
function deserializeJSXAttributeName(pos) {
|
|
3034
3143
|
switch (uint8[pos]) {
|
|
@@ -3051,7 +3160,7 @@ function deserializeJSXIdentifier(pos) {
|
|
|
3051
3160
|
return {
|
|
3052
3161
|
__proto__: NodeProto,
|
|
3053
3162
|
type: "JSXIdentifier",
|
|
3054
|
-
name: deserializeStr(pos +
|
|
3163
|
+
name: deserializeStr(pos + 16),
|
|
3055
3164
|
start: start = deserializeU32(pos),
|
|
3056
3165
|
end: end = deserializeU32(pos + 4),
|
|
3057
3166
|
range: [start, end],
|
|
@@ -3078,15 +3187,15 @@ function deserializeJSXSpreadChild(pos) {
|
|
|
3078
3187
|
range: [start, end],
|
|
3079
3188
|
parent
|
|
3080
3189
|
};
|
|
3081
|
-
return node.expression = deserializeExpression(pos +
|
|
3190
|
+
return node.expression = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
3082
3191
|
}
|
|
3083
3192
|
function deserializeJSXText(pos) {
|
|
3084
3193
|
let start, end;
|
|
3085
3194
|
return {
|
|
3086
3195
|
__proto__: NodeProto,
|
|
3087
3196
|
type: "JSXText",
|
|
3088
|
-
value: deserializeStr(pos +
|
|
3089
|
-
raw: deserializeOptionStr(pos +
|
|
3197
|
+
value: deserializeStr(pos + 16),
|
|
3198
|
+
raw: deserializeOptionStr(pos + 32),
|
|
3090
3199
|
start: start = deserializeU32(pos),
|
|
3091
3200
|
end: end = deserializeU32(pos + 4),
|
|
3092
3201
|
range: [start, end],
|
|
@@ -3106,7 +3215,7 @@ function deserializeTSThisParameter(pos) {
|
|
|
3106
3215
|
range: [start, end],
|
|
3107
3216
|
parent
|
|
3108
3217
|
};
|
|
3109
|
-
return node.decorators = [], node.name = "this", node.optional = !1, node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos +
|
|
3218
|
+
return node.decorators = [], node.name = "this", node.optional = !1, node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 24), parent = previousParent, node;
|
|
3110
3219
|
}
|
|
3111
3220
|
function deserializeTSEnumDeclaration(pos) {
|
|
3112
3221
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3114,14 +3223,14 @@ function deserializeTSEnumDeclaration(pos) {
|
|
|
3114
3223
|
type: "TSEnumDeclaration",
|
|
3115
3224
|
id: null,
|
|
3116
3225
|
body: null,
|
|
3117
|
-
const: deserializeBool(pos +
|
|
3118
|
-
declare: deserializeBool(pos +
|
|
3226
|
+
const: deserializeBool(pos + 12),
|
|
3227
|
+
declare: deserializeBool(pos + 13),
|
|
3119
3228
|
start: start = deserializeU32(pos),
|
|
3120
3229
|
end: end = deserializeU32(pos + 4),
|
|
3121
3230
|
range: [start, end],
|
|
3122
3231
|
parent
|
|
3123
3232
|
};
|
|
3124
|
-
return node.id = deserializeBindingIdentifier(pos +
|
|
3233
|
+
return node.id = deserializeBindingIdentifier(pos + 16), node.body = deserializeTSEnumBody(pos + 48), parent = previousParent, node;
|
|
3125
3234
|
}
|
|
3126
3235
|
function deserializeTSEnumBody(pos) {
|
|
3127
3236
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3133,7 +3242,7 @@ function deserializeTSEnumBody(pos) {
|
|
|
3133
3242
|
range: [start, end],
|
|
3134
3243
|
parent
|
|
3135
3244
|
};
|
|
3136
|
-
return node.members = deserializeVecTSEnumMember(pos +
|
|
3245
|
+
return node.members = deserializeVecTSEnumMember(pos + 16), parent = previousParent, node;
|
|
3137
3246
|
}
|
|
3138
3247
|
function deserializeTSEnumMember(pos) {
|
|
3139
3248
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3147,7 +3256,7 @@ function deserializeTSEnumMember(pos) {
|
|
|
3147
3256
|
range: [start, end],
|
|
3148
3257
|
parent
|
|
3149
3258
|
};
|
|
3150
|
-
return node.id = deserializeTSEnumMemberName(pos +
|
|
3259
|
+
return node.id = deserializeTSEnumMemberName(pos + 16), node.initializer = deserializeOptionExpression(pos + 32), node.computed = deserializeU8(pos + 16) > 1, parent = previousParent, node;
|
|
3151
3260
|
}
|
|
3152
3261
|
function deserializeTSEnumMemberName(pos) {
|
|
3153
3262
|
switch (uint8[pos]) {
|
|
@@ -3168,7 +3277,7 @@ function deserializeTSTypeAnnotation(pos) {
|
|
|
3168
3277
|
range: [start, end],
|
|
3169
3278
|
parent
|
|
3170
3279
|
};
|
|
3171
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
3280
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
3172
3281
|
}
|
|
3173
3282
|
function deserializeTSLiteralType(pos) {
|
|
3174
3283
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3180,7 +3289,7 @@ function deserializeTSLiteralType(pos) {
|
|
|
3180
3289
|
range: [start, end],
|
|
3181
3290
|
parent
|
|
3182
3291
|
};
|
|
3183
|
-
return node.literal = deserializeTSLiteral(pos +
|
|
3292
|
+
return node.literal = deserializeTSLiteral(pos + 16), parent = previousParent, node;
|
|
3184
3293
|
}
|
|
3185
3294
|
function deserializeTSLiteral(pos) {
|
|
3186
3295
|
switch (uint8[pos]) {
|
|
@@ -3248,7 +3357,7 @@ function deserializeTSConditionalType(pos) {
|
|
|
3248
3357
|
range: [start, end],
|
|
3249
3358
|
parent
|
|
3250
3359
|
};
|
|
3251
|
-
return node.checkType = deserializeTSType(pos +
|
|
3360
|
+
return node.checkType = deserializeTSType(pos + 16), node.extendsType = deserializeTSType(pos + 32), node.trueType = deserializeTSType(pos + 48), node.falseType = deserializeTSType(pos + 64), parent = previousParent, node;
|
|
3252
3361
|
}
|
|
3253
3362
|
function deserializeTSUnionType(pos) {
|
|
3254
3363
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3260,7 +3369,7 @@ function deserializeTSUnionType(pos) {
|
|
|
3260
3369
|
range: [start, end],
|
|
3261
3370
|
parent
|
|
3262
3371
|
};
|
|
3263
|
-
return node.types = deserializeVecTSType(pos +
|
|
3372
|
+
return node.types = deserializeVecTSType(pos + 16), parent = previousParent, node;
|
|
3264
3373
|
}
|
|
3265
3374
|
function deserializeTSIntersectionType(pos) {
|
|
3266
3375
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3272,24 +3381,24 @@ function deserializeTSIntersectionType(pos) {
|
|
|
3272
3381
|
range: [start, end],
|
|
3273
3382
|
parent
|
|
3274
3383
|
};
|
|
3275
|
-
return node.types = deserializeVecTSType(pos +
|
|
3384
|
+
return node.types = deserializeVecTSType(pos + 16), parent = previousParent, node;
|
|
3276
3385
|
}
|
|
3277
3386
|
function deserializeTSParenthesizedType(pos) {
|
|
3278
3387
|
let node;
|
|
3279
|
-
return node = deserializeTSType(pos +
|
|
3388
|
+
return node = deserializeTSType(pos + 16), node;
|
|
3280
3389
|
}
|
|
3281
3390
|
function deserializeTSTypeOperator(pos) {
|
|
3282
3391
|
let start, end, previousParent = parent, node = parent = {
|
|
3283
3392
|
__proto__: NodeProto,
|
|
3284
3393
|
type: "TSTypeOperator",
|
|
3285
|
-
operator: deserializeTSTypeOperatorOperator(pos +
|
|
3394
|
+
operator: deserializeTSTypeOperatorOperator(pos + 12),
|
|
3286
3395
|
typeAnnotation: null,
|
|
3287
3396
|
start: start = deserializeU32(pos),
|
|
3288
3397
|
end: end = deserializeU32(pos + 4),
|
|
3289
3398
|
range: [start, end],
|
|
3290
3399
|
parent
|
|
3291
3400
|
};
|
|
3292
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
3401
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
3293
3402
|
}
|
|
3294
3403
|
function deserializeTSTypeOperatorOperator(pos) {
|
|
3295
3404
|
switch (uint8[pos]) {
|
|
@@ -3309,7 +3418,7 @@ function deserializeTSArrayType(pos) {
|
|
|
3309
3418
|
range: [start, end],
|
|
3310
3419
|
parent
|
|
3311
3420
|
};
|
|
3312
|
-
return node.elementType = deserializeTSType(pos +
|
|
3421
|
+
return node.elementType = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
3313
3422
|
}
|
|
3314
3423
|
function deserializeTSIndexedAccessType(pos) {
|
|
3315
3424
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3322,7 +3431,7 @@ function deserializeTSIndexedAccessType(pos) {
|
|
|
3322
3431
|
range: [start, end],
|
|
3323
3432
|
parent
|
|
3324
3433
|
};
|
|
3325
|
-
return node.objectType = deserializeTSType(pos +
|
|
3434
|
+
return node.objectType = deserializeTSType(pos + 16), node.indexType = deserializeTSType(pos + 32), parent = previousParent, node;
|
|
3326
3435
|
}
|
|
3327
3436
|
function deserializeTSTupleType(pos) {
|
|
3328
3437
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3334,7 +3443,7 @@ function deserializeTSTupleType(pos) {
|
|
|
3334
3443
|
range: [start, end],
|
|
3335
3444
|
parent
|
|
3336
3445
|
};
|
|
3337
|
-
return node.elementTypes = deserializeVecTSTupleElement(pos +
|
|
3446
|
+
return node.elementTypes = deserializeVecTSTupleElement(pos + 16), parent = previousParent, node;
|
|
3338
3447
|
}
|
|
3339
3448
|
function deserializeTSNamedTupleMember(pos) {
|
|
3340
3449
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3342,13 +3451,13 @@ function deserializeTSNamedTupleMember(pos) {
|
|
|
3342
3451
|
type: "TSNamedTupleMember",
|
|
3343
3452
|
label: null,
|
|
3344
3453
|
elementType: null,
|
|
3345
|
-
optional: deserializeBool(pos +
|
|
3454
|
+
optional: deserializeBool(pos + 12),
|
|
3346
3455
|
start: start = deserializeU32(pos),
|
|
3347
3456
|
end: end = deserializeU32(pos + 4),
|
|
3348
3457
|
range: [start, end],
|
|
3349
3458
|
parent
|
|
3350
3459
|
};
|
|
3351
|
-
return node.label = deserializeIdentifierName(pos +
|
|
3460
|
+
return node.label = deserializeIdentifierName(pos + 16), node.elementType = deserializeTSTupleElement(pos + 48), parent = previousParent, node;
|
|
3352
3461
|
}
|
|
3353
3462
|
function deserializeTSOptionalType(pos) {
|
|
3354
3463
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3360,7 +3469,7 @@ function deserializeTSOptionalType(pos) {
|
|
|
3360
3469
|
range: [start, end],
|
|
3361
3470
|
parent
|
|
3362
3471
|
};
|
|
3363
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
3472
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
3364
3473
|
}
|
|
3365
3474
|
function deserializeTSRestType(pos) {
|
|
3366
3475
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3372,7 +3481,7 @@ function deserializeTSRestType(pos) {
|
|
|
3372
3481
|
range: [start, end],
|
|
3373
3482
|
parent
|
|
3374
3483
|
};
|
|
3375
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
3484
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
3376
3485
|
}
|
|
3377
3486
|
function deserializeTSTupleElement(pos) {
|
|
3378
3487
|
switch (uint8[pos]) {
|
|
@@ -3583,7 +3692,7 @@ function deserializeTSTypeReference(pos) {
|
|
|
3583
3692
|
range: [start, end],
|
|
3584
3693
|
parent
|
|
3585
3694
|
};
|
|
3586
|
-
return node.typeName = deserializeTSTypeName(pos +
|
|
3695
|
+
return node.typeName = deserializeTSTypeName(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), parent = previousParent, node;
|
|
3587
3696
|
}
|
|
3588
3697
|
function deserializeTSTypeName(pos) {
|
|
3589
3698
|
switch (uint8[pos]) {
|
|
@@ -3604,7 +3713,7 @@ function deserializeTSQualifiedName(pos) {
|
|
|
3604
3713
|
range: [start, end],
|
|
3605
3714
|
parent
|
|
3606
3715
|
};
|
|
3607
|
-
return node.left = deserializeTSTypeName(pos +
|
|
3716
|
+
return node.left = deserializeTSTypeName(pos + 16), node.right = deserializeIdentifierName(pos + 32), parent = previousParent, node;
|
|
3608
3717
|
}
|
|
3609
3718
|
function deserializeTSTypeParameterInstantiation(pos) {
|
|
3610
3719
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3616,7 +3725,7 @@ function deserializeTSTypeParameterInstantiation(pos) {
|
|
|
3616
3725
|
range: [start, end],
|
|
3617
3726
|
parent
|
|
3618
3727
|
};
|
|
3619
|
-
return node.params = deserializeVecTSType(pos +
|
|
3728
|
+
return node.params = deserializeVecTSType(pos + 16), parent = previousParent, node;
|
|
3620
3729
|
}
|
|
3621
3730
|
function deserializeTSTypeParameter(pos) {
|
|
3622
3731
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3625,15 +3734,15 @@ function deserializeTSTypeParameter(pos) {
|
|
|
3625
3734
|
name: null,
|
|
3626
3735
|
constraint: null,
|
|
3627
3736
|
default: null,
|
|
3628
|
-
in: deserializeBool(pos +
|
|
3629
|
-
out: deserializeBool(pos +
|
|
3630
|
-
const: deserializeBool(pos +
|
|
3737
|
+
in: deserializeBool(pos + 12),
|
|
3738
|
+
out: deserializeBool(pos + 13),
|
|
3739
|
+
const: deserializeBool(pos + 14),
|
|
3631
3740
|
start: start = deserializeU32(pos),
|
|
3632
3741
|
end: end = deserializeU32(pos + 4),
|
|
3633
3742
|
range: [start, end],
|
|
3634
3743
|
parent
|
|
3635
3744
|
};
|
|
3636
|
-
return node.name = deserializeBindingIdentifier(pos +
|
|
3745
|
+
return node.name = deserializeBindingIdentifier(pos + 16), node.constraint = deserializeOptionTSType(pos + 48), node.default = deserializeOptionTSType(pos + 64), parent = previousParent, node;
|
|
3637
3746
|
}
|
|
3638
3747
|
function deserializeTSTypeParameterDeclaration(pos) {
|
|
3639
3748
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3645,7 +3754,7 @@ function deserializeTSTypeParameterDeclaration(pos) {
|
|
|
3645
3754
|
range: [start, end],
|
|
3646
3755
|
parent
|
|
3647
3756
|
};
|
|
3648
|
-
return node.params = deserializeVecTSTypeParameter(pos +
|
|
3757
|
+
return node.params = deserializeVecTSTypeParameter(pos + 16), parent = previousParent, node;
|
|
3649
3758
|
}
|
|
3650
3759
|
function deserializeTSTypeAliasDeclaration(pos) {
|
|
3651
3760
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3660,7 +3769,7 @@ function deserializeTSTypeAliasDeclaration(pos) {
|
|
|
3660
3769
|
range: [start, end],
|
|
3661
3770
|
parent
|
|
3662
3771
|
};
|
|
3663
|
-
return node.id = deserializeBindingIdentifier(pos +
|
|
3772
|
+
return node.id = deserializeBindingIdentifier(pos + 16), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 48), node.typeAnnotation = deserializeTSType(pos + 56), parent = previousParent, node;
|
|
3664
3773
|
}
|
|
3665
3774
|
function deserializeTSAccessibility(pos) {
|
|
3666
3775
|
switch (uint8[pos]) {
|
|
@@ -3680,7 +3789,7 @@ function deserializeTSClassImplements(pos) {
|
|
|
3680
3789
|
end: end = deserializeU32(pos + 4),
|
|
3681
3790
|
range: [start, end],
|
|
3682
3791
|
parent
|
|
3683
|
-
}, expression = deserializeTSTypeName(pos +
|
|
3792
|
+
}, expression = deserializeTSTypeName(pos + 16);
|
|
3684
3793
|
if (expression.type === "TSQualifiedName") {
|
|
3685
3794
|
let object = expression.left, { right } = expression, start, end, previous = expression = {
|
|
3686
3795
|
__proto__: NodeProto,
|
|
@@ -3714,7 +3823,7 @@ function deserializeTSClassImplements(pos) {
|
|
|
3714
3823
|
}, right.parent = previous, object = left;
|
|
3715
3824
|
}
|
|
3716
3825
|
}
|
|
3717
|
-
return node.expression = expression, node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos +
|
|
3826
|
+
return node.expression = expression, node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), parent = previousParent, node;
|
|
3718
3827
|
}
|
|
3719
3828
|
function deserializeTSInterfaceDeclaration(pos) {
|
|
3720
3829
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3730,7 +3839,7 @@ function deserializeTSInterfaceDeclaration(pos) {
|
|
|
3730
3839
|
range: [start, end],
|
|
3731
3840
|
parent
|
|
3732
3841
|
};
|
|
3733
|
-
return node.id = deserializeBindingIdentifier(pos +
|
|
3842
|
+
return node.id = deserializeBindingIdentifier(pos + 16), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 48), node.extends = deserializeVecTSInterfaceHeritage(pos + 56), node.body = deserializeBoxTSInterfaceBody(pos + 80), parent = previousParent, node;
|
|
3734
3843
|
}
|
|
3735
3844
|
function deserializeTSInterfaceBody(pos) {
|
|
3736
3845
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3742,15 +3851,15 @@ function deserializeTSInterfaceBody(pos) {
|
|
|
3742
3851
|
range: [start, end],
|
|
3743
3852
|
parent
|
|
3744
3853
|
};
|
|
3745
|
-
return node.body = deserializeVecTSSignature(pos +
|
|
3854
|
+
return node.body = deserializeVecTSSignature(pos + 16), parent = previousParent, node;
|
|
3746
3855
|
}
|
|
3747
3856
|
function deserializeTSPropertySignature(pos) {
|
|
3748
3857
|
let start, end, previousParent = parent, node = parent = {
|
|
3749
3858
|
__proto__: NodeProto,
|
|
3750
3859
|
type: "TSPropertySignature",
|
|
3751
|
-
computed: deserializeBool(pos +
|
|
3752
|
-
optional: deserializeBool(pos +
|
|
3753
|
-
readonly: deserializeBool(pos +
|
|
3860
|
+
computed: deserializeBool(pos + 12),
|
|
3861
|
+
optional: deserializeBool(pos + 13),
|
|
3862
|
+
readonly: deserializeBool(pos + 14),
|
|
3754
3863
|
key: null,
|
|
3755
3864
|
typeAnnotation: null,
|
|
3756
3865
|
accessibility: null,
|
|
@@ -3760,7 +3869,7 @@ function deserializeTSPropertySignature(pos) {
|
|
|
3760
3869
|
range: [start, end],
|
|
3761
3870
|
parent
|
|
3762
3871
|
};
|
|
3763
|
-
return node.key = deserializePropertyKey(pos +
|
|
3872
|
+
return node.key = deserializePropertyKey(pos + 16), node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 32), node.static = !1, parent = previousParent, node;
|
|
3764
3873
|
}
|
|
3765
3874
|
function deserializeTSSignature(pos) {
|
|
3766
3875
|
switch (uint8[pos]) {
|
|
@@ -3778,15 +3887,15 @@ function deserializeTSIndexSignature(pos) {
|
|
|
3778
3887
|
type: "TSIndexSignature",
|
|
3779
3888
|
parameters: null,
|
|
3780
3889
|
typeAnnotation: null,
|
|
3781
|
-
readonly: deserializeBool(pos +
|
|
3782
|
-
static: deserializeBool(pos +
|
|
3890
|
+
readonly: deserializeBool(pos + 12),
|
|
3891
|
+
static: deserializeBool(pos + 13),
|
|
3783
3892
|
accessibility: null,
|
|
3784
3893
|
start: start = deserializeU32(pos),
|
|
3785
3894
|
end: end = deserializeU32(pos + 4),
|
|
3786
3895
|
range: [start, end],
|
|
3787
3896
|
parent
|
|
3788
3897
|
};
|
|
3789
|
-
return node.parameters = deserializeVecTSIndexSignatureName(pos +
|
|
3898
|
+
return node.parameters = deserializeVecTSIndexSignatureName(pos + 16), node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 40), parent = previousParent, node;
|
|
3790
3899
|
}
|
|
3791
3900
|
function deserializeTSCallSignatureDeclaration(pos) {
|
|
3792
3901
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3799,8 +3908,8 @@ function deserializeTSCallSignatureDeclaration(pos) {
|
|
|
3799
3908
|
end: end = deserializeU32(pos + 4),
|
|
3800
3909
|
range: [start, end],
|
|
3801
3910
|
parent
|
|
3802
|
-
}, params = deserializeBoxFormalParameters(pos +
|
|
3803
|
-
return thisParam !== null && params.unshift(thisParam), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos +
|
|
3911
|
+
}, params = deserializeBoxFormalParameters(pos + 32), thisParam = deserializeOptionBoxTSThisParameter(pos + 24);
|
|
3912
|
+
return thisParam !== null && params.unshift(thisParam), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 16), node.params = params, node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 40), parent = previousParent, node;
|
|
3804
3913
|
}
|
|
3805
3914
|
function deserializeTSMethodSignatureKind(pos) {
|
|
3806
3915
|
switch (uint8[pos]) {
|
|
@@ -3828,8 +3937,8 @@ function deserializeTSMethodSignature(pos) {
|
|
|
3828
3937
|
end: end = deserializeU32(pos + 4),
|
|
3829
3938
|
range: [start, end],
|
|
3830
3939
|
parent
|
|
3831
|
-
}, params = deserializeBoxFormalParameters(pos +
|
|
3832
|
-
return thisParam !== null && params.unshift(thisParam), node.key = deserializePropertyKey(pos +
|
|
3940
|
+
}, params = deserializeBoxFormalParameters(pos + 48), thisParam = deserializeOptionBoxTSThisParameter(pos + 40);
|
|
3941
|
+
return thisParam !== null && params.unshift(thisParam), node.key = deserializePropertyKey(pos + 16), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 32), node.params = params, node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 56), node.readonly = !1, node.static = !1, parent = previousParent, node;
|
|
3833
3942
|
}
|
|
3834
3943
|
function deserializeTSConstructSignatureDeclaration(pos) {
|
|
3835
3944
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3843,14 +3952,14 @@ function deserializeTSConstructSignatureDeclaration(pos) {
|
|
|
3843
3952
|
range: [start, end],
|
|
3844
3953
|
parent
|
|
3845
3954
|
};
|
|
3846
|
-
return node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos +
|
|
3955
|
+
return node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 16), node.params = deserializeBoxFormalParameters(pos + 24), node.returnType = deserializeOptionBoxTSTypeAnnotation(pos + 32), parent = previousParent, node;
|
|
3847
3956
|
}
|
|
3848
3957
|
function deserializeTSIndexSignatureName(pos) {
|
|
3849
3958
|
let start, end, previousParent = parent, node = parent = {
|
|
3850
3959
|
__proto__: NodeProto,
|
|
3851
3960
|
type: "Identifier",
|
|
3852
3961
|
decorators: null,
|
|
3853
|
-
name: deserializeStr(pos +
|
|
3962
|
+
name: deserializeStr(pos + 16),
|
|
3854
3963
|
optional: null,
|
|
3855
3964
|
typeAnnotation: null,
|
|
3856
3965
|
start: start = deserializeU32(pos),
|
|
@@ -3858,7 +3967,7 @@ function deserializeTSIndexSignatureName(pos) {
|
|
|
3858
3967
|
range: [start, end],
|
|
3859
3968
|
parent
|
|
3860
3969
|
};
|
|
3861
|
-
return node.decorators = [], node.optional = !1, node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos +
|
|
3970
|
+
return node.decorators = [], node.optional = !1, node.typeAnnotation = deserializeBoxTSTypeAnnotation(pos + 32), parent = previousParent, node;
|
|
3862
3971
|
}
|
|
3863
3972
|
function deserializeTSInterfaceHeritage(pos) {
|
|
3864
3973
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -3871,21 +3980,21 @@ function deserializeTSInterfaceHeritage(pos) {
|
|
|
3871
3980
|
range: [start, end],
|
|
3872
3981
|
parent
|
|
3873
3982
|
};
|
|
3874
|
-
return node.expression = deserializeExpression(pos +
|
|
3983
|
+
return node.expression = deserializeExpression(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), parent = previousParent, node;
|
|
3875
3984
|
}
|
|
3876
3985
|
function deserializeTSTypePredicate(pos) {
|
|
3877
3986
|
let start, end, previousParent = parent, node = parent = {
|
|
3878
3987
|
__proto__: NodeProto,
|
|
3879
3988
|
type: "TSTypePredicate",
|
|
3880
3989
|
parameterName: null,
|
|
3881
|
-
asserts: deserializeBool(pos +
|
|
3990
|
+
asserts: deserializeBool(pos + 12),
|
|
3882
3991
|
typeAnnotation: null,
|
|
3883
3992
|
start: start = deserializeU32(pos),
|
|
3884
3993
|
end: end = deserializeU32(pos + 4),
|
|
3885
3994
|
range: [start, end],
|
|
3886
3995
|
parent
|
|
3887
3996
|
};
|
|
3888
|
-
return node.parameterName = deserializeTSTypePredicateName(pos +
|
|
3997
|
+
return node.parameterName = deserializeTSTypePredicateName(pos + 16), node.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 40), parent = previousParent, node;
|
|
3889
3998
|
}
|
|
3890
3999
|
function deserializeTSTypePredicateName(pos) {
|
|
3891
4000
|
switch (uint8[pos]) {
|
|
@@ -3895,7 +4004,7 @@ function deserializeTSTypePredicateName(pos) {
|
|
|
3895
4004
|
}
|
|
3896
4005
|
}
|
|
3897
4006
|
function deserializeTSModuleDeclaration(pos) {
|
|
3898
|
-
let kind = deserializeTSModuleDeclarationKind(pos + 88), start = deserializeU32(pos), end = deserializeU32(pos + 4), declare = deserializeBool(pos + 89), node, previousParent = parent, body = deserializeOptionTSModuleDeclarationBody(pos +
|
|
4007
|
+
let kind = deserializeTSModuleDeclarationKind(pos + 88), start = deserializeU32(pos), end = deserializeU32(pos + 4), declare = deserializeBool(pos + 89), node, previousParent = parent, body = deserializeOptionTSModuleDeclarationBody(pos + 72);
|
|
3899
4008
|
if (body === null) node = parent = {
|
|
3900
4009
|
__proto__: NodeProto,
|
|
3901
4010
|
type: "TSModuleDeclaration",
|
|
@@ -3907,7 +4016,7 @@ function deserializeTSModuleDeclaration(pos) {
|
|
|
3907
4016
|
end,
|
|
3908
4017
|
range: [start, end],
|
|
3909
4018
|
parent
|
|
3910
|
-
}, node.id = deserializeTSModuleDeclarationName(pos +
|
|
4019
|
+
}, node.id = deserializeTSModuleDeclarationName(pos + 16);
|
|
3911
4020
|
else {
|
|
3912
4021
|
node = parent = {
|
|
3913
4022
|
__proto__: NodeProto,
|
|
@@ -3922,7 +4031,7 @@ function deserializeTSModuleDeclaration(pos) {
|
|
|
3922
4031
|
range: [start, end],
|
|
3923
4032
|
parent
|
|
3924
4033
|
};
|
|
3925
|
-
let id = deserializeTSModuleDeclarationName(pos +
|
|
4034
|
+
let id = deserializeTSModuleDeclarationName(pos + 16);
|
|
3926
4035
|
if (body.type === "TSModuleBlock") node.id = id, body.parent = node;
|
|
3927
4036
|
else {
|
|
3928
4037
|
let innerId = body.id;
|
|
@@ -4001,11 +4110,11 @@ function deserializeTSGlobalDeclaration(pos) {
|
|
|
4001
4110
|
name: "global",
|
|
4002
4111
|
optional: !1,
|
|
4003
4112
|
typeAnnotation: null,
|
|
4004
|
-
start: keywordStart = deserializeU32(pos +
|
|
4005
|
-
end: keywordEnd = deserializeU32(pos +
|
|
4113
|
+
start: keywordStart = deserializeU32(pos + 16),
|
|
4114
|
+
end: keywordEnd = deserializeU32(pos + 20),
|
|
4006
4115
|
range: [keywordStart, keywordEnd],
|
|
4007
4116
|
parent
|
|
4008
|
-
}, node.body = deserializeTSModuleBlock(pos +
|
|
4117
|
+
}, node.body = deserializeTSModuleBlock(pos + 24), node.kind = "global", node.global = !0, parent = previousParent, node;
|
|
4009
4118
|
}
|
|
4010
4119
|
function deserializeTSModuleBlock(pos) {
|
|
4011
4120
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4016,8 +4125,8 @@ function deserializeTSModuleBlock(pos) {
|
|
|
4016
4125
|
end: end = deserializeU32(pos + 4),
|
|
4017
4126
|
range: [start, end],
|
|
4018
4127
|
parent
|
|
4019
|
-
}, body = deserializeVecDirective(pos +
|
|
4020
|
-
return body.push(...deserializeVecStatement(pos +
|
|
4128
|
+
}, body = deserializeVecDirective(pos + 16);
|
|
4129
|
+
return body.push(...deserializeVecStatement(pos + 40)), node.body = body, parent = previousParent, node;
|
|
4021
4130
|
}
|
|
4022
4131
|
function deserializeTSTypeLiteral(pos) {
|
|
4023
4132
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4029,7 +4138,7 @@ function deserializeTSTypeLiteral(pos) {
|
|
|
4029
4138
|
range: [start, end],
|
|
4030
4139
|
parent
|
|
4031
4140
|
};
|
|
4032
|
-
return node.members = deserializeVecTSSignature(pos +
|
|
4141
|
+
return node.members = deserializeVecTSSignature(pos + 16), parent = previousParent, node;
|
|
4033
4142
|
}
|
|
4034
4143
|
function deserializeTSInferType(pos) {
|
|
4035
4144
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4041,7 +4150,7 @@ function deserializeTSInferType(pos) {
|
|
|
4041
4150
|
range: [start, end],
|
|
4042
4151
|
parent
|
|
4043
4152
|
};
|
|
4044
|
-
return node.typeParameter = deserializeBoxTSTypeParameter(pos +
|
|
4153
|
+
return node.typeParameter = deserializeBoxTSTypeParameter(pos + 16), parent = previousParent, node;
|
|
4045
4154
|
}
|
|
4046
4155
|
function deserializeTSTypeQuery(pos) {
|
|
4047
4156
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4054,7 +4163,7 @@ function deserializeTSTypeQuery(pos) {
|
|
|
4054
4163
|
range: [start, end],
|
|
4055
4164
|
parent
|
|
4056
4165
|
};
|
|
4057
|
-
return node.exprName = deserializeTSTypeQueryExprName(pos +
|
|
4166
|
+
return node.exprName = deserializeTSTypeQueryExprName(pos + 16), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 32), parent = previousParent, node;
|
|
4058
4167
|
}
|
|
4059
4168
|
function deserializeTSTypeQueryExprName(pos) {
|
|
4060
4169
|
switch (uint8[pos]) {
|
|
@@ -4078,7 +4187,7 @@ function deserializeTSImportType(pos) {
|
|
|
4078
4187
|
range: [start, end],
|
|
4079
4188
|
parent
|
|
4080
4189
|
};
|
|
4081
|
-
return node.source = deserializeStringLiteral(pos +
|
|
4190
|
+
return node.source = deserializeStringLiteral(pos + 16), node.options = deserializeOptionBoxObjectExpression(pos + 64), node.qualifier = deserializeOptionTSImportTypeQualifier(pos + 72), node.typeArguments = deserializeOptionBoxTSTypeParameterInstantiation(pos + 88), parent = previousParent, node;
|
|
4082
4191
|
}
|
|
4083
4192
|
function deserializeTSImportTypeQualifier(pos) {
|
|
4084
4193
|
switch (uint8[pos]) {
|
|
@@ -4098,7 +4207,7 @@ function deserializeTSImportTypeQualifiedName(pos) {
|
|
|
4098
4207
|
range: [start, end],
|
|
4099
4208
|
parent
|
|
4100
4209
|
};
|
|
4101
|
-
return node.left = deserializeTSImportTypeQualifier(pos +
|
|
4210
|
+
return node.left = deserializeTSImportTypeQualifier(pos + 16), node.right = deserializeIdentifierName(pos + 32), parent = previousParent, node;
|
|
4102
4211
|
}
|
|
4103
4212
|
function deserializeTSFunctionType(pos) {
|
|
4104
4213
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4111,8 +4220,8 @@ function deserializeTSFunctionType(pos) {
|
|
|
4111
4220
|
end: end = deserializeU32(pos + 4),
|
|
4112
4221
|
range: [start, end],
|
|
4113
4222
|
parent
|
|
4114
|
-
}, params = deserializeBoxFormalParameters(pos +
|
|
4115
|
-
return thisParam !== null && params.unshift(thisParam), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos +
|
|
4223
|
+
}, params = deserializeBoxFormalParameters(pos + 32), thisParam = deserializeOptionBoxTSThisParameter(pos + 24);
|
|
4224
|
+
return thisParam !== null && params.unshift(thisParam), node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 16), node.params = params, node.returnType = deserializeBoxTSTypeAnnotation(pos + 40), parent = previousParent, node;
|
|
4116
4225
|
}
|
|
4117
4226
|
function deserializeTSConstructorType(pos) {
|
|
4118
4227
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4127,7 +4236,7 @@ function deserializeTSConstructorType(pos) {
|
|
|
4127
4236
|
range: [start, end],
|
|
4128
4237
|
parent
|
|
4129
4238
|
};
|
|
4130
|
-
return node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos +
|
|
4239
|
+
return node.typeParameters = deserializeOptionBoxTSTypeParameterDeclaration(pos + 16), node.params = deserializeBoxFormalParameters(pos + 24), node.returnType = deserializeBoxTSTypeAnnotation(pos + 32), parent = previousParent, node;
|
|
4131
4240
|
}
|
|
4132
4241
|
function deserializeTSMappedType(pos) {
|
|
4133
4242
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4144,7 +4253,7 @@ function deserializeTSMappedType(pos) {
|
|
|
4144
4253
|
range: [start, end],
|
|
4145
4254
|
parent
|
|
4146
4255
|
}, optional = deserializeOptionTSMappedTypeModifierOperator(pos + 96);
|
|
4147
|
-
return optional === null && (optional = !1), node.key = deserializeBindingIdentifier(pos +
|
|
4256
|
+
return optional === null && (optional = !1), node.key = deserializeBindingIdentifier(pos + 16), node.constraint = deserializeTSType(pos + 48), node.nameType = deserializeOptionTSType(pos + 64), node.typeAnnotation = deserializeOptionTSType(pos + 80), node.optional = optional, parent = previousParent, node;
|
|
4148
4257
|
}
|
|
4149
4258
|
function deserializeTSMappedTypeModifierOperator(pos) {
|
|
4150
4259
|
switch (uint8[pos]) {
|
|
@@ -4165,7 +4274,7 @@ function deserializeTSTemplateLiteralType(pos) {
|
|
|
4165
4274
|
range: [start, end],
|
|
4166
4275
|
parent
|
|
4167
4276
|
};
|
|
4168
|
-
return node.quasis = deserializeVecTemplateElement(pos +
|
|
4277
|
+
return node.quasis = deserializeVecTemplateElement(pos + 16), node.types = deserializeVecTSType(pos + 40), parent = previousParent, node;
|
|
4169
4278
|
}
|
|
4170
4279
|
function deserializeTSAsExpression(pos) {
|
|
4171
4280
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4178,7 +4287,7 @@ function deserializeTSAsExpression(pos) {
|
|
|
4178
4287
|
range: [start, end],
|
|
4179
4288
|
parent
|
|
4180
4289
|
};
|
|
4181
|
-
return node.expression = deserializeExpression(pos +
|
|
4290
|
+
return node.expression = deserializeExpression(pos + 16), node.typeAnnotation = deserializeTSType(pos + 32), parent = previousParent, node;
|
|
4182
4291
|
}
|
|
4183
4292
|
function deserializeTSSatisfiesExpression(pos) {
|
|
4184
4293
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4191,7 +4300,7 @@ function deserializeTSSatisfiesExpression(pos) {
|
|
|
4191
4300
|
range: [start, end],
|
|
4192
4301
|
parent
|
|
4193
4302
|
};
|
|
4194
|
-
return node.expression = deserializeExpression(pos +
|
|
4303
|
+
return node.expression = deserializeExpression(pos + 16), node.typeAnnotation = deserializeTSType(pos + 32), parent = previousParent, node;
|
|
4195
4304
|
}
|
|
4196
4305
|
function deserializeTSTypeAssertion(pos) {
|
|
4197
4306
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4204,7 +4313,7 @@ function deserializeTSTypeAssertion(pos) {
|
|
|
4204
4313
|
range: [start, end],
|
|
4205
4314
|
parent
|
|
4206
4315
|
};
|
|
4207
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
4316
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), node.expression = deserializeExpression(pos + 32), parent = previousParent, node;
|
|
4208
4317
|
}
|
|
4209
4318
|
function deserializeTSImportEqualsDeclaration(pos) {
|
|
4210
4319
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4212,13 +4321,13 @@ function deserializeTSImportEqualsDeclaration(pos) {
|
|
|
4212
4321
|
type: "TSImportEqualsDeclaration",
|
|
4213
4322
|
id: null,
|
|
4214
4323
|
moduleReference: null,
|
|
4215
|
-
importKind: deserializeImportOrExportKind(pos +
|
|
4324
|
+
importKind: deserializeImportOrExportKind(pos + 12),
|
|
4216
4325
|
start: start = deserializeU32(pos),
|
|
4217
4326
|
end: end = deserializeU32(pos + 4),
|
|
4218
4327
|
range: [start, end],
|
|
4219
4328
|
parent
|
|
4220
4329
|
};
|
|
4221
|
-
return node.id = deserializeBindingIdentifier(pos +
|
|
4330
|
+
return node.id = deserializeBindingIdentifier(pos + 16), node.moduleReference = deserializeTSModuleReference(pos + 48), parent = previousParent, node;
|
|
4222
4331
|
}
|
|
4223
4332
|
function deserializeTSModuleReference(pos) {
|
|
4224
4333
|
switch (uint8[pos]) {
|
|
@@ -4238,7 +4347,7 @@ function deserializeTSExternalModuleReference(pos) {
|
|
|
4238
4347
|
range: [start, end],
|
|
4239
4348
|
parent
|
|
4240
4349
|
};
|
|
4241
|
-
return node.expression = deserializeStringLiteral(pos +
|
|
4350
|
+
return node.expression = deserializeStringLiteral(pos + 16), parent = previousParent, node;
|
|
4242
4351
|
}
|
|
4243
4352
|
function deserializeTSNonNullExpression(pos) {
|
|
4244
4353
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4250,7 +4359,7 @@ function deserializeTSNonNullExpression(pos) {
|
|
|
4250
4359
|
range: [start, end],
|
|
4251
4360
|
parent
|
|
4252
4361
|
};
|
|
4253
|
-
return node.expression = deserializeExpression(pos +
|
|
4362
|
+
return node.expression = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
4254
4363
|
}
|
|
4255
4364
|
function deserializeDecorator(pos) {
|
|
4256
4365
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4262,7 +4371,7 @@ function deserializeDecorator(pos) {
|
|
|
4262
4371
|
range: [start, end],
|
|
4263
4372
|
parent
|
|
4264
4373
|
};
|
|
4265
|
-
return node.expression = deserializeExpression(pos +
|
|
4374
|
+
return node.expression = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
4266
4375
|
}
|
|
4267
4376
|
function deserializeTSExportAssignment(pos) {
|
|
4268
4377
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4274,7 +4383,7 @@ function deserializeTSExportAssignment(pos) {
|
|
|
4274
4383
|
range: [start, end],
|
|
4275
4384
|
parent
|
|
4276
4385
|
};
|
|
4277
|
-
return node.expression = deserializeExpression(pos +
|
|
4386
|
+
return node.expression = deserializeExpression(pos + 16), parent = previousParent, node;
|
|
4278
4387
|
}
|
|
4279
4388
|
function deserializeTSNamespaceExportDeclaration(pos) {
|
|
4280
4389
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4286,7 +4395,7 @@ function deserializeTSNamespaceExportDeclaration(pos) {
|
|
|
4286
4395
|
range: [start, end],
|
|
4287
4396
|
parent
|
|
4288
4397
|
};
|
|
4289
|
-
return node.id = deserializeIdentifierName(pos +
|
|
4398
|
+
return node.id = deserializeIdentifierName(pos + 16), parent = previousParent, node;
|
|
4290
4399
|
}
|
|
4291
4400
|
function deserializeTSInstantiationExpression(pos) {
|
|
4292
4401
|
let start, end, previousParent = parent, node = parent = {
|
|
@@ -4299,7 +4408,7 @@ function deserializeTSInstantiationExpression(pos) {
|
|
|
4299
4408
|
range: [start, end],
|
|
4300
4409
|
parent
|
|
4301
4410
|
};
|
|
4302
|
-
return node.expression = deserializeExpression(pos +
|
|
4411
|
+
return node.expression = deserializeExpression(pos + 16), node.typeArguments = deserializeBoxTSTypeParameterInstantiation(pos + 32), parent = previousParent, node;
|
|
4303
4412
|
}
|
|
4304
4413
|
function deserializeImportOrExportKind(pos) {
|
|
4305
4414
|
switch (uint8[pos]) {
|
|
@@ -4313,26 +4422,26 @@ function deserializeJSDocNullableType(pos) {
|
|
|
4313
4422
|
__proto__: NodeProto,
|
|
4314
4423
|
type: "TSJSDocNullableType",
|
|
4315
4424
|
typeAnnotation: null,
|
|
4316
|
-
postfix: deserializeBool(pos +
|
|
4425
|
+
postfix: deserializeBool(pos + 12),
|
|
4317
4426
|
start: start = deserializeU32(pos),
|
|
4318
4427
|
end: end = deserializeU32(pos + 4),
|
|
4319
4428
|
range: [start, end],
|
|
4320
4429
|
parent
|
|
4321
4430
|
};
|
|
4322
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
4431
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
4323
4432
|
}
|
|
4324
4433
|
function deserializeJSDocNonNullableType(pos) {
|
|
4325
4434
|
let start, end, previousParent = parent, node = parent = {
|
|
4326
4435
|
__proto__: NodeProto,
|
|
4327
4436
|
type: "TSJSDocNonNullableType",
|
|
4328
4437
|
typeAnnotation: null,
|
|
4329
|
-
postfix: deserializeBool(pos +
|
|
4438
|
+
postfix: deserializeBool(pos + 12),
|
|
4330
4439
|
start: start = deserializeU32(pos),
|
|
4331
4440
|
end: end = deserializeU32(pos + 4),
|
|
4332
4441
|
range: [start, end],
|
|
4333
4442
|
parent
|
|
4334
4443
|
};
|
|
4335
|
-
return node.typeAnnotation = deserializeTSType(pos +
|
|
4444
|
+
return node.typeAnnotation = deserializeTSType(pos + 16), parent = previousParent, node;
|
|
4336
4445
|
}
|
|
4337
4446
|
function deserializeJSDocUnknownType(pos) {
|
|
4338
4447
|
let start, end;
|
|
@@ -4345,6 +4454,14 @@ function deserializeJSDocUnknownType(pos) {
|
|
|
4345
4454
|
parent
|
|
4346
4455
|
};
|
|
4347
4456
|
}
|
|
4457
|
+
function deserializeModuleKind(pos) {
|
|
4458
|
+
switch (uint8[pos]) {
|
|
4459
|
+
case 0: return "script";
|
|
4460
|
+
case 1: return "module";
|
|
4461
|
+
case 3: return "commonjs";
|
|
4462
|
+
default: throw Error(`Unexpected discriminant ${uint8[pos]} for ModuleKind`);
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4348
4465
|
function deserializeAssignmentOperator(pos) {
|
|
4349
4466
|
switch (uint8[pos]) {
|
|
4350
4467
|
case 0: return "=";
|
|
@@ -4420,20 +4537,6 @@ function deserializeUpdateOperator(pos) {
|
|
|
4420
4537
|
default: throw Error(`Unexpected discriminant ${uint8[pos]} for UpdateOperator`);
|
|
4421
4538
|
}
|
|
4422
4539
|
}
|
|
4423
|
-
function deserializeModuleKind(pos) {
|
|
4424
|
-
switch (uint8[pos]) {
|
|
4425
|
-
case 0: return "script";
|
|
4426
|
-
case 1: return "module";
|
|
4427
|
-
case 3: return "commonjs";
|
|
4428
|
-
default: throw Error(`Unexpected discriminant ${uint8[pos]} for ModuleKind`);
|
|
4429
|
-
}
|
|
4430
|
-
}
|
|
4431
|
-
function deserializeU32(pos) {
|
|
4432
|
-
return uint32[pos >> 2];
|
|
4433
|
-
}
|
|
4434
|
-
function deserializeU8(pos) {
|
|
4435
|
-
return uint8[pos];
|
|
4436
|
-
}
|
|
4437
4540
|
function deserializeStr(pos) {
|
|
4438
4541
|
let pos32 = pos >> 2, len = uint32[pos32 + 2];
|
|
4439
4542
|
if (len === 0) return "";
|
|
@@ -4788,7 +4891,7 @@ function deserializeOptionForStatementInit(pos) {
|
|
|
4788
4891
|
return uint8[pos] === 65 ? null : deserializeForStatementInit(pos);
|
|
4789
4892
|
}
|
|
4790
4893
|
function deserializeOptionLabelIdentifier(pos) {
|
|
4791
|
-
return uint32[pos +
|
|
4894
|
+
return uint32[pos + 16 >> 2] === 0 && uint32[pos + 20 >> 2] === 0 ? null : deserializeLabelIdentifier(pos);
|
|
4792
4895
|
}
|
|
4793
4896
|
function deserializeVecSwitchCase(pos) {
|
|
4794
4897
|
let arr = [], pos32 = pos >> 2;
|
|
@@ -4807,7 +4910,7 @@ function deserializeOptionBoxBlockStatement(pos) {
|
|
|
4807
4910
|
return uint32[pos >> 2] === 0 && uint32[pos + 4 >> 2] === 0 ? null : deserializeBoxBlockStatement(pos);
|
|
4808
4911
|
}
|
|
4809
4912
|
function deserializeOptionCatchParameter(pos) {
|
|
4810
|
-
return uint8[pos +
|
|
4913
|
+
return uint8[pos + 16] === 4 ? null : deserializeCatchParameter(pos);
|
|
4811
4914
|
}
|
|
4812
4915
|
function deserializeBoxBindingIdentifier(pos) {
|
|
4813
4916
|
return deserializeBindingIdentifier(uint32[pos >> 2]);
|
|
@@ -4845,7 +4948,7 @@ function deserializeVecOptionBindingPattern(pos) {
|
|
|
4845
4948
|
return arr;
|
|
4846
4949
|
}
|
|
4847
4950
|
function deserializeOptionBindingIdentifier(pos) {
|
|
4848
|
-
return uint32[pos +
|
|
4951
|
+
return uint32[pos + 16 >> 2] === 0 && uint32[pos + 20 >> 2] === 0 ? null : deserializeBindingIdentifier(pos);
|
|
4849
4952
|
}
|
|
4850
4953
|
function deserializeBoxTSTypeParameterDeclaration(pos) {
|
|
4851
4954
|
return deserializeTSTypeParameterDeclaration(uint32[pos >> 2]);
|
|
@@ -4987,7 +5090,7 @@ function deserializeVecExportSpecifier(pos) {
|
|
|
4987
5090
|
return arr;
|
|
4988
5091
|
}
|
|
4989
5092
|
function deserializeOptionStringLiteral(pos) {
|
|
4990
|
-
return uint8[pos +
|
|
5093
|
+
return uint8[pos + 12] === 2 ? null : deserializeStringLiteral(pos);
|
|
4991
5094
|
}
|
|
4992
5095
|
function deserializeOptionModuleExportName(pos) {
|
|
4993
5096
|
return uint8[pos] === 3 ? null : deserializeModuleExportName(pos);
|
|
@@ -4995,6 +5098,9 @@ function deserializeOptionModuleExportName(pos) {
|
|
|
4995
5098
|
function deserializeF64(pos) {
|
|
4996
5099
|
return float64[pos >> 3];
|
|
4997
5100
|
}
|
|
5101
|
+
function deserializeU8(pos) {
|
|
5102
|
+
return uint8[pos];
|
|
5103
|
+
}
|
|
4998
5104
|
function deserializeBoxJSXOpeningElement(pos) {
|
|
4999
5105
|
return deserializeJSXOpeningElement(uint32[pos >> 2]);
|
|
5000
5106
|
}
|
|
@@ -5256,9 +5362,123 @@ function deserializeOptionTSMappedTypeModifierOperator(pos) {
|
|
|
5256
5362
|
function deserializeBoxTSExternalModuleReference(pos) {
|
|
5257
5363
|
return deserializeTSExternalModuleReference(uint32[pos >> 2]);
|
|
5258
5364
|
}
|
|
5365
|
+
function deserializeU32(pos) {
|
|
5366
|
+
return uint32[pos >> 2];
|
|
5367
|
+
}
|
|
5368
|
+
let tokensAndComments = null, previousTokensAndComments = [], tokensAndCommentsUint32 = null, tokensAndCommentsLen = 0, tokensAndCommentsBackingUint32 = EMPTY_UINT32_ARRAY;
|
|
5369
|
+
/**
|
|
5370
|
+
* Initialize tokens-and-comments buffer.
|
|
5371
|
+
*
|
|
5372
|
+
* Creates a buffer containing tokens and comments interleaved in ascending order of `start`.
|
|
5373
|
+
*
|
|
5374
|
+
* Each token/comment in the input buffers is 16 bytes, with `start` as the first `u32`.
|
|
5375
|
+
*
|
|
5376
|
+
* `tokensAndCommentsUint32` contains 16-byte entries with the layout:
|
|
5377
|
+
* `{ start: u32, index: u32, type: u32, 4 bytes padding }`.
|
|
5378
|
+
*
|
|
5379
|
+
* `index` is the index of the token/comment within its original buffer (in 16-byte units).
|
|
5380
|
+
*/
|
|
5381
|
+
function initTokensAndCommentsBuffer() {
|
|
5382
|
+
tokensUint32 === null && initTokensBuffer(), commentsUint32 === null && initCommentsBuffer(), tokensAndCommentsLen = tokensLen + commentsLen;
|
|
5383
|
+
let requiredLen32 = tokensAndCommentsLen + 1 << 2, backingLen = tokensAndCommentsBackingUint32.length;
|
|
5384
|
+
backingLen < requiredLen32 && (tokensAndCommentsBackingUint32 = new Uint32Array(MathMax(requiredLen32, backingLen === 0 ? 256 : backingLen << 1))), tokensAndCommentsUint32 = tokensAndCommentsBackingUint32, commentsLen === 0 ? fillMergedEntries(0, tokensUint32, 0, 0, tokensLen) : tokensLen === 0 ? fillMergedEntries(1, commentsUint32, 0, 0, commentsLen) : mergeTokensAndComments(tokensUint32, commentsUint32), tokensAndCommentsUint32[(tokensAndCommentsLen << 2) + 2] = 0;
|
|
5385
|
+
}
|
|
5386
|
+
/**
|
|
5387
|
+
* Merge tokens and comments in ascending order of `start`.
|
|
5388
|
+
*
|
|
5389
|
+
* Uses two separate inner loops (one for token runs, one for comment runs)
|
|
5390
|
+
* so the branch predictor sees a consistent "continue" pattern within each run,
|
|
5391
|
+
* only mispredicting once at each run transition.
|
|
5392
|
+
*/
|
|
5393
|
+
function mergeTokensAndComments(tokensUint32, commentsUint32) {
|
|
5394
|
+
let tokenIndex = 0, commentIndex = 0, mergedPos32 = 0, tokenStart = tokensUint32[0], commentStart = commentsUint32[0];
|
|
5395
|
+
for (; commentStart < tokenStart;) {
|
|
5396
|
+
if (writeMergedEntry(1, mergedPos32, commentIndex, commentStart), mergedPos32 += 4, ++commentIndex === commentsLen) {
|
|
5397
|
+
fillMergedEntries(0, tokensUint32, mergedPos32, tokenIndex, tokensLen);
|
|
5398
|
+
return;
|
|
5399
|
+
}
|
|
5400
|
+
commentStart = commentsUint32[commentIndex << 2];
|
|
5401
|
+
}
|
|
5402
|
+
for (;;) {
|
|
5403
|
+
do {
|
|
5404
|
+
if (writeMergedEntry(0, mergedPos32, tokenIndex, tokenStart), mergedPos32 += 4, ++tokenIndex === tokensLen) {
|
|
5405
|
+
fillMergedEntries(1, commentsUint32, mergedPos32, commentIndex, commentsLen);
|
|
5406
|
+
return;
|
|
5407
|
+
}
|
|
5408
|
+
tokenStart = tokensUint32[tokenIndex << 2];
|
|
5409
|
+
} while (tokenStart < commentStart);
|
|
5410
|
+
do {
|
|
5411
|
+
if (writeMergedEntry(1, mergedPos32, commentIndex, commentStart), mergedPos32 += 4, ++commentIndex === commentsLen) {
|
|
5412
|
+
fillMergedEntries(0, tokensUint32, mergedPos32, tokenIndex, tokensLen);
|
|
5413
|
+
return;
|
|
5414
|
+
}
|
|
5415
|
+
commentStart = commentsUint32[commentIndex << 2];
|
|
5416
|
+
} while (commentStart < tokenStart);
|
|
5417
|
+
}
|
|
5418
|
+
}
|
|
5419
|
+
/**
|
|
5420
|
+
* Write a single entry to the merged buffer.
|
|
5421
|
+
*/
|
|
5422
|
+
function writeMergedEntry(type, mergedPos32, originalIndex, start) {
|
|
5423
|
+
tokensAndCommentsUint32[mergedPos32] = start, tokensAndCommentsUint32[mergedPos32 + 1] = originalIndex, tokensAndCommentsUint32[mergedPos32 + 2] = type;
|
|
5424
|
+
}
|
|
5425
|
+
/**
|
|
5426
|
+
* Fill output entries from a single source buffer (tokens or comments) sequentially.
|
|
5427
|
+
* Used for fast paths and for appending remaining items after the merge loop.
|
|
5428
|
+
*/
|
|
5429
|
+
function fillMergedEntries(type, srcUint32, mergedPos32, srcIndex, srcLen) {
|
|
5430
|
+
let srcPos32 = srcIndex << 2;
|
|
5431
|
+
for (; srcIndex < srcLen; srcIndex++) tokensAndCommentsUint32[mergedPos32] = srcUint32[srcPos32], tokensAndCommentsUint32[mergedPos32 + 1] = srcIndex, tokensAndCommentsUint32[mergedPos32 + 2] = type, mergedPos32 += 4, srcPos32 += 4;
|
|
5432
|
+
}
|
|
5433
|
+
/**
|
|
5434
|
+
* Get token or comment from the merged buffer at `index`.
|
|
5435
|
+
* Deserializes the underlying token/comment if needed.
|
|
5436
|
+
*
|
|
5437
|
+
* @param index - Index in the merged buffer
|
|
5438
|
+
* @returns Deserialized token or comment
|
|
5439
|
+
*/
|
|
5440
|
+
function getTokenOrComment(index) {
|
|
5441
|
+
let pos32 = index << 2, originalIndex = tokensAndCommentsUint32[pos32 + 1];
|
|
5442
|
+
return tokensAndCommentsUint32[pos32 + 2] === 0 ? getToken(originalIndex) : getComment(originalIndex);
|
|
5443
|
+
}
|
|
5444
|
+
/**
|
|
5445
|
+
* Get the `end` value for an entry in the merged `tokensAndComments` buffer,
|
|
5446
|
+
* by looking it up in the original tokens or comments buffer.
|
|
5447
|
+
*
|
|
5448
|
+
* @param entryIndex - Index in the merged buffer
|
|
5449
|
+
* @returns The `end` offset of the token/comment in source text
|
|
5450
|
+
*/
|
|
5451
|
+
function getTokenOrCommentEnd(entryIndex) {
|
|
5452
|
+
let pos32 = entryIndex << 2, originalEndPos32 = (tokensAndCommentsUint32[pos32 + 1] << 2) + 1;
|
|
5453
|
+
return tokensAndCommentsUint32[pos32 + 2] === 0 ? tokensUint32[originalEndPos32] : commentsUint32[originalEndPos32];
|
|
5454
|
+
}
|
|
5455
|
+
/**
|
|
5456
|
+
* Get all tokens and comments in source order.
|
|
5457
|
+
*
|
|
5458
|
+
* Builds and caches the merged array on first call.
|
|
5459
|
+
* Subsequent calls return the same cached array.
|
|
5460
|
+
*
|
|
5461
|
+
* @returns Array of all tokens and comments, sorted by source position
|
|
5462
|
+
*/
|
|
5463
|
+
function getTokensAndComments() {
|
|
5464
|
+
if (tokensAndComments !== null) return tokensAndComments;
|
|
5465
|
+
if (tokensUint32 === null && initTokensBuffer(), commentsUint32 === null && initCommentsBuffer(), commentsLen === 0) return tokens === null && initTokens(), tokensAndComments = tokens;
|
|
5466
|
+
if (tokensLen === 0) return comments === null && initComments(), tokensAndComments = comments;
|
|
5467
|
+
allTokensDeserialized || deserializeTokens(), allCommentsDeserialized || deserializeComments(), tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), previousTokensAndComments.length >= tokensAndCommentsLen ? (tokensAndComments = previousTokensAndComments, tokensAndComments.length = tokensAndCommentsLen) : (tokensAndComments = previousTokensAndComments = Array(tokensAndCommentsLen).fill(0), tokensAndComments[0] = null);
|
|
5468
|
+
for (let i = 0; i < tokensAndCommentsLen; i++) {
|
|
5469
|
+
let pos32 = i << 2, originalIndex = tokensAndCommentsUint32[pos32 + 1];
|
|
5470
|
+
tokensAndComments[i] = tokensAndCommentsUint32[pos32 + 2] === 0 ? cachedTokens[originalIndex] : cachedComments[originalIndex];
|
|
5471
|
+
}
|
|
5472
|
+
return tokensAndComments;
|
|
5473
|
+
}
|
|
5474
|
+
/**
|
|
5475
|
+
* Reset merged tokens-and-comments array and buffer after file has been linted.
|
|
5476
|
+
*/
|
|
5477
|
+
function resetTokensAndComments() {
|
|
5478
|
+
tokensAndComments = null, tokensAndCommentsUint32 = null, tokensAndCommentsLen = 0;
|
|
5479
|
+
}
|
|
5259
5480
|
//#endregion
|
|
5260
5481
|
//#region src-js/plugins/comments_methods.ts
|
|
5261
|
-
const WHITESPACE_ONLY_REGEXP = /^\s*$/;
|
|
5262
5482
|
/**
|
|
5263
5483
|
* Retrieve an array containing all comments in the source code.
|
|
5264
5484
|
* @returns Array of `Comment`s in order they appear in source.
|
|
@@ -5284,19 +5504,19 @@ function getAllComments() {
|
|
|
5284
5504
|
* @returns Array of `Comment`s in occurrence order.
|
|
5285
5505
|
*/
|
|
5286
5506
|
function getCommentsBefore(nodeOrToken) {
|
|
5287
|
-
|
|
5288
|
-
let targetStart = nodeOrToken.range[0],
|
|
5289
|
-
for (let endIndex =
|
|
5290
|
-
let mid =
|
|
5291
|
-
|
|
5292
|
-
}
|
|
5293
|
-
let
|
|
5294
|
-
for (
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
return
|
|
5507
|
+
if (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), commentsLen === 0) return [];
|
|
5508
|
+
let targetStart = nodeOrToken.range[0], searchIndex = 0;
|
|
5509
|
+
for (let endIndex = tokensAndCommentsLen; searchIndex < endIndex;) {
|
|
5510
|
+
let mid = searchIndex + endIndex >>> 1;
|
|
5511
|
+
tokensAndCommentsUint32[mid << 2] < targetStart ? searchIndex = mid + 1 : endIndex = mid;
|
|
5512
|
+
}
|
|
5513
|
+
let startTypePos32 = (searchIndex << 2) - 2, typePos32 = startTypePos32;
|
|
5514
|
+
for (; typePos32 > 0 && tokensAndCommentsUint32[typePos32] !== 0;) typePos32 -= 4;
|
|
5515
|
+
let count32 = startTypePos32 - typePos32;
|
|
5516
|
+
if (count32 === 0) return [];
|
|
5517
|
+
let sliceStart = tokensAndCommentsUint32[typePos32 + 3], sliceEnd = sliceStart + (count32 >> 2);
|
|
5518
|
+
for (let i = sliceStart; i < sliceEnd; i++) getComment(i);
|
|
5519
|
+
return cachedComments.slice(sliceStart, sliceEnd);
|
|
5300
5520
|
}
|
|
5301
5521
|
/**
|
|
5302
5522
|
* Get all comment tokens directly after the given node or token.
|
|
@@ -5317,19 +5537,19 @@ function getCommentsBefore(nodeOrToken) {
|
|
|
5317
5537
|
* @returns Array of `Comment`s in occurrence order.
|
|
5318
5538
|
*/
|
|
5319
5539
|
function getCommentsAfter(nodeOrToken) {
|
|
5320
|
-
|
|
5321
|
-
let targetEnd = nodeOrToken.range[1],
|
|
5322
|
-
for (let endIndex =
|
|
5323
|
-
let mid =
|
|
5324
|
-
|
|
5325
|
-
}
|
|
5326
|
-
let
|
|
5327
|
-
for (
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
return
|
|
5540
|
+
if (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), commentsLen === 0) return [];
|
|
5541
|
+
let targetEnd = nodeOrToken.range[1], searchIndex = 0;
|
|
5542
|
+
for (let endIndex = tokensAndCommentsLen; searchIndex < endIndex;) {
|
|
5543
|
+
let mid = searchIndex + endIndex >>> 1;
|
|
5544
|
+
tokensAndCommentsUint32[mid << 2] < targetEnd ? searchIndex = mid + 1 : endIndex = mid;
|
|
5545
|
+
}
|
|
5546
|
+
let startTypePos32 = (searchIndex << 2) + 2, typePos32 = startTypePos32;
|
|
5547
|
+
for (; tokensAndCommentsUint32[typePos32] !== 0;) typePos32 += 4;
|
|
5548
|
+
let count32 = typePos32 - startTypePos32;
|
|
5549
|
+
if (count32 === 0) return [];
|
|
5550
|
+
let sliceStart = tokensAndCommentsUint32[startTypePos32 - 1], sliceEnd = sliceStart + (count32 >> 2);
|
|
5551
|
+
for (let i = sliceStart; i < sliceEnd; i++) getComment(i);
|
|
5552
|
+
return cachedComments.slice(sliceStart, sliceEnd);
|
|
5333
5553
|
}
|
|
5334
5554
|
/**
|
|
5335
5555
|
* Get all comment tokens inside the given node.
|
|
@@ -5337,18 +5557,19 @@ function getCommentsAfter(nodeOrToken) {
|
|
|
5337
5557
|
* @returns Array of `Comment`s in occurrence order.
|
|
5338
5558
|
*/
|
|
5339
5559
|
function getCommentsInside(node) {
|
|
5340
|
-
|
|
5560
|
+
if (commentsUint32 === null && initCommentsBuffer(), commentsLen === 0) return [];
|
|
5341
5561
|
let { range } = node, rangeStart = range[0], rangeEnd = range[1], sliceStart = 0;
|
|
5342
|
-
for (let endIndex =
|
|
5343
|
-
let mid = sliceStart + endIndex
|
|
5344
|
-
|
|
5562
|
+
for (let endIndex = commentsLen; sliceStart < endIndex;) {
|
|
5563
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
5564
|
+
commentsUint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
5345
5565
|
}
|
|
5346
5566
|
let sliceEnd = sliceStart;
|
|
5347
|
-
for (let endIndex =
|
|
5348
|
-
let mid = sliceEnd + endIndex
|
|
5349
|
-
|
|
5567
|
+
for (let endIndex = commentsLen; sliceEnd < endIndex;) {
|
|
5568
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
5569
|
+
commentsUint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
5350
5570
|
}
|
|
5351
|
-
|
|
5571
|
+
for (let i = sliceStart; i < sliceEnd; i++) getComment(i);
|
|
5572
|
+
return cachedComments.slice(sliceStart, sliceEnd);
|
|
5352
5573
|
}
|
|
5353
5574
|
/**
|
|
5354
5575
|
* Check whether any comments exist or not between the given 2 nodes.
|
|
@@ -5357,13 +5578,13 @@ function getCommentsInside(node) {
|
|
|
5357
5578
|
* @returns `true` if one or more comments exist between the two.
|
|
5358
5579
|
*/
|
|
5359
5580
|
function commentsExistBetween(nodeOrToken1, nodeOrToken2) {
|
|
5360
|
-
|
|
5581
|
+
if (commentsUint32 === null && initCommentsBuffer(), commentsLen === 0) return !1;
|
|
5361
5582
|
let betweenRangeStart = nodeOrToken1.range[1], firstCommentBetween = 0;
|
|
5362
|
-
for (let endIndex =
|
|
5363
|
-
let mid = firstCommentBetween + endIndex
|
|
5364
|
-
|
|
5583
|
+
for (let endIndex = commentsLen; firstCommentBetween < endIndex;) {
|
|
5584
|
+
let mid = firstCommentBetween + endIndex >>> 1;
|
|
5585
|
+
commentsUint32[mid << 2] < betweenRangeStart ? firstCommentBetween = mid + 1 : endIndex = mid;
|
|
5365
5586
|
}
|
|
5366
|
-
return firstCommentBetween <
|
|
5587
|
+
return firstCommentBetween < commentsLen && commentsUint32[(firstCommentBetween << 2) + 1] <= nodeOrToken2.range[0];
|
|
5367
5588
|
}
|
|
5368
5589
|
/**
|
|
5369
5590
|
* Retrieve the JSDoc comment for a given node.
|
|
@@ -12151,32 +12372,34 @@ const INCLUDE_COMMENTS_SKIP_OPTIONS = {
|
|
|
12151
12372
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12152
12373
|
*/
|
|
12153
12374
|
function getTokens(node, countOptions, afterCount) {
|
|
12154
|
-
tokens === null && initTokens();
|
|
12155
12375
|
let count = typeof countOptions == "object" && countOptions ? countOptions.count : null, beforeCount = typeof countOptions == "number" ? countOptions : 0;
|
|
12156
12376
|
afterCount = (typeof countOptions == "number" || countOptions === void 0) && typeof afterCount == "number" ? afterCount : 0;
|
|
12157
|
-
let filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments =
|
|
12158
|
-
includeComments ? (
|
|
12377
|
+
let filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12378
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12159
12379
|
let { range } = node, rangeStart = range[0], rangeEnd = range[1], sliceStart = 0;
|
|
12160
|
-
for (let endIndex =
|
|
12161
|
-
let mid = sliceStart + endIndex
|
|
12162
|
-
|
|
12380
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12381
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12382
|
+
uint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
12163
12383
|
}
|
|
12164
12384
|
let sliceEnd = sliceStart;
|
|
12165
|
-
for (let endIndex =
|
|
12166
|
-
let mid = sliceEnd + endIndex
|
|
12167
|
-
|
|
12385
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12386
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12387
|
+
uint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12388
|
+
}
|
|
12389
|
+
if (sliceStart = MathMax(0, sliceStart - beforeCount), sliceEnd = MathMin(sliceEnd + afterCount, len), typeof filter != "function") {
|
|
12390
|
+
let end = MathMin(sliceStart + (count ?? sliceEnd), sliceEnd);
|
|
12391
|
+
return collectEntries(sliceStart, end, includeComments);
|
|
12168
12392
|
}
|
|
12169
|
-
if (sliceStart = MathMax(0, sliceStart - beforeCount), sliceEnd = MathMin(sliceEnd + afterCount, tokenList.length), typeof filter != "function") return tokenList.slice(sliceStart, MathMin(sliceStart + (count ?? sliceEnd), sliceEnd));
|
|
12170
12393
|
let allTokens = [];
|
|
12171
12394
|
if (typeof count != "number") {
|
|
12172
12395
|
for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12173
|
-
let token =
|
|
12396
|
+
let token = getEntry(i, includeComments);
|
|
12174
12397
|
filter(token) && allTokens.push(token);
|
|
12175
12398
|
}
|
|
12176
12399
|
return allTokens;
|
|
12177
12400
|
}
|
|
12178
12401
|
for (let i = sliceStart; i < sliceEnd && count > 0; i++) {
|
|
12179
|
-
let token =
|
|
12402
|
+
let token = getEntry(i, includeComments);
|
|
12180
12403
|
filter(token) && (allTokens.push(token), count--);
|
|
12181
12404
|
}
|
|
12182
12405
|
return allTokens;
|
|
@@ -12190,29 +12413,25 @@ function getTokens(node, countOptions, afterCount) {
|
|
|
12190
12413
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12191
12414
|
*/
|
|
12192
12415
|
function getFirstToken(node, skipOptions) {
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12416
|
+
let skip = typeof skipOptions == "number" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.skip : null, filter = typeof skipOptions == "function" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.filter : null, includeComments = getIncludeComments(skipOptions), uint32, len;
|
|
12417
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12196
12418
|
let { range } = node, rangeStart = range[0], rangeEnd = range[1], startIndex = 0;
|
|
12197
|
-
for (let endIndex =
|
|
12198
|
-
let mid = startIndex + endIndex
|
|
12199
|
-
|
|
12419
|
+
for (let endIndex = len; startIndex < endIndex;) {
|
|
12420
|
+
let mid = startIndex + endIndex >>> 1;
|
|
12421
|
+
uint32[mid << 2] < rangeStart ? startIndex = mid + 1 : endIndex = mid;
|
|
12200
12422
|
}
|
|
12201
|
-
let tokensLength = tokenList.length;
|
|
12202
12423
|
if (typeof filter != "function") {
|
|
12203
12424
|
let skipTo = startIndex + (skip ?? 0);
|
|
12204
|
-
|
|
12205
|
-
let token = tokenList[skipTo];
|
|
12206
|
-
return token.start >= rangeEnd ? null : token;
|
|
12425
|
+
return skipTo >= len || entryStart(skipTo, uint32) >= rangeEnd ? null : getEntry(skipTo, includeComments);
|
|
12207
12426
|
}
|
|
12208
|
-
if (typeof skip != "number") for (let i = startIndex; i <
|
|
12209
|
-
|
|
12210
|
-
|
|
12427
|
+
if (typeof skip != "number") for (let i = startIndex; i < len; i++) {
|
|
12428
|
+
if (entryStart(i, uint32) >= rangeEnd) return null;
|
|
12429
|
+
let token = getEntry(i, includeComments);
|
|
12211
12430
|
if (filter(token)) return token;
|
|
12212
12431
|
}
|
|
12213
|
-
else for (let i = startIndex; i <
|
|
12214
|
-
|
|
12215
|
-
|
|
12432
|
+
else for (let i = startIndex; i < len; i++) {
|
|
12433
|
+
if (entryStart(i, uint32) >= rangeEnd) return null;
|
|
12434
|
+
let token = getEntry(i, includeComments);
|
|
12216
12435
|
if (filter(token)) {
|
|
12217
12436
|
if (skip <= 0) return token;
|
|
12218
12437
|
skip--;
|
|
@@ -12229,27 +12448,26 @@ function getFirstToken(node, skipOptions) {
|
|
|
12229
12448
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12230
12449
|
*/
|
|
12231
12450
|
function getFirstTokens(node, countOptions) {
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12451
|
+
let count = typeof countOptions == "number" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12452
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12235
12453
|
let { range } = node, rangeStart = range[0], rangeEnd = range[1], sliceStart = 0;
|
|
12236
|
-
for (let endIndex =
|
|
12237
|
-
let mid = sliceStart + endIndex
|
|
12238
|
-
|
|
12454
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12455
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12456
|
+
uint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
12239
12457
|
}
|
|
12240
12458
|
let sliceEnd = sliceStart;
|
|
12241
|
-
for (let endIndex =
|
|
12242
|
-
let mid = sliceEnd + endIndex
|
|
12243
|
-
|
|
12459
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12460
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12461
|
+
uint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12244
12462
|
}
|
|
12245
|
-
if (typeof filter != "function") return typeof count == "number" ?
|
|
12463
|
+
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
12246
12464
|
let firstTokens = [];
|
|
12247
12465
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12248
|
-
let token =
|
|
12466
|
+
let token = getEntry(i, includeComments);
|
|
12249
12467
|
filter(token) && firstTokens.push(token);
|
|
12250
12468
|
}
|
|
12251
12469
|
else for (let i = sliceStart; i < sliceEnd && firstTokens.length < count; i++) {
|
|
12252
|
-
let token =
|
|
12470
|
+
let token = getEntry(i, includeComments);
|
|
12253
12471
|
filter(token) && firstTokens.push(token);
|
|
12254
12472
|
}
|
|
12255
12473
|
return firstTokens;
|
|
@@ -12263,28 +12481,25 @@ function getFirstTokens(node, countOptions) {
|
|
|
12263
12481
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12264
12482
|
*/
|
|
12265
12483
|
function getLastToken(node, skipOptions) {
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12484
|
+
let skip = typeof skipOptions == "number" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.skip : null, filter = typeof skipOptions == "function" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.filter : null, includeComments = getIncludeComments(skipOptions), uint32, len;
|
|
12485
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12269
12486
|
let { range } = node, rangeStart = range[0], rangeEnd = range[1], lastTokenIndex = 0;
|
|
12270
|
-
for (let endIndex =
|
|
12271
|
-
let mid = lastTokenIndex + endIndex
|
|
12272
|
-
|
|
12487
|
+
for (let endIndex = len; lastTokenIndex < endIndex;) {
|
|
12488
|
+
let mid = lastTokenIndex + endIndex >>> 1;
|
|
12489
|
+
uint32[mid << 2] < rangeEnd ? lastTokenIndex = mid + 1 : endIndex = mid;
|
|
12273
12490
|
}
|
|
12274
12491
|
if (--lastTokenIndex, typeof filter != "function") {
|
|
12275
12492
|
let skipTo = lastTokenIndex - (skip ?? 0);
|
|
12276
|
-
|
|
12277
|
-
let token = tokenList[skipTo];
|
|
12278
|
-
return token.start < rangeStart ? null : token;
|
|
12493
|
+
return skipTo < 0 || entryStart(skipTo, uint32) < rangeStart ? null : getEntry(skipTo, includeComments);
|
|
12279
12494
|
}
|
|
12280
12495
|
if (typeof skip != "number") for (let i = lastTokenIndex; i >= 0; i--) {
|
|
12281
|
-
|
|
12282
|
-
|
|
12496
|
+
if (entryStart(i, uint32) < rangeStart) return null;
|
|
12497
|
+
let token = getEntry(i, includeComments);
|
|
12283
12498
|
if (filter(token)) return token;
|
|
12284
12499
|
}
|
|
12285
12500
|
else for (let i = lastTokenIndex; i >= 0; i--) {
|
|
12286
|
-
|
|
12287
|
-
|
|
12501
|
+
if (entryStart(i, uint32) < rangeStart) return null;
|
|
12502
|
+
let token = getEntry(i, includeComments);
|
|
12288
12503
|
if (filter(token)) {
|
|
12289
12504
|
if (skip <= 0) return token;
|
|
12290
12505
|
skip--;
|
|
@@ -12301,27 +12516,26 @@ function getLastToken(node, skipOptions) {
|
|
|
12301
12516
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12302
12517
|
*/
|
|
12303
12518
|
function getLastTokens(node, countOptions) {
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12519
|
+
let count = typeof countOptions == "number" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12520
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12307
12521
|
let { range } = node, rangeStart = range[0], rangeEnd = range[1], sliceStart = 0;
|
|
12308
|
-
for (let endIndex =
|
|
12309
|
-
let mid = sliceStart + endIndex
|
|
12310
|
-
|
|
12522
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12523
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12524
|
+
uint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
12311
12525
|
}
|
|
12312
12526
|
let sliceEnd = sliceStart;
|
|
12313
|
-
for (let endIndex =
|
|
12314
|
-
let mid = sliceEnd + endIndex
|
|
12315
|
-
|
|
12527
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12528
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12529
|
+
uint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12316
12530
|
}
|
|
12317
|
-
if (typeof filter != "function") return typeof count == "number" ?
|
|
12531
|
+
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax(sliceStart, sliceEnd - count) : sliceStart, sliceEnd, includeComments);
|
|
12318
12532
|
let lastTokens = [];
|
|
12319
12533
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12320
|
-
let token =
|
|
12534
|
+
let token = getEntry(i, includeComments);
|
|
12321
12535
|
filter(token) && lastTokens.push(token);
|
|
12322
12536
|
}
|
|
12323
12537
|
else for (let i = sliceEnd - 1; i >= sliceStart && lastTokens.length < count; i--) {
|
|
12324
|
-
let token =
|
|
12538
|
+
let token = getEntry(i, includeComments);
|
|
12325
12539
|
filter(token) && lastTokens.unshift(token);
|
|
12326
12540
|
}
|
|
12327
12541
|
return lastTokens;
|
|
@@ -12335,25 +12549,24 @@ function getLastTokens(node, countOptions) {
|
|
|
12335
12549
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12336
12550
|
*/
|
|
12337
12551
|
function getTokenBefore(nodeOrToken, skipOptions) {
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12552
|
+
let skip = typeof skipOptions == "number" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.skip : null, filter = typeof skipOptions == "function" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.filter : null, includeComments = getIncludeComments(skipOptions), uint32, len;
|
|
12553
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12341
12554
|
let nodeStart = nodeOrToken.range[0], beforeIndex = 0;
|
|
12342
|
-
for (let endIndex =
|
|
12343
|
-
let mid = beforeIndex + endIndex
|
|
12344
|
-
|
|
12555
|
+
for (let endIndex = len; beforeIndex < endIndex;) {
|
|
12556
|
+
let mid = beforeIndex + endIndex >>> 1;
|
|
12557
|
+
uint32[mid << 2] < nodeStart ? beforeIndex = mid + 1 : endIndex = mid;
|
|
12345
12558
|
}
|
|
12346
12559
|
if (--beforeIndex, typeof filter != "function") {
|
|
12347
12560
|
let skipTo = beforeIndex - (skip ?? 0);
|
|
12348
|
-
return skipTo < 0 ? null :
|
|
12561
|
+
return skipTo < 0 ? null : getEntry(skipTo, includeComments);
|
|
12349
12562
|
}
|
|
12350
12563
|
if (typeof skip != "number") for (; beforeIndex >= 0;) {
|
|
12351
|
-
let token =
|
|
12564
|
+
let token = getEntry(beforeIndex, includeComments);
|
|
12352
12565
|
if (filter(token)) return token;
|
|
12353
12566
|
beforeIndex--;
|
|
12354
12567
|
}
|
|
12355
12568
|
else for (; beforeIndex >= 0;) {
|
|
12356
|
-
let token =
|
|
12569
|
+
let token = getEntry(beforeIndex, includeComments);
|
|
12357
12570
|
if (filter(token)) {
|
|
12358
12571
|
if (skip <= 0) return token;
|
|
12359
12572
|
skip--;
|
|
@@ -12383,22 +12596,21 @@ function getTokenOrCommentBefore(nodeOrToken, skip) {
|
|
|
12383
12596
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12384
12597
|
*/
|
|
12385
12598
|
function getTokensBefore(nodeOrToken, countOptions) {
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12599
|
+
let count = typeof countOptions == "number" ? MathMax(0, countOptions) : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12600
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12389
12601
|
let targetStart = nodeOrToken.range[0], sliceEnd = 0;
|
|
12390
|
-
for (let endIndex =
|
|
12391
|
-
let mid = sliceEnd + endIndex
|
|
12392
|
-
|
|
12602
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12603
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12604
|
+
uint32[mid << 2] < targetStart ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12393
12605
|
}
|
|
12394
|
-
if (typeof filter != "function") return typeof count == "number" ?
|
|
12606
|
+
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax(0, sliceEnd - count) : 0, sliceEnd, includeComments);
|
|
12395
12607
|
let tokensBefore = [];
|
|
12396
12608
|
if (typeof count != "number") for (let i = 0; i < sliceEnd; i++) {
|
|
12397
|
-
let token =
|
|
12609
|
+
let token = getEntry(i, includeComments);
|
|
12398
12610
|
filter(token) && tokensBefore.push(token);
|
|
12399
12611
|
}
|
|
12400
12612
|
else for (let i = sliceEnd - 1; i >= 0 && tokensBefore.length < count; i--) {
|
|
12401
|
-
let token =
|
|
12613
|
+
let token = getEntry(i, includeComments);
|
|
12402
12614
|
filter(token) && tokensBefore.unshift(token);
|
|
12403
12615
|
}
|
|
12404
12616
|
return tokensBefore;
|
|
@@ -12412,25 +12624,23 @@ function getTokensBefore(nodeOrToken, countOptions) {
|
|
|
12412
12624
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12413
12625
|
*/
|
|
12414
12626
|
function getTokenAfter(nodeOrToken, skipOptions) {
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12627
|
+
let skip = typeof skipOptions == "number" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.skip : null, filter = typeof skipOptions == "function" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.filter : null, includeComments = getIncludeComments(skipOptions), uint32, len;
|
|
12628
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12418
12629
|
let rangeEnd = nodeOrToken.range[1], startIndex = 0;
|
|
12419
|
-
for (let endIndex =
|
|
12420
|
-
let mid = startIndex + endIndex
|
|
12421
|
-
|
|
12630
|
+
for (let endIndex = len; startIndex < endIndex;) {
|
|
12631
|
+
let mid = startIndex + endIndex >>> 1;
|
|
12632
|
+
uint32[mid << 2] < rangeEnd ? startIndex = mid + 1 : endIndex = mid;
|
|
12422
12633
|
}
|
|
12423
|
-
let tokensLength = tokenList.length;
|
|
12424
12634
|
if (typeof filter != "function") {
|
|
12425
12635
|
let skipTo = startIndex + (skip ?? 0);
|
|
12426
|
-
return skipTo >=
|
|
12636
|
+
return skipTo >= len ? null : getEntry(skipTo, includeComments);
|
|
12427
12637
|
}
|
|
12428
|
-
if (typeof skip != "number") for (let i = startIndex; i <
|
|
12429
|
-
let token =
|
|
12638
|
+
if (typeof skip != "number") for (let i = startIndex; i < len; i++) {
|
|
12639
|
+
let token = getEntry(i, includeComments);
|
|
12430
12640
|
if (filter(token)) return token;
|
|
12431
12641
|
}
|
|
12432
|
-
else for (let i = startIndex; i <
|
|
12433
|
-
let token =
|
|
12642
|
+
else for (let i = startIndex; i < len; i++) {
|
|
12643
|
+
let token = getEntry(i, includeComments);
|
|
12434
12644
|
if (filter(token)) {
|
|
12435
12645
|
if (skip <= 0) return token;
|
|
12436
12646
|
skip--;
|
|
@@ -12459,22 +12669,21 @@ function getTokenOrCommentAfter(nodeOrToken, skip) {
|
|
|
12459
12669
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12460
12670
|
*/
|
|
12461
12671
|
function getTokensAfter(nodeOrToken, countOptions) {
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12672
|
+
let count = typeof countOptions == "number" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12673
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12465
12674
|
let rangeEnd = nodeOrToken.range[1], sliceStart = 0;
|
|
12466
|
-
for (let endIndex =
|
|
12467
|
-
let mid = sliceStart + endIndex
|
|
12468
|
-
|
|
12675
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12676
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12677
|
+
uint32[mid << 2] < rangeEnd ? sliceStart = mid + 1 : endIndex = mid;
|
|
12469
12678
|
}
|
|
12470
|
-
if (typeof filter != "function") return typeof count == "number" ?
|
|
12679
|
+
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, len), includeComments) : collectEntries(sliceStart, len, includeComments);
|
|
12471
12680
|
let tokenListAfter = [];
|
|
12472
|
-
if (typeof count != "number") for (let i = sliceStart; i <
|
|
12473
|
-
let token =
|
|
12681
|
+
if (typeof count != "number") for (let i = sliceStart; i < len; i++) {
|
|
12682
|
+
let token = getEntry(i, includeComments);
|
|
12474
12683
|
filter(token) && tokenListAfter.push(token);
|
|
12475
12684
|
}
|
|
12476
|
-
else for (let i = sliceStart; i <
|
|
12477
|
-
let token =
|
|
12685
|
+
else for (let i = sliceStart; i < len && tokenListAfter.length < count; i++) {
|
|
12686
|
+
let token = getEntry(i, includeComments);
|
|
12478
12687
|
filter(token) && tokenListAfter.push(token);
|
|
12479
12688
|
}
|
|
12480
12689
|
return tokenListAfter;
|
|
@@ -12494,27 +12703,26 @@ function getTokensAfter(nodeOrToken, countOptions) {
|
|
|
12494
12703
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12495
12704
|
*/
|
|
12496
12705
|
function getTokensBetween(left, right, countOptions) {
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12706
|
+
let count = typeof countOptions == "object" && countOptions ? countOptions.count : null, padding = typeof countOptions == "number" ? countOptions : 0, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12707
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12500
12708
|
let rangeStart = left.range[1], rangeEnd = right.range[0], sliceStart = 0;
|
|
12501
|
-
for (let endIndex =
|
|
12502
|
-
let mid = sliceStart + endIndex
|
|
12503
|
-
|
|
12709
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12710
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12711
|
+
uint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
12504
12712
|
}
|
|
12505
12713
|
let sliceEnd = sliceStart;
|
|
12506
|
-
for (let endIndex =
|
|
12507
|
-
let mid = sliceEnd + endIndex
|
|
12508
|
-
|
|
12714
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12715
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12716
|
+
uint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12509
12717
|
}
|
|
12510
|
-
if (sliceStart = MathMax(0, sliceStart - padding), sliceEnd
|
|
12718
|
+
if (sliceStart = MathMax(0, sliceStart - padding), sliceEnd = MathMin(sliceEnd + padding, len), typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
12511
12719
|
let tokensBetween = [];
|
|
12512
12720
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12513
|
-
let token =
|
|
12721
|
+
let token = getEntry(i, includeComments);
|
|
12514
12722
|
filter(token) && tokensBetween.push(token);
|
|
12515
12723
|
}
|
|
12516
12724
|
else for (let i = sliceStart; i < sliceEnd && tokensBetween.length < count; i++) {
|
|
12517
|
-
let token =
|
|
12725
|
+
let token = getEntry(i, includeComments);
|
|
12518
12726
|
filter(token) && tokensBetween.push(token);
|
|
12519
12727
|
}
|
|
12520
12728
|
return tokensBetween;
|
|
@@ -12529,28 +12737,25 @@ function getTokensBetween(left, right, countOptions) {
|
|
|
12529
12737
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12530
12738
|
*/
|
|
12531
12739
|
function getFirstTokenBetween(left, right, skipOptions) {
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
let
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
tokenList[mid].start < rangeStart ? firstTokenIndex = mid + 1 : endIndex = mid;
|
|
12740
|
+
let skip = typeof skipOptions == "number" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.skip : null, filter = typeof skipOptions == "function" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.filter : null, includeComments = getIncludeComments(skipOptions), uint32, len;
|
|
12741
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12742
|
+
let rangeStart = left.range[1], rangeEnd = right.range[0], firstTokenIndex = 0;
|
|
12743
|
+
for (let endIndex = len; firstTokenIndex < endIndex;) {
|
|
12744
|
+
let mid = firstTokenIndex + endIndex >>> 1;
|
|
12745
|
+
uint32[mid << 2] < rangeStart ? firstTokenIndex = mid + 1 : endIndex = mid;
|
|
12539
12746
|
}
|
|
12540
12747
|
if (typeof filter != "function") {
|
|
12541
12748
|
let skipTo = firstTokenIndex + (skip ?? 0);
|
|
12542
|
-
|
|
12543
|
-
let token = tokenList[skipTo];
|
|
12544
|
-
return token.start >= rangeEnd ? null : token;
|
|
12749
|
+
return skipTo >= len || entryStart(skipTo, uint32) >= rangeEnd ? null : getEntry(skipTo, includeComments);
|
|
12545
12750
|
}
|
|
12546
|
-
if (typeof skip != "number") for (let i = firstTokenIndex; i <
|
|
12547
|
-
|
|
12548
|
-
|
|
12751
|
+
if (typeof skip != "number") for (let i = firstTokenIndex; i < len; i++) {
|
|
12752
|
+
if (entryStart(i, uint32) >= rangeEnd) return null;
|
|
12753
|
+
let token = getEntry(i, includeComments);
|
|
12549
12754
|
if (filter(token)) return token;
|
|
12550
12755
|
}
|
|
12551
|
-
else for (let i = firstTokenIndex; i <
|
|
12552
|
-
|
|
12553
|
-
|
|
12756
|
+
else for (let i = firstTokenIndex; i < len; i++) {
|
|
12757
|
+
if (entryStart(i, uint32) >= rangeEnd) return null;
|
|
12758
|
+
let token = getEntry(i, includeComments);
|
|
12554
12759
|
if (filter(token)) {
|
|
12555
12760
|
if (skip <= 0) return token;
|
|
12556
12761
|
skip--;
|
|
@@ -12568,27 +12773,26 @@ function getFirstTokenBetween(left, right, skipOptions) {
|
|
|
12568
12773
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12569
12774
|
*/
|
|
12570
12775
|
function getFirstTokensBetween(left, right, countOptions) {
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12776
|
+
let count = typeof countOptions == "number" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12777
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12574
12778
|
let rangeStart = left.range[1], rangeEnd = right.range[0], sliceStart = 0;
|
|
12575
|
-
for (let endIndex =
|
|
12576
|
-
let mid = sliceStart + endIndex
|
|
12577
|
-
|
|
12779
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12780
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12781
|
+
uint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
12578
12782
|
}
|
|
12579
12783
|
let sliceEnd = sliceStart;
|
|
12580
|
-
for (let endIndex =
|
|
12581
|
-
let mid = sliceEnd + endIndex
|
|
12582
|
-
|
|
12784
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12785
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12786
|
+
uint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12583
12787
|
}
|
|
12584
|
-
if (typeof filter != "function") return typeof count == "number" ?
|
|
12788
|
+
if (typeof filter != "function") return typeof count == "number" ? collectEntries(sliceStart, MathMin(sliceStart + count, sliceEnd), includeComments) : collectEntries(sliceStart, sliceEnd, includeComments);
|
|
12585
12789
|
let firstTokens = [];
|
|
12586
12790
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12587
|
-
let token =
|
|
12791
|
+
let token = getEntry(i, includeComments);
|
|
12588
12792
|
filter(token) && firstTokens.push(token);
|
|
12589
12793
|
}
|
|
12590
12794
|
else for (let i = sliceStart; i < sliceEnd && firstTokens.length < count; i++) {
|
|
12591
|
-
let token =
|
|
12795
|
+
let token = getEntry(i, includeComments);
|
|
12592
12796
|
filter(token) && firstTokens.push(token);
|
|
12593
12797
|
}
|
|
12594
12798
|
return firstTokens;
|
|
@@ -12603,28 +12807,25 @@ function getFirstTokensBetween(left, right, countOptions) {
|
|
|
12603
12807
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12604
12808
|
*/
|
|
12605
12809
|
function getLastTokenBetween(left, right, skipOptions) {
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12810
|
+
let skip = typeof skipOptions == "number" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.skip : null, filter = typeof skipOptions == "function" ? skipOptions : typeof skipOptions == "object" && skipOptions ? skipOptions.filter : null, includeComments = getIncludeComments(skipOptions), uint32, len;
|
|
12811
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12609
12812
|
let rangeStart = left.range[1], rangeEnd = right.range[0], lastTokenIndex = 0;
|
|
12610
|
-
for (let endIndex =
|
|
12611
|
-
let mid = lastTokenIndex + endIndex
|
|
12612
|
-
|
|
12813
|
+
for (let endIndex = len; lastTokenIndex < endIndex;) {
|
|
12814
|
+
let mid = lastTokenIndex + endIndex >>> 1;
|
|
12815
|
+
uint32[mid << 2] < rangeEnd ? lastTokenIndex = mid + 1 : endIndex = mid;
|
|
12613
12816
|
}
|
|
12614
12817
|
if (--lastTokenIndex, typeof filter != "function") {
|
|
12615
12818
|
let skipTo = lastTokenIndex - (skip ?? 0);
|
|
12616
|
-
|
|
12617
|
-
let token = tokenList[skipTo];
|
|
12618
|
-
return token.start < rangeStart ? null : token;
|
|
12819
|
+
return skipTo < 0 || entryStart(skipTo, uint32) < rangeStart ? null : getEntry(skipTo, includeComments);
|
|
12619
12820
|
}
|
|
12620
12821
|
if (typeof skip != "number") for (let i = lastTokenIndex; i >= 0; i--) {
|
|
12621
|
-
|
|
12622
|
-
|
|
12822
|
+
if (entryStart(i, uint32) < rangeStart) return null;
|
|
12823
|
+
let token = getEntry(i, includeComments);
|
|
12623
12824
|
if (filter(token)) return token;
|
|
12624
12825
|
}
|
|
12625
12826
|
else for (let i = lastTokenIndex; i >= 0; i--) {
|
|
12626
|
-
|
|
12627
|
-
|
|
12827
|
+
if (entryStart(i, uint32) < rangeStart) return null;
|
|
12828
|
+
let token = getEntry(i, includeComments);
|
|
12628
12829
|
if (filter(token)) {
|
|
12629
12830
|
if (skip <= 0) return token;
|
|
12630
12831
|
skip--;
|
|
@@ -12642,46 +12843,44 @@ function getLastTokenBetween(left, right, skipOptions) {
|
|
|
12642
12843
|
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
12643
12844
|
*/
|
|
12644
12845
|
function getLastTokensBetween(left, right, countOptions) {
|
|
12645
|
-
|
|
12646
|
-
|
|
12647
|
-
includeComments ? (tokensAndComments === null && initTokensAndComments(), tokenList = tokensAndComments) : tokenList = tokens;
|
|
12846
|
+
let count = typeof countOptions == "number" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.count : null, filter = typeof countOptions == "function" ? countOptions : typeof countOptions == "object" && countOptions ? countOptions.filter : null, includeComments = getIncludeComments(countOptions), uint32, len;
|
|
12847
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12648
12848
|
let rangeStart = left.range[1], rangeEnd = right.range[0], sliceStart = 0;
|
|
12649
|
-
for (let endIndex =
|
|
12650
|
-
let mid = sliceStart + endIndex
|
|
12651
|
-
|
|
12849
|
+
for (let endIndex = len; sliceStart < endIndex;) {
|
|
12850
|
+
let mid = sliceStart + endIndex >>> 1;
|
|
12851
|
+
uint32[mid << 2] < rangeStart ? sliceStart = mid + 1 : endIndex = mid;
|
|
12652
12852
|
}
|
|
12653
12853
|
let sliceEnd = sliceStart;
|
|
12654
|
-
for (let endIndex =
|
|
12655
|
-
let mid = sliceEnd + endIndex
|
|
12656
|
-
|
|
12854
|
+
for (let endIndex = len; sliceEnd < endIndex;) {
|
|
12855
|
+
let mid = sliceEnd + endIndex >>> 1;
|
|
12856
|
+
uint32[mid << 2] < rangeEnd ? sliceEnd = mid + 1 : endIndex = mid;
|
|
12657
12857
|
}
|
|
12658
|
-
if (typeof filter != "function") return typeof count == "number" ?
|
|
12858
|
+
if (typeof filter != "function") return collectEntries(typeof count == "number" ? MathMax(sliceStart, sliceEnd - count) : sliceStart, sliceEnd, includeComments);
|
|
12659
12859
|
let tokensBetween = [];
|
|
12660
12860
|
if (typeof count != "number") for (let i = sliceStart; i < sliceEnd; i++) {
|
|
12661
|
-
let token =
|
|
12861
|
+
let token = getEntry(i, includeComments);
|
|
12662
12862
|
filter(token) && tokensBetween.push(token);
|
|
12663
12863
|
}
|
|
12664
12864
|
else for (let i = sliceEnd - 1; i >= sliceStart && tokensBetween.length < count; i--) {
|
|
12665
|
-
let token =
|
|
12865
|
+
let token = getEntry(i, includeComments);
|
|
12666
12866
|
filter(token) && tokensBetween.unshift(token);
|
|
12667
12867
|
}
|
|
12668
12868
|
return tokensBetween;
|
|
12669
12869
|
}
|
|
12670
12870
|
/**
|
|
12671
12871
|
* Get the token starting at the specified index.
|
|
12672
|
-
* @param
|
|
12872
|
+
* @param offset - Start offset of the token.
|
|
12673
12873
|
* @param rangeOptions - Options object.
|
|
12674
12874
|
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
12675
12875
|
*/
|
|
12676
|
-
function getTokenByRangeStart(
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
if (tokenStart
|
|
12683
|
-
else
|
|
12684
|
-
else return token;
|
|
12876
|
+
function getTokenByRangeStart(offset, rangeOptions) {
|
|
12877
|
+
let includeComments = typeof rangeOptions == "object" && !!rangeOptions && "includeComments" in rangeOptions && !!rangeOptions.includeComments, uint32, len;
|
|
12878
|
+
includeComments === !1 ? (tokensUint32 === null && initTokensBuffer(), uint32 = tokensUint32, len = tokensLen) : (tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer(), uint32 = tokensAndCommentsUint32, len = tokensAndCommentsLen);
|
|
12879
|
+
for (let lo = 0, hi = len; lo < hi;) {
|
|
12880
|
+
let mid = lo + hi >>> 1, tokenStart = uint32[mid << 2];
|
|
12881
|
+
if (tokenStart < offset) lo = mid + 1;
|
|
12882
|
+
else if (tokenStart > offset) hi = mid;
|
|
12883
|
+
else return getEntry(mid, includeComments);
|
|
12685
12884
|
}
|
|
12686
12885
|
return null;
|
|
12687
12886
|
}
|
|
@@ -12701,20 +12900,19 @@ const JSX_WHITESPACE_REGEXP = /\s/u;
|
|
|
12701
12900
|
* any of the tokens found between the two given nodes or tokens.
|
|
12702
12901
|
*/
|
|
12703
12902
|
function isSpaceBetween(first, second) {
|
|
12704
|
-
|
|
12903
|
+
tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer();
|
|
12705
12904
|
let range1 = first.range, range2 = second.range, rangeStart = range1[0], rangeEnd = range2[0];
|
|
12706
12905
|
rangeStart < rangeEnd ? rangeStart = range1[1] : (rangeEnd = rangeStart, rangeStart = range2[1]);
|
|
12707
|
-
let
|
|
12708
|
-
for (let endIndex =
|
|
12709
|
-
let mid =
|
|
12710
|
-
|
|
12711
|
-
}
|
|
12712
|
-
let
|
|
12713
|
-
|
|
12714
|
-
let token = tokensAndComments[tokenBetweenIndex], tokenStart = token.start;
|
|
12906
|
+
let index = 0;
|
|
12907
|
+
for (let endIndex = tokensAndCommentsLen; index < endIndex;) {
|
|
12908
|
+
let mid = index + endIndex >>> 1;
|
|
12909
|
+
tokensAndCommentsUint32[mid << 2] < rangeStart ? index = mid + 1 : endIndex = mid;
|
|
12910
|
+
}
|
|
12911
|
+
for (let lastTokenEnd = rangeStart; index < tokensAndCommentsLen; index++) {
|
|
12912
|
+
let tokenStart = tokensAndCommentsUint32[index << 2];
|
|
12715
12913
|
if (tokenStart > rangeEnd) break;
|
|
12716
12914
|
if (tokenStart !== lastTokenEnd) return !0;
|
|
12717
|
-
lastTokenEnd =
|
|
12915
|
+
lastTokenEnd = entryEnd(index, !0);
|
|
12718
12916
|
}
|
|
12719
12917
|
return !1;
|
|
12720
12918
|
}
|
|
@@ -12739,23 +12937,91 @@ function isSpaceBetween(first, second) {
|
|
|
12739
12937
|
* any of the tokens found between the two given nodes or tokens.
|
|
12740
12938
|
*/
|
|
12741
12939
|
function isSpaceBetweenTokens(first, second) {
|
|
12742
|
-
|
|
12940
|
+
tokensAndCommentsUint32 === null && initTokensAndCommentsBuffer();
|
|
12743
12941
|
let range1 = first.range, range2 = second.range, rangeStart = range1[0], rangeEnd = range2[0];
|
|
12744
12942
|
rangeStart < rangeEnd ? rangeStart = range1[1] : (rangeEnd = rangeStart, rangeStart = range2[1]);
|
|
12745
|
-
let
|
|
12746
|
-
for (let endIndex =
|
|
12747
|
-
let mid =
|
|
12748
|
-
|
|
12749
|
-
}
|
|
12750
|
-
let
|
|
12751
|
-
|
|
12752
|
-
let token = tokensAndComments[tokenBetweenIndex], tokenStart = token.start;
|
|
12943
|
+
let index = 0;
|
|
12944
|
+
for (let endIndex = tokensAndCommentsLen; index < endIndex;) {
|
|
12945
|
+
let mid = index + endIndex >>> 1;
|
|
12946
|
+
tokensAndCommentsUint32[mid << 2] < rangeStart ? index = mid + 1 : endIndex = mid;
|
|
12947
|
+
}
|
|
12948
|
+
for (let lastTokenEnd = rangeStart; index < tokensAndCommentsLen; index++) {
|
|
12949
|
+
let tokenStart = tokensAndCommentsUint32[index << 2];
|
|
12753
12950
|
if (tokenStart > rangeEnd) break;
|
|
12951
|
+
let token = getTokenOrComment(index);
|
|
12754
12952
|
if (tokenStart !== lastTokenEnd || token.type === "JSXText" && JSX_WHITESPACE_REGEXP.test(token.value)) return !0;
|
|
12755
12953
|
lastTokenEnd = token.end;
|
|
12756
12954
|
}
|
|
12757
12955
|
return !1;
|
|
12758
12956
|
}
|
|
12957
|
+
/**
|
|
12958
|
+
* Extract `includeComments` boolean from options.
|
|
12959
|
+
*
|
|
12960
|
+
* @param options - Options object, number, function, or nullish
|
|
12961
|
+
* @returns `true` if `options` has `includeComments: true`
|
|
12962
|
+
*/
|
|
12963
|
+
function getIncludeComments(options) {
|
|
12964
|
+
return typeof options == "object" && !!options && "includeComments" in options && !!options.includeComments;
|
|
12965
|
+
}
|
|
12966
|
+
/**
|
|
12967
|
+
* Get a token at `index`, deserializing if needed.
|
|
12968
|
+
* For `includeComments` mode, gets from the merged buffer instead.
|
|
12969
|
+
*
|
|
12970
|
+
* @param index - Entry index in the tokens or merged buffer
|
|
12971
|
+
* @param includeComments - Whether to use the merged tokens-and-comments buffer
|
|
12972
|
+
* @returns Deserialized token or comment
|
|
12973
|
+
*/
|
|
12974
|
+
function getEntry(index, includeComments) {
|
|
12975
|
+
return includeComments === !0 ? getTokenOrComment(index) : getToken(index);
|
|
12976
|
+
}
|
|
12977
|
+
/**
|
|
12978
|
+
* Get `start` offset of token/comment at `index` from the given buffer.
|
|
12979
|
+
*
|
|
12980
|
+
* @param index - Entry index
|
|
12981
|
+
* @param uint32 - The `Uint32Array` buffer (tokens or merged)
|
|
12982
|
+
* @returns Start offset in source text
|
|
12983
|
+
*/
|
|
12984
|
+
function entryStart(index, uint32) {
|
|
12985
|
+
return uint32[index << 2];
|
|
12986
|
+
}
|
|
12987
|
+
/**
|
|
12988
|
+
* Get `end` offset of token/comment at `index`.
|
|
12989
|
+
* For tokens-only, reads from `tokensUint32`. For `includeComments`, looks up from the original buffer.
|
|
12990
|
+
*
|
|
12991
|
+
* @param index - Entry index in the tokens or merged buffer
|
|
12992
|
+
* @param includeComments - Whether to use the merged tokens-and-comments buffer
|
|
12993
|
+
* @returns End offset in source text
|
|
12994
|
+
*/
|
|
12995
|
+
function entryEnd(index, includeComments) {
|
|
12996
|
+
return includeComments === !0 ? getTokenOrCommentEnd(index) : tokensUint32[(index << 2) + 1];
|
|
12997
|
+
}
|
|
12998
|
+
/**
|
|
12999
|
+
* Collect tokens/comments from `startIndex` (inclusive) to `endIndex` (exclusive) into an array.
|
|
13000
|
+
* Deserializes each token/comment on demand.
|
|
13001
|
+
*
|
|
13002
|
+
* For tokens-only mode, batch-deserializes then slices `cachedTokens`.
|
|
13003
|
+
* For `includeComments` mode, builds the array entry by entry from the merged buffer.
|
|
13004
|
+
*
|
|
13005
|
+
* @param startIndex - First entry index (inclusive)
|
|
13006
|
+
* @param endIndex - Last entry index (exclusive)
|
|
13007
|
+
* @param includeComments - Whether to use the merged tokens-and-comments buffer
|
|
13008
|
+
* @returns Array of tokens (and optionally comments)
|
|
13009
|
+
*/
|
|
13010
|
+
function collectEntries(startIndex, endIndex, includeComments) {
|
|
13011
|
+
if (includeComments === !1) {
|
|
13012
|
+
for (let i = startIndex; i < endIndex; i++) getToken(i);
|
|
13013
|
+
return cachedTokens.slice(startIndex, endIndex);
|
|
13014
|
+
}
|
|
13015
|
+
let len = endIndex - startIndex;
|
|
13016
|
+
if (len === 0) return [];
|
|
13017
|
+
let tokensAndCommentsSubset = Array(len).fill(0);
|
|
13018
|
+
tokensAndCommentsSubset[0] = null;
|
|
13019
|
+
let i = 0;
|
|
13020
|
+
do
|
|
13021
|
+
tokensAndCommentsSubset[i] = getTokenOrComment(startIndex + i);
|
|
13022
|
+
while (++i < len);
|
|
13023
|
+
return tokensAndCommentsSubset;
|
|
13024
|
+
}
|
|
12759
13025
|
//#endregion
|
|
12760
13026
|
//#region src-js/plugins/source_code.ts
|
|
12761
13027
|
const textDecoder = new TextDecoder("utf-8", { ignoreBOM: !0 });
|
|
@@ -12773,7 +13039,7 @@ function setupSourceForFile(bufferInput, hasBOMInput) {
|
|
|
12773
13039
|
*/
|
|
12774
13040
|
function initSourceText() {
|
|
12775
13041
|
let { uint32 } = buffer, programPos = uint32[DATA_POINTER_POS_32];
|
|
12776
|
-
sourceStartPos = uint32[programPos +
|
|
13042
|
+
sourceStartPos = uint32[programPos + 16 >> 2], sourceByteLen = uint32[programPos + 24 >> 2], sourceText = textDecoder.decode(buffer.subarray(sourceStartPos, sourceStartPos + sourceByteLen));
|
|
12777
13043
|
}
|
|
12778
13044
|
/**
|
|
12779
13045
|
* Deserialize AST from buffer.
|
|
@@ -12792,7 +13058,7 @@ function initAst() {
|
|
|
12792
13058
|
* and no danger of an infinite loop due to a circular AST (unlikely but possible).
|
|
12793
13059
|
*/
|
|
12794
13060
|
function resetSourceAndAst() {
|
|
12795
|
-
buffer = null, sourceText = null, ast = null, resetBuffer(),
|
|
13061
|
+
buffer = null, sourceText = null, ast = null, resetBuffer(), resetLinesAndLocs(), resetScopeManager(), resetTokens(), resetComments(), resetTokensAndComments();
|
|
12796
13062
|
}
|
|
12797
13063
|
/**
|
|
12798
13064
|
* Get whether file is JSX.
|
|
@@ -12826,7 +13092,7 @@ const SOURCE_CODE = ObjectFreeze({
|
|
|
12826
13092
|
return lines.length === 0 && initLines(), lineStartIndices;
|
|
12827
13093
|
},
|
|
12828
13094
|
get tokensAndComments() {
|
|
12829
|
-
return
|
|
13095
|
+
return getTokensAndComments();
|
|
12830
13096
|
},
|
|
12831
13097
|
getText(node, beforeCount, afterCount) {
|
|
12832
13098
|
if (sourceText === null && initSourceText(), !node) return sourceText;
|
|
@@ -13281,7 +13547,7 @@ function resetSettings() {
|
|
|
13281
13547
|
}
|
|
13282
13548
|
//#endregion
|
|
13283
13549
|
//#region package.json
|
|
13284
|
-
var version = "1.
|
|
13550
|
+
var version = "1.57.0";
|
|
13285
13551
|
//#endregion
|
|
13286
13552
|
//#region src-js/plugins/context.ts
|
|
13287
13553
|
let filePath = null, cwd = null;
|
|
@@ -16753,7 +17019,7 @@ function conformHookFn(hookFn, hookName) {
|
|
|
16753
17019
|
return hookFn;
|
|
16754
17020
|
}
|
|
16755
17021
|
//#endregion
|
|
16756
|
-
//#region ../../node_modules/.pnpm/eslint@9.39.
|
|
17022
|
+
//#region ../../node_modules/.pnpm/eslint@9.39.4_jiti@2.6.1/node_modules/eslint/lib/shared/assert.js
|
|
16757
17023
|
/**
|
|
16758
17024
|
* @fileoverview Assertion utilities equivalent to the Node.js node:asserts module.
|
|
16759
17025
|
* @author Josh Goldberg
|
|
@@ -22497,7 +22763,7 @@ const mergers = [
|
|
|
22497
22763
|
visit1(...args), visit2(...args), visit3(...args);
|
|
22498
22764
|
};
|
|
22499
22765
|
}
|
|
22500
|
-
], buffers = [], afterHooks = [];
|
|
22766
|
+
], buffers = [], afterHooks = [], OPTIONS_DESCRIPTOR = { value: null };
|
|
22501
22767
|
/**
|
|
22502
22768
|
* Lint a file.
|
|
22503
22769
|
*
|
|
@@ -22551,7 +22817,7 @@ function lintFileImpl(filePath, bufferId, buffer, ruleIds, optionsIds, settingsJ
|
|
|
22551
22817
|
let ruleDetails = registeredRules[ruleIds[i]];
|
|
22552
22818
|
ruleDetails.ruleIndex = i;
|
|
22553
22819
|
let optionsId = optionsIds[i];
|
|
22554
|
-
|
|
22820
|
+
OPTIONS_DESCRIPTOR.value = optionsId === 0 ? ruleDetails.defaultOptions : allOptions[optionsId], ObjectDefineProperty(ruleDetails.context, "options", OPTIONS_DESCRIPTOR);
|
|
22555
22821
|
let { visitor } = ruleDetails;
|
|
22556
22822
|
if (visitor === null) visitor = ruleDetails.rule.create(ruleDetails.context);
|
|
22557
22823
|
else {
|