typescript 7.1.0-dev.20261019.1 → 7.1.0-dev.20261020.3
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/api/async/api.d.ts +21 -5
- package/dist/api/async/api.d.ts.map +1 -1
- package/dist/api/async/api.js +216 -159
- package/dist/api/async/api.js.map +1 -1
- package/dist/api/node/node.d.ts +3 -1
- package/dist/api/node/node.d.ts.map +1 -1
- package/dist/api/node/node.js +47 -4
- package/dist/api/node/node.js.map +1 -1
- package/dist/api/proto.d.ts +2 -2
- package/dist/api/proto.d.ts.map +1 -1
- package/dist/api/proto.generated.d.ts +62 -60
- package/dist/api/proto.generated.d.ts.map +1 -1
- package/dist/api/proto.js.map +1 -1
- package/dist/api/sync/api.d.ts +21 -5
- package/dist/api/sync/api.d.ts.map +1 -1
- package/dist/api/sync/api.js +353 -296
- package/dist/api/sync/api.js.map +1 -1
- package/dist/ast/astnav.d.ts.map +1 -1
- package/dist/ast/astnav.js +203 -86
- package/dist/ast/astnav.js.map +1 -1
- package/package.json +9 -9
package/dist/api/async/api.js
CHANGED
|
@@ -21,7 +21,7 @@ import { TypePredicateKind } from "#enums/typePredicateKind";
|
|
|
21
21
|
import { ModifierFlags, unescapeLeadingUnderscores, } from "../../ast/index.js";
|
|
22
22
|
import { assertNever } from "../../internal/utils.js";
|
|
23
23
|
import { encodeNode, uint8ArrayToBase64, } from "../node/encoder.js";
|
|
24
|
-
import { decodeNode, getNodeId, parseNodeHandleFromCompiler, readParseOptionsKey, readSourceFileHash, readSourceFileLease, RemoteNode, RemoteSourceFile, } from "../node/node.js";
|
|
24
|
+
import { decodeNode, getNodeId, getNodeRequestHandle, parseNodeHandleFromCompiler, readParseOptionsKey, readSourceFileHash, readSourceFileLease, RemoteNode, RemoteSourceFile, } from "../node/node.js";
|
|
25
25
|
import { Wtf8Decoder } from "../node/wtf8.js";
|
|
26
26
|
import { canonicalize, CaseSensitivity, pathKey, toRootedDirectoryPath, toRootedPath, } from "../path.js";
|
|
27
27
|
import { prepareCompilerOptions } from "../prepareCompilerOptions.generated.js";
|
|
@@ -735,13 +735,15 @@ export class ModuleResolver {
|
|
|
735
735
|
}
|
|
736
736
|
class SnapshotObjectRegistry {
|
|
737
737
|
symbols = new Map();
|
|
738
|
+
nodeHandles = new Map();
|
|
738
739
|
projectRegistries = new Map();
|
|
739
740
|
snapshotId;
|
|
741
|
+
disposed = false;
|
|
740
742
|
constructor(snapshotId) {
|
|
741
743
|
this.snapshotId = snapshotId;
|
|
742
744
|
}
|
|
743
745
|
addProjectRegistry(registry) {
|
|
744
|
-
this.projectRegistries.set(registry.project.
|
|
746
|
+
this.projectRegistries.set(registry.project.handle, registry);
|
|
745
747
|
}
|
|
746
748
|
getOrCreateSymbol(data) {
|
|
747
749
|
const reference = data.reference;
|
|
@@ -763,8 +765,19 @@ class SnapshotObjectRegistry {
|
|
|
763
765
|
getSymbol(id) {
|
|
764
766
|
return this.symbols.get(id);
|
|
765
767
|
}
|
|
768
|
+
getOrCreateNodeHandle(handle, project) {
|
|
769
|
+
let node = this.nodeHandles.get(handle);
|
|
770
|
+
if (!node) {
|
|
771
|
+
node = new NodeHandle(handle, project);
|
|
772
|
+
if (!this.disposed)
|
|
773
|
+
this.nodeHandles.set(handle, node);
|
|
774
|
+
}
|
|
775
|
+
return node;
|
|
776
|
+
}
|
|
766
777
|
clear() {
|
|
778
|
+
this.disposed = true;
|
|
767
779
|
this.symbols.clear();
|
|
780
|
+
this.nodeHandles.clear();
|
|
768
781
|
}
|
|
769
782
|
}
|
|
770
783
|
class ProjectObjectRegistry {
|
|
@@ -824,7 +837,7 @@ class ProjectObjectRegistry {
|
|
|
824
837
|
return this.types.get(id);
|
|
825
838
|
}
|
|
826
839
|
createNodeHandle(handle) {
|
|
827
|
-
return
|
|
840
|
+
return this.snapshotRegistry.getOrCreateNodeHandle(handle, this.project);
|
|
828
841
|
}
|
|
829
842
|
getOrCreateSignature(data) {
|
|
830
843
|
let sig = this.signatures.get(data.id);
|
|
@@ -856,7 +869,7 @@ class ProjectObjectRegistry {
|
|
|
856
869
|
}
|
|
857
870
|
const data = await this.client.apiRequest(method, {
|
|
858
871
|
snapshot: this.snapshotId,
|
|
859
|
-
project: this.project.
|
|
872
|
+
project: this.project.handle,
|
|
860
873
|
objectId: source.id,
|
|
861
874
|
});
|
|
862
875
|
if (!data)
|
|
@@ -879,7 +892,7 @@ class ProjectObjectRegistry {
|
|
|
879
892
|
? await this.client.apiRequest(method, { symbol: source.reference })
|
|
880
893
|
: await this.client.apiRequest(method, {
|
|
881
894
|
snapshot: this.snapshotId,
|
|
882
|
-
project: this.project.
|
|
895
|
+
project: this.project.handle,
|
|
883
896
|
objectId: source.id,
|
|
884
897
|
});
|
|
885
898
|
if (!data)
|
|
@@ -894,7 +907,7 @@ class ProjectObjectRegistry {
|
|
|
894
907
|
return cached;
|
|
895
908
|
const data = await this.client.apiRequest(method, {
|
|
896
909
|
snapshot: this.snapshotId,
|
|
897
|
-
project: this.project.
|
|
910
|
+
project: this.project.handle,
|
|
898
911
|
objectId: source.id,
|
|
899
912
|
});
|
|
900
913
|
if (!data)
|
|
@@ -918,7 +931,7 @@ class ProjectObjectRegistry {
|
|
|
918
931
|
}
|
|
919
932
|
const typesData = await this.client.apiRequest(method, {
|
|
920
933
|
snapshot: this.snapshotId,
|
|
921
|
-
project: this.project.
|
|
934
|
+
project: this.project.handle,
|
|
922
935
|
objectId: source.id,
|
|
923
936
|
});
|
|
924
937
|
if (typesData == null)
|
|
@@ -945,7 +958,7 @@ class ProjectObjectRegistry {
|
|
|
945
958
|
? await this.client.apiRequest(method, { symbol: source.reference })
|
|
946
959
|
: await this.client.apiRequest(method, {
|
|
947
960
|
snapshot: this.snapshotId,
|
|
948
|
-
project: this.project.
|
|
961
|
+
project: this.project.handle,
|
|
949
962
|
objectId: source.id,
|
|
950
963
|
});
|
|
951
964
|
return data?.map(symbol => this.getOrCreateSymbol(symbol)) ?? [];
|
|
@@ -955,7 +968,7 @@ class ProjectObjectRegistry {
|
|
|
955
968
|
async fetchBaseTypes(source) {
|
|
956
969
|
const typesData = await this.client.apiRequest("getBaseTypes", {
|
|
957
970
|
snapshot: this.snapshotId,
|
|
958
|
-
project: this.project.
|
|
971
|
+
project: this.project.handle,
|
|
959
972
|
type: source.id,
|
|
960
973
|
});
|
|
961
974
|
if (typesData == null)
|
|
@@ -965,7 +978,7 @@ class ProjectObjectRegistry {
|
|
|
965
978
|
async fetchPropertiesOfType(source) {
|
|
966
979
|
const data = await this.client.apiRequest("getPropertiesOfType", {
|
|
967
980
|
snapshot: this.snapshotId,
|
|
968
|
-
project: this.project.
|
|
981
|
+
project: this.project.handle,
|
|
969
982
|
type: source.id,
|
|
970
983
|
});
|
|
971
984
|
return data ? data.map(symbol => this.getOrCreateSymbol(symbol)) : [];
|
|
@@ -973,7 +986,7 @@ class ProjectObjectRegistry {
|
|
|
973
986
|
async fetchApparentPropertiesOfType(source) {
|
|
974
987
|
const data = await this.client.apiRequest("getApparentPropertiesOfType", {
|
|
975
988
|
snapshot: this.snapshotId,
|
|
976
|
-
project: this.project.
|
|
989
|
+
project: this.project.handle,
|
|
977
990
|
objectId: source.id,
|
|
978
991
|
});
|
|
979
992
|
return data ? data.map(symbol => this.getOrCreateSymbol(symbol)) : [];
|
|
@@ -981,7 +994,7 @@ class ProjectObjectRegistry {
|
|
|
981
994
|
async fetchPropertyOfType(source, name) {
|
|
982
995
|
const data = await this.client.apiRequest("getPropertyOfType", {
|
|
983
996
|
snapshot: this.snapshotId,
|
|
984
|
-
project: this.project.
|
|
997
|
+
project: this.project.handle,
|
|
985
998
|
type: source.id,
|
|
986
999
|
name,
|
|
987
1000
|
});
|
|
@@ -990,7 +1003,7 @@ class ProjectObjectRegistry {
|
|
|
990
1003
|
async fetchSignaturesOfType(source, kind) {
|
|
991
1004
|
const data = await this.client.apiRequest("getSignaturesOfType", {
|
|
992
1005
|
snapshot: this.snapshotId,
|
|
993
|
-
project: this.project.
|
|
1006
|
+
project: this.project.handle,
|
|
994
1007
|
type: source.id,
|
|
995
1008
|
kind,
|
|
996
1009
|
});
|
|
@@ -999,7 +1012,7 @@ class ProjectObjectRegistry {
|
|
|
999
1012
|
async fetchIndexInfosOfType(source) {
|
|
1000
1013
|
const data = await this.client.apiRequest("getIndexInfosOfType", {
|
|
1001
1014
|
snapshot: this.snapshotId,
|
|
1002
|
-
project: this.project.
|
|
1015
|
+
project: this.project.handle,
|
|
1003
1016
|
type: source.id,
|
|
1004
1017
|
});
|
|
1005
1018
|
if (!data)
|
|
@@ -1008,13 +1021,13 @@ class ProjectObjectRegistry {
|
|
|
1008
1021
|
keyType: this.getOrCreateType(info.keyType),
|
|
1009
1022
|
valueType: this.getOrCreateType(info.valueType),
|
|
1010
1023
|
isReadonly: info.isReadonly ?? false,
|
|
1011
|
-
declaration: info.declaration ?
|
|
1024
|
+
declaration: info.declaration ? this.createNodeHandle(info.declaration) : undefined,
|
|
1012
1025
|
}));
|
|
1013
1026
|
}
|
|
1014
1027
|
async fetchTypeParameterAtPosition(source, pos) {
|
|
1015
1028
|
const data = await this.client.apiRequest("getTypeParameterAtPosition", {
|
|
1016
1029
|
snapshot: this.snapshotId,
|
|
1017
|
-
project: this.project.
|
|
1030
|
+
project: this.project.handle,
|
|
1018
1031
|
signature: source.id,
|
|
1019
1032
|
index: pos,
|
|
1020
1033
|
});
|
|
@@ -1025,6 +1038,11 @@ export class Project {
|
|
|
1025
1038
|
/** @internal */
|
|
1026
1039
|
api;
|
|
1027
1040
|
id;
|
|
1041
|
+
/**
|
|
1042
|
+
* Server identity for this project's lifetime across snapshots.
|
|
1043
|
+
* @internal
|
|
1044
|
+
*/
|
|
1045
|
+
handle;
|
|
1028
1046
|
configFileName;
|
|
1029
1047
|
currentDirectory;
|
|
1030
1048
|
dirty;
|
|
@@ -1034,6 +1052,7 @@ export class Project {
|
|
|
1034
1052
|
languageService;
|
|
1035
1053
|
constructor(data, snapshotId, toPath, api, snapshotRegistry) {
|
|
1036
1054
|
this.id = data.id;
|
|
1055
|
+
this.handle = data.handle;
|
|
1037
1056
|
this.api = api;
|
|
1038
1057
|
this.configFileName = data.configFileName;
|
|
1039
1058
|
this.currentDirectory = data.currentDirectory;
|
|
@@ -1081,7 +1100,7 @@ export class LanguageService {
|
|
|
1081
1100
|
});
|
|
1082
1101
|
const data = await this.client.apiRequest("getImportAdderEdits", {
|
|
1083
1102
|
snapshot: this.snapshotId,
|
|
1084
|
-
project: this.project.
|
|
1103
|
+
project: this.project.handle,
|
|
1085
1104
|
file,
|
|
1086
1105
|
actions: requestActions,
|
|
1087
1106
|
});
|
|
@@ -1105,31 +1124,31 @@ export class LanguageService {
|
|
|
1105
1124
|
async getReferencedSymbolsForNode(node, position) {
|
|
1106
1125
|
const data = await this.client.apiRequest("getReferencedSymbolsForNode", {
|
|
1107
1126
|
snapshot: this.snapshotId,
|
|
1108
|
-
project: this.project.
|
|
1109
|
-
node:
|
|
1127
|
+
project: this.project.handle,
|
|
1128
|
+
node: getNodeRequestHandle(node),
|
|
1110
1129
|
position,
|
|
1111
1130
|
});
|
|
1112
1131
|
return (data ?? []).map(entry => ({
|
|
1113
|
-
definition:
|
|
1132
|
+
definition: this.objectRegistry.createNodeHandle(entry.definition),
|
|
1114
1133
|
symbol: entry.symbol ? this.objectRegistry.getOrCreateSymbol(entry.symbol) : undefined,
|
|
1115
|
-
references: (entry.references ?? []).map(h =>
|
|
1134
|
+
references: (entry.references ?? []).map(h => this.objectRegistry.createNodeHandle(h)),
|
|
1116
1135
|
}));
|
|
1117
1136
|
}
|
|
1118
1137
|
async getSignatureUsage(signatureDecl) {
|
|
1119
1138
|
const data = await this.client.apiRequest("getSignatureUsages", {
|
|
1120
1139
|
snapshot: this.snapshotId,
|
|
1121
|
-
project: this.project.
|
|
1122
|
-
signatureDecl:
|
|
1140
|
+
project: this.project.handle,
|
|
1141
|
+
signatureDecl: getNodeRequestHandle(signatureDecl),
|
|
1123
1142
|
});
|
|
1124
1143
|
return (data ?? []).map(entry => ({
|
|
1125
|
-
name:
|
|
1126
|
-
call: entry.call ?
|
|
1144
|
+
name: this.objectRegistry.createNodeHandle(entry.name),
|
|
1145
|
+
call: entry.call ? this.objectRegistry.createNodeHandle(entry.call) : undefined,
|
|
1127
1146
|
}));
|
|
1128
1147
|
}
|
|
1129
1148
|
async getCompletionsAtPosition(document, position, options) {
|
|
1130
1149
|
const data = await this.client.apiRequest("getCompletionsAtPosition", {
|
|
1131
1150
|
snapshot: this.snapshotId,
|
|
1132
|
-
project: this.project.
|
|
1151
|
+
project: this.project.handle,
|
|
1133
1152
|
file: document,
|
|
1134
1153
|
position,
|
|
1135
1154
|
triggerCharacter: options?.triggerCharacter,
|
|
@@ -1159,7 +1178,7 @@ export class LanguageService {
|
|
|
1159
1178
|
const base64 = uint8ArrayToBase64(encoded);
|
|
1160
1179
|
return this.client.apiRequest("formatNodeForInsertion", {
|
|
1161
1180
|
snapshot: this.snapshotId,
|
|
1162
|
-
project: this.project.
|
|
1181
|
+
project: this.project.handle,
|
|
1163
1182
|
file,
|
|
1164
1183
|
position,
|
|
1165
1184
|
data: base64,
|
|
@@ -1238,7 +1257,7 @@ export class Program {
|
|
|
1238
1257
|
// Fetch from server
|
|
1239
1258
|
const binaryData = await this.client.apiRequestBinary("getSourceFile", {
|
|
1240
1259
|
snapshot: this.snapshotId,
|
|
1241
|
-
project: this.project.
|
|
1260
|
+
project: this.project.handle,
|
|
1242
1261
|
file,
|
|
1243
1262
|
});
|
|
1244
1263
|
if (!binaryData) {
|
|
@@ -1251,7 +1270,7 @@ export class Program {
|
|
|
1251
1270
|
async getResolvedModule(file, moduleName, mode) {
|
|
1252
1271
|
const result = await this.client.apiRequest("getResolvedModule", {
|
|
1253
1272
|
snapshot: this.snapshotId,
|
|
1254
|
-
project: this.project.
|
|
1273
|
+
project: this.project.handle,
|
|
1255
1274
|
file,
|
|
1256
1275
|
moduleName,
|
|
1257
1276
|
mode,
|
|
@@ -1261,15 +1280,15 @@ export class Program {
|
|
|
1261
1280
|
async getModeForUsageLocation(file, usage) {
|
|
1262
1281
|
return this.client.apiRequest("getModeForUsageLocation", {
|
|
1263
1282
|
snapshot: this.snapshotId,
|
|
1264
|
-
project: this.project.
|
|
1283
|
+
project: this.project.handle,
|
|
1265
1284
|
file,
|
|
1266
|
-
usage:
|
|
1285
|
+
usage: getNodeRequestHandle(usage),
|
|
1267
1286
|
});
|
|
1268
1287
|
}
|
|
1269
1288
|
async getModeForResolutionAtIndex(file, index) {
|
|
1270
1289
|
return this.client.apiRequest("getModeForResolutionAtIndex", {
|
|
1271
1290
|
snapshot: this.snapshotId,
|
|
1272
|
-
project: this.project.
|
|
1291
|
+
project: this.project.handle,
|
|
1273
1292
|
file,
|
|
1274
1293
|
index,
|
|
1275
1294
|
});
|
|
@@ -1277,8 +1296,8 @@ export class Program {
|
|
|
1277
1296
|
async getResolvedModuleFromModuleSpecifier(moduleSpecifier, sourceFile) {
|
|
1278
1297
|
const result = await this.client.apiRequest("getResolvedModuleFromModuleSpecifier", {
|
|
1279
1298
|
snapshot: this.snapshotId,
|
|
1280
|
-
project: this.project.
|
|
1281
|
-
moduleSpecifier:
|
|
1299
|
+
project: this.project.handle,
|
|
1300
|
+
moduleSpecifier: getNodeRequestHandle(moduleSpecifier),
|
|
1282
1301
|
sourceFile,
|
|
1283
1302
|
});
|
|
1284
1303
|
return result ?? undefined;
|
|
@@ -1286,7 +1305,7 @@ export class Program {
|
|
|
1286
1305
|
async getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
1287
1306
|
const result = await this.client.apiRequest("getResolvedTypeReferenceDirective", {
|
|
1288
1307
|
snapshot: this.snapshotId,
|
|
1289
|
-
project: this.project.
|
|
1308
|
+
project: this.project.handle,
|
|
1290
1309
|
file,
|
|
1291
1310
|
typeDirectiveName,
|
|
1292
1311
|
mode,
|
|
@@ -1296,7 +1315,7 @@ export class Program {
|
|
|
1296
1315
|
async getResolvedTypeReferenceDirectiveFromTypeReferenceDirective(typeReferenceDirective, sourceFile) {
|
|
1297
1316
|
const result = await this.client.apiRequest("getResolvedTypeReferenceDirectiveFromTypeReferenceDirective", {
|
|
1298
1317
|
snapshot: this.snapshotId,
|
|
1299
|
-
project: this.project.
|
|
1318
|
+
project: this.project.handle,
|
|
1300
1319
|
sourceFile,
|
|
1301
1320
|
typeDirectiveName: typeReferenceDirective.fileName,
|
|
1302
1321
|
resolutionMode: typeReferenceDirective.resolutionMode,
|
|
@@ -1306,7 +1325,7 @@ export class Program {
|
|
|
1306
1325
|
async getSourceFileNames() {
|
|
1307
1326
|
const data = await this.client.apiRequest("getSourceFileNames", {
|
|
1308
1327
|
snapshot: this.snapshotId,
|
|
1309
|
-
project: this.project.
|
|
1328
|
+
project: this.project.handle,
|
|
1310
1329
|
});
|
|
1311
1330
|
return data ?? [];
|
|
1312
1331
|
}
|
|
@@ -1337,7 +1356,7 @@ export class Program {
|
|
|
1337
1356
|
// client-provided path text as untrusted input.
|
|
1338
1357
|
const data = await this.client.apiRequest("getSourceFileMetadata", {
|
|
1339
1358
|
snapshot: this.snapshotId,
|
|
1340
|
-
project: this.project.
|
|
1359
|
+
project: this.project.handle,
|
|
1341
1360
|
file: path,
|
|
1342
1361
|
});
|
|
1343
1362
|
return data ?? undefined;
|
|
@@ -1370,7 +1389,7 @@ export class Program {
|
|
|
1370
1389
|
async getConfigFileNames() {
|
|
1371
1390
|
const data = await this.client.apiRequest("getConfigFileNames", {
|
|
1372
1391
|
snapshot: this.snapshotId,
|
|
1373
|
-
project: this.project.
|
|
1392
|
+
project: this.project.handle,
|
|
1374
1393
|
});
|
|
1375
1394
|
return data ?? [];
|
|
1376
1395
|
}
|
|
@@ -1381,7 +1400,7 @@ export class Program {
|
|
|
1381
1400
|
async getConfigSourceFile(file) {
|
|
1382
1401
|
const binaryData = await this.client.apiRequestBinary("getConfigSourceFile", {
|
|
1383
1402
|
snapshot: this.snapshotId,
|
|
1384
|
-
project: this.project.
|
|
1403
|
+
project: this.project.handle,
|
|
1385
1404
|
file,
|
|
1386
1405
|
});
|
|
1387
1406
|
if (!binaryData) {
|
|
@@ -1399,7 +1418,7 @@ export class Program {
|
|
|
1399
1418
|
: [file];
|
|
1400
1419
|
const data = await this.client.apiRequest("getSyntacticDiagnostics", {
|
|
1401
1420
|
snapshot: this.snapshotId,
|
|
1402
|
-
project: this.project.
|
|
1421
|
+
project: this.project.handle,
|
|
1403
1422
|
files,
|
|
1404
1423
|
});
|
|
1405
1424
|
return data ?? [];
|
|
@@ -1414,7 +1433,7 @@ export class Program {
|
|
|
1414
1433
|
: [file];
|
|
1415
1434
|
const data = await this.client.apiRequest("getBindDiagnostics", {
|
|
1416
1435
|
snapshot: this.snapshotId,
|
|
1417
|
-
project: this.project.
|
|
1436
|
+
project: this.project.handle,
|
|
1418
1437
|
files,
|
|
1419
1438
|
});
|
|
1420
1439
|
return data ?? [];
|
|
@@ -1429,7 +1448,7 @@ export class Program {
|
|
|
1429
1448
|
: [file];
|
|
1430
1449
|
const data = await this.client.apiRequest("getSemanticDiagnostics", {
|
|
1431
1450
|
snapshot: this.snapshotId,
|
|
1432
|
-
project: this.project.
|
|
1451
|
+
project: this.project.handle,
|
|
1433
1452
|
files,
|
|
1434
1453
|
});
|
|
1435
1454
|
return data ?? [];
|
|
@@ -1444,7 +1463,7 @@ export class Program {
|
|
|
1444
1463
|
: [file];
|
|
1445
1464
|
const data = await this.client.apiRequest("getSuggestionDiagnostics", {
|
|
1446
1465
|
snapshot: this.snapshotId,
|
|
1447
|
-
project: this.project.
|
|
1466
|
+
project: this.project.handle,
|
|
1448
1467
|
files,
|
|
1449
1468
|
});
|
|
1450
1469
|
return data ?? [];
|
|
@@ -1459,7 +1478,7 @@ export class Program {
|
|
|
1459
1478
|
: [file];
|
|
1460
1479
|
const data = await this.client.apiRequest("getDeclarationDiagnostics", {
|
|
1461
1480
|
snapshot: this.snapshotId,
|
|
1462
|
-
project: this.project.
|
|
1481
|
+
project: this.project.handle,
|
|
1463
1482
|
files,
|
|
1464
1483
|
});
|
|
1465
1484
|
return data ?? [];
|
|
@@ -1470,7 +1489,7 @@ export class Program {
|
|
|
1470
1489
|
async getProgramDiagnostics() {
|
|
1471
1490
|
const data = await this.client.apiRequest("getProgramDiagnostics", {
|
|
1472
1491
|
snapshot: this.snapshotId,
|
|
1473
|
-
project: this.project.
|
|
1492
|
+
project: this.project.handle,
|
|
1474
1493
|
});
|
|
1475
1494
|
return data ?? [];
|
|
1476
1495
|
}
|
|
@@ -1480,7 +1499,7 @@ export class Program {
|
|
|
1480
1499
|
async getGlobalDiagnostics() {
|
|
1481
1500
|
const data = await this.client.apiRequest("getGlobalDiagnostics", {
|
|
1482
1501
|
snapshot: this.snapshotId,
|
|
1483
|
-
project: this.project.
|
|
1502
|
+
project: this.project.handle,
|
|
1484
1503
|
});
|
|
1485
1504
|
return data ?? [];
|
|
1486
1505
|
}
|
|
@@ -1490,7 +1509,7 @@ export class Program {
|
|
|
1490
1509
|
async getConfigFileParsingDiagnostics() {
|
|
1491
1510
|
const data = await this.client.apiRequest("getConfigFileParsingDiagnostics", {
|
|
1492
1511
|
snapshot: this.snapshotId,
|
|
1493
|
-
project: this.project.
|
|
1512
|
+
project: this.project.handle,
|
|
1494
1513
|
});
|
|
1495
1514
|
return data ?? [];
|
|
1496
1515
|
}
|
|
@@ -1502,7 +1521,7 @@ export class Program {
|
|
|
1502
1521
|
async emit(emitOnly) {
|
|
1503
1522
|
const response = await this.client.apiRequest("emit", {
|
|
1504
1523
|
snapshot: this.snapshotId,
|
|
1505
|
-
project: this.project.
|
|
1524
|
+
project: this.project.handle,
|
|
1506
1525
|
emitOnly,
|
|
1507
1526
|
});
|
|
1508
1527
|
const fileSystem = response.emittedFilesContents.length
|
|
@@ -1524,7 +1543,7 @@ export class Program {
|
|
|
1524
1543
|
async emitToString(emitOnly) {
|
|
1525
1544
|
const response = await this.client.apiRequest("emitToString", {
|
|
1526
1545
|
snapshot: this.snapshotId,
|
|
1527
|
-
project: this.project.
|
|
1546
|
+
project: this.project.handle,
|
|
1528
1547
|
emitOnly,
|
|
1529
1548
|
});
|
|
1530
1549
|
return toEmitOutput(response);
|
|
@@ -1535,7 +1554,7 @@ export class Program {
|
|
|
1535
1554
|
async getJavaScriptEmit(files) {
|
|
1536
1555
|
const response = await this.client.apiRequest("getJavaScriptEmit", {
|
|
1537
1556
|
snapshot: this.snapshotId,
|
|
1538
|
-
project: this.project.
|
|
1557
|
+
project: this.project.handle,
|
|
1539
1558
|
files,
|
|
1540
1559
|
});
|
|
1541
1560
|
return toEmitOutput(response);
|
|
@@ -1546,7 +1565,7 @@ export class Program {
|
|
|
1546
1565
|
async getDeclarationEmit(files) {
|
|
1547
1566
|
const response = await this.client.apiRequest("getDeclarationEmit", {
|
|
1548
1567
|
snapshot: this.snapshotId,
|
|
1549
|
-
project: this.project.
|
|
1568
|
+
project: this.project.handle,
|
|
1550
1569
|
files,
|
|
1551
1570
|
});
|
|
1552
1571
|
return toEmitOutput(response);
|
|
@@ -1658,7 +1677,7 @@ export class Checker {
|
|
|
1658
1677
|
async getMergedSymbol(symbol) {
|
|
1659
1678
|
const data = await this.client.apiRequest("getMergedSymbol", {
|
|
1660
1679
|
snapshot: this.snapshotId,
|
|
1661
|
-
project: this.project.
|
|
1680
|
+
project: this.project.handle,
|
|
1662
1681
|
symbol: symbol.reference,
|
|
1663
1682
|
});
|
|
1664
1683
|
return this.objectRegistry.getOrCreateSymbol(data);
|
|
@@ -1670,8 +1689,8 @@ export class Checker {
|
|
|
1670
1689
|
async getSymbolOfNode(node) {
|
|
1671
1690
|
const data = await this.client.apiRequest("getSymbolOfNode", {
|
|
1672
1691
|
snapshot: this.snapshotId,
|
|
1673
|
-
project: this.project.
|
|
1674
|
-
location:
|
|
1692
|
+
project: this.project.handle,
|
|
1693
|
+
location: getNodeRequestHandle(node),
|
|
1675
1694
|
});
|
|
1676
1695
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1677
1696
|
}
|
|
@@ -1679,8 +1698,8 @@ export class Checker {
|
|
|
1679
1698
|
async getSymbolOfDeclaration(node) {
|
|
1680
1699
|
const data = await this.client.apiRequest("getSymbolOfDeclarationForChecker", {
|
|
1681
1700
|
snapshot: this.snapshotId,
|
|
1682
|
-
project: this.project.
|
|
1683
|
-
location:
|
|
1701
|
+
project: this.project.handle,
|
|
1702
|
+
location: getNodeRequestHandle(node),
|
|
1684
1703
|
});
|
|
1685
1704
|
// Declarations normally have symbols, but preserve unexpected null results at runtime.
|
|
1686
1705
|
return (data && this.objectRegistry.getOrCreateSymbol(data));
|
|
@@ -1689,7 +1708,7 @@ export class Checker {
|
|
|
1689
1708
|
async getParentOfSymbol(symbol) {
|
|
1690
1709
|
const data = await this.client.apiRequest("getParentOfSymbolForChecker", {
|
|
1691
1710
|
snapshot: this.snapshotId,
|
|
1692
|
-
project: this.project.
|
|
1711
|
+
project: this.project.handle,
|
|
1693
1712
|
symbol: symbol.reference,
|
|
1694
1713
|
});
|
|
1695
1714
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1698,15 +1717,15 @@ export class Checker {
|
|
|
1698
1717
|
if (Array.isArray(nodeOrNodes)) {
|
|
1699
1718
|
const data = await this.client.apiRequest("getSymbolsAtLocations", {
|
|
1700
1719
|
snapshot: this.snapshotId,
|
|
1701
|
-
project: this.project.
|
|
1702
|
-
locations: nodeOrNodes.map(node =>
|
|
1720
|
+
project: this.project.handle,
|
|
1721
|
+
locations: nodeOrNodes.map(node => getNodeRequestHandle(node)),
|
|
1703
1722
|
});
|
|
1704
1723
|
return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
|
|
1705
1724
|
}
|
|
1706
1725
|
const data = await this.client.apiRequest("getSymbolAtLocation", {
|
|
1707
1726
|
snapshot: this.snapshotId,
|
|
1708
|
-
project: this.project.
|
|
1709
|
-
location:
|
|
1727
|
+
project: this.project.handle,
|
|
1728
|
+
location: getNodeRequestHandle(nodeOrNodes),
|
|
1710
1729
|
});
|
|
1711
1730
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1712
1731
|
}
|
|
@@ -1714,7 +1733,7 @@ export class Checker {
|
|
|
1714
1733
|
if (typeof positionOrPositions === "number") {
|
|
1715
1734
|
const data = await this.client.apiRequest("getSymbolAtPosition", {
|
|
1716
1735
|
snapshot: this.snapshotId,
|
|
1717
|
-
project: this.project.
|
|
1736
|
+
project: this.project.handle,
|
|
1718
1737
|
file,
|
|
1719
1738
|
position: positionOrPositions,
|
|
1720
1739
|
});
|
|
@@ -1722,7 +1741,7 @@ export class Checker {
|
|
|
1722
1741
|
}
|
|
1723
1742
|
const data = await this.client.apiRequest("getSymbolsAtPositions", {
|
|
1724
1743
|
snapshot: this.snapshotId,
|
|
1725
|
-
project: this.project.
|
|
1744
|
+
project: this.project.handle,
|
|
1726
1745
|
file,
|
|
1727
1746
|
positions: positionOrPositions,
|
|
1728
1747
|
});
|
|
@@ -1732,14 +1751,14 @@ export class Checker {
|
|
|
1732
1751
|
if (Array.isArray(fileOrFiles)) {
|
|
1733
1752
|
const data = await this.client.apiRequest("getSymbolsOfSourceFiles", {
|
|
1734
1753
|
snapshot: this.snapshotId,
|
|
1735
|
-
project: this.project.
|
|
1754
|
+
project: this.project.handle,
|
|
1736
1755
|
files: fileOrFiles,
|
|
1737
1756
|
});
|
|
1738
1757
|
return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
|
|
1739
1758
|
}
|
|
1740
1759
|
const data = await this.client.apiRequest("getSymbolOfSourceFile", {
|
|
1741
1760
|
snapshot: this.snapshotId,
|
|
1742
|
-
project: this.project.
|
|
1761
|
+
project: this.project.handle,
|
|
1743
1762
|
file: fileOrFiles,
|
|
1744
1763
|
});
|
|
1745
1764
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1748,14 +1767,14 @@ export class Checker {
|
|
|
1748
1767
|
if (Array.isArray(symbolOrSymbols)) {
|
|
1749
1768
|
const data = await this.client.apiRequest("getTypesOfSymbols", {
|
|
1750
1769
|
snapshot: this.snapshotId,
|
|
1751
|
-
project: this.project.
|
|
1770
|
+
project: this.project.handle,
|
|
1752
1771
|
symbols: symbolOrSymbols.map(symbol => symbol.reference),
|
|
1753
1772
|
});
|
|
1754
1773
|
return data.map(d => this.objectRegistry.getOrCreateType(d));
|
|
1755
1774
|
}
|
|
1756
1775
|
const data = await this.client.apiRequest("getTypeOfSymbol", {
|
|
1757
1776
|
snapshot: this.snapshotId,
|
|
1758
|
-
project: this.project.
|
|
1777
|
+
project: this.project.handle,
|
|
1759
1778
|
symbol: symbolOrSymbols.reference,
|
|
1760
1779
|
});
|
|
1761
1780
|
return this.objectRegistry.getOrCreateType(data);
|
|
@@ -1768,7 +1787,7 @@ export class Checker {
|
|
|
1768
1787
|
async getDeclaredTypeOfSymbol(symbol) {
|
|
1769
1788
|
const data = await this.client.apiRequest("getDeclaredTypeOfSymbol", {
|
|
1770
1789
|
snapshot: this.snapshotId,
|
|
1771
|
-
project: this.project.
|
|
1790
|
+
project: this.project.handle,
|
|
1772
1791
|
symbol: symbol.reference,
|
|
1773
1792
|
});
|
|
1774
1793
|
return this.objectRegistry.getOrCreateType(data);
|
|
@@ -1782,7 +1801,7 @@ export class Checker {
|
|
|
1782
1801
|
async getNonMissingTypeOfSymbol(symbol) {
|
|
1783
1802
|
const data = await this.client.apiRequest("getNonMissingTypeOfSymbol", {
|
|
1784
1803
|
snapshot: this.snapshotId,
|
|
1785
|
-
project: this.project.
|
|
1804
|
+
project: this.project.handle,
|
|
1786
1805
|
symbol: symbol.reference,
|
|
1787
1806
|
});
|
|
1788
1807
|
return this.objectRegistry.getOrCreateType(data);
|
|
@@ -1790,25 +1809,25 @@ export class Checker {
|
|
|
1790
1809
|
async getReferencesToSymbolInFile(file, symbol) {
|
|
1791
1810
|
const data = await this.client.apiRequest("getReferencesToSymbolInFile", {
|
|
1792
1811
|
snapshot: this.snapshotId,
|
|
1793
|
-
project: this.project.
|
|
1812
|
+
project: this.project.handle,
|
|
1794
1813
|
file,
|
|
1795
1814
|
symbol: symbol.reference,
|
|
1796
1815
|
});
|
|
1797
|
-
return (data ?? []).map(h =>
|
|
1816
|
+
return (data ?? []).map(h => this.objectRegistry.createNodeHandle(h));
|
|
1798
1817
|
}
|
|
1799
1818
|
async getTypeAtLocation(nodeOrNodes) {
|
|
1800
1819
|
if (Array.isArray(nodeOrNodes)) {
|
|
1801
1820
|
const data = await this.client.apiRequest("getTypeAtLocations", {
|
|
1802
1821
|
snapshot: this.snapshotId,
|
|
1803
|
-
project: this.project.
|
|
1804
|
-
locations: nodeOrNodes.map(node =>
|
|
1822
|
+
project: this.project.handle,
|
|
1823
|
+
locations: nodeOrNodes.map(node => getNodeRequestHandle(node)),
|
|
1805
1824
|
});
|
|
1806
1825
|
return data.map(d => this.objectRegistry.getOrCreateType(d));
|
|
1807
1826
|
}
|
|
1808
1827
|
const data = await this.client.apiRequest("getTypeAtLocation", {
|
|
1809
1828
|
snapshot: this.snapshotId,
|
|
1810
|
-
project: this.project.
|
|
1811
|
-
location:
|
|
1829
|
+
project: this.project.handle,
|
|
1830
|
+
location: getNodeRequestHandle(nodeOrNodes),
|
|
1812
1831
|
});
|
|
1813
1832
|
return this.objectRegistry.getOrCreateType(data);
|
|
1814
1833
|
}
|
|
@@ -1823,8 +1842,8 @@ export class Checker {
|
|
|
1823
1842
|
async getResolvedSignature(node) {
|
|
1824
1843
|
const data = await this.client.apiRequest("getResolvedSignature", {
|
|
1825
1844
|
snapshot: this.snapshotId,
|
|
1826
|
-
project: this.project.
|
|
1827
|
-
location:
|
|
1845
|
+
project: this.project.handle,
|
|
1846
|
+
location: getNodeRequestHandle(node),
|
|
1828
1847
|
});
|
|
1829
1848
|
return this.objectRegistry.getOrCreateSignature(data);
|
|
1830
1849
|
}
|
|
@@ -1832,7 +1851,7 @@ export class Checker {
|
|
|
1832
1851
|
if (typeof positionOrPositions === "number") {
|
|
1833
1852
|
const data = await this.client.apiRequest("getTypeAtPosition", {
|
|
1834
1853
|
snapshot: this.snapshotId,
|
|
1835
|
-
project: this.project.
|
|
1854
|
+
project: this.project.handle,
|
|
1836
1855
|
file,
|
|
1837
1856
|
position: positionOrPositions,
|
|
1838
1857
|
});
|
|
@@ -1840,7 +1859,7 @@ export class Checker {
|
|
|
1840
1859
|
}
|
|
1841
1860
|
const data = await this.client.apiRequest("getTypesAtPositions", {
|
|
1842
1861
|
snapshot: this.snapshotId,
|
|
1843
|
-
project: this.project.
|
|
1862
|
+
project: this.project.handle,
|
|
1844
1863
|
file,
|
|
1845
1864
|
positions: positionOrPositions,
|
|
1846
1865
|
});
|
|
@@ -1851,10 +1870,10 @@ export class Checker {
|
|
|
1851
1870
|
const isNode = location && "kind" in location;
|
|
1852
1871
|
const data = await this.client.apiRequest("resolveName", {
|
|
1853
1872
|
snapshot: this.snapshotId,
|
|
1854
|
-
project: this.project.
|
|
1873
|
+
project: this.project.handle,
|
|
1855
1874
|
name,
|
|
1856
1875
|
meaning,
|
|
1857
|
-
location: isNode ?
|
|
1876
|
+
location: isNode ? getNodeRequestHandle(location) : undefined,
|
|
1858
1877
|
file: !isNode && location ? location.document : undefined,
|
|
1859
1878
|
position: !isNode && location ? location.position : undefined,
|
|
1860
1879
|
excludeGlobals,
|
|
@@ -1869,9 +1888,9 @@ export class Checker {
|
|
|
1869
1888
|
const isNode = "kind" in location;
|
|
1870
1889
|
const data = await this.client.apiRequest("getSymbolsInScope", {
|
|
1871
1890
|
snapshot: this.snapshotId,
|
|
1872
|
-
project: this.project.
|
|
1891
|
+
project: this.project.handle,
|
|
1873
1892
|
meaning,
|
|
1874
|
-
location: isNode ?
|
|
1893
|
+
location: isNode ? getNodeRequestHandle(location) : undefined,
|
|
1875
1894
|
file: isNode ? undefined : location.document,
|
|
1876
1895
|
position: isNode ? undefined : location.position,
|
|
1877
1896
|
});
|
|
@@ -1886,16 +1905,16 @@ export class Checker {
|
|
|
1886
1905
|
async getContextualType(node) {
|
|
1887
1906
|
const data = await this.client.apiRequest("getContextualType", {
|
|
1888
1907
|
snapshot: this.snapshotId,
|
|
1889
|
-
project: this.project.
|
|
1890
|
-
location:
|
|
1908
|
+
project: this.project.handle,
|
|
1909
|
+
location: getNodeRequestHandle(node),
|
|
1891
1910
|
});
|
|
1892
1911
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
1893
1912
|
}
|
|
1894
1913
|
async getContextualTypeForArgumentAtIndex(node, argIndex) {
|
|
1895
1914
|
const data = await this.client.apiRequest("getContextualTypeForArgument", {
|
|
1896
1915
|
snapshot: this.snapshotId,
|
|
1897
|
-
project: this.project.
|
|
1898
|
-
location:
|
|
1916
|
+
project: this.project.handle,
|
|
1917
|
+
location: getNodeRequestHandle(node),
|
|
1899
1918
|
index: argIndex,
|
|
1900
1919
|
});
|
|
1901
1920
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1903,7 +1922,7 @@ export class Checker {
|
|
|
1903
1922
|
async getAwaitedType(type) {
|
|
1904
1923
|
const data = await this.client.apiRequest("getAwaitedType", {
|
|
1905
1924
|
snapshot: this.snapshotId,
|
|
1906
|
-
project: this.project.
|
|
1925
|
+
project: this.project.handle,
|
|
1907
1926
|
type: type.id,
|
|
1908
1927
|
});
|
|
1909
1928
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1912,7 +1931,7 @@ export class Checker {
|
|
|
1912
1931
|
async getBaseTypeOfLiteralType(type) {
|
|
1913
1932
|
const data = await this.client.apiRequest("getBaseTypeOfLiteralType", {
|
|
1914
1933
|
snapshot: this.snapshotId,
|
|
1915
|
-
project: this.project.
|
|
1934
|
+
project: this.project.handle,
|
|
1916
1935
|
type: type.id,
|
|
1917
1936
|
});
|
|
1918
1937
|
return this.objectRegistry.getOrCreateType(data);
|
|
@@ -1929,8 +1948,8 @@ export class Checker {
|
|
|
1929
1948
|
async getTypeFromTypeNode(node) {
|
|
1930
1949
|
const data = await this.client.apiRequest("getTypeFromTypeNode", {
|
|
1931
1950
|
snapshot: this.snapshotId,
|
|
1932
|
-
project: this.project.
|
|
1933
|
-
location:
|
|
1951
|
+
project: this.project.handle,
|
|
1952
|
+
location: getNodeRequestHandle(node),
|
|
1934
1953
|
});
|
|
1935
1954
|
return this.objectRegistry.getOrCreateType(data);
|
|
1936
1955
|
}
|
|
@@ -1938,7 +1957,7 @@ export class Checker {
|
|
|
1938
1957
|
async getWidenedType(type) {
|
|
1939
1958
|
const data = await this.client.apiRequest("getWidenedType", {
|
|
1940
1959
|
snapshot: this.snapshotId,
|
|
1941
|
-
project: this.project.
|
|
1960
|
+
project: this.project.handle,
|
|
1942
1961
|
type: type.id,
|
|
1943
1962
|
});
|
|
1944
1963
|
return this.objectRegistry.getOrCreateType(data);
|
|
@@ -1950,7 +1969,7 @@ export class Checker {
|
|
|
1950
1969
|
async getParameterType(signature, index) {
|
|
1951
1970
|
const data = await this.client.apiRequest("getParameterType", {
|
|
1952
1971
|
snapshot: this.snapshotId,
|
|
1953
|
-
project: this.project.
|
|
1972
|
+
project: this.project.handle,
|
|
1954
1973
|
signature: signature.id,
|
|
1955
1974
|
index,
|
|
1956
1975
|
});
|
|
@@ -1959,14 +1978,14 @@ export class Checker {
|
|
|
1959
1978
|
async isArrayLikeType(type) {
|
|
1960
1979
|
return this.client.apiRequest("isArrayLikeType", {
|
|
1961
1980
|
snapshot: this.snapshotId,
|
|
1962
|
-
project: this.project.
|
|
1981
|
+
project: this.project.handle,
|
|
1963
1982
|
type: type.id,
|
|
1964
1983
|
});
|
|
1965
1984
|
}
|
|
1966
1985
|
async isTypeAssignableTo(source, target) {
|
|
1967
1986
|
return this.client.apiRequest("isTypeAssignableTo", {
|
|
1968
1987
|
snapshot: this.snapshotId,
|
|
1969
|
-
project: this.project.
|
|
1988
|
+
project: this.project.handle,
|
|
1970
1989
|
source: source.id,
|
|
1971
1990
|
target: target.id,
|
|
1972
1991
|
});
|
|
@@ -1974,8 +1993,8 @@ export class Checker {
|
|
|
1974
1993
|
async getShorthandAssignmentValueSymbol(node) {
|
|
1975
1994
|
const data = await this.client.apiRequest("getShorthandAssignmentValueSymbol", {
|
|
1976
1995
|
snapshot: this.snapshotId,
|
|
1977
|
-
project: this.project.
|
|
1978
|
-
location:
|
|
1996
|
+
project: this.project.handle,
|
|
1997
|
+
location: getNodeRequestHandle(node),
|
|
1979
1998
|
});
|
|
1980
1999
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
1981
2000
|
}
|
|
@@ -1987,16 +2006,16 @@ export class Checker {
|
|
|
1987
2006
|
async getTypeOfSymbolAtLocation(symbol, location) {
|
|
1988
2007
|
const data = await this.client.apiRequest("getTypeOfSymbolAtLocation", {
|
|
1989
2008
|
snapshot: this.snapshotId,
|
|
1990
|
-
project: this.project.
|
|
2009
|
+
project: this.project.handle,
|
|
1991
2010
|
symbol: symbol.reference,
|
|
1992
|
-
location:
|
|
2011
|
+
location: getNodeRequestHandle(location),
|
|
1993
2012
|
});
|
|
1994
2013
|
return this.objectRegistry.getOrCreateType(data);
|
|
1995
2014
|
}
|
|
1996
2015
|
async getIntrinsicType(method) {
|
|
1997
2016
|
const data = await this.client.apiRequest(method, {
|
|
1998
2017
|
snapshot: this.snapshotId,
|
|
1999
|
-
project: this.project.
|
|
2018
|
+
project: this.project.handle,
|
|
2000
2019
|
});
|
|
2001
2020
|
return this.objectRegistry.getOrCreateType(data);
|
|
2002
2021
|
}
|
|
@@ -2039,9 +2058,9 @@ export class Checker {
|
|
|
2039
2058
|
async typeToTypeNode(type, enclosingDeclaration, flags) {
|
|
2040
2059
|
const binaryData = await this.client.apiRequestBinary("typeToTypeNode", {
|
|
2041
2060
|
snapshot: this.snapshotId,
|
|
2042
|
-
project: this.project.
|
|
2061
|
+
project: this.project.handle,
|
|
2043
2062
|
type: type.id,
|
|
2044
|
-
location: enclosingDeclaration ?
|
|
2063
|
+
location: enclosingDeclaration ? getNodeRequestHandle(enclosingDeclaration) : undefined,
|
|
2045
2064
|
flags,
|
|
2046
2065
|
});
|
|
2047
2066
|
if (!binaryData)
|
|
@@ -2051,10 +2070,10 @@ export class Checker {
|
|
|
2051
2070
|
async signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags) {
|
|
2052
2071
|
const binaryData = await this.client.apiRequestBinary("signatureToSignatureDeclaration", {
|
|
2053
2072
|
snapshot: this.snapshotId,
|
|
2054
|
-
project: this.project.
|
|
2073
|
+
project: this.project.handle,
|
|
2055
2074
|
signature: signature.id,
|
|
2056
2075
|
kind,
|
|
2057
|
-
location: enclosingDeclaration ?
|
|
2076
|
+
location: enclosingDeclaration ? getNodeRequestHandle(enclosingDeclaration) : undefined,
|
|
2058
2077
|
flags,
|
|
2059
2078
|
});
|
|
2060
2079
|
if (!binaryData)
|
|
@@ -2064,9 +2083,9 @@ export class Checker {
|
|
|
2064
2083
|
async typeToString(type, enclosingDeclaration, flags) {
|
|
2065
2084
|
const result = await this.client.apiRequest("typeToString", {
|
|
2066
2085
|
snapshot: this.snapshotId,
|
|
2067
|
-
project: this.project.
|
|
2086
|
+
project: this.project.handle,
|
|
2068
2087
|
type: type.id,
|
|
2069
|
-
location: enclosingDeclaration ?
|
|
2088
|
+
location: enclosingDeclaration ? getNodeRequestHandle(enclosingDeclaration) : undefined,
|
|
2070
2089
|
flags,
|
|
2071
2090
|
});
|
|
2072
2091
|
if (typeof result !== "string")
|
|
@@ -2076,14 +2095,14 @@ export class Checker {
|
|
|
2076
2095
|
async isContextSensitive(node) {
|
|
2077
2096
|
return this.client.apiRequest("isContextSensitive", {
|
|
2078
2097
|
snapshot: this.snapshotId,
|
|
2079
|
-
project: this.project.
|
|
2080
|
-
location:
|
|
2098
|
+
project: this.project.handle,
|
|
2099
|
+
location: getNodeRequestHandle(node),
|
|
2081
2100
|
});
|
|
2082
2101
|
}
|
|
2083
2102
|
async isArrayType(type) {
|
|
2084
2103
|
return this.client.apiRequest("isArrayType", {
|
|
2085
2104
|
snapshot: this.snapshotId,
|
|
2086
|
-
project: this.project.
|
|
2105
|
+
project: this.project.handle,
|
|
2087
2106
|
type: type.id,
|
|
2088
2107
|
});
|
|
2089
2108
|
}
|
|
@@ -2105,7 +2124,7 @@ export class Checker {
|
|
|
2105
2124
|
async isReadonlySymbol(symbol) {
|
|
2106
2125
|
return this.client.apiRequest("isReadonlySymbol", {
|
|
2107
2126
|
snapshot: this.snapshotId,
|
|
2108
|
-
project: this.project.
|
|
2127
|
+
project: this.project.handle,
|
|
2109
2128
|
symbol: symbol.reference,
|
|
2110
2129
|
});
|
|
2111
2130
|
}
|
|
@@ -2120,7 +2139,7 @@ export class Checker {
|
|
|
2120
2139
|
async getRestTypeOfSignature(signature) {
|
|
2121
2140
|
const data = await this.client.apiRequest("getRestTypeOfSignature", {
|
|
2122
2141
|
snapshot: this.snapshotId,
|
|
2123
|
-
project: this.project.
|
|
2142
|
+
project: this.project.handle,
|
|
2124
2143
|
signature: signature.id,
|
|
2125
2144
|
});
|
|
2126
2145
|
return this.objectRegistry.getOrCreateType(data);
|
|
@@ -2128,7 +2147,7 @@ export class Checker {
|
|
|
2128
2147
|
async getTypePredicateOfSignature(signature) {
|
|
2129
2148
|
const data = await this.client.apiRequest("getTypePredicateOfSignature", {
|
|
2130
2149
|
snapshot: this.snapshotId,
|
|
2131
|
-
project: this.project.
|
|
2150
|
+
project: this.project.handle,
|
|
2132
2151
|
signature: signature.id,
|
|
2133
2152
|
});
|
|
2134
2153
|
if (!data)
|
|
@@ -2164,7 +2183,7 @@ export class Checker {
|
|
|
2164
2183
|
async getIndexInfoOfType(type, kind) {
|
|
2165
2184
|
const data = await this.client.apiRequest("getIndexInfoOfType", {
|
|
2166
2185
|
snapshot: this.snapshotId,
|
|
2167
|
-
project: this.project.
|
|
2186
|
+
project: this.project.handle,
|
|
2168
2187
|
type: type.id,
|
|
2169
2188
|
kind,
|
|
2170
2189
|
});
|
|
@@ -2172,7 +2191,7 @@ export class Checker {
|
|
|
2172
2191
|
keyType: this.objectRegistry.getOrCreateType(data.keyType),
|
|
2173
2192
|
valueType: this.objectRegistry.getOrCreateType(data.valueType),
|
|
2174
2193
|
isReadonly: data.isReadonly ?? false,
|
|
2175
|
-
declaration: data.declaration ?
|
|
2194
|
+
declaration: data.declaration ? this.objectRegistry.createNodeHandle(data.declaration) : undefined,
|
|
2176
2195
|
} : undefined;
|
|
2177
2196
|
}
|
|
2178
2197
|
async getIndexTypeOfType(type, kind) {
|
|
@@ -2181,7 +2200,7 @@ export class Checker {
|
|
|
2181
2200
|
async getTypeOfPropertyOfType(type, propertyName) {
|
|
2182
2201
|
const data = await this.client.apiRequest("getTypeOfPropertyOfType", {
|
|
2183
2202
|
snapshot: this.snapshotId,
|
|
2184
|
-
project: this.project.
|
|
2203
|
+
project: this.project.handle,
|
|
2185
2204
|
type: type.id,
|
|
2186
2205
|
name: propertyName,
|
|
2187
2206
|
});
|
|
@@ -2200,7 +2219,7 @@ export class Checker {
|
|
|
2200
2219
|
async getBaseConstraintOfType(type) {
|
|
2201
2220
|
const data = await this.client.apiRequest("getBaseConstraintOfType", {
|
|
2202
2221
|
snapshot: this.snapshotId,
|
|
2203
|
-
project: this.project.
|
|
2222
|
+
project: this.project.handle,
|
|
2204
2223
|
type: type.id,
|
|
2205
2224
|
});
|
|
2206
2225
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -2208,7 +2227,7 @@ export class Checker {
|
|
|
2208
2227
|
async getPropertyOfType(type, name) {
|
|
2209
2228
|
const data = await this.client.apiRequest("getPropertyOfType", {
|
|
2210
2229
|
snapshot: this.snapshotId,
|
|
2211
|
-
project: this.project.
|
|
2230
|
+
project: this.project.handle,
|
|
2212
2231
|
type: type.id,
|
|
2213
2232
|
name,
|
|
2214
2233
|
});
|
|
@@ -2217,8 +2236,8 @@ export class Checker {
|
|
|
2217
2236
|
async getConstantValue(node) {
|
|
2218
2237
|
const data = await this.client.apiRequest("getConstantValue", {
|
|
2219
2238
|
snapshot: this.snapshotId,
|
|
2220
|
-
project: this.project.
|
|
2221
|
-
location:
|
|
2239
|
+
project: this.project.handle,
|
|
2240
|
+
location: getNodeRequestHandle(node),
|
|
2222
2241
|
});
|
|
2223
2242
|
if (!data || (typeof data.value !== "string" && typeof data.value !== "number")) {
|
|
2224
2243
|
return undefined;
|
|
@@ -2238,16 +2257,16 @@ export class Checker {
|
|
|
2238
2257
|
async getSignatureFromDeclaration(node) {
|
|
2239
2258
|
const data = await this.client.apiRequest("getSignatureFromDeclaration", {
|
|
2240
2259
|
snapshot: this.snapshotId,
|
|
2241
|
-
project: this.project.
|
|
2242
|
-
location:
|
|
2260
|
+
project: this.project.handle,
|
|
2261
|
+
location: getNodeRequestHandle(node),
|
|
2243
2262
|
});
|
|
2244
2263
|
return this.objectRegistry.getOrCreateSignature(data);
|
|
2245
2264
|
}
|
|
2246
2265
|
async getExportSpecifierLocalTargetSymbol(node) {
|
|
2247
2266
|
const data = await this.client.apiRequest("getExportSpecifierLocalTargetSymbol", {
|
|
2248
2267
|
snapshot: this.snapshotId,
|
|
2249
|
-
project: this.project.
|
|
2250
|
-
location:
|
|
2268
|
+
project: this.project.handle,
|
|
2269
|
+
location: getNodeRequestHandle(node),
|
|
2251
2270
|
});
|
|
2252
2271
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
2253
2272
|
}
|
|
@@ -2259,7 +2278,7 @@ export class Checker {
|
|
|
2259
2278
|
async getAliasedSymbol(symbol) {
|
|
2260
2279
|
const data = await this.client.apiRequest("getAliasedSymbol", {
|
|
2261
2280
|
snapshot: this.snapshotId,
|
|
2262
|
-
project: this.project.
|
|
2281
|
+
project: this.project.handle,
|
|
2263
2282
|
symbol: symbol.reference,
|
|
2264
2283
|
});
|
|
2265
2284
|
return this.objectRegistry.getOrCreateSymbol(data);
|
|
@@ -2271,14 +2290,14 @@ export class Checker {
|
|
|
2271
2290
|
async getFullyQualifiedName(symbol) {
|
|
2272
2291
|
return this.client.apiRequest("getFullyQualifiedName", {
|
|
2273
2292
|
snapshot: this.snapshotId,
|
|
2274
|
-
project: this.project.
|
|
2293
|
+
project: this.project.handle,
|
|
2275
2294
|
symbol: symbol.reference,
|
|
2276
2295
|
});
|
|
2277
2296
|
}
|
|
2278
2297
|
async getImmediateAliasedSymbol(symbol) {
|
|
2279
2298
|
const data = await this.client.apiRequest("getImmediateAliasedSymbol", {
|
|
2280
2299
|
snapshot: this.snapshotId,
|
|
2281
|
-
project: this.project.
|
|
2300
|
+
project: this.project.handle,
|
|
2282
2301
|
symbol: symbol.reference,
|
|
2283
2302
|
});
|
|
2284
2303
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -2290,7 +2309,7 @@ export class Checker {
|
|
|
2290
2309
|
if (symbol.checkFlags & CheckFlags.Instantiated) {
|
|
2291
2310
|
const data = await this.client.apiRequest("getTargetSymbol", {
|
|
2292
2311
|
snapshot: this.snapshotId,
|
|
2293
|
-
project: this.project.
|
|
2312
|
+
project: this.project.handle,
|
|
2294
2313
|
symbol: symbol.reference,
|
|
2295
2314
|
});
|
|
2296
2315
|
return this.objectRegistry.getOrCreateSymbol(data);
|
|
@@ -2300,7 +2319,7 @@ export class Checker {
|
|
|
2300
2319
|
async getExportSymbolOfSymbol(symbol) {
|
|
2301
2320
|
const data = await this.client.apiRequest("getExportSymbolOfSymbolForChecker", {
|
|
2302
2321
|
snapshot: this.snapshotId,
|
|
2303
|
-
project: this.project.
|
|
2322
|
+
project: this.project.handle,
|
|
2304
2323
|
symbol: symbol.reference,
|
|
2305
2324
|
});
|
|
2306
2325
|
return this.objectRegistry.getOrCreateSymbol(data);
|
|
@@ -2314,7 +2333,7 @@ export class Checker {
|
|
|
2314
2333
|
getWellKnownSymbols() {
|
|
2315
2334
|
return this.wellKnownSymbols ??= this.client.apiRequest("getWellKnownSymbols", {
|
|
2316
2335
|
snapshot: this.snapshotId,
|
|
2317
|
-
project: this.project.
|
|
2336
|
+
project: this.project.handle,
|
|
2318
2337
|
});
|
|
2319
2338
|
}
|
|
2320
2339
|
/**
|
|
@@ -2344,7 +2363,7 @@ export class Checker {
|
|
|
2344
2363
|
getWellKnownSignatures() {
|
|
2345
2364
|
return this.wellKnownSignatures ??= this.client.apiRequest("getWellKnownSignatures", {
|
|
2346
2365
|
snapshot: this.snapshotId,
|
|
2347
|
-
project: this.project.
|
|
2366
|
+
project: this.project.handle,
|
|
2348
2367
|
});
|
|
2349
2368
|
}
|
|
2350
2369
|
/**
|
|
@@ -2358,7 +2377,7 @@ export class Checker {
|
|
|
2358
2377
|
async getExportsOfModule(symbol) {
|
|
2359
2378
|
const data = await this.client.apiRequest("getExportsOfModule", {
|
|
2360
2379
|
snapshot: this.snapshotId,
|
|
2361
|
-
project: this.project.
|
|
2380
|
+
project: this.project.handle,
|
|
2362
2381
|
symbol: symbol.reference,
|
|
2363
2382
|
});
|
|
2364
2383
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -2366,7 +2385,7 @@ export class Checker {
|
|
|
2366
2385
|
async getMemberInModuleExports(symbol, name) {
|
|
2367
2386
|
const data = await this.client.apiRequest("getMemberInModuleExports", {
|
|
2368
2387
|
snapshot: this.snapshotId,
|
|
2369
|
-
project: this.project.
|
|
2388
|
+
project: this.project.handle,
|
|
2370
2389
|
symbol: symbol.reference,
|
|
2371
2390
|
name,
|
|
2372
2391
|
});
|
|
@@ -2375,7 +2394,7 @@ export class Checker {
|
|
|
2375
2394
|
async getJsDocTagsOfSymbol(symbol) {
|
|
2376
2395
|
const data = await this.client.apiRequest("getJsDocTags", {
|
|
2377
2396
|
snapshot: this.snapshotId,
|
|
2378
|
-
project: this.project.
|
|
2397
|
+
project: this.project.handle,
|
|
2379
2398
|
symbol: symbol.reference,
|
|
2380
2399
|
});
|
|
2381
2400
|
return data ?? [];
|
|
@@ -2383,7 +2402,7 @@ export class Checker {
|
|
|
2383
2402
|
async getDocumentationCommentOfSymbol(symbol) {
|
|
2384
2403
|
return this.client.apiRequest("getDocumentationComment", {
|
|
2385
2404
|
snapshot: this.snapshotId,
|
|
2386
|
-
project: this.project.
|
|
2405
|
+
project: this.project.handle,
|
|
2387
2406
|
symbol: symbol.reference,
|
|
2388
2407
|
});
|
|
2389
2408
|
}
|
|
@@ -2393,7 +2412,7 @@ export class Checker {
|
|
|
2393
2412
|
async getTypeArguments(type) {
|
|
2394
2413
|
const data = await this.client.apiRequest("getTypeArguments", {
|
|
2395
2414
|
snapshot: this.snapshotId,
|
|
2396
|
-
project: this.project.
|
|
2415
|
+
project: this.project.handle,
|
|
2397
2416
|
type: type.id,
|
|
2398
2417
|
});
|
|
2399
2418
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -2427,7 +2446,7 @@ export class Printer {
|
|
|
2427
2446
|
}
|
|
2428
2447
|
export class NodeHandle {
|
|
2429
2448
|
/**
|
|
2430
|
-
* The project this handle was
|
|
2449
|
+
* The project where this handle was first materialized, used as the default for {@link resolve}.
|
|
2431
2450
|
* Node handles are only meaningful within a project's program, so the producing project
|
|
2432
2451
|
* is remembered so callers don't have to pass it explicitly.
|
|
2433
2452
|
*/
|
|
@@ -2436,11 +2455,15 @@ export class NodeHandle {
|
|
|
2436
2455
|
fileOwner;
|
|
2437
2456
|
index;
|
|
2438
2457
|
kind;
|
|
2458
|
+
/** Identity of the exact parsed source file, shared across programs that reuse that AST. */
|
|
2459
|
+
sourceFileId;
|
|
2460
|
+
/** Retrieval metadata; never used to substitute a different source-file AST. */
|
|
2439
2461
|
path;
|
|
2440
2462
|
constructor(handle, canonicalProject, fileOwner) {
|
|
2441
2463
|
const parsed = parseNodeHandleFromCompiler(handle);
|
|
2442
2464
|
this.index = parsed.index;
|
|
2443
2465
|
this.kind = parsed.kind;
|
|
2466
|
+
this.sourceFileId = parsed.sourceFileId;
|
|
2444
2467
|
this.path = parsed.path;
|
|
2445
2468
|
this.canonicalProject = canonicalProject;
|
|
2446
2469
|
this.fileOwner = fileOwner;
|
|
@@ -2449,20 +2472,31 @@ export class NodeHandle {
|
|
|
2449
2472
|
* Resolve this handle to the actual AST node by fetching the source file from a project
|
|
2450
2473
|
* and looking up the node by index. If no project is passed, the project that produced
|
|
2451
2474
|
* the handle is used. Declarations of file-owned symbols identify an exact source file and
|
|
2452
|
-
* resolve through it, independently of any project.
|
|
2475
|
+
* resolve through it, independently of any project. A different AST at the
|
|
2476
|
+
* same path is never substituted.
|
|
2453
2477
|
*/
|
|
2454
2478
|
async resolve(project = this.canonicalProject) {
|
|
2455
2479
|
if (this.fileOwner) {
|
|
2456
2480
|
const sourceFile = this.fileOwner.record.file ?? await this.fetchOwnerFile(this.fileOwner);
|
|
2457
|
-
return
|
|
2481
|
+
return this.resolveInFile(sourceFile);
|
|
2458
2482
|
}
|
|
2459
2483
|
if (!project)
|
|
2460
|
-
throw new Error(`Node handle for '${this.
|
|
2484
|
+
throw new Error(`Node handle for source file '${this.sourceFileId}' has no project context`);
|
|
2461
2485
|
const sourceFile = await project.program.getSourceFileByPath(this.path);
|
|
2462
2486
|
if (!sourceFile) {
|
|
2463
|
-
|
|
2487
|
+
throw new Error("Node handle source file is not part of the requested program");
|
|
2464
2488
|
}
|
|
2465
|
-
return
|
|
2489
|
+
return this.resolveInFile(sourceFile);
|
|
2490
|
+
}
|
|
2491
|
+
resolveInFile(sourceFile) {
|
|
2492
|
+
if (sourceFile.nodeId !== this.sourceFileId) {
|
|
2493
|
+
throw new Error(`Node handle source file is not part of the requested program`);
|
|
2494
|
+
}
|
|
2495
|
+
const node = sourceFile.getOrCreateNodeAtIndex(this.index);
|
|
2496
|
+
if (!node || node.kind !== this.kind) {
|
|
2497
|
+
throw new Error("Node handle does not identify a node of the expected kind");
|
|
2498
|
+
}
|
|
2499
|
+
return node;
|
|
2466
2500
|
}
|
|
2467
2501
|
async fetchOwnerFile(fileOwner) {
|
|
2468
2502
|
const data = await fileOwner.api.client.apiRequestBinary("getCachedSourceFile", { file: fileOwner.record.descriptor });
|
|
@@ -2484,8 +2518,11 @@ export class Symbol {
|
|
|
2484
2518
|
checkFlags;
|
|
2485
2519
|
/** @internal */
|
|
2486
2520
|
reference;
|
|
2487
|
-
|
|
2488
|
-
|
|
2521
|
+
// Declaration handles are kept in their wire form until first accessed.
|
|
2522
|
+
declarationHandles;
|
|
2523
|
+
valueDeclarationHandle;
|
|
2524
|
+
declarationsCache;
|
|
2525
|
+
valueDeclarationCache;
|
|
2489
2526
|
parent;
|
|
2490
2527
|
exportSymbol;
|
|
2491
2528
|
membersCache;
|
|
@@ -2498,19 +2535,31 @@ export class Symbol {
|
|
|
2498
2535
|
this.escapedName = data.name;
|
|
2499
2536
|
this.name = unescapeLeadingUnderscores(data.name);
|
|
2500
2537
|
this.flags = data.flags;
|
|
2501
|
-
this.checkFlags = data.checkFlags;
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
this.
|
|
2506
|
-
this.valueDeclaration = data.valueDeclaration
|
|
2507
|
-
? new NodeHandle(data.valueDeclaration, project, fileOwner)
|
|
2508
|
-
: undefined;
|
|
2538
|
+
this.checkFlags = data.checkFlags ?? 0;
|
|
2539
|
+
this.declarationHandles = data.declarations;
|
|
2540
|
+
this.valueDeclarationHandle = data.valueDeclaration;
|
|
2541
|
+
this.declarationsCache = undefined;
|
|
2542
|
+
this.valueDeclarationCache = undefined;
|
|
2509
2543
|
if (data.parent !== undefined)
|
|
2510
2544
|
this.parent = data.parent;
|
|
2511
2545
|
if (data.exportSymbol !== undefined)
|
|
2512
2546
|
this.exportSymbol = data.exportSymbol;
|
|
2513
2547
|
}
|
|
2548
|
+
get declarations() {
|
|
2549
|
+
return this.declarationsCache ??= this.declarationHandles?.map(handle => this.createDeclarationHandle(handle)) ?? [];
|
|
2550
|
+
}
|
|
2551
|
+
get valueDeclaration() {
|
|
2552
|
+
if (this.valueDeclarationCache === undefined && this.valueDeclarationHandle) {
|
|
2553
|
+
this.valueDeclarationCache = this.createDeclarationHandle(this.valueDeclarationHandle);
|
|
2554
|
+
}
|
|
2555
|
+
return this.valueDeclarationCache;
|
|
2556
|
+
}
|
|
2557
|
+
createDeclarationHandle(handle) {
|
|
2558
|
+
// A file-owned symbol has no canonical project; its declarations resolve through its file.
|
|
2559
|
+
return this.storage.kind === SymbolOwnerKind.Snapshot
|
|
2560
|
+
? this.storage.registry.createNodeHandle(handle)
|
|
2561
|
+
: new NodeHandle(handle, undefined, this.storage.owner);
|
|
2562
|
+
}
|
|
2514
2563
|
async getParent() {
|
|
2515
2564
|
if (!this.parent)
|
|
2516
2565
|
return undefined;
|
|
@@ -2640,8 +2689,7 @@ class TypeObject {
|
|
|
2640
2689
|
this.objectRegistry = objectRegistry;
|
|
2641
2690
|
this.id = data.id;
|
|
2642
2691
|
this.flags = data.flags;
|
|
2643
|
-
|
|
2644
|
-
this.objectFlags = data.objectFlags;
|
|
2692
|
+
this.objectFlags = data.objectFlags ?? 0;
|
|
2645
2693
|
if (data.symbol !== undefined)
|
|
2646
2694
|
this.symbol = data.symbol;
|
|
2647
2695
|
if (data.value != null) {
|
|
@@ -2669,8 +2717,7 @@ class TypeObject {
|
|
|
2669
2717
|
}
|
|
2670
2718
|
if (data.intrinsicName !== undefined)
|
|
2671
2719
|
this.intrinsicName = data.intrinsicName;
|
|
2672
|
-
|
|
2673
|
-
this.isThisType = data.isThisType;
|
|
2720
|
+
this.isThisType = data.isThisType ?? false;
|
|
2674
2721
|
if (data.freshType !== undefined)
|
|
2675
2722
|
this.freshType = data.freshType;
|
|
2676
2723
|
if (data.regularType !== undefined)
|
|
@@ -3049,7 +3096,9 @@ export class Signature {
|
|
|
3049
3096
|
flags;
|
|
3050
3097
|
objectRegistry;
|
|
3051
3098
|
id;
|
|
3052
|
-
|
|
3099
|
+
project;
|
|
3100
|
+
declarationHandle;
|
|
3101
|
+
declarationCache;
|
|
3053
3102
|
typeParameters;
|
|
3054
3103
|
parameters;
|
|
3055
3104
|
thisParameter;
|
|
@@ -3057,15 +3106,23 @@ export class Signature {
|
|
|
3057
3106
|
returnType;
|
|
3058
3107
|
constructor(data, project, objectRegistry) {
|
|
3059
3108
|
this.id = data.id;
|
|
3060
|
-
this.flags = data.flags;
|
|
3109
|
+
this.flags = data.flags ?? 0;
|
|
3061
3110
|
this.objectRegistry = objectRegistry;
|
|
3062
|
-
this.
|
|
3111
|
+
this.project = project;
|
|
3112
|
+
this.declarationHandle = data.declaration;
|
|
3113
|
+
this.declarationCache = undefined;
|
|
3063
3114
|
this.typeParameters = data.typeParameters ?? [];
|
|
3064
3115
|
this.parameters = data.parameters ?? [];
|
|
3065
3116
|
this.thisParameter = data.thisParameter;
|
|
3066
3117
|
this.target = data.target;
|
|
3067
3118
|
this.returnType = false;
|
|
3068
3119
|
}
|
|
3120
|
+
get declaration() {
|
|
3121
|
+
if (this.declarationCache === undefined && this.declarationHandle) {
|
|
3122
|
+
this.declarationCache = this.objectRegistry.createNodeHandle(this.declarationHandle);
|
|
3123
|
+
}
|
|
3124
|
+
return this.declarationCache;
|
|
3125
|
+
}
|
|
3069
3126
|
async getTypeParameters() {
|
|
3070
3127
|
return this.objectRegistry.fetchTypes(this, "getTypeParametersOfSignature", this.typeParameters);
|
|
3071
3128
|
}
|