tsc-ts 0.0.5 → 0.0.6

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.
Files changed (171) hide show
  1. package/README.md +1 -1
  2. package/dist/api/compiler/ast.d.ts +10 -9
  3. package/dist/api/compiler/ast.js +22 -16
  4. package/dist/api/compiler/binder-utilities.js +2 -1
  5. package/dist/api/compiler/binder.js +9 -8
  6. package/dist/api/compiler/checker-calls.js +3 -2
  7. package/dist/api/compiler/checker-declaration-order.js +2 -1
  8. package/dist/api/compiler/checker-declarations.js +14 -14
  9. package/dist/api/compiler/checker-declared-types.d.ts +1 -1
  10. package/dist/api/compiler/checker-declared-types.js +12 -11
  11. package/dist/api/compiler/checker-decorators.js +3 -3
  12. package/dist/api/compiler/checker-deprecation.js +17 -18
  13. package/dist/api/compiler/checker-destructuring.d.ts +1 -1
  14. package/dist/api/compiler/checker-destructuring.js +3 -3
  15. package/dist/api/compiler/checker-elaboration.js +8 -7
  16. package/dist/api/compiler/checker-emit-resolver.d.ts +1 -1
  17. package/dist/api/compiler/checker-emit-resolver.js +5 -4
  18. package/dist/api/compiler/checker-grammar.js +18 -4
  19. package/dist/api/compiler/checker-heritage.d.ts +1 -1
  20. package/dist/api/compiler/checker-heritage.js +14 -13
  21. package/dist/api/compiler/checker-inference.d.ts +1 -1
  22. package/dist/api/compiler/checker-inference.js +9 -9
  23. package/dist/api/compiler/checker-javascript.d.ts +1 -1
  24. package/dist/api/compiler/checker-javascript.js +5 -4
  25. package/dist/api/compiler/checker-jsx.d.ts +1 -1
  26. package/dist/api/compiler/checker-jsx.js +4 -4
  27. package/dist/api/compiler/checker-literals.js +2 -2
  28. package/dist/api/compiler/checker-members.d.ts +5 -3
  29. package/dist/api/compiler/checker-members.js +75 -53
  30. package/dist/api/compiler/checker-modules.d.ts +1 -1
  31. package/dist/api/compiler/checker-modules.js +13 -13
  32. package/dist/api/compiler/checker-object-literals.d.ts +1 -1
  33. package/dist/api/compiler/checker-object-literals.js +11 -7
  34. package/dist/api/compiler/checker-overloads.d.ts +1 -1
  35. package/dist/api/compiler/checker-overloads.js +4 -3
  36. package/dist/api/compiler/checker-property-access.d.ts +1 -1
  37. package/dist/api/compiler/checker-property-access.js +2 -2
  38. package/dist/api/compiler/checker-services.js +2 -2
  39. package/dist/api/compiler/checker-signatures.d.ts +1 -1
  40. package/dist/api/compiler/checker-signatures.js +9 -8
  41. package/dist/api/compiler/checker-symbol-types.d.ts +2 -18
  42. package/dist/api/compiler/checker-symbol-types.js +22 -952
  43. package/dist/api/compiler/checker-symbols.d.ts +2 -2
  44. package/dist/api/compiler/checker-symbols.js +29 -27
  45. package/dist/api/compiler/checker-type-factory.d.ts +2 -2
  46. package/dist/api/compiler/checker-type-factory.js +57 -16
  47. package/dist/api/compiler/checker-type-nodes.d.ts +1 -1
  48. package/dist/api/compiler/checker-type-nodes.js +2 -2
  49. package/dist/api/compiler/checker-type-operators.d.ts +1 -1
  50. package/dist/api/compiler/checker-type-operators.js +5 -5
  51. package/dist/api/compiler/checker-types.d.ts +73 -7
  52. package/dist/api/compiler/checker-types.js +220 -43
  53. package/dist/api/compiler/checker-unused.d.ts +1 -1
  54. package/dist/api/compiler/checker-unused.js +3 -3
  55. package/dist/api/compiler/checker.d.ts +29 -8
  56. package/dist/api/compiler/checker.js +29 -9
  57. package/dist/api/compiler/diagnostics.d.ts +2 -8
  58. package/dist/api/compiler/diagnostics.js +4 -40
  59. package/dist/api/compiler/file-include.d.ts +35 -8
  60. package/dist/api/compiler/file-include.js +81 -18
  61. package/dist/api/compiler/file-loader.d.ts +33 -4
  62. package/dist/api/compiler/file-loader.js +90 -24
  63. package/dist/api/compiler/instantiation.d.ts +1 -1
  64. package/dist/api/compiler/instantiation.js +86 -50
  65. package/dist/api/compiler/link-tables.d.ts +69 -0
  66. package/dist/api/compiler/link-tables.js +236 -0
  67. package/dist/api/compiler/name-resolver.js +3 -3
  68. package/dist/api/compiler/node-builder-names.d.ts +1 -1
  69. package/dist/api/compiler/node-builder-names.js +12 -12
  70. package/dist/api/compiler/node-builder-pseudo.d.ts +1 -1
  71. package/dist/api/compiler/node-builder-pseudo.js +2 -1
  72. package/dist/api/compiler/node-builder.d.ts +1 -1
  73. package/dist/api/compiler/node-builder.js +16 -16
  74. package/dist/api/compiler/parallel-parse.d.ts +2 -0
  75. package/dist/api/compiler/parallel-parse.js +4 -0
  76. package/dist/api/compiler/parser.d.ts +33 -16
  77. package/dist/api/compiler/parser.js +95 -76
  78. package/dist/api/compiler/printer/emit-context.d.ts +5 -2
  79. package/dist/api/compiler/printer/emit-context.js +19 -13
  80. package/dist/api/compiler/program-checker.js +3 -0
  81. package/dist/api/compiler/program.js +9 -1
  82. package/dist/api/compiler/relations.d.ts +1 -1
  83. package/dist/api/compiler/relations.js +10 -10
  84. package/dist/api/compiler/symbol-accessibility.d.ts +1 -1
  85. package/dist/api/compiler/symbol-accessibility.js +123 -26
  86. package/dist/api/compiler/symbol.d.ts +45 -3
  87. package/dist/api/compiler/symbol.js +121 -10
  88. package/dist/api/compiler/transformers/alias-references.d.ts +1 -1
  89. package/dist/api/compiler/transformers/alias-references.js +2 -1
  90. package/dist/api/compiler/transformers/declarations-diagnostics.js +2 -1
  91. package/dist/api/compiler/transformers/declarations-pseudo.js +4 -2
  92. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -1
  93. package/dist/api/compiler/transformers/declarations-syntactic.js +9 -9
  94. package/dist/api/compiler/transformers/declarations-tracker.d.ts +1 -1
  95. package/dist/api/compiler/transformers/declarations-tracker.js +3 -2
  96. package/dist/api/compiler/transformers/declarations.js +6 -5
  97. package/dist/api/compiler/transformers/reference-resolver.d.ts +2 -1
  98. package/dist/api/compiler/transformers/reference-resolver.js +26 -24
  99. package/dist/api/compiler/transformers/subtree-facts.d.ts +1 -0
  100. package/dist/api/compiler/transformers/subtree-facts.js +7 -5
  101. package/dist/api/compiler/transformers/syntax-facts.d.ts +1 -0
  102. package/dist/api/compiler/transformers/syntax-facts.js +9 -5
  103. package/dist/api/compiler/transformers/type-serialization.js +12 -12
  104. package/package.json +9 -9
  105. package/src/compiler/ast.ts +27 -19
  106. package/src/compiler/binder-utilities.ts +2 -2
  107. package/src/compiler/binder.ts +15 -11
  108. package/src/compiler/checker-calls.ts +3 -3
  109. package/src/compiler/checker-declaration-order.ts +2 -2
  110. package/src/compiler/checker-declarations.ts +21 -14
  111. package/src/compiler/checker-declared-types.ts +12 -12
  112. package/src/compiler/checker-decorators.ts +3 -3
  113. package/src/compiler/checker-deprecation.ts +17 -21
  114. package/src/compiler/checker-destructuring.ts +3 -3
  115. package/src/compiler/checker-elaboration.ts +8 -8
  116. package/src/compiler/checker-emit-resolver.ts +5 -5
  117. package/src/compiler/checker-grammar.ts +17 -5
  118. package/src/compiler/checker-heritage.ts +21 -14
  119. package/src/compiler/checker-inference.ts +17 -9
  120. package/src/compiler/checker-javascript.ts +5 -5
  121. package/src/compiler/checker-jsx.ts +12 -8
  122. package/src/compiler/checker-literals.ts +2 -2
  123. package/src/compiler/checker-members.ts +91 -47
  124. package/src/compiler/checker-modules.ts +23 -13
  125. package/src/compiler/checker-object-literals.ts +22 -6
  126. package/src/compiler/checker-overloads.ts +6 -6
  127. package/src/compiler/checker-property-access.ts +2 -2
  128. package/src/compiler/checker-services.ts +2 -2
  129. package/src/compiler/checker-signatures.ts +9 -9
  130. package/src/compiler/checker-symbol-types.ts +20 -940
  131. package/src/compiler/checker-symbols.ts +42 -35
  132. package/src/compiler/checker-type-factory.ts +53 -16
  133. package/src/compiler/checker-type-nodes.ts +2 -2
  134. package/src/compiler/checker-type-operators.ts +13 -5
  135. package/src/compiler/checker-types.ts +223 -43
  136. package/src/compiler/checker-unused.ts +3 -3
  137. package/src/compiler/checker.ts +31 -9
  138. package/src/compiler/diagnostics.ts +5 -44
  139. package/src/compiler/file-include.ts +85 -17
  140. package/src/compiler/file-loader.ts +104 -35
  141. package/src/compiler/incremental.ts +39 -5
  142. package/src/compiler/instantiation.ts +99 -55
  143. package/src/compiler/link-tables.ts +245 -0
  144. package/src/compiler/name-resolver.ts +3 -3
  145. package/src/compiler/node-builder-names.ts +21 -19
  146. package/src/compiler/node-builder-pseudo.ts +2 -2
  147. package/src/compiler/node-builder.ts +24 -16
  148. package/src/compiler/parallel-check.ts +11 -8
  149. package/src/compiler/parallel-parse.ts +5 -0
  150. package/src/compiler/parse-thread.ts +0 -4
  151. package/src/compiler/parser.ts +120 -70
  152. package/src/compiler/printer/emit-context.ts +20 -15
  153. package/src/compiler/program-checker.ts +2 -0
  154. package/src/compiler/program.ts +8 -1
  155. package/src/compiler/relations.ts +10 -10
  156. package/src/compiler/symbol-accessibility.ts +120 -25
  157. package/src/compiler/symbol.ts +127 -9
  158. package/src/compiler/transformers/alias-references.ts +2 -2
  159. package/src/compiler/transformers/declarations-diagnostics.ts +2 -1
  160. package/src/compiler/transformers/declarations-pseudo.ts +7 -4
  161. package/src/compiler/transformers/declarations-syntactic.ts +17 -9
  162. package/src/compiler/transformers/declarations-tracker.ts +3 -3
  163. package/src/compiler/transformers/declarations.ts +6 -6
  164. package/src/compiler/transformers/reference-resolver.ts +37 -25
  165. package/src/compiler/transformers/subtree-facts.ts +13 -5
  166. package/src/compiler/transformers/syntax-facts.ts +10 -5
  167. package/src/compiler/transformers/type-serialization.ts +12 -12
  168. package/src/compiler/tsc-build.ts +17 -13
  169. package/src/compiler/tsc-cli.ts +9 -6
  170. package/src/compiler/tsc-compile.ts +16 -7
  171. package/src/compiler/tsc-watch.ts +94 -26
