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.
- package/README.md +1 -1
- package/dist/api/compiler/ast.d.ts +10 -9
- package/dist/api/compiler/ast.js +22 -16
- package/dist/api/compiler/binder-utilities.js +2 -1
- package/dist/api/compiler/binder.js +9 -8
- package/dist/api/compiler/checker-calls.js +3 -2
- package/dist/api/compiler/checker-declaration-order.js +2 -1
- package/dist/api/compiler/checker-declarations.js +14 -14
- package/dist/api/compiler/checker-declared-types.d.ts +1 -1
- package/dist/api/compiler/checker-declared-types.js +12 -11
- package/dist/api/compiler/checker-decorators.js +3 -3
- package/dist/api/compiler/checker-deprecation.js +17 -18
- package/dist/api/compiler/checker-destructuring.d.ts +1 -1
- package/dist/api/compiler/checker-destructuring.js +3 -3
- package/dist/api/compiler/checker-elaboration.js +8 -7
- package/dist/api/compiler/checker-emit-resolver.d.ts +1 -1
- package/dist/api/compiler/checker-emit-resolver.js +5 -4
- package/dist/api/compiler/checker-grammar.js +18 -4
- package/dist/api/compiler/checker-heritage.d.ts +1 -1
- package/dist/api/compiler/checker-heritage.js +14 -13
- package/dist/api/compiler/checker-inference.d.ts +1 -1
- package/dist/api/compiler/checker-inference.js +9 -9
- package/dist/api/compiler/checker-javascript.d.ts +1 -1
- package/dist/api/compiler/checker-javascript.js +5 -4
- package/dist/api/compiler/checker-jsx.d.ts +1 -1
- package/dist/api/compiler/checker-jsx.js +4 -4
- package/dist/api/compiler/checker-literals.js +2 -2
- package/dist/api/compiler/checker-members.d.ts +5 -3
- package/dist/api/compiler/checker-members.js +75 -53
- package/dist/api/compiler/checker-modules.d.ts +1 -1
- package/dist/api/compiler/checker-modules.js +13 -13
- package/dist/api/compiler/checker-object-literals.d.ts +1 -1
- package/dist/api/compiler/checker-object-literals.js +11 -7
- package/dist/api/compiler/checker-overloads.d.ts +1 -1
- package/dist/api/compiler/checker-overloads.js +4 -3
- package/dist/api/compiler/checker-property-access.d.ts +1 -1
- package/dist/api/compiler/checker-property-access.js +2 -2
- package/dist/api/compiler/checker-services.js +2 -2
- package/dist/api/compiler/checker-signatures.d.ts +1 -1
- package/dist/api/compiler/checker-signatures.js +9 -8
- package/dist/api/compiler/checker-symbol-types.d.ts +2 -18
- package/dist/api/compiler/checker-symbol-types.js +22 -952
- package/dist/api/compiler/checker-symbols.d.ts +2 -2
- package/dist/api/compiler/checker-symbols.js +29 -27
- package/dist/api/compiler/checker-type-factory.d.ts +2 -2
- package/dist/api/compiler/checker-type-factory.js +57 -16
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -1
- package/dist/api/compiler/checker-type-nodes.js +2 -2
- package/dist/api/compiler/checker-type-operators.d.ts +1 -1
- package/dist/api/compiler/checker-type-operators.js +5 -5
- package/dist/api/compiler/checker-types.d.ts +73 -7
- package/dist/api/compiler/checker-types.js +220 -43
- package/dist/api/compiler/checker-unused.d.ts +1 -1
- package/dist/api/compiler/checker-unused.js +3 -3
- package/dist/api/compiler/checker.d.ts +29 -8
- package/dist/api/compiler/checker.js +29 -9
- package/dist/api/compiler/diagnostics.d.ts +2 -8
- package/dist/api/compiler/diagnostics.js +4 -40
- package/dist/api/compiler/file-include.d.ts +35 -8
- package/dist/api/compiler/file-include.js +81 -18
- package/dist/api/compiler/file-loader.d.ts +33 -4
- package/dist/api/compiler/file-loader.js +90 -24
- package/dist/api/compiler/instantiation.d.ts +1 -1
- package/dist/api/compiler/instantiation.js +86 -50
- package/dist/api/compiler/link-tables.d.ts +69 -0
- package/dist/api/compiler/link-tables.js +236 -0
- package/dist/api/compiler/name-resolver.js +3 -3
- package/dist/api/compiler/node-builder-names.d.ts +1 -1
- package/dist/api/compiler/node-builder-names.js +12 -12
- package/dist/api/compiler/node-builder-pseudo.d.ts +1 -1
- package/dist/api/compiler/node-builder-pseudo.js +2 -1
- package/dist/api/compiler/node-builder.d.ts +1 -1
- package/dist/api/compiler/node-builder.js +16 -16
- package/dist/api/compiler/parallel-parse.d.ts +2 -0
- package/dist/api/compiler/parallel-parse.js +4 -0
- package/dist/api/compiler/parser.d.ts +33 -16
- package/dist/api/compiler/parser.js +95 -76
- package/dist/api/compiler/printer/emit-context.d.ts +5 -2
- package/dist/api/compiler/printer/emit-context.js +19 -13
- package/dist/api/compiler/program-checker.js +3 -0
- package/dist/api/compiler/program.js +9 -1
- package/dist/api/compiler/relations.d.ts +1 -1
- package/dist/api/compiler/relations.js +10 -10
- package/dist/api/compiler/symbol-accessibility.d.ts +1 -1
- package/dist/api/compiler/symbol-accessibility.js +123 -26
- package/dist/api/compiler/symbol.d.ts +45 -3
- package/dist/api/compiler/symbol.js +121 -10
- package/dist/api/compiler/transformers/alias-references.d.ts +1 -1
- package/dist/api/compiler/transformers/alias-references.js +2 -1
- package/dist/api/compiler/transformers/declarations-diagnostics.js +2 -1
- package/dist/api/compiler/transformers/declarations-pseudo.js +4 -2
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-syntactic.js +9 -9
- package/dist/api/compiler/transformers/declarations-tracker.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-tracker.js +3 -2
- package/dist/api/compiler/transformers/declarations.js +6 -5
- package/dist/api/compiler/transformers/reference-resolver.d.ts +2 -1
- package/dist/api/compiler/transformers/reference-resolver.js +26 -24
- package/dist/api/compiler/transformers/subtree-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/subtree-facts.js +7 -5
- package/dist/api/compiler/transformers/syntax-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/syntax-facts.js +9 -5
- package/dist/api/compiler/transformers/type-serialization.js +12 -12
- package/package.json +9 -9
- package/src/compiler/ast.ts +27 -19
- package/src/compiler/binder-utilities.ts +2 -2
- package/src/compiler/binder.ts +15 -11
- package/src/compiler/checker-calls.ts +3 -3
- package/src/compiler/checker-declaration-order.ts +2 -2
- package/src/compiler/checker-declarations.ts +21 -14
- package/src/compiler/checker-declared-types.ts +12 -12
- package/src/compiler/checker-decorators.ts +3 -3
- package/src/compiler/checker-deprecation.ts +17 -21
- package/src/compiler/checker-destructuring.ts +3 -3
- package/src/compiler/checker-elaboration.ts +8 -8
- package/src/compiler/checker-emit-resolver.ts +5 -5
- package/src/compiler/checker-grammar.ts +17 -5
- package/src/compiler/checker-heritage.ts +21 -14
- package/src/compiler/checker-inference.ts +17 -9
- package/src/compiler/checker-javascript.ts +5 -5
- package/src/compiler/checker-jsx.ts +12 -8
- package/src/compiler/checker-literals.ts +2 -2
- package/src/compiler/checker-members.ts +91 -47
- package/src/compiler/checker-modules.ts +23 -13
- package/src/compiler/checker-object-literals.ts +22 -6
- package/src/compiler/checker-overloads.ts +6 -6
- package/src/compiler/checker-property-access.ts +2 -2
- package/src/compiler/checker-services.ts +2 -2
- package/src/compiler/checker-signatures.ts +9 -9
- package/src/compiler/checker-symbol-types.ts +20 -940
- package/src/compiler/checker-symbols.ts +42 -35
- package/src/compiler/checker-type-factory.ts +53 -16
- package/src/compiler/checker-type-nodes.ts +2 -2
- package/src/compiler/checker-type-operators.ts +13 -5
- package/src/compiler/checker-types.ts +223 -43
- package/src/compiler/checker-unused.ts +3 -3
- package/src/compiler/checker.ts +31 -9
- package/src/compiler/diagnostics.ts +5 -44
- package/src/compiler/file-include.ts +85 -17
- package/src/compiler/file-loader.ts +104 -35
- package/src/compiler/incremental.ts +39 -5
- package/src/compiler/instantiation.ts +99 -55
- package/src/compiler/link-tables.ts +245 -0
- package/src/compiler/name-resolver.ts +3 -3
- package/src/compiler/node-builder-names.ts +21 -19
- package/src/compiler/node-builder-pseudo.ts +2 -2
- package/src/compiler/node-builder.ts +24 -16
- package/src/compiler/parallel-check.ts +11 -8
- package/src/compiler/parallel-parse.ts +5 -0
- package/src/compiler/parse-thread.ts +0 -4
- package/src/compiler/parser.ts +120 -70
- package/src/compiler/printer/emit-context.ts +20 -15
- package/src/compiler/program-checker.ts +2 -0
- package/src/compiler/program.ts +8 -1
- package/src/compiler/relations.ts +10 -10
- package/src/compiler/symbol-accessibility.ts +120 -25
- package/src/compiler/symbol.ts +127 -9
- package/src/compiler/transformers/alias-references.ts +2 -2
- package/src/compiler/transformers/declarations-diagnostics.ts +2 -1
- package/src/compiler/transformers/declarations-pseudo.ts +7 -4
- package/src/compiler/transformers/declarations-syntactic.ts +17 -9
- package/src/compiler/transformers/declarations-tracker.ts +3 -3
- package/src/compiler/transformers/declarations.ts +6 -6
- package/src/compiler/transformers/reference-resolver.ts +37 -25
- package/src/compiler/transformers/subtree-facts.ts +13 -5
- package/src/compiler/transformers/syntax-facts.ts +10 -5
- package/src/compiler/transformers/type-serialization.ts +12 -12
- package/src/compiler/tsc-build.ts +17 -13
- package/src/compiler/tsc-cli.ts +9 -6
- package/src/compiler/tsc-compile.ts +16 -7
- package/src/compiler/tsc-watch.ts +94 -26
|
@@ -6,6 +6,7 @@ import { isFunctionLikeDeclarationKind } from '../ast-utilities.js';
|
|
|
6
6
|
import { Diagnostic } from '../diagnostics.js';
|
|
7
7
|
import { isStatement } from '../printer/utilities.js';
|
|
8
8
|
import { isParameterPropertyDeclaration } from './utilities.js';
|
|
9
|
+
import { getDeclarations } from '../symbol.js';
|
|
9
10
|
export function createDiagnosticForNode(node, message, args) {
|
|
10
11
|
const file = getSourceFileOfNode(node);
|
|
11
12
|
const range = getErrorRangeForNode(file, node);
|
|
@@ -527,7 +528,7 @@ export function getAllAccessorDeclarations(accessor) {
|
|
|
527
528
|
let other = undefined;
|
|
528
529
|
const symbol = getSymbol(accessor);
|
|
529
530
|
if (symbol !== undefined)
|
|
530
|
-
for (const declaration of symbol
|
|
531
|
+
for (const declaration of getDeclarations(symbol))
|
|
531
532
|
if (declaration.kind === otherKind) {
|
|
532
533
|
other = declaration;
|
|
533
534
|
break;
|
|
@@ -6,6 +6,7 @@ import { ArrayLiteralExpression, ArrowFunction, FunctionExpression, MethodDeclar
|
|
|
6
6
|
import { isFunctionLike, nodeIsMissing } from '../ast-utilities.js';
|
|
7
7
|
import { getCombinedNodeFlags, hasSyntacticModifier, isIdentifierNamed } from '../binder-utilities.js';
|
|
8
8
|
import { getAllAccessorDeclarations } from './declarations-diagnostics.js';
|
|
9
|
+
import { declarationCount, getDeclarations } from '../symbol.js';
|
|
9
10
|
export class PseudoType {
|
|
10
11
|
kind;
|
|
11
12
|
constructor(kind) {
|
|
@@ -249,7 +250,7 @@ export class PseudoChecker {
|
|
|
249
250
|
// A property declared more than once has the type of its first declaration; only the checker
|
|
250
251
|
// knows which, so the type is still written from this one but counted as uncertain.
|
|
251
252
|
const symbol = getSymbol(node);
|
|
252
|
-
if (symbol !== undefined && symbol
|
|
253
|
+
if (symbol !== undefined && declarationCount(symbol) > 1)
|
|
253
254
|
this.uncertain++;
|
|
254
255
|
if (node instanceof PropertyDeclaration) {
|
|
255
256
|
const initializer = node.initializer;
|
|
@@ -277,7 +278,8 @@ export class PseudoChecker {
|
|
|
277
278
|
const initializer = declaration.initializer;
|
|
278
279
|
// As tsgo, the file's own declarations; merged ones are left to the checker's type comparison.
|
|
279
280
|
const symbol = declaration.symbol;
|
|
280
|
-
if (initializer !== undefined &&
|
|
281
|
+
if (initializer !== undefined &&
|
|
282
|
+
(symbol === undefined || countVariableDeclarations(getDeclarations(symbol)) === 1)) {
|
|
281
283
|
if (!isContextuallyTyped(declaration)) {
|
|
282
284
|
// Const template literals may become literal types, so they aren't inferred.
|
|
283
285
|
if ((getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */) !== 0 &&
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FileReference, Identifier, type ImportDeclaration, ModifierFlags, type Node, SourceFile, type EntityName } from '../ast.js';
|
|
2
2
|
import type { CompilerOptions, ModuleKind } from '../options.js';
|
|
3
3
|
import type { EmitContext } from '../printer/emit-context.js';
|
|
4
|
-
import { Symbol, SymbolFlags } from '../symbol.js';
|
|
5
4
|
import type { SyntacticEmitResolver } from './emit-resolver.js';
|
|
6
5
|
import type { TypeReferenceSerializationKind } from './type-serialization.js';
|
|
7
6
|
import type { Evaluation } from './reference-resolver.js';
|
|
8
7
|
import { DeclarationEmitResolver, NodeBuilderFlags, SymbolAccessibilityResult, type SymbolTracker } from './declarations-resolver.js';
|
|
8
|
+
import { Symbol, SymbolFlags } from '../symbol.js';
|
|
9
9
|
/** How much of a file's declaration types needed inference. */
|
|
10
10
|
export declare class InferenceCounts {
|
|
11
11
|
/** Types without annotations or literal initializers. */
|
|
@@ -10,9 +10,9 @@ import { NameResolver } from '../name-resolver.js';
|
|
|
10
10
|
import { ModuleKind as ModuleKinds } from '../options.js';
|
|
11
11
|
import { combinePaths, getDirectoryPath, getNormalizedAbsolutePath, normalizePath } from '../path.js';
|
|
12
12
|
import { isIdentifierText } from '../scanner.js';
|
|
13
|
-
import { Symbol, addDeclaration } from '../symbol.js';
|
|
14
13
|
import { DeclarationEmitResolver, SymbolAccessibilityResult, accessible, } from './declarations-resolver.js';
|
|
15
14
|
import { DirectType, InferredType, MaybeConstType, NoResultType, ObjectLiteralType, PseudoChecker, SignatureType, TupleType, UnionType, collectReturnStatements, couldAlreadyReferToUndefined, isConstTypeReference, isInConstContext, lastRequiredParameterIndex, typesOf, undefinedType, } from './declarations-pseudo.js';
|
|
15
|
+
import { addDeclaration, declarationCount, getDeclarations, setDeclarations, Symbol, } from '../symbol.js';
|
|
16
16
|
const emptyTable = new Map();
|
|
17
17
|
/** Name resolution without module resolution: an import may name anything. */
|
|
18
18
|
class DeclarationNameResolver extends NameResolver {
|
|
@@ -139,7 +139,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
139
139
|
while (symbol !== undefined && !visited.has(symbol)) {
|
|
140
140
|
visited.add(symbol);
|
|
141
141
|
let next = undefined;
|
|
142
|
-
for (const declaration of symbol
|
|
142
|
+
for (const declaration of getDeclarations(symbol)) {
|
|
143
143
|
this.visibility.set(declaration, true);
|
|
144
144
|
if (declaration instanceof ImportEqualsDeclaration &&
|
|
145
145
|
!(declaration.moduleReference instanceof ExternalModuleReference)) {
|
|
@@ -270,7 +270,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
270
270
|
/** Accessible if every declaration is visible or can be made so by keeping an unexported statement. */
|
|
271
271
|
hasVisibleDeclarations(symbol, shouldComputeAliasesToMakeVisible) {
|
|
272
272
|
const aliases = [];
|
|
273
|
-
for (const declaration of symbol
|
|
273
|
+
for (const declaration of getDeclarations(symbol)) {
|
|
274
274
|
if (declaration.kind === 79 /* SyntaxKind.Identifier */ || this.isDeclarationVisible(declaration))
|
|
275
275
|
continue;
|
|
276
276
|
let statement = undefined;
|
|
@@ -349,7 +349,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
349
349
|
if (symbol === undefined)
|
|
350
350
|
return false;
|
|
351
351
|
const signatures = [];
|
|
352
|
-
const declarations = symbol
|
|
352
|
+
const declarations = getDeclarations(symbol);
|
|
353
353
|
for (let i = 0; i < declarations.length; i++) {
|
|
354
354
|
const declaration = declarations[i];
|
|
355
355
|
if (!isFunctionLike(declaration))
|
|
@@ -388,7 +388,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
388
388
|
if (symbol === undefined)
|
|
389
389
|
return undefined;
|
|
390
390
|
const resolved = symbol.exportSymbol ?? symbol;
|
|
391
|
-
return resolved.valueDeclaration ?? (resolved
|
|
391
|
+
return resolved.valueDeclaration ?? (declarationCount(resolved) > 0 ? resolved.declaration : undefined);
|
|
392
392
|
}
|
|
393
393
|
if (!(node instanceof PropertyAccessExpression) || !(node.name instanceof Identifier))
|
|
394
394
|
return undefined;
|
|
@@ -620,7 +620,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
|
|
|
620
620
|
}
|
|
621
621
|
hasMergedDeclarations(declaration) {
|
|
622
622
|
const symbol = getSymbol(declaration);
|
|
623
|
-
return symbol !== undefined && this.pseudo.getMergedSymbol(symbol)
|
|
623
|
+
return symbol !== undefined && declarationCount(this.pseudo.getMergedSymbol(symbol)) > declarationCount(symbol);
|
|
624
624
|
}
|
|
625
625
|
/** Whether a parameter's pseudo-type already has `undefined`, so none is added. */
|
|
626
626
|
pseudoContainsUndefined(type) {
|
|
@@ -1135,7 +1135,7 @@ class PseudoTypeWriter {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
/** Parameters and type parameters are in scope where the signature's types are written. */
|
|
1137
1137
|
function isSignatureLocal(symbol) {
|
|
1138
|
-
const declaration = symbol.valueDeclaration ?? (symbol
|
|
1138
|
+
const declaration = symbol.valueDeclaration ?? (declarationCount(symbol) > 0 ? symbol.declaration : undefined);
|
|
1139
1139
|
return (declaration !== undefined &&
|
|
1140
1140
|
(declaration.kind === 170 /* SyntaxKind.Parameter */ || declaration.kind === 169 /* SyntaxKind.TypeParameter */));
|
|
1141
1141
|
}
|
|
@@ -1488,7 +1488,7 @@ function mergeInto(target, source, mergedSymbols) {
|
|
|
1488
1488
|
if (mergedSymbols.get(existing) !== existing) {
|
|
1489
1489
|
// The first merge replaces the first file's symbol with a copy.
|
|
1490
1490
|
merged = new Symbol(existing.flags, name);
|
|
1491
|
-
merged
|
|
1491
|
+
setDeclarations(merged, getDeclarations(existing).slice());
|
|
1492
1492
|
merged.valueDeclaration = existing.valueDeclaration;
|
|
1493
1493
|
merged.exports = copyTable(existing.exports);
|
|
1494
1494
|
merged.members = copyTable(existing.members);
|
|
@@ -1497,7 +1497,7 @@ function mergeInto(target, source, mergedSymbols) {
|
|
|
1497
1497
|
target.set(name, merged);
|
|
1498
1498
|
}
|
|
1499
1499
|
merged.flags |= symbol.flags;
|
|
1500
|
-
for (const declaration of symbol
|
|
1500
|
+
for (const declaration of getDeclarations(symbol))
|
|
1501
1501
|
addDeclaration(merged, declaration);
|
|
1502
1502
|
merged.valueDeclaration ??= symbol.valueDeclaration;
|
|
1503
1503
|
if (symbol.exports !== undefined) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Node, type SourceFile } from '../ast.js';
|
|
2
2
|
import { type Diagnostic } from '../diagnostics.js';
|
|
3
|
-
import { type Symbol, SymbolFlags } from '../symbol.js';
|
|
4
3
|
import { DiagnosticContext } from './declarations-diagnostics.js';
|
|
5
4
|
import { type DeclarationEmitResolver, type SymbolAccessibilityResult, SymbolTracker } from './declarations-resolver.js';
|
|
5
|
+
import { type Symbol, SymbolFlags } from '../symbol.js';
|
|
6
6
|
export declare class DeclarationTracker extends SymbolTracker {
|
|
7
7
|
readonly resolver: DeclarationEmitResolver;
|
|
8
8
|
readonly isolatedDeclarations: boolean;
|
|
@@ -4,6 +4,7 @@ import { BinaryExpression, ExportAssignment, Identifier, getExpression } from '.
|
|
|
4
4
|
import { getNameOfDeclaration, getSourceFileOfNode } from '../binder-utilities.js';
|
|
5
5
|
import { createDiagnosticForNode, createIsolatedDeclarationError, getSymbolAccessibilityDiagnostic, nameToString, noDiagnosticContext, textOfNode, } from './declarations-diagnostics.js';
|
|
6
6
|
import { SymbolTracker, } from './declarations-resolver.js';
|
|
7
|
+
import { getDeclarations } from '../symbol.js';
|
|
7
8
|
export class DeclarationTracker extends SymbolTracker {
|
|
8
9
|
resolver;
|
|
9
10
|
isolatedDeclarations;
|
|
@@ -105,14 +106,14 @@ export class DeclarationTracker extends SymbolTracker {
|
|
|
105
106
|
}
|
|
106
107
|
reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
|
|
107
108
|
let primary = undefined;
|
|
108
|
-
for (const declaration of parentSymbol
|
|
109
|
+
for (const declaration of getDeclarations(parentSymbol))
|
|
109
110
|
if (getSourceFileOfNode(declaration) === containingFile) {
|
|
110
111
|
primary = declaration;
|
|
111
112
|
break;
|
|
112
113
|
}
|
|
113
114
|
if (primary === undefined)
|
|
114
115
|
return false;
|
|
115
|
-
for (const augmentation of augmentingSymbol
|
|
116
|
+
for (const augmentation of getDeclarations(augmentingSymbol)) {
|
|
116
117
|
if (getSourceFileOfNode(augmentation) === containingFile)
|
|
117
118
|
continue;
|
|
118
119
|
const diagnostic = createDiagnosticForNode(augmentation, 1384 /* Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized */, []);
|
|
@@ -13,6 +13,7 @@ import { getRelativePathToDirectoryOrUrl } from '../sourcemap.js';
|
|
|
13
13
|
import { DiagnosticContext, canProduceDiagnostics, createDiagnosticForNode, declarationContext, declarationNameContext, noDiagnosticContext, } from './declarations-diagnostics.js';
|
|
14
14
|
import { DeclarationTracker } from './declarations-tracker.js';
|
|
15
15
|
import { Transformer } from './transformer.js';
|
|
16
|
+
import { declarationCount, getDeclarations } from '../symbol.js';
|
|
16
17
|
export class DeclarationTransformer extends Transformer {
|
|
17
18
|
host;
|
|
18
19
|
options;
|
|
@@ -191,9 +192,9 @@ export class DeclarationTransformer extends Transformer {
|
|
|
191
192
|
reportMultipleModuleExports(file) {
|
|
192
193
|
const symbol = file.symbol;
|
|
193
194
|
const exportEquals = symbol === undefined || symbol.exports === undefined ? undefined : symbol.exports.get('export=');
|
|
194
|
-
if (exportEquals === undefined || exportEquals
|
|
195
|
+
if (exportEquals === undefined || declarationCount(exportEquals) <= 1)
|
|
195
196
|
return false;
|
|
196
|
-
for (const declaration of exportEquals
|
|
197
|
+
for (const declaration of getDeclarations(exportEquals))
|
|
197
198
|
this.tracker.addDiagnostic(createDiagnosticForNode(declaration, 1513 /* Diagnostics.Multiple_module_exports_assignments_cannot_be_serialized_for_declaration_emit */, []));
|
|
198
199
|
return true;
|
|
199
200
|
}
|
|
@@ -694,7 +695,7 @@ export class DeclarationTransformer extends Transformer {
|
|
|
694
695
|
/** A private method is written as a property without a type. */
|
|
695
696
|
omitPrivateMethodType(input) {
|
|
696
697
|
const symbol = getSymbol(input);
|
|
697
|
-
if (symbol !== undefined && symbol
|
|
698
|
+
if (symbol !== undefined && declarationCount(symbol) > 0 && symbol.declaration !== input)
|
|
698
699
|
return undefined;
|
|
699
700
|
const result = this.factory.created(new PropertyDeclaration(this.ensureModifiers(input), getName(input), undefined, undefined, undefined));
|
|
700
701
|
this.context.assignCommentRange(result, input);
|
|
@@ -2275,7 +2276,7 @@ function isCommonJSAliasExport(node) {
|
|
|
2275
2276
|
if (!(node instanceof BinaryExpression) || !(node.right instanceof Identifier))
|
|
2276
2277
|
return false;
|
|
2277
2278
|
const symbol = node.symbol;
|
|
2278
|
-
return symbol !== undefined && symbol
|
|
2279
|
+
return symbol !== undefined && declarationCount(symbol) === 1;
|
|
2279
2280
|
}
|
|
2280
2281
|
function getLeftmostAccessExpression(node) {
|
|
2281
2282
|
let current = node;
|
|
@@ -2290,7 +2291,7 @@ function shouldEmitFunctionProperties(fn) {
|
|
|
2290
2291
|
const symbol = fn.symbol;
|
|
2291
2292
|
if (symbol === undefined)
|
|
2292
2293
|
return false;
|
|
2293
|
-
for (const declaration of symbol
|
|
2294
|
+
for (const declaration of getDeclarations(symbol))
|
|
2294
2295
|
if (declaration instanceof FunctionDeclaration && declaration.body !== undefined)
|
|
2295
2296
|
return true;
|
|
2296
2297
|
return false;
|
|
@@ -48,8 +48,9 @@ export declare class ReferenceResolver {
|
|
|
48
48
|
private readonly enumValues;
|
|
49
49
|
private readonly computedEnums;
|
|
50
50
|
private readonly aliasTargets;
|
|
51
|
-
/** Value symbols of identifiers resolved as expressions, as the checker caches them. */
|
|
51
|
+
/** Value symbols of identifiers resolved as expressions, as the checker caches them, by node id. */
|
|
52
52
|
private readonly resolvedSymbols;
|
|
53
|
+
/** 1 for each identifier, by node id, that resolved to no value symbol. */
|
|
53
54
|
private readonly unresolvedReferences;
|
|
54
55
|
private readonly unresolvedAliases;
|
|
55
56
|
private readonly resolvingAliases;
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
import { ElementAccessExpression, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, Identifier, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ModuleDeclaration, NamespaceImport, NumericLiteral, ParenthesizedExpression, PrefixUnaryExpression, PropertyAccessExpression, QualifiedName, SourceFile, BinaryExpression, NoSubstitutionTemplateLiteral, StringLiteral, TemplateExpression, TemplateMiddle, TemplateSpan, TemplateTail, VariableDeclaration, ExternalModuleReference, getInitializer, getIsTypeOnly, getModuleSpecifier, getLocals, getName, getSymbol, getType, } from '../ast.js';
|
|
5
5
|
import { isFunctionLike } from '../ast-utilities.js';
|
|
6
6
|
import { getCombinedNodeFlags, getRootDeclaration, getSourceFileOfNode, isEnumConst, isExternalOrCommonJSModule, } from '../binder-utilities.js';
|
|
7
|
+
import { IntLinkTable, LinkTable } from '../link-tables.js';
|
|
7
8
|
import { NameResolver } from '../name-resolver.js';
|
|
8
9
|
import { isSameNode } from './utilities.js';
|
|
9
10
|
import { pathIsRelative } from '../path.js';
|
|
10
11
|
import { shouldPreserveConstEnums } from '../options.js';
|
|
11
|
-
import { Symbol,
|
|
12
|
+
import { addDeclaration, declarationAt, declarationCount, getDeclarations, setDeclarations, Symbol, } from '../symbol.js';
|
|
12
13
|
/** The result of evaluating a constant expression, as the checker's evaluator returns it. */
|
|
13
14
|
export class Evaluation {
|
|
14
15
|
kind;
|
|
@@ -126,7 +127,7 @@ export class MergedGlobals {
|
|
|
126
127
|
((source.flags | resolved.flags) & 67108864 /* SymbolFlags.Assignment */) === 0)
|
|
127
128
|
return source;
|
|
128
129
|
result = new Symbol(resolved.flags | 33554432 /* SymbolFlags.Transient */, resolved.name);
|
|
129
|
-
result
|
|
130
|
+
setDeclarations(result, getDeclarations(resolved).slice());
|
|
130
131
|
result.parent = resolved.parent;
|
|
131
132
|
result.valueDeclaration = resolved.valueDeclaration;
|
|
132
133
|
result.members = resolved.members === undefined ? undefined : new Map(resolved.members);
|
|
@@ -144,8 +145,8 @@ export class MergedGlobals {
|
|
|
144
145
|
result.flags |= sourceFlags;
|
|
145
146
|
if (source.valueDeclaration !== undefined)
|
|
146
147
|
setValueDeclaration(result, source.valueDeclaration);
|
|
147
|
-
for (let i = 0; i < source
|
|
148
|
-
addDeclaration(result, source
|
|
148
|
+
for (let i = 0; i < declarationCount(source); i++)
|
|
149
|
+
addDeclaration(result, declarationAt(source, i));
|
|
149
150
|
if (source.members !== undefined) {
|
|
150
151
|
if (result.members === undefined)
|
|
151
152
|
result.members = new Map();
|
|
@@ -244,8 +245,9 @@ export class ReferenceResolver {
|
|
|
244
245
|
enumValues;
|
|
245
246
|
computedEnums;
|
|
246
247
|
aliasTargets;
|
|
247
|
-
/** Value symbols of identifiers resolved as expressions, as the checker caches them. */
|
|
248
|
+
/** Value symbols of identifiers resolved as expressions, as the checker caches them, by node id. */
|
|
248
249
|
resolvedSymbols;
|
|
250
|
+
/** 1 for each identifier, by node id, that resolved to no value symbol. */
|
|
249
251
|
unresolvedReferences;
|
|
250
252
|
unresolvedAliases;
|
|
251
253
|
resolvingAliases;
|
|
@@ -262,8 +264,8 @@ export class ReferenceResolver {
|
|
|
262
264
|
this.enumValues = new Map();
|
|
263
265
|
this.computedEnums = new Set();
|
|
264
266
|
this.aliasTargets = new Map();
|
|
265
|
-
this.resolvedSymbols = new
|
|
266
|
-
this.unresolvedReferences = new
|
|
267
|
+
this.resolvedSymbols = new LinkTable();
|
|
268
|
+
this.unresolvedReferences = new IntLinkTable();
|
|
267
269
|
this.unresolvedAliases = new Set();
|
|
268
270
|
this.resolvingAliases = new Set();
|
|
269
271
|
this.specifierModules = new Map();
|
|
@@ -283,24 +285,24 @@ export class ReferenceResolver {
|
|
|
283
285
|
}
|
|
284
286
|
/** The value an identifier in an expression refers to, cached for later queries of the identifier. */
|
|
285
287
|
getResolvedSymbol(node) {
|
|
286
|
-
const cached = this.resolvedSymbols.get(node);
|
|
288
|
+
const cached = this.resolvedSymbols.get(node.id);
|
|
287
289
|
if (cached !== undefined)
|
|
288
290
|
return cached;
|
|
289
|
-
if (this.unresolvedReferences.
|
|
291
|
+
if (this.unresolvedReferences.get(node.id) !== 0)
|
|
290
292
|
return undefined;
|
|
291
293
|
const symbol = this.resolveName(node, node.text, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */);
|
|
292
294
|
if (symbol === undefined)
|
|
293
|
-
this.unresolvedReferences.
|
|
295
|
+
this.unresolvedReferences.set(node.id, 1);
|
|
294
296
|
else
|
|
295
|
-
this.resolvedSymbols.set(node, symbol);
|
|
297
|
+
this.resolvedSymbols.set(node.id, symbol);
|
|
296
298
|
return symbol;
|
|
297
299
|
}
|
|
298
300
|
getReferencedValueSymbol(reference, startInDeclarationContainer) {
|
|
299
301
|
// An identifier resolved as an expression keeps that meaning, as with the checker's cache.
|
|
300
|
-
const cached = this.resolvedSymbols.get(reference);
|
|
302
|
+
const cached = this.resolvedSymbols.get(reference.id);
|
|
301
303
|
if (cached !== undefined)
|
|
302
304
|
return cached;
|
|
303
|
-
if (this.unresolvedReferences.
|
|
305
|
+
if (this.unresolvedReferences.get(reference.id) !== 0)
|
|
304
306
|
return undefined;
|
|
305
307
|
let location = reference;
|
|
306
308
|
const parent = reference.parent;
|
|
@@ -360,7 +362,7 @@ export class ReferenceResolver {
|
|
|
360
362
|
getReferencedImportDeclaration(node) {
|
|
361
363
|
// As the checker: an identifier that didn't resolve as a value may still name an alias.
|
|
362
364
|
const reference = node;
|
|
363
|
-
let symbol = this.resolvedSymbols.get(reference);
|
|
365
|
+
let symbol = this.resolvedSymbols.get(reference.id);
|
|
364
366
|
if (symbol === undefined)
|
|
365
367
|
symbol = this.resolveName(node, node.text, valueMeaning);
|
|
366
368
|
if (symbol === undefined ||
|
|
@@ -394,7 +396,7 @@ export class ReferenceResolver {
|
|
|
394
396
|
return undefined;
|
|
395
397
|
const symbol = this.getExportSymbolOfValueSymbolIfExported(resolved);
|
|
396
398
|
const declarations = [];
|
|
397
|
-
for (const declaration of symbol
|
|
399
|
+
for (const declaration of getDeclarations(symbol))
|
|
398
400
|
if (isValueDeclarationKind(declaration.kind))
|
|
399
401
|
declarations.push(declaration);
|
|
400
402
|
return declarations;
|
|
@@ -444,7 +446,7 @@ export class ReferenceResolver {
|
|
|
444
446
|
const star = exports.get("\uFFFEexport" /* InternalSymbolName.ExportStar */);
|
|
445
447
|
if (star === undefined)
|
|
446
448
|
return false;
|
|
447
|
-
for (const declaration of star
|
|
449
|
+
for (const declaration of getDeclarations(star)) {
|
|
448
450
|
if (!(declaration instanceof ExportDeclaration))
|
|
449
451
|
continue;
|
|
450
452
|
const target = this.resolveExternalModuleSymbol(this.resolveModuleSpecifier(declaration, declaration.moduleSpecifier));
|
|
@@ -456,9 +458,9 @@ export class ReferenceResolver {
|
|
|
456
458
|
}
|
|
457
459
|
/** Whether a symbol is declared in the global scope. */
|
|
458
460
|
isGlobalSymbol(symbol) {
|
|
459
|
-
if (symbol
|
|
461
|
+
if (declarationCount(symbol) === 0)
|
|
460
462
|
return false;
|
|
461
|
-
const container = getDeclarationContainer(symbol.
|
|
463
|
+
const container = getDeclarationContainer(symbol.declaration);
|
|
462
464
|
return container instanceof SourceFile && !isExternalOrCommonJSModule(container);
|
|
463
465
|
}
|
|
464
466
|
/** Whether a symbol is a value at runtime: const enums aren't unless preserved. */
|
|
@@ -677,7 +679,7 @@ export class ReferenceResolver {
|
|
|
677
679
|
const star = exports.get("\uFFFEexport" /* InternalSymbolName.ExportStar */);
|
|
678
680
|
if (star === undefined)
|
|
679
681
|
return undefined;
|
|
680
|
-
for (const declaration of star
|
|
682
|
+
for (const declaration of getDeclarations(star)) {
|
|
681
683
|
if (!(declaration instanceof ExportDeclaration))
|
|
682
684
|
continue;
|
|
683
685
|
const target = this.resolveExternalModuleSymbol(this.resolveModuleSpecifier(declaration, declaration.moduleSpecifier));
|
|
@@ -877,7 +879,7 @@ export class ReferenceResolver {
|
|
|
877
879
|
return noEvaluation;
|
|
878
880
|
if (expression instanceof Identifier && (expression.text === 'Infinity' || expression.text === 'NaN')) {
|
|
879
881
|
// A global `Infinity` or `NaN`; without lib files these don't resolve at all.
|
|
880
|
-
if (symbol
|
|
882
|
+
if (declarationCount(symbol) > 0 && isAmbientGlobal(symbol))
|
|
881
883
|
return numberEvaluation(expression.text === 'NaN' ? NaN : Infinity);
|
|
882
884
|
}
|
|
883
885
|
if ((symbol.flags & 8 /* SymbolFlags.EnumMember */) !== 0)
|
|
@@ -983,8 +985,8 @@ export function isEntityNameExpressionNode(node) {
|
|
|
983
985
|
return false;
|
|
984
986
|
}
|
|
985
987
|
function isAmbientGlobal(symbol) {
|
|
986
|
-
for (let i = 0; i < symbol
|
|
987
|
-
if ((symbol
|
|
988
|
+
for (let i = 0; i < declarationCount(symbol); i++)
|
|
989
|
+
if ((declarationAt(symbol, i).flags & 8388608 /* NodeFlags.Ambient */) === 0)
|
|
988
990
|
return false;
|
|
989
991
|
return true;
|
|
990
992
|
}
|
|
@@ -1067,8 +1069,8 @@ function isAliasSymbolDeclaration(node) {
|
|
|
1067
1069
|
return false;
|
|
1068
1070
|
}
|
|
1069
1071
|
export function getDeclarationOfAliasSymbol(symbol) {
|
|
1070
|
-
for (let i = symbol
|
|
1071
|
-
const declaration = symbol
|
|
1072
|
+
for (let i = declarationCount(symbol) - 1; i >= 0; i--) {
|
|
1073
|
+
const declaration = declarationAt(symbol, i);
|
|
1072
1074
|
if (isAliasSymbolDeclaration(declaration))
|
|
1073
1075
|
return declaration;
|
|
1074
1076
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Node, NodeVisitor } from '../ast.js';
|
|
2
2
|
/** Memoized `containsTypeScript` answers for one emit. */
|
|
3
3
|
export declare class TypeScriptFacts extends NodeVisitor {
|
|
4
|
+
/** The answer for each node, by node id. */
|
|
4
5
|
private readonly cache;
|
|
5
6
|
private found;
|
|
6
7
|
constructor();
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
// Whether a subtree contains TypeScript-only syntax, computed as tsgo's subtree facts are.
|
|
2
2
|
// Transforms skip subtrees without it; that also decides how malformed code is emitted.
|
|
3
3
|
import { ClassDeclaration, ClassExpression, ConstructorDeclaration, ExportAssignment, ExportDeclaration, ExportSpecifier, FunctionDeclaration, GetAccessorDeclaration, Identifier, ImportClause, ImportEqualsDeclaration, ImportSpecifier, MethodDeclaration, NodeVisitor, ParameterDeclaration, PropertyDeclaration, SetAccessorDeclaration, VariableDeclaration, VariableStatement, ArrowFunction, FunctionExpression, CallExpression, NewExpression, TaggedTemplateExpression, ExpressionWithTypeArguments, JsxOpeningElement, JsxSelfClosingElement, HeritageClause, getModifiers, } from '../ast.js';
|
|
4
|
+
import { ClusteredIntLinkTable } from '../link-tables.js';
|
|
4
5
|
import { isTypeNodeKind } from '../printer/utilities.js';
|
|
5
6
|
/** Memoized `containsTypeScript` answers for one emit. */
|
|
6
7
|
export class TypeScriptFacts extends NodeVisitor {
|
|
8
|
+
/** The answer for each node, by node id. */
|
|
7
9
|
cache;
|
|
8
10
|
found;
|
|
9
11
|
constructor() {
|
|
10
12
|
super();
|
|
11
|
-
this.cache = new
|
|
13
|
+
this.cache = new ClusteredIntLinkTable();
|
|
12
14
|
this.found = false;
|
|
13
15
|
}
|
|
14
16
|
containsTypeScript(node) {
|
|
15
|
-
const cached = this.cache.get(node);
|
|
16
|
-
if (cached !==
|
|
17
|
-
return cached
|
|
17
|
+
const cached = this.cache.get(node.id);
|
|
18
|
+
if (cached !== 0)
|
|
19
|
+
return cached === 2 /* Answer.Yes */;
|
|
18
20
|
const own = ownFacts(node);
|
|
19
21
|
let result = (own & 1 /* Facts.TypeScript */) !== 0;
|
|
20
22
|
if (!result && (own & 2 /* Facts.Final */) === 0) {
|
|
@@ -24,7 +26,7 @@ export class TypeScriptFacts extends NodeVisitor {
|
|
|
24
26
|
result = this.found;
|
|
25
27
|
this.found = saved;
|
|
26
28
|
}
|
|
27
|
-
this.cache.set(node, result);
|
|
29
|
+
this.cache.set(node.id, result ? 2 /* Answer.Yes */ : 1 /* Answer.No */);
|
|
28
30
|
return result;
|
|
29
31
|
}
|
|
30
32
|
visitNode(node) {
|
|
@@ -30,6 +30,7 @@ export declare const enum SubtreeFacts {
|
|
|
30
30
|
}
|
|
31
31
|
/** Memoized subtree facts for one emit; synthesized nodes get theirs on first use. */
|
|
32
32
|
export declare class SyntaxFacts extends NodeVisitor {
|
|
33
|
+
/** The facts of each node, by node id, with `computedFacts` set. */
|
|
33
34
|
private readonly cache;
|
|
34
35
|
private collected;
|
|
35
36
|
constructor();
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
// What syntax a subtree contains, computed as tsgo's subtree facts are. Downlevel transforms
|
|
2
2
|
// skip subtrees without the syntax they lower.
|
|
3
3
|
import { BindingElement, CallExpression, CatchClause, ForInOrOfStatement, Identifier, MetaProperty, NodeVisitor, NoSubstitutionTemplateLiteral, PropertyAccessExpression, TemplateHead, TemplateMiddle, TemplateTail, VariableDeclarationList, getModifiers, getName, } from '../ast.js';
|
|
4
|
+
import { ClusteredIntLinkTable } from '../link-tables.js';
|
|
4
5
|
import { isTypeNodeKind } from '../printer/utilities.js';
|
|
5
6
|
import { getElementsOfBindingOrAssignmentPattern, getTargetOfBindingOrAssignmentElement } from './destructuring.js';
|
|
7
|
+
/** Marks a computed entry of `SyntaxFacts.cache`, whose facts may be `None`. */
|
|
8
|
+
const computedFacts = 1 << 30;
|
|
6
9
|
/** Memoized subtree facts for one emit; synthesized nodes get theirs on first use. */
|
|
7
10
|
export class SyntaxFacts extends NodeVisitor {
|
|
11
|
+
/** The facts of each node, by node id, with `computedFacts` set. */
|
|
8
12
|
cache;
|
|
9
13
|
collected;
|
|
10
14
|
constructor() {
|
|
11
15
|
super();
|
|
12
|
-
this.cache = new
|
|
16
|
+
this.cache = new ClusteredIntLinkTable();
|
|
13
17
|
this.collected = 0 /* SubtreeFacts.None */;
|
|
14
18
|
}
|
|
15
19
|
of(node) {
|
|
16
|
-
const cached = this.cache.get(node);
|
|
17
|
-
if (cached !==
|
|
18
|
-
return cached;
|
|
20
|
+
const cached = this.cache.get(node.id);
|
|
21
|
+
if (cached !== 0)
|
|
22
|
+
return cached & ~computedFacts;
|
|
19
23
|
const facts = this.compute(node);
|
|
20
|
-
this.cache.set(node, facts);
|
|
24
|
+
this.cache.set(node.id, facts | computedFacts);
|
|
21
25
|
return facts;
|
|
22
26
|
}
|
|
23
27
|
has(node, facts) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// inherited members) serialize as `Object`.
|
|
6
6
|
import { ArrayTypeNode, EnumDeclaration, Identifier, ImportClause, InterfaceDeclaration, LiteralTypeNode, ParenthesizedTypeNode, PrefixUnaryExpression, QualifiedName, TypeAliasDeclaration, TypeLiteralNode, TypeOperatorNode, TypeParameterDeclaration, TypeReferenceNode, UnionTypeNode, VariableDeclaration, getIsTypeOnly, } from '../ast.js';
|
|
7
7
|
import { getStrictOptionValue } from '../options.js';
|
|
8
|
-
import { Symbol } from '../symbol.js';
|
|
8
|
+
import { declarationAt, declarationCount, getDeclarations, Symbol } from '../symbol.js';
|
|
9
9
|
/** What an unresolvable alias resolves to, as the checker's unknown symbol. */
|
|
10
10
|
const unknownSymbol = new Symbol(1073741823 /* SymbolFlags.All */, 'unknown');
|
|
11
11
|
/** Nested type aliases followed before giving up. */
|
|
@@ -17,9 +17,9 @@ export function getTypeReferenceSerializationKind(resolver, typeName, location)
|
|
|
17
17
|
let isTypeOnly = false;
|
|
18
18
|
if (typeName instanceof QualifiedName) {
|
|
19
19
|
const root = resolveEntityName(resolver, getFirstIdentifier(typeName), 111551 /* SymbolFlags.Value */, true, location);
|
|
20
|
-
if (root !== undefined && root !== unknownSymbol && root
|
|
20
|
+
if (root !== undefined && root !== unknownSymbol && declarationCount(root) > 0) {
|
|
21
21
|
isTypeOnly = true;
|
|
22
|
-
for (const declaration of root
|
|
22
|
+
for (const declaration of getDeclarations(root))
|
|
23
23
|
if (!isTypeOnlyImportOrExportDeclaration(declaration)) {
|
|
24
24
|
isTypeOnly = false;
|
|
25
25
|
break;
|
|
@@ -120,8 +120,8 @@ function hasConstructSignature(resolver, type, location, depth) {
|
|
|
120
120
|
const symbol = resolveEntityName(resolver, type.typeName, 788968 /* SymbolFlags.Type */, false, location);
|
|
121
121
|
if (symbol === undefined || symbol === unknownSymbol)
|
|
122
122
|
return false;
|
|
123
|
-
for (let i = 0; i < symbol
|
|
124
|
-
const declaration = symbol
|
|
123
|
+
for (let i = 0; i < declarationCount(symbol); i++) {
|
|
124
|
+
const declaration = declarationAt(symbol, i);
|
|
125
125
|
if (declaration instanceof InterfaceDeclaration &&
|
|
126
126
|
hasMember(declaration.members.nodes, 181 /* SyntaxKind.ConstructSignature */))
|
|
127
127
|
return true;
|
|
@@ -160,22 +160,22 @@ class TypeClassifier {
|
|
|
160
160
|
if ((flags & 32 /* SymbolFlags.Class */) !== 0)
|
|
161
161
|
return 11 /* TypeReferenceSerializationKind.ObjectType */;
|
|
162
162
|
if ((flags & 524288 /* SymbolFlags.TypeAlias */) !== 0) {
|
|
163
|
-
for (let i = 0; i < symbol
|
|
164
|
-
const declaration = symbol
|
|
163
|
+
for (let i = 0; i < declarationCount(symbol); i++) {
|
|
164
|
+
const declaration = declarationAt(symbol, i);
|
|
165
165
|
if (declaration instanceof TypeAliasDeclaration)
|
|
166
166
|
return this.ofTypeNode(declaration.type, declaration, depth + 1);
|
|
167
167
|
}
|
|
168
168
|
return 11 /* TypeReferenceSerializationKind.ObjectType */;
|
|
169
169
|
}
|
|
170
170
|
if ((flags & 262144 /* SymbolFlags.TypeParameter */) !== 0) {
|
|
171
|
-
const declaration = symbol
|
|
171
|
+
const declaration = declarationCount(symbol) > 0 ? symbol.declaration : undefined;
|
|
172
172
|
if (declaration instanceof TypeParameterDeclaration && declaration.constraint !== undefined)
|
|
173
173
|
return this.ofTypeNode(declaration.constraint, declaration, depth + 1);
|
|
174
174
|
return 11 /* TypeReferenceSerializationKind.ObjectType */;
|
|
175
175
|
}
|
|
176
176
|
if ((flags & 64 /* SymbolFlags.Interface */) !== 0) {
|
|
177
|
-
for (let i = 0; i < symbol
|
|
178
|
-
const declaration = symbol
|
|
177
|
+
for (let i = 0; i < declarationCount(symbol); i++) {
|
|
178
|
+
const declaration = declarationAt(symbol, i);
|
|
179
179
|
if (declaration instanceof InterfaceDeclaration &&
|
|
180
180
|
hasMember(declaration.members.nodes, 180 /* SyntaxKind.CallSignature */))
|
|
181
181
|
return 10 /* TypeReferenceSerializationKind.TypeWithCallSignature */;
|
|
@@ -187,8 +187,8 @@ class TypeClassifier {
|
|
|
187
187
|
ofEnum(symbol) {
|
|
188
188
|
let strings = false;
|
|
189
189
|
let numbers = false;
|
|
190
|
-
for (let i = 0; i < symbol
|
|
191
|
-
const declaration = symbol
|
|
190
|
+
for (let i = 0; i < declarationCount(symbol); i++) {
|
|
191
|
+
const declaration = declarationAt(symbol, i);
|
|
192
192
|
if (!(declaration instanceof EnumDeclaration))
|
|
193
193
|
continue;
|
|
194
194
|
const members = declaration.members.nodes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsc-ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "The TypeScript 7 compiler, ported to TypeScript and compiled to a native executable.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scriptc/threads": "0.
|
|
32
|
+
"@scriptc/threads": "0.4.1"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=20"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@tsc-ts/darwin-arm64": "0.0.
|
|
39
|
-
"@tsc-ts/darwin-x64": "0.0.
|
|
40
|
-
"@tsc-ts/linux-arm64-gnu": "0.0.
|
|
41
|
-
"@tsc-ts/linux-arm64-musl": "0.0.
|
|
42
|
-
"@tsc-ts/linux-x64-gnu": "0.0.
|
|
43
|
-
"@tsc-ts/linux-x64-musl": "0.0.
|
|
44
|
-
"@tsc-ts/win32-x64-msvc": "0.0.
|
|
38
|
+
"@tsc-ts/darwin-arm64": "0.0.6",
|
|
39
|
+
"@tsc-ts/darwin-x64": "0.0.6",
|
|
40
|
+
"@tsc-ts/linux-arm64-gnu": "0.0.6",
|
|
41
|
+
"@tsc-ts/linux-arm64-musl": "0.0.6",
|
|
42
|
+
"@tsc-ts/linux-x64-gnu": "0.0.6",
|
|
43
|
+
"@tsc-ts/linux-x64-musl": "0.0.6",
|
|
44
|
+
"@tsc-ts/win32-x64-msvc": "0.0.6"
|
|
45
45
|
}
|
|
46
46
|
}
|