@@ -84,7 +84,6 @@ import {
84
84
  import { tryReuseExistingNode } from './node-builder-reuse.js';
85
85
  import { EmitFlags } from './printer/emit-flags.js';
86
86
  import { compareTypesIdentical } from './relations.js';
87
- import { CheckFlags, type Symbol, SymbolFlags } from './symbol.js';
88
87
  import { SyntaxKind } from './syntax-kind.js';
89
88
  import { NodeBuilderFlags } from './transformers/declarations-resolver.js';
90
89
  import {
@@ -106,6 +105,7 @@ import {
106
105
  } from './transformers/declarations-pseudo.js';
107
106
  import { tryGetTextOfPropertyName } from './transformers/declarations-syntactic.js';
108
107
  import { TokenFlags } from './types.js';
108
+ import { CheckFlags, declarationCount, type Symbol, SymbolFlags } from './symbol.js';
109
109
 
110
110
  /** Resolves no names: `undefined` in an expression is the undefined value, as tsgo's pseudochecker assumes. */
111
111
  class NoNames extends NameResolver {
@@ -562,7 +562,7 @@ export function pseudoTypeEquivalentToType(
562
562
  const targetProps = getPropertiesOfType(c, undefinedStripped);
563
563
  // Accessor pairs are two members but one property.
564
564
  let targetDeclCount = 0;
565
- for (const prop of targetProps) targetDeclCount += prop.declarations.length;
565
+ for (const prop of targetProps) targetDeclCount += declarationCount(prop);
566
566
  if (pt.members.length !== targetDeclCount) return false;
567
567
  for (const e of pt.members) {
568
568
  let targetProp: Symbol | undefined = undefined;
@@ -214,7 +214,6 @@ import { TextWriter } from './printer/text-writer.js';
214
214
  import type { NodeFactory } from './printer/factory.js';
215
215
  import { isTypeIdenticalTo } from './relations.js';
216
216
  import { isIdentifierText } from './scanner.js';
217
- import { CheckFlags, type Symbol, SymbolFlags, type SymbolTable, getSymbolId } from './symbol.js';
218
217
  import { SyntaxKind } from './syntax-kind.js';
219
218
  import {
220
219
  NodeBuilderFlags,
@@ -263,6 +262,15 @@ import {
263
262
  couldAlreadyReferToUndefined,
264
263
  undefinedType as pseudoUndefinedType,
265
264
  } from './transformers/declarations-pseudo.js';
265
+ import {
266
+ CheckFlags,
267
+ declarationCount,
268
+ getDeclarations,
269
+ getSymbolId,
270
+ type Symbol,
271
+ SymbolFlags,
272
+ type SymbolTable,
273
+ } from './symbol.js';
266
274
 
267
275
  const defaultMaximumTruncationLength = 160;
268
276
  const noTruncationMaximumTruncationLength = 1_000_000;
@@ -693,7 +701,7 @@ export class NodeBuilder {
693
701
 
694
702
  /** Adds the names bound by a destructured parameter; false if `param` isn't one. */
695
703
  private addBindingPatternParameters(param: Symbol, table: SymbolTable): boolean {
696
- for (const d of param.declarations) {
704
+ for (const d of getDeclarations(param)) {
697
705
  if (d.kind !== SyntaxKind.Parameter) continue;
698
706
  const name = asBindingPattern(getName(d));
699
707
  if (name !== undefined) {
@@ -1431,14 +1439,14 @@ export class NodeBuilder {
1431
1439
  const c = this.c;
1432
1440
  let isStaticMethodSymbol = false;
1433
1441
  if ((symbol.flags & SymbolFlags.Method) !== 0)
1434
- for (const d of symbol.declarations)
1442
+ for (const d of getDeclarations(symbol))
1435
1443
  if (isStatic(d) && !hasLateBindableIndexSignature(c, d)) isStaticMethodSymbol = true;
1436
1444
  let isNonLocalFunctionSymbol = false;
1437
1445
  let isFunctionExpressionSymbol = false;
1438
1446
  if ((symbol.flags & SymbolFlags.Function) !== 0) {
1439
1447
  if (symbol.parent !== undefined) isNonLocalFunctionSymbol = true;
1440
1448
  else
1441
- for (const d of symbol.declarations) {
1449
+ for (const d of getDeclarations(symbol)) {
1442
1450
  const parent = d.parent!;
1443
1451
  if (parent.kind === SyntaxKind.SourceFile || parent.kind === SyntaxKind.ModuleBlock) {
1444
1452
  isNonLocalFunctionSymbol = true;
@@ -1740,8 +1748,8 @@ export class NodeBuilder {
1740
1748
  const saveEnclosingDeclaration = this.enclosingDeclaration;
1741
1749
  this.enclosingDeclaration = undefined;
1742
1750
  if (isLateBoundName(propertySymbol.name)) {
1743
- if (propertySymbol.declarations.length > 0) {
1744
- const decl = propertySymbol.declarations[0]!;
1751
+ if (declarationCount(propertySymbol) > 0) {
1752
+ const decl = propertySymbol.declaration!;
1745
1753
  if (hasLateBindableName(c, decl)) {
1746
1754
  if (decl instanceof BinaryExpression) {
1747
1755
  const name = getNameOfDeclaration(decl);
@@ -1756,7 +1764,7 @@ export class NodeBuilder {
1756
1764
  }
1757
1765
  this.enclosingDeclaration =
1758
1766
  propertySymbol.valueDeclaration ??
1759
- (propertySymbol.declarations.length > 0 ? propertySymbol.declarations[0]! : saveEnclosingDeclaration);
1767
+ (declarationCount(propertySymbol) > 0 ? propertySymbol.declaration! : saveEnclosingDeclaration);
1760
1768
  const propertyName = getPropertyNameNodeForSymbol(this, propertySymbol);
1761
1769
  this.enclosingDeclaration = saveEnclosingDeclaration;
1762
1770
  this.approximateLength += symbolName(propertySymbol).length + 1;
@@ -1883,7 +1891,7 @@ export class NodeBuilder {
1883
1891
  }
1884
1892
 
1885
1893
  private isDeclaredInEnclosingFile(symbol: Symbol): boolean {
1886
- for (const d of symbol.declarations) if (getSourceFileOfNode(d) === this.enclosingFile) return true;
1894
+ for (const d of getDeclarations(symbol)) if (getSourceFileOfNode(d) === this.enclosingFile) return true;
1887
1895
  return false;
1888
1896
  }
1889
1897
 
@@ -2119,8 +2127,8 @@ export class NodeBuilder {
2119
2127
  let result = symbolToName(this, typeParameter.symbol!, SymbolFlags.Type, true);
2120
2128
  if (!(result instanceof Identifier)) return this.identifier('(Missing type parameter)');
2121
2129
  const symbol = typeParameter.symbol;
2122
- if (symbol !== undefined && symbol.declarations.length > 0) {
2123
- const decl = symbol.declarations[0]!;
2130
+ if (symbol !== undefined && declarationCount(symbol) > 0) {
2131
+ const decl = symbol.declaration!;
2124
2132
  if (decl.kind === SyntaxKind.TypeParameter) result = this.setTextRange(result, getName(decl)) as Identifier;
2125
2133
  }
2126
2134
  if (generateNames) {
@@ -2484,7 +2492,7 @@ export class NodeBuilder {
2484
2492
  ): Node {
2485
2493
  const c = this.c;
2486
2494
  if (declaration === undefined && symbol !== undefined)
2487
- declaration = symbol.valueDeclaration ?? (symbol.declarations.length > 0 ? symbol.declarations[0]! : undefined);
2495
+ declaration = symbol.valueDeclaration ?? (declarationCount(symbol) > 0 ? symbol.declaration! : undefined);
2488
2496
  if (symbol === undefined && declaration !== undefined) symbol = getSymbolOfDeclaration(c, declaration);
2489
2497
  let t = type;
2490
2498
  if (t === undefined && symbol !== undefined) {
@@ -2567,7 +2575,7 @@ export class NodeBuilder {
2567
2575
  : pseudo.getTypeOfDeclaration(declaration);
2568
2576
  if (pt.kind === PseudoTypeKind.NoResult && declaration.kind === SyntaxKind.BinaryExpression) {
2569
2577
  // The first annotated assignment declares the type for the rest.
2570
- for (const d of symbol.declarations)
2578
+ for (const d of getDeclarations(symbol))
2571
2579
  if (getType(d) !== undefined) {
2572
2580
  pt = pseudo.getTypeOfDeclaration(d);
2573
2581
  break;
@@ -2814,9 +2822,9 @@ function isClassInstanceSide(c: Checker, t: Type): boolean {
2814
2822
 
2815
2823
  function getTypeAliasForTypeLiteral(c: Checker, t: Type): Symbol | undefined {
2816
2824
  const symbol = t.symbol;
2817
- if (symbol === undefined || (symbol.flags & SymbolFlags.TypeLiteral) === 0 || symbol.declarations.length === 0)
2825
+ if (symbol === undefined || (symbol.flags & SymbolFlags.TypeLiteral) === 0 || declarationCount(symbol) === 0)
2818
2826
  return undefined;
2819
- let node = symbol.declarations[0]!.parent;
2827
+ let node = symbol.declaration!.parent;
2820
2828
  while (node !== undefined && node.kind === SyntaxKind.ParenthesizedType) node = node.parent;
2821
2829
  if (node !== undefined && node.kind === SyntaxKind.TypeAliasDeclaration) return getSymbolOfDeclaration(c, node);
2822
2830
  return undefined;
@@ -2825,7 +2833,7 @@ function getTypeAliasForTypeLiteral(c: Checker, t: Type): Symbol | undefined {
2825
2833
  /** A copy of `t`, whose members are `resolved`, without its abstract construct signatures. */
2826
2834
  function getResolvedTypeWithoutAbstractConstructSignatures(c: Checker, t: Type, resolved: StructuredType): Type {
2827
2835
  if (resolved.constructSignatures.length === 0) return t;
2828
- const side = sideOf(c, t as StructuredType);
2836
+ const side = membersHolder(c, t);
2829
2837
  if (side.objectTypeWithoutAbstractConstructSignatures !== undefined)
2830
2838
  return side.objectTypeWithoutAbstractConstructSignatures;
2831
2839
  const constructSignatures = resolved.constructSignatures.filter((s) => (s.flags & SignatureFlags.Abstract) === 0);
@@ -2865,7 +2873,7 @@ function getEffectiveConstraint(typeParameter: Node): Node | undefined {
2865
2873
 
2866
2874
  function getTypeParameterModifiers(tp: Type): ModifierFlags {
2867
2875
  let flags = ModifierFlags.None;
2868
- if (tp.symbol !== undefined) for (const d of tp.symbol.declarations) flags |= getCombinedModifierFlags(d);
2876
+ if (tp.symbol !== undefined) for (const d of getDeclarations(tp.symbol)) flags |= getCombinedModifierFlags(d);
2869
2877
  return flags & (ModifierFlags.In | ModifierFlags.Out | ModifierFlags.Const);
2870
2878
  }
2871
2879
 
@@ -440,7 +440,7 @@ function checksLittle(program: Program): boolean {
440
440
  let text = 0;
441
441
  for (const file of program.getSourceFiles()) {
442
442
  if (file.isDeclarationFile && options.skipLibCheck === true) continue;
443
- text += file.text.length;
443
+ text += file.end;
444
444
  if (text >= littleText) return false;
445
445
  }
446
446
  return true;
@@ -454,10 +454,14 @@ export function autoCheckers(cpus: number, fit: number): number {
454
454
  /**
455
455
  * The number of threads that parse ahead of a program checked by `checkers` checkers: every CPU this
456
456
  * process may run on, as tsgo parses on every core whatever its checker count (parse threads hand
457
- * their files to the shared program; what else they allocate is reused by the checker threads).
457
+ * their files to the shared program; what else they allocate is reused by the checker threads), but
458
+ * one. The main thread hands out the chunks they load: with a thread on every CPU, it waits for a CPU
459
+ * each time a thread returns a chunk, and so does that thread for its next chunk (VS Code's parse took
460
+ * 18-57 ms longer with 16 threads on 16 CPUs than with 15).
458
461
  */
459
462
  export function parseThreads(checkers: number): number {
460
- return Math.max(checkers, Math.min(availableParallelism(), maxAutoCheckers));
463
+ const cpus = availableParallelism();
464
+ return Math.max(1, Math.min(cpus - 1, Math.max(checkers, Math.min(cpus, maxAutoCheckers))));
461
465
  }
462
466
 
463
467
  /**
@@ -572,15 +576,14 @@ let lengthsProgram: Program | undefined = undefined;
572
576
  let lengthsOfProgram: number[] = [];
573
577
 
574
578
  /**
575
- * The text length of each of `program`'s files, by index, computed once per program. In scriptc
576
- * builds a thread caches the UTF-16 length of only the few non-ASCII strings it read last, so each
577
- * read of a non-ASCII file's `text.length` scans its text again, and planning reads a file's length
578
- * several times (its cost, the load of each group candidate importing it, its position).
579
+ * The text length of each of `program`'s files, by index, computed once per program: a file's `end`,
580
+ * the length the parser found. In scriptc builds a thread caches the UTF-16 length of only the few
581
+ * non-ASCII strings it read last, so reading a non-ASCII file's `text.length` scans its text.
579
582
  */
580
583
  export function textLengths(program: Program): number[] {
581
584
  if (lengthsProgram !== program) {
582
585
  const lengths: number[] = [];
583
- for (const file of program.getSourceFiles()) lengths.push(file.text.length);
586
+ for (const file of program.getSourceFiles()) lengths.push(file.end);
584
587
  lengthsProgram = program;
585
588
  lengthsOfProgram = lengths;
586
589
  }
@@ -86,6 +86,11 @@ export function preparedVersion(file: SourceFile): string {
86
86
  return prepared !== undefined && prepared.file === file ? prepared.version : '';
87
87
  }
88
88
 
89
+ /** Whether a parse thread prepared `fileName`. */
90
+ export function isPrepared(fileName: string): boolean {
91
+ return parallelParse.files.has(fileName);
92
+ }
93
+
89
94
  /** What a parse thread's FileLoader found loading `fileName`, if the thread prepared it. */
90
95
  export function preparedLoad(fileName: string): LoadedFile | undefined {
91
96
  if (parallelParse.files.size === 0) return undefined;
@@ -6,7 +6,6 @@
6
6
  import { publish } from '@scriptc/threads';
7
7
  import { type ExternalModuleIndicatorOptions, ParseOptions, ScriptKind, type SourceFile } from './ast.js';
8
8
  import { bindSourceFile } from './binder.js';
9
- import { scanSiblingProperties } from './checker-symbol-types.js';
10
9
  import { useThreadTextCaches } from './diagnostics.js';
11
10
  import { CompilerHost, FileLoader } from './file-loader.js';
12
11
  import { computeHash } from './incremental.js';
@@ -50,9 +49,6 @@ class PreparingHost extends CompilerHost {
50
49
  );
51
50
  const t2 = timeline ? performance.now() : 0;
52
51
  bindSourceFile(file);
53
- // Checkers look up the unions of the files tsgo checks with one checker (firstSiblingProperty):
54
- // each file is scanned here once instead of by every checker.
55
- file.siblingProperties = scanSiblingProperties(file, undefined);
56
52
  if (timeline) {
57
53
  const t3 = performance.now();
58
54
  this.readMs += t1 - t0;