@artel/artc 0.6.25277 → 0.6.25278
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/build/Cli.js +3 -3
- package/build/api/Api.js +14 -10
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +286 -293
- package/build/{chunk-QK3TWMY2.js → chunk-4C7CEJJF.js} +20 -24
- package/build/{chunk-EVYL6VFM.js → chunk-A2QTLTGI.js} +1935 -1176
- package/build/{chunk-DKZTCPRN.js → chunk-L44WWCT7.js} +15 -15
- package/build/types/analysis/AccessedFunction.d.ts +3 -3
- package/build/types/analysis/AnalyzedTextTranslationPackage.d.ts +2 -2
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +11 -8
- package/build/types/analysis/Analyzer.d.ts +21 -19
- package/build/types/analysis/DeclarationsUsageCounter.d.ts +2 -2
- package/build/types/analysis/{DiagnosticCollector.d.ts → SourceFileAnalyzer.d.ts} +4 -5
- package/build/types/analysis/SourcePackageDependencyGraph.d.ts +2 -2
- package/build/types/analysis/SubstitutedFunction.d.ts +3 -3
- package/build/types/analysis/TranslatedEntityNameConflictsValidator.d.ts +28 -0
- package/build/types/analysis/Translation.d.ts +1 -2
- package/build/types/analysis/index.d.ts +1 -1
- package/build/types/analysis/semantic-context/Declarations.d.ts +3 -3
- package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +2 -2
- package/build/types/api/Api.d.ts +1 -1
- package/build/types/common/TaskController.d.ts +14 -0
- package/build/types/common/TreeTraversal.d.ts +10 -9
- package/build/types/common/index.d.ts +1 -2
- package/build/types/diagnostic/DiagnosticCode.d.ts +5 -1
- package/build/types/emitter/Emitter.d.ts +3 -3
- package/build/types/emitter/EmitterContext.d.ts +1 -1
- package/build/types/emitter/EntityMap.d.ts +1 -1
- package/build/types/entities/Entity.d.ts +3 -1
- package/build/types/entities/EntityNaming.d.ts +2 -0
- package/build/types/entities/interfaces/FunctionEntity.d.ts +19 -6
- package/build/types/entities/interfaces/TypeParameterEntity.d.ts +2 -2
- package/build/types/entities/intrinsic/IntrinsicFunctionEntity.d.ts +3 -1
- package/build/types/entities/source/SourceFunctionEntity.d.ts +86 -5
- package/build/types/entities/source/SourceVariableEntity.d.ts +3 -1
- package/build/types/entities/translated/TranslatedAliasTypeEntity.d.ts +0 -1
- package/build/types/entities/translated/TranslatedConstructorEntity.d.ts +1 -1
- package/build/types/entities/translated/TranslatedFunctionEntity.d.ts +29 -14
- package/build/types/entities/translated/TranslatedFunctionTypeEntity.d.ts +0 -1
- package/build/types/entities/translated/TranslatedIndexerEntity.d.ts +19 -9
- package/build/types/entities/translated/TranslatedOperatorEntity.d.ts +21 -10
- package/build/types/entities/translated/TranslatedPackageEntity.d.ts +0 -2
- package/build/types/entities/translated/TranslatedStructuredTypeEntity.d.ts +0 -1
- package/build/types/entities/translated/TranslatedVariantTypeEntity.d.ts +0 -1
- package/build/types/executor/Compiler.d.ts +6 -6
- package/build/types/executor/NodeCompiler.d.ts +6 -6
- package/build/types/project/CompilationLoader.d.ts +5 -5
- package/build/types/project/FileSystemTree.d.ts +1 -1
- package/build/types/project/PackageContentCreator.d.ts +2 -1
- package/build/types/services/DefinitionService.d.ts +2 -2
- package/build/types/services/DisplayService.d.ts +22 -7
- package/build/types/services/DocumentHighlightsService.d.ts +2 -2
- package/build/types/services/LanguageServer.d.ts +1 -1
- package/build/types/services/NodeSemanticInfo.d.ts +1 -6
- package/build/types/services/ReferencesService.d.ts +3 -3
- package/build/types/services/RenameService.d.ts +2 -2
- package/build/types/services/SemanticTokensService.d.ts +4 -4
- package/build/types/services/source-generation/SourceGenerationService.d.ts +3 -3
- package/build/types/services/workspace/CompilationController.d.ts +7 -5
- package/build/types/services/workspace/FileSystemTreeProviderBasedOnWatchedFileSystem.d.ts +2 -2
- package/build/types/services/workspace/ManuallyUpdatedFileSystemTreeProvider.d.ts +2 -2
- package/build/types/services/workspace/Workspace.d.ts +3 -5
- package/build/types/services/workspace/WorkspaceFiles.d.ts +3 -3
- package/build/types/ts-interop/Entities.d.ts +3 -0
- package/package.json +1 -1
- package/build/types/common/ThrottledCancellationToken.d.ts +0 -17
- package/build/types/common/YieldExecution.d.ts +0 -1
|
@@ -764,7 +764,7 @@ var UniqueWithComparatorQuery = class extends Query {
|
|
|
764
764
|
};
|
|
765
765
|
|
|
766
766
|
// source/common/Constants.ts
|
|
767
|
-
var ArtelVersion = true ? "0.6.
|
|
767
|
+
var ArtelVersion = true ? "0.6.25278" : "";
|
|
768
768
|
var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel"];
|
|
769
769
|
var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
|
|
770
770
|
var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
|
|
@@ -8398,49 +8398,6 @@ var Result;
|
|
|
8398
8398
|
Result2.Error = Error2;
|
|
8399
8399
|
})(Result || (Result = {}));
|
|
8400
8400
|
|
|
8401
|
-
// source/common/ThrottledCancellationToken.ts
|
|
8402
|
-
var ThrottledCancellationToken = class _ThrottledCancellationToken {
|
|
8403
|
-
constructor(token, throttleTimeMs, checkThrottleTimeEveryN) {
|
|
8404
|
-
this.token = token;
|
|
8405
|
-
this.throttleTimeMs = throttleTimeMs;
|
|
8406
|
-
this.checkThrottleTimeEveryN = checkThrottleTimeEveryN;
|
|
8407
|
-
this.checkNumber = 0;
|
|
8408
|
-
this.lastTimeMs = Date.now();
|
|
8409
|
-
Debug.assert(checkThrottleTimeEveryN > 0);
|
|
8410
|
-
}
|
|
8411
|
-
isThrottleTimeOver() {
|
|
8412
|
-
this.checkNumber++;
|
|
8413
|
-
let result = this.checkNumber % this.checkThrottleTimeEveryN === 0;
|
|
8414
|
-
if (result) {
|
|
8415
|
-
const time = Date.now();
|
|
8416
|
-
const elapsedTime = time - this.lastTimeMs;
|
|
8417
|
-
result = elapsedTime > this.throttleTimeMs;
|
|
8418
|
-
if (result) {
|
|
8419
|
-
this.lastTimeMs = time;
|
|
8420
|
-
}
|
|
8421
|
-
}
|
|
8422
|
-
return result;
|
|
8423
|
-
}
|
|
8424
|
-
throwIfCancellationRequestedAndReset() {
|
|
8425
|
-
this.token.throwIfCancellationRequested();
|
|
8426
|
-
this.checkNumber = 0;
|
|
8427
|
-
this.lastTimeMs = Date.now();
|
|
8428
|
-
}
|
|
8429
|
-
throwIfCancellationRequestedAndResetAsync() {
|
|
8430
|
-
return __async(this, null, function* () {
|
|
8431
|
-
yield yieldExecution();
|
|
8432
|
-
this.token.throwIfCancellationRequested();
|
|
8433
|
-
this.checkNumber = 0;
|
|
8434
|
-
this.lastTimeMs = Date.now();
|
|
8435
|
-
});
|
|
8436
|
-
}
|
|
8437
|
-
withOptions(options) {
|
|
8438
|
-
const throttleTimeMs = options.throttleTimeMs ?? this.throttleTimeMs;
|
|
8439
|
-
const checkThrottleTimeEveryN = options.checkThrottleTimeEveryN ?? this.checkThrottleTimeEveryN;
|
|
8440
|
-
return new _ThrottledCancellationToken(this.token, throttleTimeMs, checkThrottleTimeEveryN);
|
|
8441
|
-
}
|
|
8442
|
-
};
|
|
8443
|
-
|
|
8444
8401
|
// source/common/TreeQuery.ts
|
|
8445
8402
|
var TreeQuery = class {
|
|
8446
8403
|
static getSourceFile(node, analyzer) {
|
|
@@ -8511,27 +8468,28 @@ var TypeMemberQuery = class {
|
|
|
8511
8468
|
};
|
|
8512
8469
|
|
|
8513
8470
|
// source/common/TreeTraversal.ts
|
|
8514
|
-
function
|
|
8471
|
+
function traverseTree(root, visitTokens, taskController, nodeVisitor) {
|
|
8515
8472
|
return __async(this, null, function* () {
|
|
8516
|
-
const
|
|
8517
|
-
yield executionController.yieldAndResetAsync();
|
|
8518
|
-
cancellationToken?.throwIfCancellationRequested();
|
|
8473
|
+
const controller = new TraversalController(taskController);
|
|
8519
8474
|
const stack = new Array();
|
|
8520
8475
|
stack.push(root);
|
|
8521
|
-
const traversalController = new TraversalController();
|
|
8522
8476
|
while (stack.length > 0) {
|
|
8523
8477
|
const node = stack.pop();
|
|
8524
|
-
|
|
8525
|
-
if (
|
|
8478
|
+
const asyncVisiter = nodeVisitor(node, controller);
|
|
8479
|
+
if (asyncVisiter !== void 0) {
|
|
8480
|
+
yield asyncVisiter;
|
|
8481
|
+
}
|
|
8482
|
+
if (controller.shouldStopTraverse()) {
|
|
8526
8483
|
break;
|
|
8527
8484
|
}
|
|
8528
|
-
if (
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8485
|
+
if (controller.task !== void 0) {
|
|
8486
|
+
if (controller.task.shouldYieldOnceOutOf100()) {
|
|
8487
|
+
yield controller.task.yieldTask();
|
|
8488
|
+
}
|
|
8489
|
+
controller.task.throwIfCancellationRequested();
|
|
8532
8490
|
}
|
|
8533
|
-
if (
|
|
8534
|
-
|
|
8491
|
+
if (controller.shouldSkipChildrenTraverse()) {
|
|
8492
|
+
controller.resetSkipChildrenTraverse();
|
|
8535
8493
|
continue;
|
|
8536
8494
|
}
|
|
8537
8495
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
@@ -8543,76 +8501,26 @@ function traverseTreeWithCancellationToken(root, cancellationToken, throttleTime
|
|
|
8543
8501
|
}
|
|
8544
8502
|
});
|
|
8545
8503
|
}
|
|
8546
|
-
function traverseTree(root, visitNodeCb) {
|
|
8547
|
-
const stack = new Array();
|
|
8548
|
-
stack.push(root);
|
|
8549
|
-
const controller = new TraversalController();
|
|
8550
|
-
while (stack.length > 0) {
|
|
8551
|
-
const node = stack.pop();
|
|
8552
|
-
visitNodeCb(node, controller);
|
|
8553
|
-
if (controller.isTraverseStopped) {
|
|
8554
|
-
break;
|
|
8555
|
-
}
|
|
8556
|
-
if (controller.isChildrenTraverseStopped) {
|
|
8557
|
-
controller.isChildrenTraverseStopped = false;
|
|
8558
|
-
continue;
|
|
8559
|
-
}
|
|
8560
|
-
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
8561
|
-
const childNode = node.children[i];
|
|
8562
|
-
if (childNode !== void 0) {
|
|
8563
|
-
stack.push(childNode);
|
|
8564
|
-
}
|
|
8565
|
-
}
|
|
8566
|
-
}
|
|
8567
|
-
}
|
|
8568
8504
|
var TraversalController = class {
|
|
8569
|
-
constructor() {
|
|
8570
|
-
this.
|
|
8571
|
-
this.
|
|
8572
|
-
this.
|
|
8505
|
+
constructor(task) {
|
|
8506
|
+
this.shouldStopTraverse_ = false;
|
|
8507
|
+
this.shouldSkipChildrenTraverse_ = false;
|
|
8508
|
+
this.task = task;
|
|
8573
8509
|
}
|
|
8574
|
-
|
|
8575
|
-
this.
|
|
8510
|
+
shouldStopTraverse() {
|
|
8511
|
+
return this.shouldStopTraverse_;
|
|
8576
8512
|
}
|
|
8577
|
-
|
|
8578
|
-
this.
|
|
8513
|
+
shouldSkipChildrenTraverse() {
|
|
8514
|
+
return this.shouldSkipChildrenTraverse_;
|
|
8579
8515
|
}
|
|
8580
|
-
|
|
8581
|
-
this.
|
|
8516
|
+
stopTraverse() {
|
|
8517
|
+
this.shouldStopTraverse_ = true;
|
|
8582
8518
|
}
|
|
8583
|
-
|
|
8584
|
-
this.
|
|
8585
|
-
this.isChildrenTraverseStopped = false;
|
|
8586
|
-
this.shouldYieldExecution = false;
|
|
8519
|
+
skipChildrenTraverse() {
|
|
8520
|
+
this.shouldSkipChildrenTraverse_ = true;
|
|
8587
8521
|
}
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
constructor(throttleTimeMs, checkThrottleTimeEveryN) {
|
|
8591
|
-
this.throttleTimeMs = throttleTimeMs;
|
|
8592
|
-
this.checkThrottleTimeEveryN = checkThrottleTimeEveryN;
|
|
8593
|
-
this.checkCount = 0;
|
|
8594
|
-
this.lastTimeMs = Date.now();
|
|
8595
|
-
Debug.assert(checkThrottleTimeEveryN > 0);
|
|
8596
|
-
}
|
|
8597
|
-
isThrottleTimeOver() {
|
|
8598
|
-
this.checkCount++;
|
|
8599
|
-
let result = this.checkCount % this.checkThrottleTimeEveryN === 0;
|
|
8600
|
-
if (result) {
|
|
8601
|
-
const time = Date.now();
|
|
8602
|
-
const elapsedTime = time - this.lastTimeMs;
|
|
8603
|
-
result = elapsedTime > this.throttleTimeMs;
|
|
8604
|
-
if (result) {
|
|
8605
|
-
this.lastTimeMs = time;
|
|
8606
|
-
}
|
|
8607
|
-
}
|
|
8608
|
-
return result;
|
|
8609
|
-
}
|
|
8610
|
-
yieldAndResetAsync() {
|
|
8611
|
-
return __async(this, null, function* () {
|
|
8612
|
-
yield yieldExecution();
|
|
8613
|
-
this.checkCount = 0;
|
|
8614
|
-
this.lastTimeMs = Date.now();
|
|
8615
|
-
});
|
|
8522
|
+
resetSkipChildrenTraverse() {
|
|
8523
|
+
this.shouldSkipChildrenTraverse_ = false;
|
|
8616
8524
|
}
|
|
8617
8525
|
};
|
|
8618
8526
|
|
|
@@ -8777,10 +8685,49 @@ var WithDiagnostics_error = class {
|
|
|
8777
8685
|
}
|
|
8778
8686
|
};
|
|
8779
8687
|
|
|
8780
|
-
// source/common/
|
|
8781
|
-
|
|
8688
|
+
// source/common/TaskController.ts
|
|
8689
|
+
var TaskController = class {
|
|
8690
|
+
constructor(timeSliceMs = 30, cancellationToken) {
|
|
8691
|
+
this.checkCount = 0;
|
|
8692
|
+
this.lastTimeMs = Date.now();
|
|
8693
|
+
this.timeSliceMs = timeSliceMs;
|
|
8694
|
+
this.cancellationToken = cancellationToken;
|
|
8695
|
+
}
|
|
8696
|
+
shouldYieldOnceOutOf100() {
|
|
8697
|
+
return this.shouldYield(100);
|
|
8698
|
+
}
|
|
8699
|
+
shouldYield(onceOutOf = 1) {
|
|
8700
|
+
Debug.assert(onceOutOf > 0);
|
|
8701
|
+
let result = false;
|
|
8702
|
+
if (this.timeSliceMs >= 0) {
|
|
8703
|
+
this.checkCount++;
|
|
8704
|
+
result = this.checkCount % onceOutOf === 0;
|
|
8705
|
+
if (result && this.timeSliceMs > 0) {
|
|
8706
|
+
const timeMs = Date.now();
|
|
8707
|
+
const elapsedTime = timeMs - this.lastTimeMs;
|
|
8708
|
+
result = elapsedTime > this.timeSliceMs;
|
|
8709
|
+
if (result) {
|
|
8710
|
+
this.lastTimeMs = timeMs;
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8713
|
+
}
|
|
8714
|
+
return result;
|
|
8715
|
+
}
|
|
8716
|
+
isCancellationRequested() {
|
|
8717
|
+
return this.cancellationToken?.isCancellationRequested === true;
|
|
8718
|
+
}
|
|
8719
|
+
throwIfCancellationRequested() {
|
|
8720
|
+
this.cancellationToken?.throwIfCancellationRequested();
|
|
8721
|
+
}
|
|
8722
|
+
yieldTask(timeMs) {
|
|
8723
|
+
return __async(this, null, function* () {
|
|
8724
|
+
return new Promise((r) => setTimeout(r, timeMs));
|
|
8725
|
+
});
|
|
8726
|
+
}
|
|
8727
|
+
};
|
|
8728
|
+
function yieldTask(timeMs) {
|
|
8782
8729
|
return __async(this, null, function* () {
|
|
8783
|
-
|
|
8730
|
+
return new Promise((r) => setTimeout(r, timeMs));
|
|
8784
8731
|
});
|
|
8785
8732
|
}
|
|
8786
8733
|
|
|
@@ -9074,7 +9021,11 @@ var DiagnosticCode = /* @__PURE__ */ ((DiagnosticCode2) => {
|
|
|
9074
9021
|
DiagnosticCode2[DiagnosticCode2["TheNumberOfTranslatedParametersMustBeEqualToTheNumberOfSourceParameters"] = 388] = "TheNumberOfTranslatedParametersMustBeEqualToTheNumberOfSourceParameters";
|
|
9075
9022
|
DiagnosticCode2[DiagnosticCode2["TheNumberOfTranslatedTypeParametersMustBeEqualToTheNumberOfSourceTypeParameters"] = 389] = "TheNumberOfTranslatedTypeParametersMustBeEqualToTheNumberOfSourceTypeParameters";
|
|
9076
9023
|
DiagnosticCode2[DiagnosticCode2["TheNameOfTheTranslatedOperatorMustMeTheSameAsSourceOperatorName"] = 390] = "TheNameOfTheTranslatedOperatorMustMeTheSameAsSourceOperatorName";
|
|
9077
|
-
DiagnosticCode2[DiagnosticCode2["
|
|
9024
|
+
DiagnosticCode2[DiagnosticCode2["TranslationOfFunctionTypeMustIncludeParameterList"] = 391] = "TranslationOfFunctionTypeMustIncludeParameterList";
|
|
9025
|
+
DiagnosticCode2[DiagnosticCode2["OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary"] = 392] = "OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary";
|
|
9026
|
+
DiagnosticCode2[DiagnosticCode2["Declarations0And1HaveTheSameSourceNamesButDifferentTranslatedNames23"] = 393] = "Declarations0And1HaveTheSameSourceNamesButDifferentTranslatedNames23";
|
|
9027
|
+
DiagnosticCode2[DiagnosticCode2["TranslatedDeclarations0And1HaveTheSameTranslatedNamesButDifferentSourceNames23"] = 394] = "TranslatedDeclarations0And1HaveTheSameTranslatedNamesButDifferentSourceNames23";
|
|
9028
|
+
DiagnosticCode2[DiagnosticCode2["TranslatedOverridingMember0MustTheSameNameAsBaseMember1"] = 395] = "TranslatedOverridingMember0MustTheSameNameAsBaseMember1";
|
|
9078
9029
|
DiagnosticCode2[DiagnosticCode2["CannotFindTsLibDirectoryBaseSearchPaths0"] = 401] = "CannotFindTsLibDirectoryBaseSearchPaths0";
|
|
9079
9030
|
DiagnosticCode2[DiagnosticCode2["SourceFile0IsNotPartOfThePackageAndWontBeLoaded"] = 402] = "SourceFile0IsNotPartOfThePackageAndWontBeLoaded";
|
|
9080
9031
|
DiagnosticCode2[DiagnosticCode2["ProgramWithoutMainPackageCannotBeCompiled"] = 403] = "ProgramWithoutMainPackageCannotBeCompiled";
|
|
@@ -9357,7 +9308,11 @@ var englishErrorMessages = {
|
|
|
9357
9308
|
[388 /* TheNumberOfTranslatedParametersMustBeEqualToTheNumberOfSourceParameters */]: "The number of translated parameters must be equal to the number of source parameters.",
|
|
9358
9309
|
[389 /* TheNumberOfTranslatedTypeParametersMustBeEqualToTheNumberOfSourceTypeParameters */]: "The number of translated type parameters must be equal to the number of source type parameters.",
|
|
9359
9310
|
[390 /* TheNameOfTheTranslatedOperatorMustMeTheSameAsSourceOperatorName */]: "The name of the translated operator must me the same as source operator name.",
|
|
9360
|
-
[391 /*
|
|
9311
|
+
[391 /* TranslationOfFunctionTypeMustIncludeParameterList */]: "Translation of function type must include parameter list.",
|
|
9312
|
+
[392 /* OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary */]: "Only one text translation package should be marked as primary (for the same translating package).",
|
|
9313
|
+
[393 /* Declarations0And1HaveTheSameSourceNamesButDifferentTranslatedNames23 */]: "Declarations that have the same source names must have the same translated names.\nDeclarations\n{0}\nand\n{1}\nhave the same source names, but different translated names: '{2}' and '{3}'.",
|
|
9314
|
+
[394 /* TranslatedDeclarations0And1HaveTheSameTranslatedNamesButDifferentSourceNames23 */]: "Declarations that have different source names must have different translated names.\nTranslated declarations\n{0}\nand\n{1}\nhave the same translated names, but different source names: '{2}' and '{3}'.",
|
|
9315
|
+
[395 /* TranslatedOverridingMember0MustTheSameNameAsBaseMember1 */]: "Translated derived member '{0}' must have the same name as base member '{1}'.",
|
|
9361
9316
|
[401 /* CannotFindTsLibDirectoryBaseSearchPaths0 */]: "Can not find directory with TypeScript library. Base search paths: {0}.",
|
|
9362
9317
|
[402 /* SourceFile0IsNotPartOfThePackageAndWontBeLoaded */]: "Source file '{0}' is not part of the package and won't be loaded.",
|
|
9363
9318
|
[403 /* ProgramWithoutMainPackageCannotBeCompiled */]: "Program without main package cannot be compiled.",
|
|
@@ -9593,7 +9548,11 @@ var russianErrorMessages = {
|
|
|
9593
9548
|
[388 /* TheNumberOfTranslatedParametersMustBeEqualToTheNumberOfSourceParameters */]: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0445 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0440\u0430\u0432\u043D\u043E \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0445 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.",
|
|
9594
9549
|
[389 /* TheNumberOfTranslatedTypeParametersMustBeEqualToTheNumberOfSourceTypeParameters */]: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0445 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0442\u0438\u043F\u0430 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0440\u0430\u0432\u043D\u043E \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0445 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432 \u0442\u0438\u043F\u0430.",
|
|
9595
9550
|
[390 /* TheNameOfTheTranslatedOperatorMustMeTheSameAsSourceOperatorName */]: "\u0418\u043C\u044F \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u043E\u0433\u043E \u043E\u043F\u0435\u0440\u0430\u0442\u043E\u0440\u0430 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u0442\u0430\u043A\u0438\u043C \u0436\u0435, \u043A\u0430\u043A \u0438\u043C\u044F \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0433\u043E \u043E\u043F\u0435\u0440\u0430\u0442\u043E\u0440\u0430.",
|
|
9596
|
-
[391 /*
|
|
9551
|
+
[391 /* TranslationOfFunctionTypeMustIncludeParameterList */]: "\u041F\u0435\u0440\u0435\u0432\u043E\u0434 \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0442\u0438\u043F\u0430 \u0434\u043E\u043B\u0436\u0435\u043D \u0432\u043A\u043B\u044E\u0447\u0430\u0442\u044C \u0441\u043F\u0438\u0441\u043E\u043A \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u0432.",
|
|
9552
|
+
[392 /* OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary */]: "\u041B\u0438\u0448\u044C \u043E\u0434\u0438\u043D \u043F\u0430\u043A\u0435\u0442 \u043F\u0435\u0440\u0435\u0432\u043E\u0434\u0430 \u0442\u0435\u043A\u0441\u0442\u043E\u0432 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u043F\u0435\u0440\u0432\u0438\u0447\u043D\u044B\u043C (\u0434\u043B\u044F \u043E\u0434\u043D\u043E\u0433\u043E \u0438 \u0442\u043E\u0433\u043E \u0436\u0435 \u043F\u0435\u0440\u0435\u0432\u043E\u0434\u0438\u043C\u043E\u0433\u043E \u043F\u0430\u043A\u0435\u0442\u0430).",
|
|
9553
|
+
[393 /* Declarations0And1HaveTheSameSourceNamesButDifferentTranslatedNames23 */]: "\u041E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u044F, \u0438\u043C\u0435\u044E\u0449\u0438\u0435 \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u0435 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430, \u0434\u043E\u043B\u0436\u043D\u044B \u0438\u043C\u0435\u0442\u044C \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u0435 \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430.\n\u041E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u044F\n{0}\n\u0438\n{1}\n\u0438\u043C\u0435\u044E\u0442 \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u0435 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430, \u043D\u043E \u0440\u0430\u0437\u043D\u044B\u0435 \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430: '{2}' \u0438 '{3}'.",
|
|
9554
|
+
[394 /* TranslatedDeclarations0And1HaveTheSameTranslatedNamesButDifferentSourceNames23 */]: "\u041E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u044F, \u0438\u043C\u0435\u044E\u0449\u0438\u0435 \u0440\u0430\u0437\u043D\u044B\u0435 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430, \u0434\u043E\u043B\u0436\u043D\u044B \u0438\u043C\u0435\u0442\u044C \u0440\u0430\u0437\u043D\u044B\u0435 \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430.\n\u041F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0435 \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u044F\n{0}\n\u0438\n{1}\n\u0438\u043C\u0435\u044E\u0442 \u043E\u0434\u0438\u043D\u0430\u043A\u043E\u0432\u044B\u0435 \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430, \u043D\u043E \u0440\u0430\u0437\u043D\u044B\u0435 \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0435 \u0438\u043C\u0435\u043D\u0430: '{2}' \u0438 '{3}'.",
|
|
9555
|
+
[395 /* TranslatedOverridingMember0MustTheSameNameAsBaseMember1 */]: "\u041F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u043D\u044B\u0439 \u043F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0439 \u0447\u043B\u0435\u043D \u0442\u0438\u043F\u0430 '{0}' \u0434\u043E\u043B\u0436\u0435\u043D \u0438\u043C\u0435\u0442\u044C \u0442\u0430\u043A\u043E\u0435 \u0436\u0435 \u0438\u043C\u044F, \u043A\u0430\u043A \u0431\u0430\u0437\u043E\u0432\u044B\u0439 \u0447\u043B\u0435\u043D \u0442\u0438\u043F\u0430 '{1}'.",
|
|
9597
9556
|
[401 /* CannotFindTsLibDirectoryBaseSearchPaths0 */]: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043D\u0430\u0439\u0442\u0438 \u043F\u0430\u043F\u043A\u0443 \u0441\u043E \u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u043E\u0439 \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u043E\u0439 TypeScript. \u041F\u0443\u0442\u0438, \u043E\u0442\u043D\u043E\u0441\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u043A\u043E\u0442\u043E\u0440\u044B\u0445 \u043E\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043B\u044F\u043B\u0441\u044F \u043F\u043E\u0438\u0441\u043A: {0}.",
|
|
9598
9557
|
[402 /* SourceFile0IsNotPartOfThePackageAndWontBeLoaded */]: "\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0444\u0430\u0439\u043B '{0}' \u043D\u0435 \u044F\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0447\u0430\u0441\u0442\u044C\u044E \u043F\u0430\u043A\u0435\u0442\u0430 \u0438 \u043D\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D.",
|
|
9599
9558
|
[403 /* ProgramWithoutMainPackageCannotBeCompiled */]: "\u041F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0431\u0435\u0437 \u0433\u043B\u0430\u0432\u043D\u043E\u0433\u043E \u043F\u0430\u043A\u0435\u0442\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0441\u043A\u043E\u043C\u043F\u0438\u043B\u0438\u0440\u043E\u0432\u0430\u043D\u0430.",
|
|
@@ -10029,6 +9988,17 @@ var DisplayService = class {
|
|
|
10029
9988
|
returnTypeText
|
|
10030
9989
|
);
|
|
10031
9990
|
}
|
|
9991
|
+
displayAnonymousFunctionDeclaration(func) {
|
|
9992
|
+
const asyncKeyword = func.isAsync() ? `${this.displayKeyword(40 /* Async */)} ` : "";
|
|
9993
|
+
const keyword = this.displayKeyword(12 /* Function */);
|
|
9994
|
+
const parameters = func.getParameters().map((p) => this.getParameterDeclarationDisplayParts(p, lessDetailsTypeDisplayOptions));
|
|
9995
|
+
const returnType = func.getReturnType();
|
|
9996
|
+
let returnTypeText = "";
|
|
9997
|
+
if (!returnType.isNullType) {
|
|
9998
|
+
returnTypeText = `: ${this.displayType(returnType)}`;
|
|
9999
|
+
}
|
|
10000
|
+
return `${asyncKeyword}${keyword}(${parameters})${returnTypeText}`;
|
|
10001
|
+
}
|
|
10032
10002
|
displayOperatorDeclaration(operator) {
|
|
10033
10003
|
return this.getOperatorDeclarationDisplayParts(operator).toString();
|
|
10034
10004
|
}
|
|
@@ -10343,8 +10313,13 @@ var DisplayService = class {
|
|
|
10343
10313
|
return this.displayVariableDeclaration(declaration);
|
|
10344
10314
|
}
|
|
10345
10315
|
case 1 /* Function */: {
|
|
10346
|
-
|
|
10347
|
-
|
|
10316
|
+
if (isNamedFunctionEntity(entity)) {
|
|
10317
|
+
const declaration = new FunctionDeclaration_entity(entity);
|
|
10318
|
+
return this.displayFunctionDeclaration(declaration);
|
|
10319
|
+
} else {
|
|
10320
|
+
const declaration = new AnonymousFunctionDeclaration_entity(entity);
|
|
10321
|
+
return this.displayAnonymousFunctionDeclaration(declaration);
|
|
10322
|
+
}
|
|
10348
10323
|
}
|
|
10349
10324
|
case 9 /* Operator */: {
|
|
10350
10325
|
const declaration = new OperatorDeclaration_entity(entity);
|
|
@@ -11047,6 +11022,21 @@ var FunctionDeclaration_accessedFunction = class {
|
|
|
11047
11022
|
}
|
|
11048
11023
|
}
|
|
11049
11024
|
};
|
|
11025
|
+
var AnonymousFunctionDeclaration_entity = class {
|
|
11026
|
+
constructor(func) {
|
|
11027
|
+
this.kind = "entity";
|
|
11028
|
+
this.func = func;
|
|
11029
|
+
}
|
|
11030
|
+
getParameters() {
|
|
11031
|
+
return this.func.getParameters().map((p) => new ParameterDeclaration_entity(p));
|
|
11032
|
+
}
|
|
11033
|
+
getReturnType() {
|
|
11034
|
+
return this.func.getReturnType();
|
|
11035
|
+
}
|
|
11036
|
+
isAsync() {
|
|
11037
|
+
return this.func.isAsync();
|
|
11038
|
+
}
|
|
11039
|
+
};
|
|
11050
11040
|
var ConstructorDeclaration_entity = class {
|
|
11051
11041
|
constructor(value) {
|
|
11052
11042
|
this.kind = "type-member";
|
|
@@ -13352,17 +13342,17 @@ function isTypeMemberEntity(entity) {
|
|
|
13352
13342
|
}
|
|
13353
13343
|
}
|
|
13354
13344
|
var TypeMemberEntity;
|
|
13355
|
-
((
|
|
13345
|
+
((TypeMemberEntity8) => {
|
|
13356
13346
|
function isAspectTypeMember(entity) {
|
|
13357
13347
|
const containingEntity = entity.getContainingEntity();
|
|
13358
13348
|
return containingEntity.kind === 2 /* Type */ && containingEntity.typeEntityKind === 1 /* Structured */ && containingEntity.getStructuredTypeKind() === 2 /* Aspect */;
|
|
13359
13349
|
}
|
|
13360
|
-
|
|
13350
|
+
TypeMemberEntity8.isAspectTypeMember = isAspectTypeMember;
|
|
13361
13351
|
function isRefObjectTypeMember(entity) {
|
|
13362
13352
|
const containingEntity = entity.getContainingEntity();
|
|
13363
13353
|
return containingEntity.kind === 2 /* Type */ && containingEntity.typeEntityKind === 1 /* Structured */ && containingEntity.getStructuredTypeKind() === 0 /* RefObject */;
|
|
13364
13354
|
}
|
|
13365
|
-
|
|
13355
|
+
TypeMemberEntity8.isRefObjectTypeMember = isRefObjectTypeMember;
|
|
13366
13356
|
function isStatic(entity) {
|
|
13367
13357
|
switch (entity.kind) {
|
|
13368
13358
|
case 0 /* Variable */:
|
|
@@ -13378,7 +13368,7 @@ var TypeMemberEntity;
|
|
|
13378
13368
|
Debug.never(entity);
|
|
13379
13369
|
}
|
|
13380
13370
|
}
|
|
13381
|
-
|
|
13371
|
+
TypeMemberEntity8.isStatic = isStatic;
|
|
13382
13372
|
function markedBasic(entity) {
|
|
13383
13373
|
switch (entity.kind) {
|
|
13384
13374
|
case 0 /* Variable */:
|
|
@@ -13394,7 +13384,7 @@ var TypeMemberEntity;
|
|
|
13394
13384
|
Debug.never(entity);
|
|
13395
13385
|
}
|
|
13396
13386
|
}
|
|
13397
|
-
|
|
13387
|
+
TypeMemberEntity8.markedBasic = markedBasic;
|
|
13398
13388
|
function isBasic(entity) {
|
|
13399
13389
|
switch (entity.kind) {
|
|
13400
13390
|
case 0 /* Variable */:
|
|
@@ -13410,11 +13400,11 @@ var TypeMemberEntity;
|
|
|
13410
13400
|
Debug.never(entity);
|
|
13411
13401
|
}
|
|
13412
13402
|
}
|
|
13413
|
-
|
|
13403
|
+
TypeMemberEntity8.isBasic = isBasic;
|
|
13414
13404
|
function isAbstract(entity) {
|
|
13415
13405
|
return entity.markedAbstract();
|
|
13416
13406
|
}
|
|
13417
|
-
|
|
13407
|
+
TypeMemberEntity8.isAbstract = isAbstract;
|
|
13418
13408
|
function getOverriddenMembers(entity) {
|
|
13419
13409
|
switch (entity.kind) {
|
|
13420
13410
|
case 0 /* Variable */:
|
|
@@ -13434,7 +13424,7 @@ var TypeMemberEntity;
|
|
|
13434
13424
|
Debug.never(entity);
|
|
13435
13425
|
}
|
|
13436
13426
|
}
|
|
13437
|
-
|
|
13427
|
+
TypeMemberEntity8.getOverriddenMembers = getOverriddenMembers;
|
|
13438
13428
|
function instantiate(analyzer, entity, substitutions) {
|
|
13439
13429
|
switch (entity.kind) {
|
|
13440
13430
|
case 0 /* Variable */:
|
|
@@ -13455,7 +13445,7 @@ var TypeMemberEntity;
|
|
|
13455
13445
|
Debug.never(entity);
|
|
13456
13446
|
}
|
|
13457
13447
|
}
|
|
13458
|
-
|
|
13448
|
+
TypeMemberEntity8.instantiate = instantiate;
|
|
13459
13449
|
})(TypeMemberEntity || (TypeMemberEntity = {}));
|
|
13460
13450
|
function isNamedTypeMemberEntity(entity) {
|
|
13461
13451
|
if (entity.kind === 0 /* Variable */ && entity.subkind === "field" || entity.kind === 1 /* Function */ && entity.subkind === "method") {
|
|
@@ -13466,7 +13456,7 @@ function isNamedTypeMemberEntity(entity) {
|
|
|
13466
13456
|
return false;
|
|
13467
13457
|
}
|
|
13468
13458
|
function isEntityWithTypeParameters(entity) {
|
|
13469
|
-
if (entity
|
|
13459
|
+
if (isNamedFunctionEntity(entity) || entity.kind === 2 /* Type */ && (entity.typeEntityKind === 1 /* Structured */ || entity.typeEntityKind === 4 /* Alias */ || entity.typeEntityKind === 0 /* Function */ || entity.typeEntityKind === 3 /* Variant */)) {
|
|
13470
13460
|
return true;
|
|
13471
13461
|
}
|
|
13472
13462
|
Debug.typeIsAssignableTo();
|
|
@@ -13481,6 +13471,14 @@ function isEntityWithParameters(entity) {
|
|
|
13481
13471
|
Debug.typeIsAssignableTo();
|
|
13482
13472
|
return false;
|
|
13483
13473
|
}
|
|
13474
|
+
function isNamedFunctionEntity(entity) {
|
|
13475
|
+
if (entity.kind === 1 /* Function */ && (entity.subkind === "package" || entity.subkind === "method" || entity.subkind === "nested")) {
|
|
13476
|
+
return true;
|
|
13477
|
+
}
|
|
13478
|
+
Debug.typeIsAssignableTo();
|
|
13479
|
+
Debug.typeIsAssignableTo();
|
|
13480
|
+
return false;
|
|
13481
|
+
}
|
|
13484
13482
|
var EntityContext = class _EntityContext {
|
|
13485
13483
|
constructor(containingPackage, hidingMatcher, typeExtensionLookup) {
|
|
13486
13484
|
this.containingPackage = containingPackage;
|
|
@@ -13945,7 +13943,8 @@ var EntityLocalizationContext = class {
|
|
|
13945
13943
|
const localizedMethod = this.getLocalizedMethodEntity(containingEntity);
|
|
13946
13944
|
return localizedMethod.getParameters().find((p) => p.getOriginalEntity() === entity) ?? entity;
|
|
13947
13945
|
}
|
|
13948
|
-
case "nested":
|
|
13946
|
+
case "nested":
|
|
13947
|
+
case "anonymous": {
|
|
13949
13948
|
return entity;
|
|
13950
13949
|
}
|
|
13951
13950
|
default:
|
|
@@ -14032,6 +14031,9 @@ var EntityNaming_named = class {
|
|
|
14032
14031
|
toString() {
|
|
14033
14032
|
return this.value.unescapedOriginal;
|
|
14034
14033
|
}
|
|
14034
|
+
considerEqual(other, considerBackQuotes) {
|
|
14035
|
+
return other.kind === "named" && this.value.considerEqual(other.value, considerBackQuotes);
|
|
14036
|
+
}
|
|
14035
14037
|
};
|
|
14036
14038
|
var EntityNaming_anonymous = class {
|
|
14037
14039
|
constructor() {
|
|
@@ -14040,6 +14042,9 @@ var EntityNaming_anonymous = class {
|
|
|
14040
14042
|
toString() {
|
|
14041
14043
|
return "anonymous";
|
|
14042
14044
|
}
|
|
14045
|
+
considerEqual(other, _considerBackQuotes) {
|
|
14046
|
+
return other.kind === "anonymous";
|
|
14047
|
+
}
|
|
14043
14048
|
};
|
|
14044
14049
|
|
|
14045
14050
|
// source/entities/interfaces/AliasTypeEntity.ts
|
|
@@ -14531,6 +14536,9 @@ var IntrinsicPackageFunctionEntity = class {
|
|
|
14531
14536
|
getName() {
|
|
14532
14537
|
return this.name;
|
|
14533
14538
|
}
|
|
14539
|
+
getNaming() {
|
|
14540
|
+
return new EntityNaming_named(this.name);
|
|
14541
|
+
}
|
|
14534
14542
|
getContainingPackage() {
|
|
14535
14543
|
return this.containingPackage;
|
|
14536
14544
|
}
|
|
@@ -14600,6 +14608,9 @@ var IntrinsicMethodEntity = class {
|
|
|
14600
14608
|
getName() {
|
|
14601
14609
|
return this.name;
|
|
14602
14610
|
}
|
|
14611
|
+
getNaming() {
|
|
14612
|
+
return new EntityNaming_named(this.name);
|
|
14613
|
+
}
|
|
14603
14614
|
getTypeParameters() {
|
|
14604
14615
|
return this.typeParameters;
|
|
14605
14616
|
}
|
|
@@ -17893,7 +17904,7 @@ var DirectoryInternal = class extends ObservableObject {
|
|
|
17893
17904
|
getChild(name) {
|
|
17894
17905
|
return this.childByName.get(name);
|
|
17895
17906
|
}
|
|
17896
|
-
*
|
|
17907
|
+
*getFlatChildren() {
|
|
17897
17908
|
const descendants = Array.from(this.childByName.values());
|
|
17898
17909
|
while (descendants.length > 0) {
|
|
17899
17910
|
const descendant = descendants.pop();
|
|
@@ -22212,17 +22223,17 @@ var SourceFile2 = class _SourceFile extends TextFile {
|
|
|
22212
22223
|
|
|
22213
22224
|
// source/project/CompilationLoader.ts
|
|
22214
22225
|
var CompilationLoader = class _CompilationLoader {
|
|
22215
|
-
constructor(source, config, diagnostics,
|
|
22226
|
+
constructor(source, config, diagnostics, taskController) {
|
|
22216
22227
|
this.configurationsByPackageOrGroupUri = /* @__PURE__ */ new Map();
|
|
22217
22228
|
this.source = source;
|
|
22218
22229
|
this.config = config;
|
|
22219
22230
|
this.diagnostics = diagnostics;
|
|
22220
|
-
this.
|
|
22231
|
+
this.taskController = taskController;
|
|
22221
22232
|
}
|
|
22222
22233
|
static {
|
|
22223
22234
|
this.artelSystemPackageName = PackageName2.parse("\u0410\u0440\u0442\u0435\u043B\u044C");
|
|
22224
22235
|
}
|
|
22225
|
-
static loadUsingSourcesProvider(uri, sourcesProvider, options, diagnostics, workspaceUri, namesOfDirectoriesToIgnore
|
|
22236
|
+
static loadUsingSourcesProvider(uri, sourcesProvider, taskController, options, diagnostics, workspaceUri, namesOfDirectoriesToIgnore) {
|
|
22226
22237
|
return __async(this, null, function* () {
|
|
22227
22238
|
const fileSystemTree = runAtomically(() => new FileSystemTree());
|
|
22228
22239
|
const namesOfDirectoriesToIgnoreSet = new Set(namesOfDirectoriesToIgnore ?? DefaultNamesOfDirectoriesToIgnore);
|
|
@@ -22243,11 +22254,11 @@ var CompilationLoader = class _CompilationLoader {
|
|
|
22243
22254
|
fileSystemTree,
|
|
22244
22255
|
options?.additionalPackageContents
|
|
22245
22256
|
);
|
|
22246
|
-
const loadResult = yield new _CompilationLoader(source, internalConfig, diagnostics,
|
|
22257
|
+
const loadResult = yield new _CompilationLoader(source, internalConfig, diagnostics, taskController).load();
|
|
22247
22258
|
return { loadResult, fileSystemTree };
|
|
22248
22259
|
});
|
|
22249
22260
|
}
|
|
22250
|
-
static loadFromFileSystemTree(rootDirectory, fileSystemTree, options, diagnostics
|
|
22261
|
+
static loadFromFileSystemTree(rootDirectory, fileSystemTree, taskController, options, diagnostics) {
|
|
22251
22262
|
return __async(this, null, function* () {
|
|
22252
22263
|
const internalConfig = this.convertOptions(options);
|
|
22253
22264
|
const source = new CompilationLoadSource.FSTreeAndPackageContents(
|
|
@@ -22255,18 +22266,18 @@ var CompilationLoader = class _CompilationLoader {
|
|
|
22255
22266
|
fileSystemTree,
|
|
22256
22267
|
options?.additionalPackageContents
|
|
22257
22268
|
);
|
|
22258
|
-
const loadResult = yield new _CompilationLoader(source, internalConfig, diagnostics,
|
|
22269
|
+
const loadResult = yield new _CompilationLoader(source, internalConfig, diagnostics, taskController).load();
|
|
22259
22270
|
return loadResult;
|
|
22260
22271
|
});
|
|
22261
22272
|
}
|
|
22262
|
-
static loadFromPackageContents(contents, options, diagnostics
|
|
22273
|
+
static loadFromPackageContents(contents, taskController, options, diagnostics) {
|
|
22263
22274
|
return __async(this, null, function* () {
|
|
22264
22275
|
const internalConfig = this.convertOptions(options);
|
|
22265
22276
|
if (options?.additionalPackageContents !== void 0) {
|
|
22266
22277
|
contents = Array.from(contents).concat(options.additionalPackageContents);
|
|
22267
22278
|
}
|
|
22268
22279
|
const source = new CompilationLoadSource.PackageContents(contents);
|
|
22269
|
-
const loadResult = yield new _CompilationLoader(source, internalConfig, diagnostics,
|
|
22280
|
+
const loadResult = yield new _CompilationLoader(source, internalConfig, diagnostics, taskController).load();
|
|
22270
22281
|
return loadResult;
|
|
22271
22282
|
});
|
|
22272
22283
|
}
|
|
@@ -22909,9 +22920,9 @@ var CompilationLoadSource;
|
|
|
22909
22920
|
var PackageContent_exports = {};
|
|
22910
22921
|
|
|
22911
22922
|
// source/project/PackageContentCreator.ts
|
|
22912
|
-
function createPackageContentsFromFSTree(rootDirectory, fileSystemTree) {
|
|
22923
|
+
function createPackageContentsFromFSTree(rootDirectory, fileSystemTree, taskController) {
|
|
22913
22924
|
return __async(this, null, function* () {
|
|
22914
|
-
const loadResult = yield CompilationLoader.loadFromFileSystemTree(rootDirectory, fileSystemTree);
|
|
22925
|
+
const loadResult = yield CompilationLoader.loadFromFileSystemTree(rootDirectory, fileSystemTree, taskController);
|
|
22915
22926
|
if (loadResult.compilation === void 0) {
|
|
22916
22927
|
return [];
|
|
22917
22928
|
}
|
|
@@ -24443,6 +24454,9 @@ var TsGlobalFunctionEntity = class {
|
|
|
24443
24454
|
getName() {
|
|
24444
24455
|
return this.name;
|
|
24445
24456
|
}
|
|
24457
|
+
getNaming() {
|
|
24458
|
+
return new EntityNaming_named(this.name);
|
|
24459
|
+
}
|
|
24446
24460
|
getContainingPackage() {
|
|
24447
24461
|
return this.containingPackage;
|
|
24448
24462
|
}
|
|
@@ -25082,8 +25096,13 @@ var TsPropertyEntity = class {
|
|
|
25082
25096
|
return this.containingType.getContainingPackage();
|
|
25083
25097
|
}
|
|
25084
25098
|
isStatic() {
|
|
25085
|
-
|
|
25086
|
-
|
|
25099
|
+
let result = this.forceStatic || // Всеобщее свойство 'prototype' создаётся компилятором TypeScript автоматически.
|
|
25100
|
+
(this.symbol.flags & ts2.SymbolFlags.Prototype) !== 0;
|
|
25101
|
+
if (!result) {
|
|
25102
|
+
const declaration = this.getDeclaration();
|
|
25103
|
+
result = declaration !== void 0 && (ts2.getCombinedModifierFlags(declaration) & ts2.ModifierFlags.Static) !== 0;
|
|
25104
|
+
}
|
|
25105
|
+
return result;
|
|
25087
25106
|
}
|
|
25088
25107
|
markedBasic() {
|
|
25089
25108
|
let result = !this.isStatic() && !this.markedAbstract();
|
|
@@ -25106,7 +25125,7 @@ var TsPropertyEntity = class {
|
|
|
25106
25125
|
return result;
|
|
25107
25126
|
}
|
|
25108
25127
|
isOverride() {
|
|
25109
|
-
return
|
|
25128
|
+
return this.getOverriddenMembers().length > 0;
|
|
25110
25129
|
}
|
|
25111
25130
|
markedAbstract() {
|
|
25112
25131
|
const declaration = this.getDeclaration();
|
|
@@ -25212,8 +25231,12 @@ var TsAccessorEntity = class {
|
|
|
25212
25231
|
return this.containingType.getContainingPackage();
|
|
25213
25232
|
}
|
|
25214
25233
|
isStatic() {
|
|
25215
|
-
|
|
25216
|
-
|
|
25234
|
+
let result = this.forceStatic;
|
|
25235
|
+
if (!result) {
|
|
25236
|
+
const declaration = this.getGetAccessorDeclaration();
|
|
25237
|
+
result = declaration !== void 0 && (ts2.getCombinedModifierFlags(declaration) & ts2.ModifierFlags.Static) !== 0;
|
|
25238
|
+
}
|
|
25239
|
+
return result;
|
|
25217
25240
|
}
|
|
25218
25241
|
markedBasic() {
|
|
25219
25242
|
let result = !this.isStatic() && !this.markedAbstract();
|
|
@@ -25236,7 +25259,7 @@ var TsAccessorEntity = class {
|
|
|
25236
25259
|
return result;
|
|
25237
25260
|
}
|
|
25238
25261
|
isOverride() {
|
|
25239
|
-
return
|
|
25262
|
+
return this.getOverriddenMembers().length > 0;
|
|
25240
25263
|
}
|
|
25241
25264
|
markedAbstract() {
|
|
25242
25265
|
const declaration = this.getGetAccessorDeclaration();
|
|
@@ -25385,6 +25408,9 @@ var TsMethodEntity = class {
|
|
|
25385
25408
|
getName() {
|
|
25386
25409
|
return this.name;
|
|
25387
25410
|
}
|
|
25411
|
+
getNaming() {
|
|
25412
|
+
return new EntityNaming_named(this.name);
|
|
25413
|
+
}
|
|
25388
25414
|
getTypeParameters() {
|
|
25389
25415
|
return this.typeParameters.getOrInsertWith(() => this.declaration.typeParameters?.map((d) => {
|
|
25390
25416
|
const symbol = this.tsctx.tsChecker.getMergedSymbol(d.symbol);
|
|
@@ -25433,7 +25459,7 @@ var TsMethodEntity = class {
|
|
|
25433
25459
|
return result;
|
|
25434
25460
|
}
|
|
25435
25461
|
isOverride() {
|
|
25436
|
-
return
|
|
25462
|
+
return this.getOverriddenMembers().length > 0;
|
|
25437
25463
|
}
|
|
25438
25464
|
markedAbstract() {
|
|
25439
25465
|
return (ts2.getCombinedModifierFlags(this.declaration) & ts2.ModifierFlags.Abstract) !== 0 || this.containingType.typeEntityKind === 1 /* Structured */ && this.containingType.getStructuredTypeKind() === 2 /* Aspect */;
|
|
@@ -25503,6 +25529,9 @@ var TsIteratorFunctionEntity = class {
|
|
|
25503
25529
|
getName() {
|
|
25504
25530
|
return this.name;
|
|
25505
25531
|
}
|
|
25532
|
+
getNaming() {
|
|
25533
|
+
return new EntityNaming_named(this.name);
|
|
25534
|
+
}
|
|
25506
25535
|
getTypeParameters() {
|
|
25507
25536
|
return emptyTypeParameterEntities;
|
|
25508
25537
|
}
|
|
@@ -25544,7 +25573,7 @@ var TsIteratorFunctionEntity = class {
|
|
|
25544
25573
|
return !this.markedAbstract();
|
|
25545
25574
|
}
|
|
25546
25575
|
isOverride() {
|
|
25547
|
-
return
|
|
25576
|
+
return this.getOverriddenMembers().length > 0;
|
|
25548
25577
|
}
|
|
25549
25578
|
markedAbstract() {
|
|
25550
25579
|
const declaration = this.getFirstDeclaration();
|
|
@@ -25797,7 +25826,7 @@ var TsIndexSignatureEntity = class {
|
|
|
25797
25826
|
return false;
|
|
25798
25827
|
}
|
|
25799
25828
|
isOverride() {
|
|
25800
|
-
return
|
|
25829
|
+
return this.getOverriddenMembers().length > 0;
|
|
25801
25830
|
}
|
|
25802
25831
|
markedAbstract() {
|
|
25803
25832
|
return false;
|
|
@@ -27994,7 +28023,7 @@ var AnalyzedTextTranslationPackage = class {
|
|
|
27994
28023
|
}
|
|
27995
28024
|
createEntitiesByTextKey() {
|
|
27996
28025
|
const result = /* @__PURE__ */ new Map();
|
|
27997
|
-
for (const declaration of this.
|
|
28026
|
+
for (const declaration of this.textTranslationDeclarations()) {
|
|
27998
28027
|
const entity = this.analyzer.entity.ofTextTranslationDeclaration(declaration.sourceText);
|
|
27999
28028
|
const key = entity.getKey();
|
|
28000
28029
|
let entities = result.get(key);
|
|
@@ -28006,8 +28035,8 @@ var AnalyzedTextTranslationPackage = class {
|
|
|
28006
28035
|
}
|
|
28007
28036
|
return result;
|
|
28008
28037
|
}
|
|
28009
|
-
*
|
|
28010
|
-
for (const translations of this.
|
|
28038
|
+
*textTranslationDeclarations() {
|
|
28039
|
+
for (const translations of this.translationsDeclarations()) {
|
|
28011
28040
|
for (const declaration of translations.translationList.elements) {
|
|
28012
28041
|
if (declaration.kind === 140 /* TextTranslationDeclaration */ || declaration.kind === 141 /* TextTranslationFunctionDeclaration */) {
|
|
28013
28042
|
yield declaration;
|
|
@@ -28015,7 +28044,7 @@ var AnalyzedTextTranslationPackage = class {
|
|
|
28015
28044
|
}
|
|
28016
28045
|
}
|
|
28017
28046
|
}
|
|
28018
|
-
*
|
|
28047
|
+
*translationsDeclarations() {
|
|
28019
28048
|
for (const sourceFile of this.package_.sourceFiles) {
|
|
28020
28049
|
for (const declaration of flattenPackageMemberDeclarationList(sourceFile.getSyntaxNode().declarationList)) {
|
|
28021
28050
|
if (declaration.kind === 123 /* TranslationsDeclaration */) {
|
|
@@ -28075,7 +28104,7 @@ var TranslatedAliasTypeEntity = class {
|
|
|
28075
28104
|
return this.aliasedType.getOrInsertWith(() => new LocalizedAliasedType(this.originalEntity.getAliasedType(), this.translationPackage.localizationContext));
|
|
28076
28105
|
}
|
|
28077
28106
|
getMembers() {
|
|
28078
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
28107
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
28079
28108
|
}
|
|
28080
28109
|
getDefinition() {
|
|
28081
28110
|
return this.originalEntity.getDefinition();
|
|
@@ -28095,9 +28124,6 @@ var TranslatedAliasTypeEntity = class {
|
|
|
28095
28124
|
getContext() {
|
|
28096
28125
|
return this.context.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedEntityContext(this.originalEntity.getContext()));
|
|
28097
28126
|
}
|
|
28098
|
-
ensureAllDiagnosticsReported() {
|
|
28099
|
-
this.getMembers();
|
|
28100
|
-
}
|
|
28101
28127
|
};
|
|
28102
28128
|
TranslatedAliasTypeEntity = __decorateClass([
|
|
28103
28129
|
entityToStringDecorator
|
|
@@ -28243,8 +28269,7 @@ var SourceTranslationDefinition = class {
|
|
|
28243
28269
|
}
|
|
28244
28270
|
};
|
|
28245
28271
|
var IntrinsicTranslationDefinition = class {
|
|
28246
|
-
constructor(
|
|
28247
|
-
this.isMissingTranslationReplacement = isMissingTranslationReplacement;
|
|
28272
|
+
constructor() {
|
|
28248
28273
|
this.kind = "intrinsic";
|
|
28249
28274
|
}
|
|
28250
28275
|
equals(other) {
|
|
@@ -28304,7 +28329,7 @@ var TranslatedDereferenceOperatorEntity = class {
|
|
|
28304
28329
|
const originalGetter = this.originalEntity.getGetter();
|
|
28305
28330
|
return originalGetter !== void 0 ? new TranslatedGetterEntity(
|
|
28306
28331
|
originalGetter,
|
|
28307
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
28332
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
28308
28333
|
this.translationPackage,
|
|
28309
28334
|
this
|
|
28310
28335
|
) : void 0;
|
|
@@ -28315,7 +28340,7 @@ var TranslatedDereferenceOperatorEntity = class {
|
|
|
28315
28340
|
const originalSetter = this.originalEntity.getSetter();
|
|
28316
28341
|
return originalSetter !== void 0 ? new TranslatedSetterEntity(
|
|
28317
28342
|
originalSetter,
|
|
28318
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
28343
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
28319
28344
|
this.translationPackage,
|
|
28320
28345
|
this
|
|
28321
28346
|
) : void 0;
|
|
@@ -28435,6 +28460,9 @@ var TranslatedPackageFunctionEntity = class {
|
|
|
28435
28460
|
getName() {
|
|
28436
28461
|
return this.name;
|
|
28437
28462
|
}
|
|
28463
|
+
getNaming() {
|
|
28464
|
+
return new EntityNaming_named(this.name);
|
|
28465
|
+
}
|
|
28438
28466
|
getTypeParameters() {
|
|
28439
28467
|
return this.typeParameters.getOrInsertWith(() => this.translationPackage.createTranslatedTypeParameters(
|
|
28440
28468
|
this.originalEntity.getTypeParameters(),
|
|
@@ -28475,11 +28503,9 @@ TranslatedPackageFunctionEntity = __decorateClass([
|
|
|
28475
28503
|
entityToStringDecorator
|
|
28476
28504
|
], TranslatedPackageFunctionEntity);
|
|
28477
28505
|
var TranslatedMethodEntity = class {
|
|
28478
|
-
constructor(analyzer, originalEntity, translation, name, translationPackage, translatedContainingEntity
|
|
28506
|
+
constructor(analyzer, originalEntity, translation, name, translationPackage, translatedContainingEntity) {
|
|
28479
28507
|
this.kind = 1 /* Function */;
|
|
28480
28508
|
this.subkind = "method";
|
|
28481
|
-
this.typeParameters = new Cached();
|
|
28482
|
-
this.parameters = new Cached();
|
|
28483
28509
|
this.returnType = new Cached();
|
|
28484
28510
|
this.overriddenMembers = new Cached();
|
|
28485
28511
|
Debug.assert(
|
|
@@ -28492,7 +28518,6 @@ var TranslatedMethodEntity = class {
|
|
|
28492
28518
|
this.name = name;
|
|
28493
28519
|
this.translationPackage = translationPackage;
|
|
28494
28520
|
this.containingEntity = translatedContainingEntity;
|
|
28495
|
-
this.node = node;
|
|
28496
28521
|
}
|
|
28497
28522
|
getContainingEntity() {
|
|
28498
28523
|
return this.containingEntity;
|
|
@@ -28515,19 +28540,8 @@ var TranslatedMethodEntity = class {
|
|
|
28515
28540
|
getName() {
|
|
28516
28541
|
return this.name;
|
|
28517
28542
|
}
|
|
28518
|
-
|
|
28519
|
-
return this.
|
|
28520
|
-
this.originalEntity.getTypeParameters(),
|
|
28521
|
-
this.node?.translatedTypeParameterClause?.typeParameterList,
|
|
28522
|
-
this
|
|
28523
|
-
));
|
|
28524
|
-
}
|
|
28525
|
-
getParameters() {
|
|
28526
|
-
return this.parameters.getOrInsertWith(() => this.translationPackage.createTranslatedParameters(
|
|
28527
|
-
this.originalEntity.getParameters(),
|
|
28528
|
-
this.node?.translatedParameterClause.parameterList,
|
|
28529
|
-
this
|
|
28530
|
-
));
|
|
28543
|
+
getNaming() {
|
|
28544
|
+
return new EntityNaming_named(this.name);
|
|
28531
28545
|
}
|
|
28532
28546
|
getReturnType() {
|
|
28533
28547
|
return this.returnType.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedType(this.originalEntity.getReturnType()));
|
|
@@ -28576,9 +28590,74 @@ var TranslatedMethodEntity = class {
|
|
|
28576
28590
|
return this.originalEntity.getSubstitutionApplicationMode();
|
|
28577
28591
|
}
|
|
28578
28592
|
};
|
|
28579
|
-
|
|
28593
|
+
var SourceTranslatedMethodEntity = class extends TranslatedMethodEntity {
|
|
28594
|
+
constructor(analyzer, originalEntity, translation, name, translationPackage, translatedContainingEntity, node) {
|
|
28595
|
+
super(analyzer, originalEntity, translation, name, translationPackage, translatedContainingEntity);
|
|
28596
|
+
this.kind = 1 /* Function */;
|
|
28597
|
+
this.subkind = "method";
|
|
28598
|
+
this.typeParameters = new Cached();
|
|
28599
|
+
this.parameters = new Cached();
|
|
28600
|
+
this.node = node;
|
|
28601
|
+
}
|
|
28602
|
+
getTypeParameters() {
|
|
28603
|
+
return this.typeParameters.getOrInsertWith(() => this.translationPackage.createTranslatedTypeParameters(
|
|
28604
|
+
this.originalEntity.getTypeParameters(),
|
|
28605
|
+
this.node?.translatedTypeParameterClause?.typeParameterList,
|
|
28606
|
+
this
|
|
28607
|
+
));
|
|
28608
|
+
}
|
|
28609
|
+
getParameters() {
|
|
28610
|
+
return this.parameters.getOrInsertWith(() => this.translationPackage.createTranslatedParameters(
|
|
28611
|
+
this.originalEntity.getParameters(),
|
|
28612
|
+
this.node?.translatedParameterClause.parameterList,
|
|
28613
|
+
this
|
|
28614
|
+
));
|
|
28615
|
+
}
|
|
28616
|
+
};
|
|
28617
|
+
SourceTranslatedMethodEntity = __decorateClass([
|
|
28618
|
+
entityToStringDecorator
|
|
28619
|
+
], SourceTranslatedMethodEntity);
|
|
28620
|
+
var UnfinishedIntrinsicTranslatedMethodEntity = class {
|
|
28621
|
+
get unfinishedValue() {
|
|
28622
|
+
return this.unfinishedValue_;
|
|
28623
|
+
}
|
|
28624
|
+
constructor(analyzer, originalEntity, translation, name, translationPackage, translatedContainingEntity) {
|
|
28625
|
+
this.unfinishedValue_ = new IntrinsicTranslatedMethodEntity(
|
|
28626
|
+
analyzer,
|
|
28627
|
+
originalEntity,
|
|
28628
|
+
translation,
|
|
28629
|
+
name,
|
|
28630
|
+
translationPackage,
|
|
28631
|
+
translatedContainingEntity
|
|
28632
|
+
);
|
|
28633
|
+
}
|
|
28634
|
+
finish(typeParameters, parameters) {
|
|
28635
|
+
this.unfinishedValue_.setTypeParameters(typeParameters);
|
|
28636
|
+
this.unfinishedValue_.setParameters(parameters);
|
|
28637
|
+
return this.unfinishedValue_;
|
|
28638
|
+
}
|
|
28639
|
+
};
|
|
28640
|
+
var IntrinsicTranslatedMethodEntity = class extends TranslatedMethodEntity {
|
|
28641
|
+
getTypeParameters() {
|
|
28642
|
+
Debug.assertNotNull(this.typeParameters, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0442\u0438\u043F\u0430 \u043D\u0435 \u0431\u044B\u043B\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
28643
|
+
return this.typeParameters;
|
|
28644
|
+
}
|
|
28645
|
+
getParameters() {
|
|
28646
|
+
Debug.assertNotNull(this.parameters, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043D\u0435 \u0431\u044B\u043B\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
28647
|
+
return this.parameters;
|
|
28648
|
+
}
|
|
28649
|
+
setTypeParameters(typeParameters) {
|
|
28650
|
+
Debug.assert(this.typeParameters === void 0, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0442\u0438\u043F\u0430 \u0443\u0436\u0435 \u0431\u044B\u043B\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
28651
|
+
this.typeParameters = typeParameters;
|
|
28652
|
+
}
|
|
28653
|
+
setParameters(parameters) {
|
|
28654
|
+
Debug.assert(this.parameters === void 0, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0443\u0436\u0435 \u0431\u044B\u043B\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
28655
|
+
this.parameters = parameters;
|
|
28656
|
+
}
|
|
28657
|
+
};
|
|
28658
|
+
IntrinsicTranslatedMethodEntity = __decorateClass([
|
|
28580
28659
|
entityToStringDecorator
|
|
28581
|
-
],
|
|
28660
|
+
], IntrinsicTranslatedMethodEntity);
|
|
28582
28661
|
|
|
28583
28662
|
// source/entities/translated/TranslatedStructuredTypeEntity.ts
|
|
28584
28663
|
var TranslatedPackageStructuredTypeEntity = class {
|
|
@@ -28630,7 +28709,7 @@ var TranslatedPackageStructuredTypeEntity = class {
|
|
|
28630
28709
|
));
|
|
28631
28710
|
}
|
|
28632
28711
|
getMembers() {
|
|
28633
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
28712
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
28634
28713
|
}
|
|
28635
28714
|
getDefinition() {
|
|
28636
28715
|
return this.originalEntity.getDefinition();
|
|
@@ -28668,9 +28747,6 @@ var TranslatedPackageStructuredTypeEntity = class {
|
|
|
28668
28747
|
getContext() {
|
|
28669
28748
|
return this.context.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedEntityContext(this.originalEntity.getContext()));
|
|
28670
28749
|
}
|
|
28671
|
-
ensureAllDiagnosticsReported() {
|
|
28672
|
-
this.getMembers();
|
|
28673
|
-
}
|
|
28674
28750
|
};
|
|
28675
28751
|
TranslatedPackageStructuredTypeEntity = __decorateClass([
|
|
28676
28752
|
entityToStringDecorator
|
|
@@ -28718,7 +28794,7 @@ var TranslatedAnonymousStructuredTypeEntity = class {
|
|
|
28718
28794
|
return originalTypeParameters;
|
|
28719
28795
|
}
|
|
28720
28796
|
getMembers() {
|
|
28721
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
28797
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
28722
28798
|
}
|
|
28723
28799
|
getDefinition() {
|
|
28724
28800
|
return this.originalEntity.getDefinition();
|
|
@@ -28870,7 +28946,7 @@ var TranslatedPackageFunctionTypeEntity = class {
|
|
|
28870
28946
|
return this.returnType.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedType(this.originalEntity.getReturnType()));
|
|
28871
28947
|
}
|
|
28872
28948
|
getMembers() {
|
|
28873
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
28949
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
28874
28950
|
}
|
|
28875
28951
|
getDefinition() {
|
|
28876
28952
|
return this.originalEntity.getDefinition();
|
|
@@ -28896,9 +28972,6 @@ var TranslatedPackageFunctionTypeEntity = class {
|
|
|
28896
28972
|
getContext() {
|
|
28897
28973
|
return this.context.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedEntityContext(this.originalEntity.getContext()));
|
|
28898
28974
|
}
|
|
28899
|
-
ensureAllDiagnosticsReported() {
|
|
28900
|
-
this.getMembers();
|
|
28901
|
-
}
|
|
28902
28975
|
};
|
|
28903
28976
|
TranslatedPackageFunctionTypeEntity = __decorateClass([
|
|
28904
28977
|
entityToStringDecorator
|
|
@@ -28953,7 +29026,7 @@ var TranslatedAnonymousFunctionTypeEntity = class {
|
|
|
28953
29026
|
return this.returnType.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedType(this.originalEntity.getReturnType()));
|
|
28954
29027
|
}
|
|
28955
29028
|
getMembers() {
|
|
28956
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
29029
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
28957
29030
|
}
|
|
28958
29031
|
getDefinition() {
|
|
28959
29032
|
return this.originalEntity.getDefinition();
|
|
@@ -29038,9 +29111,8 @@ TranslatedGetterEntity = __decorateClass([
|
|
|
29038
29111
|
|
|
29039
29112
|
// source/entities/translated/TranslatedIndexerEntity.ts
|
|
29040
29113
|
var TranslatedIndexerEntity = class {
|
|
29041
|
-
constructor(originalEntity, translation, translationPackage, translatedContainingEntity
|
|
29114
|
+
constructor(originalEntity, translation, translationPackage, translatedContainingEntity) {
|
|
29042
29115
|
this.kind = 5 /* Indexer */;
|
|
29043
|
-
this.parameters = new Cached();
|
|
29044
29116
|
this.type = new Cached();
|
|
29045
29117
|
this.getter = new Cached();
|
|
29046
29118
|
this.setter = new Cached();
|
|
@@ -29053,7 +29125,6 @@ var TranslatedIndexerEntity = class {
|
|
|
29053
29125
|
this.translation = translation;
|
|
29054
29126
|
this.translationPackage = translationPackage;
|
|
29055
29127
|
this.containingEntity = translatedContainingEntity;
|
|
29056
|
-
this.node = node;
|
|
29057
29128
|
}
|
|
29058
29129
|
getContainingEntity() {
|
|
29059
29130
|
return this.containingEntity;
|
|
@@ -29073,13 +29144,6 @@ var TranslatedIndexerEntity = class {
|
|
|
29073
29144
|
getOriginalEntity() {
|
|
29074
29145
|
return this.originalEntity;
|
|
29075
29146
|
}
|
|
29076
|
-
getParameters() {
|
|
29077
|
-
return this.parameters.getOrInsertWith(() => this.translationPackage.createTranslatedParameters(
|
|
29078
|
-
this.originalEntity.getParameters(),
|
|
29079
|
-
this.node?.translatedParameterClause.parameterList,
|
|
29080
|
-
this
|
|
29081
|
-
));
|
|
29082
|
-
}
|
|
29083
29147
|
getDefinition() {
|
|
29084
29148
|
return this.originalEntity.getDefinition();
|
|
29085
29149
|
}
|
|
@@ -29097,7 +29161,7 @@ var TranslatedIndexerEntity = class {
|
|
|
29097
29161
|
const originalGetter = this.originalEntity.getGetter();
|
|
29098
29162
|
return originalGetter !== void 0 ? new TranslatedGetterEntity(
|
|
29099
29163
|
originalGetter,
|
|
29100
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
29164
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
29101
29165
|
this.translationPackage,
|
|
29102
29166
|
this
|
|
29103
29167
|
) : void 0;
|
|
@@ -29108,7 +29172,7 @@ var TranslatedIndexerEntity = class {
|
|
|
29108
29172
|
const originalSetter = this.originalEntity.getSetter();
|
|
29109
29173
|
return originalSetter !== void 0 ? new TranslatedSetterEntity(
|
|
29110
29174
|
originalSetter,
|
|
29111
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
29175
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
29112
29176
|
this.translationPackage,
|
|
29113
29177
|
this
|
|
29114
29178
|
) : void 0;
|
|
@@ -29136,15 +29200,58 @@ var TranslatedIndexerEntity = class {
|
|
|
29136
29200
|
return this.originalEntity.getTags();
|
|
29137
29201
|
}
|
|
29138
29202
|
};
|
|
29139
|
-
|
|
29203
|
+
var SourceTranslatedIndexerEntity = class extends TranslatedIndexerEntity {
|
|
29204
|
+
constructor(originalEntity, translation, translationPackage, translatedContainingEntity, node) {
|
|
29205
|
+
super(originalEntity, translation, translationPackage, translatedContainingEntity);
|
|
29206
|
+
this.parameters = new Cached();
|
|
29207
|
+
this.node = node;
|
|
29208
|
+
}
|
|
29209
|
+
getParameters() {
|
|
29210
|
+
return this.parameters.getOrInsertWith(() => this.translationPackage.createTranslatedParameters(
|
|
29211
|
+
this.originalEntity.getParameters(),
|
|
29212
|
+
this.node?.translatedParameterClause.parameterList,
|
|
29213
|
+
this
|
|
29214
|
+
));
|
|
29215
|
+
}
|
|
29216
|
+
};
|
|
29217
|
+
SourceTranslatedIndexerEntity = __decorateClass([
|
|
29140
29218
|
entityToStringDecorator
|
|
29141
|
-
],
|
|
29219
|
+
], SourceTranslatedIndexerEntity);
|
|
29220
|
+
var UnfinishedIntrinsicTranslatedIndexerEntity = class {
|
|
29221
|
+
get unfinishedValue() {
|
|
29222
|
+
return this.unfinishedValue_;
|
|
29223
|
+
}
|
|
29224
|
+
constructor(originalEntity, translation, translationPackage, translatedContainingEntity) {
|
|
29225
|
+
this.unfinishedValue_ = new IntrinsicTranslatedIndexerEntity(
|
|
29226
|
+
originalEntity,
|
|
29227
|
+
translation,
|
|
29228
|
+
translationPackage,
|
|
29229
|
+
translatedContainingEntity
|
|
29230
|
+
);
|
|
29231
|
+
}
|
|
29232
|
+
finish(parameters) {
|
|
29233
|
+
this.unfinishedValue_.setParameters(parameters);
|
|
29234
|
+
return this.unfinishedValue_;
|
|
29235
|
+
}
|
|
29236
|
+
};
|
|
29237
|
+
var IntrinsicTranslatedIndexerEntity = class extends TranslatedIndexerEntity {
|
|
29238
|
+
getParameters() {
|
|
29239
|
+
Debug.assertNotNull(this.parameters, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
29240
|
+
return this.parameters;
|
|
29241
|
+
}
|
|
29242
|
+
setParameters(parameters) {
|
|
29243
|
+
Debug.assert(this.parameters === void 0, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0443\u0436\u0435 \u0431\u044B\u043B\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
29244
|
+
this.parameters = parameters;
|
|
29245
|
+
}
|
|
29246
|
+
};
|
|
29247
|
+
IntrinsicTranslatedIndexerEntity = __decorateClass([
|
|
29248
|
+
entityToStringDecorator
|
|
29249
|
+
], IntrinsicTranslatedIndexerEntity);
|
|
29142
29250
|
|
|
29143
29251
|
// source/entities/translated/TranslatedOperatorEntity.ts
|
|
29144
29252
|
var TranslatedOperatorEntity = class {
|
|
29145
|
-
constructor(analyzer, originalEntity, translation, translationPackage, translatedContainingEntity
|
|
29253
|
+
constructor(analyzer, originalEntity, translation, translationPackage, translatedContainingEntity) {
|
|
29146
29254
|
this.kind = 9 /* Operator */;
|
|
29147
|
-
this.parameters = new Cached();
|
|
29148
29255
|
this.returnType = new Cached();
|
|
29149
29256
|
this.overriddenMembers = new Cached();
|
|
29150
29257
|
Debug.assert(
|
|
@@ -29156,7 +29263,6 @@ var TranslatedOperatorEntity = class {
|
|
|
29156
29263
|
this.translation = translation;
|
|
29157
29264
|
this.translationPackage = translationPackage;
|
|
29158
29265
|
this.containingEntity = translatedContainingEntity;
|
|
29159
|
-
this.node = node;
|
|
29160
29266
|
}
|
|
29161
29267
|
getContainingEntity() {
|
|
29162
29268
|
return this.containingEntity;
|
|
@@ -29179,13 +29285,6 @@ var TranslatedOperatorEntity = class {
|
|
|
29179
29285
|
getOperatorKind() {
|
|
29180
29286
|
return this.originalEntity.getOperatorKind();
|
|
29181
29287
|
}
|
|
29182
|
-
getParameters() {
|
|
29183
|
-
return this.parameters.getOrInsertWith(() => this.translationPackage.createTranslatedParameters(
|
|
29184
|
-
this.originalEntity.getParameters(),
|
|
29185
|
-
this.node?.translatedParameterClause.parameterList,
|
|
29186
|
-
this
|
|
29187
|
-
));
|
|
29188
|
-
}
|
|
29189
29288
|
getReturnType() {
|
|
29190
29289
|
return this.returnType.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedType(this.originalEntity.getReturnType()));
|
|
29191
29290
|
}
|
|
@@ -29218,15 +29317,60 @@ var TranslatedOperatorEntity = class {
|
|
|
29218
29317
|
return this.originalEntity.getTags();
|
|
29219
29318
|
}
|
|
29220
29319
|
};
|
|
29221
|
-
|
|
29320
|
+
var SourceTranslatedOperatorEntity = class extends TranslatedOperatorEntity {
|
|
29321
|
+
constructor(analyzer, originalEntity, translation, translationPackage, translatedContainingEntity, node) {
|
|
29322
|
+
super(analyzer, originalEntity, translation, translationPackage, translatedContainingEntity);
|
|
29323
|
+
this.kind = 9 /* Operator */;
|
|
29324
|
+
this.parameters = new Cached();
|
|
29325
|
+
this.node = node;
|
|
29326
|
+
}
|
|
29327
|
+
getParameters() {
|
|
29328
|
+
return this.parameters.getOrInsertWith(() => this.translationPackage.createTranslatedParameters(
|
|
29329
|
+
this.originalEntity.getParameters(),
|
|
29330
|
+
this.node?.translatedParameterClause.parameterList,
|
|
29331
|
+
this
|
|
29332
|
+
));
|
|
29333
|
+
}
|
|
29334
|
+
};
|
|
29335
|
+
SourceTranslatedOperatorEntity = __decorateClass([
|
|
29222
29336
|
entityToStringDecorator
|
|
29223
|
-
],
|
|
29337
|
+
], SourceTranslatedOperatorEntity);
|
|
29338
|
+
var UnfinishedIntrinsicTranslatedOperatorEntity = class {
|
|
29339
|
+
get unfinishedValue() {
|
|
29340
|
+
return this.unfinishedValue_;
|
|
29341
|
+
}
|
|
29342
|
+
constructor(analyzer, originalEntity, translation, translationPackage, translatedContainingEntity) {
|
|
29343
|
+
this.unfinishedValue_ = new IntrinsicTranslatedOperatorEntity(
|
|
29344
|
+
analyzer,
|
|
29345
|
+
originalEntity,
|
|
29346
|
+
translation,
|
|
29347
|
+
translationPackage,
|
|
29348
|
+
translatedContainingEntity
|
|
29349
|
+
);
|
|
29350
|
+
}
|
|
29351
|
+
finish(parameters) {
|
|
29352
|
+
this.unfinishedValue_.setParameters(parameters);
|
|
29353
|
+
return this.unfinishedValue_;
|
|
29354
|
+
}
|
|
29355
|
+
};
|
|
29356
|
+
var IntrinsicTranslatedOperatorEntity = class extends TranslatedOperatorEntity {
|
|
29357
|
+
getParameters() {
|
|
29358
|
+
Debug.assertNotNull(this.parameters, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u043D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
29359
|
+
return this.parameters;
|
|
29360
|
+
}
|
|
29361
|
+
setParameters(parameters) {
|
|
29362
|
+
Debug.assert(this.parameters === void 0, "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0443\u0436\u0435 \u0431\u044B\u043B\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u044B.");
|
|
29363
|
+
this.parameters = parameters;
|
|
29364
|
+
}
|
|
29365
|
+
};
|
|
29366
|
+
IntrinsicTranslatedOperatorEntity = __decorateClass([
|
|
29367
|
+
entityToStringDecorator
|
|
29368
|
+
], IntrinsicTranslatedOperatorEntity);
|
|
29224
29369
|
|
|
29225
29370
|
// source/entities/translated/TranslatedPackageEntity.ts
|
|
29226
29371
|
var TranslatedPackageEntity = class {
|
|
29227
29372
|
constructor(originalEntity, translation, name, translationPackage) {
|
|
29228
29373
|
this.kind = 12 /* Package */;
|
|
29229
|
-
this.members = new Cached();
|
|
29230
29374
|
Debug.assert(
|
|
29231
29375
|
originalEntity.getOriginalEntity() === originalEntity,
|
|
29232
29376
|
"\u041F\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043D\u043D\u0430\u044F \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u044C \u043C\u043E\u0436\u0435\u0442 \u0441\u043E\u0437\u0434\u0430\u0432\u0430\u0442\u044C\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u0438\u0437 \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0439 \u0441\u0443\u0449\u043D\u043E\u0441\u0442\u0438."
|
|
@@ -29246,7 +29390,7 @@ var TranslatedPackageEntity = class {
|
|
|
29246
29390
|
return this.originalEntity.getDialect();
|
|
29247
29391
|
}
|
|
29248
29392
|
getMembers() {
|
|
29249
|
-
return this.
|
|
29393
|
+
return this.translationPackage.getTranslatedPackageMembers();
|
|
29250
29394
|
}
|
|
29251
29395
|
getInterfacePackageInfo() {
|
|
29252
29396
|
return this.originalEntity.getInterfacePackageInfo();
|
|
@@ -29275,9 +29419,6 @@ var TranslatedPackageEntity = class {
|
|
|
29275
29419
|
getTextTranslationPackageInfo() {
|
|
29276
29420
|
return void 0;
|
|
29277
29421
|
}
|
|
29278
|
-
ensureAllDiagnosticsReported() {
|
|
29279
|
-
this.getMembers();
|
|
29280
|
-
}
|
|
29281
29422
|
};
|
|
29282
29423
|
TranslatedPackageEntity = __decorateClass([
|
|
29283
29424
|
entityToStringDecorator
|
|
@@ -29347,7 +29488,7 @@ var TranslatedTypeExtensionEntity = class {
|
|
|
29347
29488
|
this.translationPackage = translationPackage;
|
|
29348
29489
|
}
|
|
29349
29490
|
getMembers() {
|
|
29350
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
29491
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
29351
29492
|
}
|
|
29352
29493
|
getContainingPackage() {
|
|
29353
29494
|
return this.translationPackage.translatedTargetPackage;
|
|
@@ -29551,7 +29692,7 @@ var TranslatedPackageVariableEntity = class {
|
|
|
29551
29692
|
const originalGetter = this.originalEntity.getGetter();
|
|
29552
29693
|
return originalGetter !== void 0 ? new TranslatedGetterEntity(
|
|
29553
29694
|
originalGetter,
|
|
29554
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
29695
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
29555
29696
|
this.translationPackage,
|
|
29556
29697
|
this
|
|
29557
29698
|
) : void 0;
|
|
@@ -29562,7 +29703,7 @@ var TranslatedPackageVariableEntity = class {
|
|
|
29562
29703
|
const originalSetter = this.originalEntity.getSetter();
|
|
29563
29704
|
return originalSetter !== void 0 ? new TranslatedSetterEntity(
|
|
29564
29705
|
originalSetter,
|
|
29565
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
29706
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
29566
29707
|
this.translationPackage,
|
|
29567
29708
|
this
|
|
29568
29709
|
) : void 0;
|
|
@@ -29658,7 +29799,7 @@ var TranslatedFieldEntity = class {
|
|
|
29658
29799
|
const originalGetter = this.originalEntity.getGetter();
|
|
29659
29800
|
return originalGetter !== void 0 ? new TranslatedGetterEntity(
|
|
29660
29801
|
originalGetter,
|
|
29661
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
29802
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
29662
29803
|
this.translationPackage,
|
|
29663
29804
|
this
|
|
29664
29805
|
) : void 0;
|
|
@@ -29669,7 +29810,7 @@ var TranslatedFieldEntity = class {
|
|
|
29669
29810
|
const originalSetter = this.originalEntity.getSetter();
|
|
29670
29811
|
return originalSetter !== void 0 ? new TranslatedSetterEntity(
|
|
29671
29812
|
originalSetter,
|
|
29672
|
-
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition(
|
|
29813
|
+
new Translation(this.translation.translationPackage, new IntrinsicTranslationDefinition()),
|
|
29673
29814
|
this.translationPackage,
|
|
29674
29815
|
this
|
|
29675
29816
|
) : void 0;
|
|
@@ -29825,7 +29966,7 @@ var TranslatedPackageVariantTypeEntity = class {
|
|
|
29825
29966
|
return this.underlyingType.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedType(this.originalEntity.getUnderlyingType()));
|
|
29826
29967
|
}
|
|
29827
29968
|
getMembers() {
|
|
29828
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
29969
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
29829
29970
|
}
|
|
29830
29971
|
getDefinition() {
|
|
29831
29972
|
return this.originalEntity.getDefinition();
|
|
@@ -29848,9 +29989,6 @@ var TranslatedPackageVariantTypeEntity = class {
|
|
|
29848
29989
|
getContext() {
|
|
29849
29990
|
return this.context.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedEntityContext(this.originalEntity.getContext()));
|
|
29850
29991
|
}
|
|
29851
|
-
ensureAllDiagnosticsReported() {
|
|
29852
|
-
this.getMembers();
|
|
29853
|
-
}
|
|
29854
29992
|
};
|
|
29855
29993
|
TranslatedPackageVariantTypeEntity = __decorateClass([
|
|
29856
29994
|
entityToStringDecorator
|
|
@@ -29901,7 +30039,7 @@ var TranslatedAnonymousVariantTypeEntity = class {
|
|
|
29901
30039
|
return this.underlyingType.getOrInsertWith(() => this.translationPackage.localizationContext.createLocalizedType(this.originalEntity.getUnderlyingType()));
|
|
29902
30040
|
}
|
|
29903
30041
|
getMembers() {
|
|
29904
|
-
return this.members.getOrInsertWith(() => this.translationPackage.
|
|
30042
|
+
return this.members.getOrInsertWith(() => this.translationPackage.getTranslatedTypeOrExtensionMembers(this));
|
|
29905
30043
|
}
|
|
29906
30044
|
getDefinition() {
|
|
29907
30045
|
return this.originalEntity.getDefinition();
|
|
@@ -29929,16 +30067,281 @@ TranslatedAnonymousVariantTypeEntity = __decorateClass([
|
|
|
29929
30067
|
entityToStringDecorator
|
|
29930
30068
|
], TranslatedAnonymousVariantTypeEntity);
|
|
29931
30069
|
|
|
30070
|
+
// source/analysis/TranslatedEntityNameConflictsValidator.ts
|
|
30071
|
+
var TranslatedEntityNameConflictsValidator = class {
|
|
30072
|
+
constructor(analyzer, package_) {
|
|
30073
|
+
this.analyzer = analyzer;
|
|
30074
|
+
this.package_ = package_;
|
|
30075
|
+
this.packageMemberDiagnostics = new AccumulatingDiagnosticAcceptor();
|
|
30076
|
+
this.arePackageMembersValidated = false;
|
|
30077
|
+
}
|
|
30078
|
+
accumulateDiagnosticForSourceFile(sourceFile, diagnostics) {
|
|
30079
|
+
this.ensurePackageMembersAreValidated();
|
|
30080
|
+
for (const diagnostic of this.packageMemberDiagnostics.items) {
|
|
30081
|
+
if (diagnostic.location?.file === sourceFile) {
|
|
30082
|
+
diagnostics.addDiagnostic(diagnostic);
|
|
30083
|
+
}
|
|
30084
|
+
}
|
|
30085
|
+
const sourceFileNode = sourceFile.getSyntaxNode();
|
|
30086
|
+
for (const member of this.package_.getMembers().getNamedMembers()) {
|
|
30087
|
+
if (member.kind === 2 /* Type */) {
|
|
30088
|
+
const translation = member.getTranslation();
|
|
30089
|
+
if (translation?.definition.kind === "source" && !(translation.definition.nodeOrPackage instanceof TranslationPackage) && translation.definition.nodeOrPackage.sourceFile === sourceFileNode) {
|
|
30090
|
+
this.validateTypeMembers(member, diagnostics);
|
|
30091
|
+
}
|
|
30092
|
+
}
|
|
30093
|
+
}
|
|
30094
|
+
}
|
|
30095
|
+
ensurePackageMembersAreValidated() {
|
|
30096
|
+
if (!this.arePackageMembersValidated) {
|
|
30097
|
+
this.validatePackageMembers(this.packageMemberDiagnostics);
|
|
30098
|
+
this.arePackageMembersValidated = true;
|
|
30099
|
+
}
|
|
30100
|
+
}
|
|
30101
|
+
validatePackageMembers(diagnostics) {
|
|
30102
|
+
const translatedNamedMembers = this.package_.getMembers().getNamedMembers();
|
|
30103
|
+
const originalNamedMembers = this.package_.getOriginalEntity().getMembers().getNamedMembers();
|
|
30104
|
+
const translatedMemberByOriginal = Query.toMap(translatedNamedMembers, (m) => m.getOriginalEntity(), (m) => m);
|
|
30105
|
+
const originalNamedMembersByNameKey = Query.groupByToMap(originalNamedMembers, (m) => m.getName().key);
|
|
30106
|
+
for (const originalMemberGroup of originalNamedMembersByNameKey.values()) {
|
|
30107
|
+
if (originalMemberGroup.length > 1) {
|
|
30108
|
+
this.checkTranslatedMembersHaveSameName(originalMemberGroup, translatedMemberByOriginal, diagnostics);
|
|
30109
|
+
}
|
|
30110
|
+
}
|
|
30111
|
+
const translatedMembersByNameKey = Query.groupByToMap(translatedNamedMembers, (m) => m.getName().key);
|
|
30112
|
+
for (const translatedMemberGroup of translatedMembersByNameKey.values()) {
|
|
30113
|
+
if (translatedMemberGroup.length > 1) {
|
|
30114
|
+
this.checkOriginalMembersHaveSameName(translatedMemberGroup, diagnostics);
|
|
30115
|
+
}
|
|
30116
|
+
}
|
|
30117
|
+
for (const member of this.package_.getMembers().getAll()) {
|
|
30118
|
+
if (member.getTranslation()?.definition.kind === "source") {
|
|
30119
|
+
switch (member.kind) {
|
|
30120
|
+
case 1 /* Function */:
|
|
30121
|
+
this.validateTypeParameterNameConflicts(member.getTypeParameters(), diagnostics);
|
|
30122
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30123
|
+
break;
|
|
30124
|
+
case 2 /* Type */:
|
|
30125
|
+
this.validateTypeParameterNameConflicts(member.getTypeParameters(), diagnostics);
|
|
30126
|
+
if (member.typeEntityKind === 0 /* Function */) {
|
|
30127
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30128
|
+
}
|
|
30129
|
+
break;
|
|
30130
|
+
case 0 /* Variable */:
|
|
30131
|
+
case 11 /* TypeExtension */:
|
|
30132
|
+
break;
|
|
30133
|
+
default:
|
|
30134
|
+
Debug.never(member);
|
|
30135
|
+
}
|
|
30136
|
+
}
|
|
30137
|
+
}
|
|
30138
|
+
}
|
|
30139
|
+
validateTypeMembers(typeEntity, diagnostics) {
|
|
30140
|
+
if (typeEntity.getTranslation()?.definition.kind !== "source") {
|
|
30141
|
+
return;
|
|
30142
|
+
}
|
|
30143
|
+
const translatedNamedMembers = typeEntity.getMembers().getNamedMembers();
|
|
30144
|
+
const originalNamedMembers = typeEntity.getOriginalEntity().getMembers().getNamedMembers();
|
|
30145
|
+
const translatedMemberByOriginal = Query.toMap(translatedNamedMembers, (m) => m.getOriginalEntity(), (m) => m);
|
|
30146
|
+
const originalNamedMembersByNameKey = Query.groupByToMap(originalNamedMembers, (m) => m.getName().key);
|
|
30147
|
+
for (const originalMemberGroup of originalNamedMembersByNameKey.values()) {
|
|
30148
|
+
if (originalMemberGroup.length > 1) {
|
|
30149
|
+
this.checkTranslatedMembersHaveSameName(originalMemberGroup, translatedMemberByOriginal, diagnostics);
|
|
30150
|
+
}
|
|
30151
|
+
}
|
|
30152
|
+
const translatedMembersByNameKey = Query.groupByToMap(translatedNamedMembers, (m) => m.getName().key);
|
|
30153
|
+
for (const translatedMemberGroup of translatedMembersByNameKey.values()) {
|
|
30154
|
+
if (translatedMemberGroup.length > 1) {
|
|
30155
|
+
this.checkOriginalMembersHaveSameName(translatedMemberGroup, diagnostics);
|
|
30156
|
+
}
|
|
30157
|
+
}
|
|
30158
|
+
for (const member of typeEntity.getMembers().getAll()) {
|
|
30159
|
+
if (member.getTranslation()?.definition.kind === "source") {
|
|
30160
|
+
switch (member.kind) {
|
|
30161
|
+
case 0 /* Variable */:
|
|
30162
|
+
this.checkOverridingMemberHasTheSameNameAsBaseMember(member, diagnostics);
|
|
30163
|
+
break;
|
|
30164
|
+
case 1 /* Function */:
|
|
30165
|
+
this.checkOverridingMemberHasTheSameNameAsBaseMember(member, diagnostics);
|
|
30166
|
+
this.validateTypeParameterNameConflicts(member.getTypeParameters(), diagnostics);
|
|
30167
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30168
|
+
break;
|
|
30169
|
+
case 5 /* Indexer */:
|
|
30170
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30171
|
+
break;
|
|
30172
|
+
case 7 /* Constructor */:
|
|
30173
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30174
|
+
break;
|
|
30175
|
+
case 8 /* Destructor */:
|
|
30176
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30177
|
+
break;
|
|
30178
|
+
case 9 /* Operator */:
|
|
30179
|
+
this.validateParameterNameConflicts(member.getParameters(), diagnostics);
|
|
30180
|
+
break;
|
|
30181
|
+
case 6 /* DereferenceOperator */:
|
|
30182
|
+
break;
|
|
30183
|
+
default:
|
|
30184
|
+
Debug.never(member);
|
|
30185
|
+
}
|
|
30186
|
+
}
|
|
30187
|
+
}
|
|
30188
|
+
}
|
|
30189
|
+
checkTranslatedMembersHaveSameName(originalMembers, translatedMemberByOriginal, diagnostics) {
|
|
30190
|
+
if (originalMembers.length > 1) {
|
|
30191
|
+
const translatedMembers = originalMembers.map((m) => translatedMemberByOriginal.get(m)).filter((m) => m !== void 0);
|
|
30192
|
+
const firstSourceTranslatedMember = translatedMembers.find((m) => m.getTranslation()?.definition.kind === "source");
|
|
30193
|
+
if (firstSourceTranslatedMember !== void 0) {
|
|
30194
|
+
const translatedMemberWithDifferentName = translatedMembers.find((m) => !m.getName().considerEqual(firstSourceTranslatedMember.getName(), true));
|
|
30195
|
+
if (translatedMemberWithDifferentName !== void 0) {
|
|
30196
|
+
const nodeForDiagnostic = this.getTranslatedNameNode(
|
|
30197
|
+
this.getTranslationDefinitionNode(firstSourceTranslatedMember.getTranslation())
|
|
30198
|
+
);
|
|
30199
|
+
if (nodeForDiagnostic !== void 0) {
|
|
30200
|
+
const argumentFactory = this.analyzer.semanticContext.ofSourceFile(nodeForDiagnostic.sourceFile).getDiagnosticArgumentFactory();
|
|
30201
|
+
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
30202
|
+
393 /* Declarations0And1HaveTheSameSourceNamesButDifferentTranslatedNames23 */,
|
|
30203
|
+
nodeForDiagnostic,
|
|
30204
|
+
[
|
|
30205
|
+
argumentFactory.createDisplayableEntity(firstSourceTranslatedMember.getOriginalEntity()),
|
|
30206
|
+
argumentFactory.createDisplayableEntity(translatedMemberWithDifferentName.getOriginalEntity()),
|
|
30207
|
+
firstSourceTranslatedMember.getName(),
|
|
30208
|
+
translatedMemberWithDifferentName.getName()
|
|
30209
|
+
]
|
|
30210
|
+
));
|
|
30211
|
+
}
|
|
30212
|
+
}
|
|
30213
|
+
}
|
|
30214
|
+
}
|
|
30215
|
+
}
|
|
30216
|
+
checkOriginalMembersHaveSameName(translatedMembers, diagnostics) {
|
|
30217
|
+
if (translatedMembers.length > 1) {
|
|
30218
|
+
const firstSourceTranslatedMember = translatedMembers.find((m) => m.getTranslation()?.definition.kind === "source");
|
|
30219
|
+
if (firstSourceTranslatedMember !== void 0) {
|
|
30220
|
+
const originalMembers = translatedMembers.map((m) => m.getOriginalEntity());
|
|
30221
|
+
const originalName = firstSourceTranslatedMember.getOriginalEntity().getName();
|
|
30222
|
+
const originalMemberWithDifferentName = originalMembers.find((m) => !m.getName().considerEqual(originalName, true));
|
|
30223
|
+
if (originalMemberWithDifferentName !== void 0) {
|
|
30224
|
+
const nodeForDiagnostic = this.getTranslatedNameNode(
|
|
30225
|
+
this.getTranslationDefinitionNode(firstSourceTranslatedMember.getTranslation())
|
|
30226
|
+
);
|
|
30227
|
+
if (nodeForDiagnostic !== void 0) {
|
|
30228
|
+
const correspondingTranslatedMember = translatedMembers.find((m) => m.getOriginalEntity() === originalMemberWithDifferentName);
|
|
30229
|
+
Debug.assertNotNull(correspondingTranslatedMember);
|
|
30230
|
+
const argumentFactory = this.analyzer.semanticContext.ofSourceFile(nodeForDiagnostic.sourceFile).getDiagnosticArgumentFactory();
|
|
30231
|
+
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
30232
|
+
394 /* TranslatedDeclarations0And1HaveTheSameTranslatedNamesButDifferentSourceNames23 */,
|
|
30233
|
+
nodeForDiagnostic,
|
|
30234
|
+
[
|
|
30235
|
+
argumentFactory.createDisplayableEntity(firstSourceTranslatedMember),
|
|
30236
|
+
argumentFactory.createDisplayableEntity(correspondingTranslatedMember),
|
|
30237
|
+
originalName,
|
|
30238
|
+
originalMemberWithDifferentName.getName()
|
|
30239
|
+
]
|
|
30240
|
+
));
|
|
30241
|
+
}
|
|
30242
|
+
}
|
|
30243
|
+
}
|
|
30244
|
+
}
|
|
30245
|
+
}
|
|
30246
|
+
getTranslatedNameNode(node) {
|
|
30247
|
+
if (node === void 0) {
|
|
30248
|
+
return void 0;
|
|
30249
|
+
}
|
|
30250
|
+
switch (node.kind) {
|
|
30251
|
+
case 132 /* PackageFunctionTranslationDeclaration */:
|
|
30252
|
+
case 133 /* MethodTranslation */:
|
|
30253
|
+
case 134 /* FunctionTypeTranslationDeclaration */:
|
|
30254
|
+
case 137 /* FieldOrVariantTranslation */:
|
|
30255
|
+
case 136 /* PackageVariableTranslationDeclaration */:
|
|
30256
|
+
case 139 /* TypeTranslationDeclaration */:
|
|
30257
|
+
return node.translatedName;
|
|
30258
|
+
case 127 /* ConstructorTranslation */:
|
|
30259
|
+
case 129 /* IndexerTranslation */:
|
|
30260
|
+
case 140 /* TextTranslationDeclaration */:
|
|
30261
|
+
case 141 /* TextTranslationFunctionDeclaration */:
|
|
30262
|
+
return void 0;
|
|
30263
|
+
default:
|
|
30264
|
+
Debug.never(node);
|
|
30265
|
+
}
|
|
30266
|
+
}
|
|
30267
|
+
validateTypeParameterNameConflicts(typeParameters, diagnostics) {
|
|
30268
|
+
if (typeParameters.length > 0) {
|
|
30269
|
+
const nameKeys = /* @__PURE__ */ new Set();
|
|
30270
|
+
for (const typeParameter of typeParameters) {
|
|
30271
|
+
const key = typeParameter.getName().keyWithoutBackQuotes;
|
|
30272
|
+
if (nameKeys.has(key)) {
|
|
30273
|
+
const translationDefinition = typeParameter.getTranslation()?.definition;
|
|
30274
|
+
if (translationDefinition?.kind === "source" && translationDefinition.translatedNameIdentifier !== void 0) {
|
|
30275
|
+
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
30276
|
+
305 /* ScopeAlreadyContainsDeclarationWithTheSameName */,
|
|
30277
|
+
translationDefinition.translatedNameIdentifier
|
|
30278
|
+
));
|
|
30279
|
+
}
|
|
30280
|
+
} else {
|
|
30281
|
+
nameKeys.add(key);
|
|
30282
|
+
}
|
|
30283
|
+
}
|
|
30284
|
+
}
|
|
30285
|
+
}
|
|
30286
|
+
validateParameterNameConflicts(parameters, diagnostics) {
|
|
30287
|
+
if (parameters.length > 0) {
|
|
30288
|
+
const nameKeys = /* @__PURE__ */ new Set();
|
|
30289
|
+
for (const parameter of parameters) {
|
|
30290
|
+
const key = parameter.getName().keyWithoutBackQuotes;
|
|
30291
|
+
if (nameKeys.has(key)) {
|
|
30292
|
+
const translationDefinition = parameter.getTranslation()?.definition;
|
|
30293
|
+
if (translationDefinition?.kind === "source" && translationDefinition.translatedNameIdentifier !== void 0) {
|
|
30294
|
+
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
30295
|
+
305 /* ScopeAlreadyContainsDeclarationWithTheSameName */,
|
|
30296
|
+
translationDefinition.translatedNameIdentifier
|
|
30297
|
+
));
|
|
30298
|
+
}
|
|
30299
|
+
} else {
|
|
30300
|
+
nameKeys.add(key);
|
|
30301
|
+
}
|
|
30302
|
+
}
|
|
30303
|
+
}
|
|
30304
|
+
}
|
|
30305
|
+
checkOverridingMemberHasTheSameNameAsBaseMember(derivedMemberEntity, diagnostics) {
|
|
30306
|
+
const baseMembers = derivedMemberEntity.getOverriddenMembers();
|
|
30307
|
+
if (baseMembers.length > 0) {
|
|
30308
|
+
const baseMemberWithDifferentName = baseMembers.find((m) => !m.getName().considerEqual(derivedMemberEntity.getName()));
|
|
30309
|
+
if (baseMemberWithDifferentName !== void 0) {
|
|
30310
|
+
const nodeForDiagnostic = this.getTranslatedNameNode(
|
|
30311
|
+
this.getTranslationDefinitionNode(derivedMemberEntity.getTranslation())
|
|
30312
|
+
);
|
|
30313
|
+
if (nodeForDiagnostic !== void 0) {
|
|
30314
|
+
const argumentFactory = this.analyzer.semanticContext.ofSourceFile(nodeForDiagnostic.sourceFile).getDiagnosticArgumentFactory();
|
|
30315
|
+
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
30316
|
+
395 /* TranslatedOverridingMember0MustTheSameNameAsBaseMember1 */,
|
|
30317
|
+
nodeForDiagnostic,
|
|
30318
|
+
[
|
|
30319
|
+
argumentFactory.createDisplayableEntity(derivedMemberEntity),
|
|
30320
|
+
argumentFactory.createDisplayableEntity(baseMemberWithDifferentName.getEntity())
|
|
30321
|
+
]
|
|
30322
|
+
));
|
|
30323
|
+
}
|
|
30324
|
+
}
|
|
30325
|
+
}
|
|
30326
|
+
}
|
|
30327
|
+
getTranslationDefinitionNode(translation) {
|
|
30328
|
+
let result;
|
|
30329
|
+
if (translation?.definition.kind === "source" && !(translation.definition.nodeOrPackage instanceof TranslationPackage)) {
|
|
30330
|
+
result = translation.definition.nodeOrPackage;
|
|
30331
|
+
}
|
|
30332
|
+
return result;
|
|
30333
|
+
}
|
|
30334
|
+
};
|
|
30335
|
+
|
|
29932
30336
|
// source/analysis/AnalyzedTranslationPackage.ts
|
|
29933
30337
|
var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
29934
30338
|
constructor(analyzer, package_, targetPackage) {
|
|
29935
|
-
this.diagnostics = new AccumulatingDiagnosticAcceptor();
|
|
29936
30339
|
this.localizedPackageByOriginalReferencedPackage = new Cached();
|
|
29937
30340
|
this.translatedEntityByOriginal = /* @__PURE__ */ new Map();
|
|
29938
|
-
this.hasCreatedPackageMembers = false;
|
|
29939
|
-
this.typesOrExtensionsWithCreatedMembers = /* @__PURE__ */ new Set();
|
|
29940
30341
|
this.packageMemberTranslationTargetsByNode = /* @__PURE__ */ new Map();
|
|
29941
30342
|
this.typeMemberTranslationTargetsByNode = /* @__PURE__ */ new Map();
|
|
30343
|
+
this.translatedPackageMembers = new Cached();
|
|
30344
|
+
this.translatedTypeMembersByTypeOrExtensionEntity = /* @__PURE__ */ new Map();
|
|
29942
30345
|
this.analyzer = analyzer;
|
|
29943
30346
|
this.package_ = package_;
|
|
29944
30347
|
this.targetPackage = targetPackage;
|
|
@@ -29949,6 +30352,10 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
29949
30352
|
this.package_.configuration.translatedName,
|
|
29950
30353
|
this
|
|
29951
30354
|
);
|
|
30355
|
+
this.entityNameConflictsValidator = new TranslatedEntityNameConflictsValidator(
|
|
30356
|
+
this.analyzer,
|
|
30357
|
+
this.translatedTargetPackage
|
|
30358
|
+
);
|
|
29952
30359
|
}
|
|
29953
30360
|
static {
|
|
29954
30361
|
this.maxDisplayedNotTranslatedEntitiesCount = 10;
|
|
@@ -29968,29 +30375,29 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
29968
30375
|
getLocalizedPackageByOriginalReferencedPackage() {
|
|
29969
30376
|
return this.localizedPackageByOriginalReferencedPackage.getOrInsertWith(() => this.createLocalizedPackageByOriginalReferencedPackage());
|
|
29970
30377
|
}
|
|
29971
|
-
|
|
29972
|
-
this.
|
|
29973
|
-
|
|
30378
|
+
getTranslatedPackageMembers() {
|
|
30379
|
+
return this.translatedPackageMembers.getOrInsertWith(() => this.createTranslatedPackageMembers());
|
|
30380
|
+
}
|
|
30381
|
+
ensureAllLazyDiagnosticsReportedForSourceFile(sourceFile) {
|
|
30382
|
+
const members = this.getTranslatedPackageMembers();
|
|
29974
30383
|
const sourceFileNode = sourceFile.getSyntaxNode();
|
|
29975
30384
|
for (const member of members.getNamedMembers()) {
|
|
29976
30385
|
if (member.kind === 2 /* Type */) {
|
|
29977
30386
|
const translation = member.getTranslation();
|
|
29978
30387
|
if (translation?.definition.kind === "source" && !(translation.definition.nodeOrPackage instanceof TranslationPackage) && translation.definition.nodeOrPackage.sourceFile === sourceFileNode) {
|
|
29979
|
-
|
|
30388
|
+
this.getTranslatedTypeOrExtensionMembers(member);
|
|
29980
30389
|
}
|
|
29981
30390
|
}
|
|
29982
30391
|
}
|
|
29983
30392
|
for (const member of members.getTypeExtensions()) {
|
|
29984
|
-
|
|
29985
|
-
}
|
|
29986
|
-
for (const diagnostic of this.diagnostics.items) {
|
|
29987
|
-
if (diagnostic.location?.file === sourceFile) {
|
|
29988
|
-
diagnostics.addDiagnostic(diagnostic);
|
|
29989
|
-
}
|
|
30393
|
+
this.getTranslatedTypeOrExtensionMembers(member);
|
|
29990
30394
|
}
|
|
29991
30395
|
}
|
|
30396
|
+
accumulateDiagnosticForSourceFile(sourceFile, diagnostics) {
|
|
30397
|
+
this.entityNameConflictsValidator.accumulateDiagnosticForSourceFile(sourceFile, diagnostics);
|
|
30398
|
+
}
|
|
29992
30399
|
getPackageMemberTranslationTargets(node) {
|
|
29993
|
-
this.
|
|
30400
|
+
this.getTranslatedPackageMembers();
|
|
29994
30401
|
return this.packageMemberTranslationTargetsByNode.get(node);
|
|
29995
30402
|
}
|
|
29996
30403
|
getTypeMemberTranslationTargets(node) {
|
|
@@ -30000,7 +30407,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30000
30407
|
return void 0;
|
|
30001
30408
|
}
|
|
30002
30409
|
typeTranslationTargets.values.forEach((t) => {
|
|
30003
|
-
if (
|
|
30410
|
+
if (t.kind === 2 /* Type */) {
|
|
30004
30411
|
this.ensureTypeMembersHaveBeenCreated(t);
|
|
30005
30412
|
}
|
|
30006
30413
|
});
|
|
@@ -30008,7 +30415,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30008
30415
|
}
|
|
30009
30416
|
getTranslatedPackageMember(entity) {
|
|
30010
30417
|
Debug.assert(entity.getContainingPackage() === this.targetPackage);
|
|
30011
|
-
this.
|
|
30418
|
+
this.getTranslatedPackageMembers();
|
|
30012
30419
|
const result = this.translatedEntityByOriginal.get(entity);
|
|
30013
30420
|
Debug.assert(result !== void 0 && isPackageMemberEntity(result));
|
|
30014
30421
|
return result;
|
|
@@ -30024,7 +30431,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30024
30431
|
Debug.assert(entity.getContainingPackage() === this.targetPackage);
|
|
30025
30432
|
let result = this.translatedEntityByOriginal.get(entity);
|
|
30026
30433
|
if (result === void 0) {
|
|
30027
|
-
const translation = new Translation(this, new IntrinsicTranslationDefinition(
|
|
30434
|
+
const translation = new Translation(this, new IntrinsicTranslationDefinition());
|
|
30028
30435
|
switch (entity.typeEntityKind) {
|
|
30029
30436
|
case 1 /* Structured */:
|
|
30030
30437
|
result = new TranslatedAnonymousStructuredTypeEntity(entity, translation, this);
|
|
@@ -30043,16 +30450,94 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30043
30450
|
Debug.assert(isAnonymousTypeEntity(result));
|
|
30044
30451
|
return result;
|
|
30045
30452
|
}
|
|
30453
|
+
getTranslatedTypeOrExtensionMembers(translatedTypeEntity) {
|
|
30454
|
+
let result = this.translatedTypeMembersByTypeOrExtensionEntity.get(translatedTypeEntity);
|
|
30455
|
+
if (result === void 0) {
|
|
30456
|
+
result = this.createTranslatedTypeOrExtensionMembers(translatedTypeEntity);
|
|
30457
|
+
this.translatedTypeMembersByTypeOrExtensionEntity.set(translatedTypeEntity, result);
|
|
30458
|
+
}
|
|
30459
|
+
return result;
|
|
30460
|
+
}
|
|
30461
|
+
createTranslatedTypeParameters(original, node, containingEntity) {
|
|
30462
|
+
if (original.length === 0) {
|
|
30463
|
+
return original;
|
|
30464
|
+
}
|
|
30465
|
+
return Query.zipLeft(original, node?.typeParameters, (e, n) => {
|
|
30466
|
+
const name = n !== void 0 ? this.analyzer.createNameFromIdentifier(n) : e.getName();
|
|
30467
|
+
const translationDefinition = node !== void 0 ? new SourceTranslationDefinition(node.parent.parent, n) : new IntrinsicTranslationDefinition();
|
|
30468
|
+
return new TranslatedTypeParameterEntity(
|
|
30469
|
+
e,
|
|
30470
|
+
new Translation(this, translationDefinition),
|
|
30471
|
+
name,
|
|
30472
|
+
this,
|
|
30473
|
+
containingEntity
|
|
30474
|
+
);
|
|
30475
|
+
}).toArray();
|
|
30476
|
+
}
|
|
30477
|
+
createTranslatedParameters(original, node, containingEntity) {
|
|
30478
|
+
if (original.length === 0) {
|
|
30479
|
+
return original;
|
|
30480
|
+
}
|
|
30481
|
+
return Query.zipLeft(original, node?.parameters, (e, n) => {
|
|
30482
|
+
const name = n !== void 0 ? this.analyzer.createNameFromIdentifier(n) : e.getName();
|
|
30483
|
+
const translationDefinition = node !== void 0 ? new SourceTranslationDefinition(node.parent.parent, n) : new IntrinsicTranslationDefinition();
|
|
30484
|
+
return new TranslatedParameterEntity(
|
|
30485
|
+
e,
|
|
30486
|
+
new Translation(this, translationDefinition),
|
|
30487
|
+
name,
|
|
30488
|
+
this,
|
|
30489
|
+
containingEntity
|
|
30490
|
+
);
|
|
30491
|
+
}).toArray();
|
|
30492
|
+
}
|
|
30493
|
+
static isPackageMemberEntityThatShouldBeTranslatedByUser(entity) {
|
|
30494
|
+
const hiding = entity.isHidden();
|
|
30495
|
+
if (hiding !== void 0) {
|
|
30496
|
+
return false;
|
|
30497
|
+
}
|
|
30498
|
+
switch (entity.kind) {
|
|
30499
|
+
case 0 /* Variable */:
|
|
30500
|
+
case 1 /* Function */:
|
|
30501
|
+
case 2 /* Type */:
|
|
30502
|
+
return true;
|
|
30503
|
+
case 11 /* TypeExtension */:
|
|
30504
|
+
return false;
|
|
30505
|
+
default:
|
|
30506
|
+
Debug.never(entity);
|
|
30507
|
+
}
|
|
30508
|
+
}
|
|
30509
|
+
static isTypeMemberEntityThatShouldBeTranslatedByUser(entity) {
|
|
30510
|
+
const hiding = entity.isHidden();
|
|
30511
|
+
if (!(hiding === void 0 || hiding.kind === "type-hierarchy")) {
|
|
30512
|
+
return false;
|
|
30513
|
+
}
|
|
30514
|
+
switch (entity.kind) {
|
|
30515
|
+
case 0 /* Variable */:
|
|
30516
|
+
case 1 /* Function */:
|
|
30517
|
+
return entity.getOverriddenMembers().length === 0;
|
|
30518
|
+
case 7 /* Constructor */:
|
|
30519
|
+
return entity.getParameters().length > 0 && entity.isDefault() === void 0;
|
|
30520
|
+
case 5 /* Indexer */:
|
|
30521
|
+
return entity.getParameters().length > 0 && entity.getOverriddenMembers().length === 0;
|
|
30522
|
+
case 9 /* Operator */:
|
|
30523
|
+
return entity.getParameters().length > 0 && entity.getOverriddenMembers().length === 0;
|
|
30524
|
+
case 8 /* Destructor */:
|
|
30525
|
+
return false;
|
|
30526
|
+
case 6 /* DereferenceOperator */:
|
|
30527
|
+
return false;
|
|
30528
|
+
default:
|
|
30529
|
+
Debug.never(entity);
|
|
30530
|
+
}
|
|
30531
|
+
}
|
|
30046
30532
|
createTranslatedPackageMembers() {
|
|
30047
|
-
|
|
30048
|
-
this.hasCreatedPackageMembers = true;
|
|
30533
|
+
const diagnostics = this.analyzer.getAcceptorForDiagnosticsComputedLazily();
|
|
30049
30534
|
const originalMembers = this.targetPackage.getOriginalEntity().getMembers();
|
|
30050
30535
|
const handleNamedTargets = (targets, translationDeclaration, translatedNameIdentifier, createTranslatedEntity) => {
|
|
30051
30536
|
this.packageMemberTranslationTargetsByNode.set(translationDeclaration, targets);
|
|
30052
30537
|
if (targets.areSuitable && targets.values.length > 0) {
|
|
30053
30538
|
const entityThatHasAlreadyBeenTranslated = targets.values.find((e) => this.translatedEntityByOriginal.has(e));
|
|
30054
30539
|
if (entityThatHasAlreadyBeenTranslated !== void 0) {
|
|
30055
|
-
this.reportPackageMemberHasAlreadyBeenTranslatedDiagnostic(translationDeclaration,
|
|
30540
|
+
this.reportPackageMemberHasAlreadyBeenTranslatedDiagnostic(translationDeclaration, diagnostics);
|
|
30056
30541
|
} else {
|
|
30057
30542
|
const translation = new Translation(this, new SourceTranslationDefinition(
|
|
30058
30543
|
translationDeclaration,
|
|
@@ -30066,14 +30551,14 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30066
30551
|
}
|
|
30067
30552
|
}
|
|
30068
30553
|
};
|
|
30069
|
-
for (const translationsDeclaration of this.
|
|
30554
|
+
for (const translationsDeclaration of this.translationsDeclarations()) {
|
|
30070
30555
|
for (const translationDeclaration of translationsDeclaration.translationList.translationDeclarations) {
|
|
30071
30556
|
switch (translationDeclaration.kind) {
|
|
30072
30557
|
case 136 /* PackageVariableTranslationDeclaration */: {
|
|
30073
30558
|
const targets = this.getPackageVariableTranslationTargets(
|
|
30074
30559
|
translationDeclaration,
|
|
30075
30560
|
originalMembers,
|
|
30076
|
-
|
|
30561
|
+
diagnostics
|
|
30077
30562
|
);
|
|
30078
30563
|
handleNamedTargets(
|
|
30079
30564
|
targets,
|
|
@@ -30087,7 +30572,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30087
30572
|
const targets = this.getPackageFunctionTranslationTargets(
|
|
30088
30573
|
translationDeclaration,
|
|
30089
30574
|
originalMembers,
|
|
30090
|
-
|
|
30575
|
+
diagnostics
|
|
30091
30576
|
);
|
|
30092
30577
|
handleNamedTargets(
|
|
30093
30578
|
targets,
|
|
@@ -30098,11 +30583,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30098
30583
|
break;
|
|
30099
30584
|
}
|
|
30100
30585
|
case 134 /* FunctionTypeTranslationDeclaration */: {
|
|
30101
|
-
const targets = this.getFunctionTypeTranslationTargets(
|
|
30102
|
-
translationDeclaration,
|
|
30103
|
-
originalMembers,
|
|
30104
|
-
this.diagnostics
|
|
30105
|
-
);
|
|
30586
|
+
const targets = this.getFunctionTypeTranslationTargets(translationDeclaration, originalMembers, diagnostics);
|
|
30106
30587
|
handleNamedTargets(
|
|
30107
30588
|
targets,
|
|
30108
30589
|
translationDeclaration,
|
|
@@ -30112,11 +30593,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30112
30593
|
break;
|
|
30113
30594
|
}
|
|
30114
30595
|
case 139 /* TypeTranslationDeclaration */: {
|
|
30115
|
-
const targets = this.getTypeTranslationTargets(
|
|
30116
|
-
translationDeclaration,
|
|
30117
|
-
originalMembers,
|
|
30118
|
-
this.diagnostics
|
|
30119
|
-
);
|
|
30596
|
+
const targets = this.getTypeTranslationTargets(translationDeclaration, originalMembers, diagnostics);
|
|
30120
30597
|
handleNamedTargets(
|
|
30121
30598
|
targets,
|
|
30122
30599
|
translationDeclaration,
|
|
@@ -30129,6 +30606,8 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30129
30606
|
return new TranslatedPackageVariantTypeEntity(e, t, n, this, translationDeclaration);
|
|
30130
30607
|
case 4 /* Alias */:
|
|
30131
30608
|
return new TranslatedAliasTypeEntity(e, t, n, this, translationDeclaration);
|
|
30609
|
+
case 0 /* Function */:
|
|
30610
|
+
return new TranslatedPackageFunctionTypeEntity(e, t, n, this, void 0);
|
|
30132
30611
|
default:
|
|
30133
30612
|
Debug.never(e);
|
|
30134
30613
|
}
|
|
@@ -30164,7 +30643,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30164
30643
|
translatedNamedMembers.push(translatedNamedMember);
|
|
30165
30644
|
}
|
|
30166
30645
|
if (notTranslatedEntitiesForDiagnostics.length > 0) {
|
|
30167
|
-
const firstTranslationsDeclaration = Query.first(this.
|
|
30646
|
+
const firstTranslationsDeclaration = Query.first(this.translationsDeclarations());
|
|
30168
30647
|
if (firstTranslationsDeclaration !== void 0) {
|
|
30169
30648
|
const diagnosticArgumentFactory = this.analyzer.semanticContext.containing(firstTranslationsDeclaration).getDiagnosticArgumentFactory();
|
|
30170
30649
|
const diagnostic = this.createNotTranslatedEntitiesDiagnostic(
|
|
@@ -30173,24 +30652,28 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30173
30652
|
firstTranslationsDeclaration.translationsKeyword,
|
|
30174
30653
|
diagnosticArgumentFactory
|
|
30175
30654
|
);
|
|
30176
|
-
|
|
30655
|
+
diagnostics.addDiagnostic(diagnostic);
|
|
30177
30656
|
}
|
|
30178
30657
|
}
|
|
30179
|
-
const translatedTypeExtensions = originalMembers.getTypeExtensions().map((e) => new TranslatedTypeExtensionEntity(e, new Translation(this, new IntrinsicTranslationDefinition(
|
|
30658
|
+
const translatedTypeExtensions = originalMembers.getTypeExtensions().map((e) => new TranslatedTypeExtensionEntity(e, new Translation(this, new IntrinsicTranslationDefinition()), this));
|
|
30180
30659
|
return new PackageEntityMembers(translatedNamedMembers, translatedTypeExtensions);
|
|
30181
30660
|
}
|
|
30182
|
-
createTranslatedTypeOrExtensionMembers(translatedTypeEntity
|
|
30661
|
+
createTranslatedTypeOrExtensionMembers(translatedTypeEntity) {
|
|
30183
30662
|
Debug.assert(translatedTypeEntity.getContainingPackage() === this.translatedTargetPackage);
|
|
30184
|
-
|
|
30185
|
-
|
|
30663
|
+
const diagnostics = this.analyzer.getAcceptorForDiagnosticsComputedLazily();
|
|
30664
|
+
let typeTranslationDeclaration;
|
|
30665
|
+
const typeTranslation = translatedTypeEntity.getTranslation();
|
|
30666
|
+
if (typeTranslation?.definition.kind === "source" && !(typeTranslation.definition.nodeOrPackage instanceof TranslationPackage) && typeTranslation.definition.nodeOrPackage.kind === 139 /* TypeTranslationDeclaration */) {
|
|
30667
|
+
typeTranslationDeclaration = typeTranslation.definition.nodeOrPackage;
|
|
30668
|
+
}
|
|
30186
30669
|
const originalMembers = translatedTypeEntity.getOriginalEntity().getMembers();
|
|
30187
30670
|
if (typeTranslationDeclaration?.memberList !== void 0) {
|
|
30188
|
-
const handleTargets = (targets, translationDeclaration,
|
|
30671
|
+
const handleTargets = (targets, translationDeclaration, createTranslatedEntity) => {
|
|
30189
30672
|
this.typeMemberTranslationTargetsByNode.set(translationDeclaration, targets);
|
|
30190
30673
|
if (targets.areSuitable && targets.values.length > 0) {
|
|
30191
30674
|
const entityThatHasAlreadyBeenTranslated = targets.values.find((e) => this.translatedEntityByOriginal.has(e));
|
|
30192
30675
|
if (entityThatHasAlreadyBeenTranslated !== void 0) {
|
|
30193
|
-
this.reportTypeMemberHasAlreadyBeenTranslatedDiagnostic(translationDeclaration,
|
|
30676
|
+
this.reportTypeMemberHasAlreadyBeenTranslatedDiagnostic(translationDeclaration, diagnostics);
|
|
30194
30677
|
} else {
|
|
30195
30678
|
const translation = new Translation(this, new SourceTranslationDefinition(
|
|
30196
30679
|
translationDeclaration,
|
|
@@ -30209,12 +30692,11 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30209
30692
|
const targets = this.getFieldOrVariantTranslationTargets(
|
|
30210
30693
|
translationDeclaration,
|
|
30211
30694
|
originalMembers,
|
|
30212
|
-
|
|
30695
|
+
diagnostics
|
|
30213
30696
|
);
|
|
30214
30697
|
handleTargets(
|
|
30215
30698
|
targets,
|
|
30216
30699
|
translationDeclaration,
|
|
30217
|
-
translationDeclaration.translatedName,
|
|
30218
30700
|
(e, t) => {
|
|
30219
30701
|
const name = this.analyzer.createNameFromIdentifier(translationDeclaration.translatedName);
|
|
30220
30702
|
return new TranslatedFieldEntity(e, t, name, this, translatedTypeEntity);
|
|
@@ -30223,20 +30705,15 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30223
30705
|
break;
|
|
30224
30706
|
}
|
|
30225
30707
|
case 133 /* MethodTranslation */: {
|
|
30226
|
-
const targets = this.getMethodTranslationTargets(
|
|
30227
|
-
translationDeclaration,
|
|
30228
|
-
originalMembers,
|
|
30229
|
-
this.diagnostics
|
|
30230
|
-
);
|
|
30708
|
+
const targets = this.getMethodTranslationTargets(translationDeclaration, originalMembers, diagnostics);
|
|
30231
30709
|
handleTargets(
|
|
30232
30710
|
targets,
|
|
30233
30711
|
translationDeclaration,
|
|
30234
|
-
translationDeclaration.translatedName,
|
|
30235
30712
|
(e, t) => {
|
|
30236
30713
|
switch (e.kind) {
|
|
30237
30714
|
case 1 /* Function */: {
|
|
30238
30715
|
const name = this.analyzer.createNameFromIdentifier(translationDeclaration.translatedName);
|
|
30239
|
-
return new
|
|
30716
|
+
return new SourceTranslatedMethodEntity(
|
|
30240
30717
|
this.analyzer,
|
|
30241
30718
|
e,
|
|
30242
30719
|
t,
|
|
@@ -30247,7 +30724,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30247
30724
|
);
|
|
30248
30725
|
}
|
|
30249
30726
|
case 9 /* Operator */: {
|
|
30250
|
-
return new
|
|
30727
|
+
return new SourceTranslatedOperatorEntity(
|
|
30251
30728
|
this.analyzer,
|
|
30252
30729
|
e,
|
|
30253
30730
|
t,
|
|
@@ -30264,30 +30741,20 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30264
30741
|
break;
|
|
30265
30742
|
}
|
|
30266
30743
|
case 127 /* ConstructorTranslation */: {
|
|
30267
|
-
const targets = this.getConstructorTranslationTargets(
|
|
30268
|
-
translationDeclaration,
|
|
30269
|
-
originalMembers,
|
|
30270
|
-
this.diagnostics
|
|
30271
|
-
);
|
|
30744
|
+
const targets = this.getConstructorTranslationTargets(translationDeclaration, originalMembers, diagnostics);
|
|
30272
30745
|
handleTargets(
|
|
30273
30746
|
targets,
|
|
30274
30747
|
translationDeclaration,
|
|
30275
|
-
void 0,
|
|
30276
30748
|
(e, t) => new SourceTranslatedConstructorEntity(e, t, this, translatedTypeEntity, translationDeclaration)
|
|
30277
30749
|
);
|
|
30278
30750
|
break;
|
|
30279
30751
|
}
|
|
30280
30752
|
case 129 /* IndexerTranslation */: {
|
|
30281
|
-
const targets = this.getIndexerTranslationTargets(
|
|
30282
|
-
translationDeclaration,
|
|
30283
|
-
originalMembers,
|
|
30284
|
-
this.diagnostics
|
|
30285
|
-
);
|
|
30753
|
+
const targets = this.getIndexerTranslationTargets(translationDeclaration, originalMembers, diagnostics);
|
|
30286
30754
|
handleTargets(
|
|
30287
30755
|
targets,
|
|
30288
30756
|
translationDeclaration,
|
|
30289
|
-
|
|
30290
|
-
(e, t) => new TranslatedIndexerEntity(e, t, this, translatedTypeEntity, translationDeclaration)
|
|
30757
|
+
(e, t) => new SourceTranslatedIndexerEntity(e, t, this, translatedTypeEntity, translationDeclaration)
|
|
30291
30758
|
);
|
|
30292
30759
|
break;
|
|
30293
30760
|
}
|
|
@@ -30316,6 +30783,12 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30316
30783
|
);
|
|
30317
30784
|
}
|
|
30318
30785
|
}
|
|
30786
|
+
if (translatedMember === void 0) {
|
|
30787
|
+
translatedMember = this.tryCreateAutomaticTranslationOfDerivedTypeMember(
|
|
30788
|
+
originalMember,
|
|
30789
|
+
translatedTypeEntity
|
|
30790
|
+
);
|
|
30791
|
+
}
|
|
30319
30792
|
if (translatedMember === void 0) {
|
|
30320
30793
|
translatedMember = this.createTranslatedTypeMemberEntityWithMissingTranslation(
|
|
30321
30794
|
originalMember,
|
|
@@ -30367,7 +30840,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30367
30840
|
typeTranslationDeclaration.sourceName,
|
|
30368
30841
|
diagnosticArgumentFactory
|
|
30369
30842
|
);
|
|
30370
|
-
|
|
30843
|
+
diagnostics.addDiagnostic(diagnostic);
|
|
30371
30844
|
}
|
|
30372
30845
|
return new TypeEntityMembers(
|
|
30373
30846
|
translatedNamedMembers,
|
|
@@ -30378,80 +30851,6 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30378
30851
|
translatedDereferenceOperators
|
|
30379
30852
|
);
|
|
30380
30853
|
}
|
|
30381
|
-
createTranslatedTypeParameters(original, node, containingEntity) {
|
|
30382
|
-
if (original.length === 0) {
|
|
30383
|
-
return original;
|
|
30384
|
-
}
|
|
30385
|
-
return Query.zipLeft(original, node?.typeParameters, (e, n) => {
|
|
30386
|
-
const name = n !== void 0 ? this.analyzer.createNameFromIdentifier(n) : e.getName();
|
|
30387
|
-
const translationDefinition = node !== void 0 ? new SourceTranslationDefinition(node.parent.parent, n) : new IntrinsicTranslationDefinition(true);
|
|
30388
|
-
return new TranslatedTypeParameterEntity(
|
|
30389
|
-
e,
|
|
30390
|
-
new Translation(this, translationDefinition),
|
|
30391
|
-
name,
|
|
30392
|
-
this,
|
|
30393
|
-
containingEntity
|
|
30394
|
-
);
|
|
30395
|
-
}).toArray();
|
|
30396
|
-
}
|
|
30397
|
-
createTranslatedParameters(original, node, containingEntity) {
|
|
30398
|
-
if (original.length === 0) {
|
|
30399
|
-
return original;
|
|
30400
|
-
}
|
|
30401
|
-
return Query.zipLeft(original, node?.parameters, (e, n) => {
|
|
30402
|
-
const name = n !== void 0 ? this.analyzer.createNameFromIdentifier(n) : e.getName();
|
|
30403
|
-
const translationDefinition = node !== void 0 ? new SourceTranslationDefinition(node.parent.parent, n) : new IntrinsicTranslationDefinition(true);
|
|
30404
|
-
return new TranslatedParameterEntity(
|
|
30405
|
-
e,
|
|
30406
|
-
new Translation(this, translationDefinition),
|
|
30407
|
-
name,
|
|
30408
|
-
this,
|
|
30409
|
-
containingEntity
|
|
30410
|
-
);
|
|
30411
|
-
}).toArray();
|
|
30412
|
-
}
|
|
30413
|
-
static isPackageMemberEntityThatShouldBeTranslatedByUser(entity) {
|
|
30414
|
-
const hiding = entity.isHidden();
|
|
30415
|
-
if (hiding !== void 0) {
|
|
30416
|
-
return false;
|
|
30417
|
-
}
|
|
30418
|
-
switch (entity.kind) {
|
|
30419
|
-
case 0 /* Variable */:
|
|
30420
|
-
case 1 /* Function */:
|
|
30421
|
-
case 2 /* Type */:
|
|
30422
|
-
return true;
|
|
30423
|
-
case 11 /* TypeExtension */:
|
|
30424
|
-
return false;
|
|
30425
|
-
default:
|
|
30426
|
-
Debug.never(entity);
|
|
30427
|
-
}
|
|
30428
|
-
}
|
|
30429
|
-
static isTypeMemberEntityThatShouldBeTranslatedByUser(entity) {
|
|
30430
|
-
const hiding = entity.isHidden();
|
|
30431
|
-
if (!(hiding === void 0 || hiding.kind === "type-hierarchy")) {
|
|
30432
|
-
return false;
|
|
30433
|
-
}
|
|
30434
|
-
switch (entity.kind) {
|
|
30435
|
-
case 0 /* Variable */:
|
|
30436
|
-
case 1 /* Function */:
|
|
30437
|
-
return true;
|
|
30438
|
-
case 7 /* Constructor */:
|
|
30439
|
-
return entity.getParameters().length > 0 && entity.isDefault() === void 0;
|
|
30440
|
-
case 5 /* Indexer */:
|
|
30441
|
-
return entity.getParameters().length > 0;
|
|
30442
|
-
case 9 /* Operator */:
|
|
30443
|
-
return entity.getParameters().length > 0;
|
|
30444
|
-
case 8 /* Destructor */:
|
|
30445
|
-
return false;
|
|
30446
|
-
case 6 /* DereferenceOperator */:
|
|
30447
|
-
return false;
|
|
30448
|
-
default:
|
|
30449
|
-
Debug.never(entity);
|
|
30450
|
-
}
|
|
30451
|
-
}
|
|
30452
|
-
ensurePackageMembersHaveBeenCreated() {
|
|
30453
|
-
this.translatedTargetPackage.getMembers();
|
|
30454
|
-
}
|
|
30455
30854
|
ensureTypeMembersHaveBeenCreated(originalEntity) {
|
|
30456
30855
|
Debug.assert(originalEntity.getContainingPackage() === this.targetPackage);
|
|
30457
30856
|
switch (originalEntity.kind) {
|
|
@@ -30520,7 +30919,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30520
30919
|
));
|
|
30521
30920
|
}
|
|
30522
30921
|
createTranslatedNamedPackageMemberEntityWithMissingTranslation(entity) {
|
|
30523
|
-
const translation = new Translation(this, new IntrinsicTranslationDefinition(
|
|
30922
|
+
const translation = new Translation(this, new IntrinsicTranslationDefinition());
|
|
30524
30923
|
switch (entity.kind) {
|
|
30525
30924
|
case 0 /* Variable */:
|
|
30526
30925
|
return new TranslatedPackageVariableEntity(entity, translation, entity.getName(), this);
|
|
@@ -30545,12 +30944,12 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30545
30944
|
}
|
|
30546
30945
|
}
|
|
30547
30946
|
createTranslatedTypeMemberEntityWithMissingTranslation(entity, translatedContainingEntity) {
|
|
30548
|
-
const translation = new Translation(this, new IntrinsicTranslationDefinition(
|
|
30947
|
+
const translation = new Translation(this, new IntrinsicTranslationDefinition());
|
|
30549
30948
|
switch (entity.kind) {
|
|
30550
30949
|
case 0 /* Variable */:
|
|
30551
30950
|
return new TranslatedFieldEntity(entity, translation, entity.getName(), this, translatedContainingEntity);
|
|
30552
30951
|
case 1 /* Function */:
|
|
30553
|
-
return new
|
|
30952
|
+
return new SourceTranslatedMethodEntity(
|
|
30554
30953
|
this.analyzer,
|
|
30555
30954
|
entity,
|
|
30556
30955
|
translation,
|
|
@@ -30560,7 +30959,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30560
30959
|
void 0
|
|
30561
30960
|
);
|
|
30562
30961
|
case 5 /* Indexer */:
|
|
30563
|
-
return new
|
|
30962
|
+
return new SourceTranslatedIndexerEntity(entity, translation, this, translatedContainingEntity, void 0);
|
|
30564
30963
|
case 7 /* Constructor */:
|
|
30565
30964
|
return new SourceTranslatedConstructorEntity(entity, translation, this, translatedContainingEntity, void 0);
|
|
30566
30965
|
case 6 /* DereferenceOperator */:
|
|
@@ -30568,7 +30967,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30568
30967
|
case 8 /* Destructor */:
|
|
30569
30968
|
return new TranslatedDestructorEntity(entity, translation, this, translatedContainingEntity);
|
|
30570
30969
|
case 9 /* Operator */:
|
|
30571
|
-
return new
|
|
30970
|
+
return new SourceTranslatedOperatorEntity(
|
|
30572
30971
|
this.analyzer,
|
|
30573
30972
|
entity,
|
|
30574
30973
|
translation,
|
|
@@ -30682,7 +31081,7 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30682
31081
|
}
|
|
30683
31082
|
getTypeTranslationTargets(node, originalMembers, diagnostics) {
|
|
30684
31083
|
const name = this.analyzer.createNameFromIdentifier(node.sourceName);
|
|
30685
|
-
let targets = originalMembers.getNamedMembersByName(name).filter((m) => m.kind === 2 /* Type */
|
|
31084
|
+
let targets = originalMembers.getNamedMembersByName(name).filter((m) => m.kind === 2 /* Type */);
|
|
30686
31085
|
let areSuitable = true;
|
|
30687
31086
|
if (targets.length === 0) {
|
|
30688
31087
|
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
@@ -30690,6 +31089,12 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30690
31089
|
node.sourceName,
|
|
30691
31090
|
[name]
|
|
30692
31091
|
));
|
|
31092
|
+
} else if (targets.every((t) => t.kind === 2 /* Type */ && t.typeEntityKind === 0 /* Function */)) {
|
|
31093
|
+
diagnostics.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
31094
|
+
391 /* TranslationOfFunctionTypeMustIncludeParameterList */,
|
|
31095
|
+
node.sourceName
|
|
31096
|
+
));
|
|
31097
|
+
areSuitable = false;
|
|
30693
31098
|
} else {
|
|
30694
31099
|
const suitableTargets = targets.filter((t) => this.areTypeParameterEntitiesEqualToTranslationTypeParameters(
|
|
30695
31100
|
t.getTypeParameters(),
|
|
@@ -30993,19 +31398,122 @@ var AnalyzedTranslationPackage = class _AnalyzedTranslationPackage {
|
|
|
30993
31398
|
}
|
|
30994
31399
|
const translatedConstructor = new UnfinishedIntrinsicTranslatedConstructorEntity(
|
|
30995
31400
|
entity,
|
|
30996
|
-
new Translation(this, new IntrinsicTranslationDefinition(
|
|
31401
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
30997
31402
|
this,
|
|
30998
31403
|
translatedContainingEntity
|
|
30999
31404
|
);
|
|
31000
31405
|
const parameters = entity.getParameters().map((p) => {
|
|
31001
31406
|
const nameWithTranslation = translatedNameByParameter.get(p);
|
|
31002
31407
|
const name = nameWithTranslation?.name ?? p.getName();
|
|
31003
|
-
const translation = nameWithTranslation?.translation ?? new Translation(this, new IntrinsicTranslationDefinition(
|
|
31408
|
+
const translation = nameWithTranslation?.translation ?? new Translation(this, new IntrinsicTranslationDefinition());
|
|
31004
31409
|
return new TranslatedParameterEntity(p, translation, name, this, translatedConstructor.unfinishedValue);
|
|
31005
31410
|
});
|
|
31006
31411
|
return translatedConstructor.finish(parameters);
|
|
31007
31412
|
}
|
|
31008
|
-
|
|
31413
|
+
tryCreateAutomaticTranslationOfDerivedTypeMember(entity, translatedContainingEntity) {
|
|
31414
|
+
switch (entity.kind) {
|
|
31415
|
+
case 0 /* Variable */: {
|
|
31416
|
+
const overriddenMember = entity.getOverriddenMembers()[0];
|
|
31417
|
+
if (overriddenMember === void 0) {
|
|
31418
|
+
return void 0;
|
|
31419
|
+
}
|
|
31420
|
+
const localizedOverriddenMember = this.localizationContext.getLocalizedFieldEntity(overriddenMember.getEntity());
|
|
31421
|
+
return new TranslatedFieldEntity(
|
|
31422
|
+
entity,
|
|
31423
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31424
|
+
localizedOverriddenMember.getName(),
|
|
31425
|
+
this,
|
|
31426
|
+
translatedContainingEntity
|
|
31427
|
+
);
|
|
31428
|
+
}
|
|
31429
|
+
case 1 /* Function */: {
|
|
31430
|
+
const overriddenMember = entity.getOverriddenMembers()[0];
|
|
31431
|
+
if (overriddenMember === void 0) {
|
|
31432
|
+
return void 0;
|
|
31433
|
+
}
|
|
31434
|
+
const localizedOverriddenMember = this.localizationContext.getLocalizedMethodEntity(
|
|
31435
|
+
overriddenMember.getEntity()
|
|
31436
|
+
);
|
|
31437
|
+
const translatedMember = new UnfinishedIntrinsicTranslatedMethodEntity(
|
|
31438
|
+
this.analyzer,
|
|
31439
|
+
entity,
|
|
31440
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31441
|
+
localizedOverriddenMember.getName(),
|
|
31442
|
+
this,
|
|
31443
|
+
translatedContainingEntity
|
|
31444
|
+
);
|
|
31445
|
+
const typeParameters = Query.zipLeft(entity.getTypeParameters(), localizedOverriddenMember.getTypeParameters(), (p, bp) => new TranslatedTypeParameterEntity(
|
|
31446
|
+
p,
|
|
31447
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31448
|
+
bp?.getName() ?? p.getName(),
|
|
31449
|
+
this,
|
|
31450
|
+
translatedMember.unfinishedValue
|
|
31451
|
+
)).toArray();
|
|
31452
|
+
const parameters = Query.zipLeft(entity.getParameters(), localizedOverriddenMember.getParameters(), (p, bp) => new TranslatedParameterEntity(
|
|
31453
|
+
p,
|
|
31454
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31455
|
+
bp?.getName() ?? p.getName(),
|
|
31456
|
+
this,
|
|
31457
|
+
translatedMember.unfinishedValue
|
|
31458
|
+
)).toArray();
|
|
31459
|
+
return translatedMember.finish(typeParameters, parameters);
|
|
31460
|
+
}
|
|
31461
|
+
case 5 /* Indexer */: {
|
|
31462
|
+
const overriddenMember = entity.getOverriddenMembers()[0];
|
|
31463
|
+
if (overriddenMember === void 0) {
|
|
31464
|
+
return void 0;
|
|
31465
|
+
}
|
|
31466
|
+
const localizedOverriddenMember = this.localizationContext.getLocalizedIndexerEntity(
|
|
31467
|
+
overriddenMember.getEntity()
|
|
31468
|
+
);
|
|
31469
|
+
const translatedMember = new UnfinishedIntrinsicTranslatedIndexerEntity(
|
|
31470
|
+
entity,
|
|
31471
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31472
|
+
this,
|
|
31473
|
+
translatedContainingEntity
|
|
31474
|
+
);
|
|
31475
|
+
const parameters = Query.zipLeft(entity.getParameters(), localizedOverriddenMember.getParameters(), (p, bp) => new TranslatedParameterEntity(
|
|
31476
|
+
p,
|
|
31477
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31478
|
+
bp?.getName() ?? p.getName(),
|
|
31479
|
+
this,
|
|
31480
|
+
translatedMember.unfinishedValue
|
|
31481
|
+
)).toArray();
|
|
31482
|
+
return translatedMember.finish(parameters);
|
|
31483
|
+
}
|
|
31484
|
+
case 9 /* Operator */: {
|
|
31485
|
+
const overriddenMember = entity.getOverriddenMembers()[0];
|
|
31486
|
+
if (overriddenMember === void 0) {
|
|
31487
|
+
return void 0;
|
|
31488
|
+
}
|
|
31489
|
+
const localizedOverriddenMember = this.localizationContext.getLocalizedOperatorEntity(
|
|
31490
|
+
overriddenMember.getEntity()
|
|
31491
|
+
);
|
|
31492
|
+
const translatedMember = new UnfinishedIntrinsicTranslatedOperatorEntity(
|
|
31493
|
+
this.analyzer,
|
|
31494
|
+
entity,
|
|
31495
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31496
|
+
this,
|
|
31497
|
+
translatedContainingEntity
|
|
31498
|
+
);
|
|
31499
|
+
const parameters = Query.zipLeft(entity.getParameters(), localizedOverriddenMember.getParameters(), (p, bp) => new TranslatedParameterEntity(
|
|
31500
|
+
p,
|
|
31501
|
+
new Translation(this, new IntrinsicTranslationDefinition()),
|
|
31502
|
+
bp?.getName() ?? p.getName(),
|
|
31503
|
+
this,
|
|
31504
|
+
translatedMember.unfinishedValue
|
|
31505
|
+
)).toArray();
|
|
31506
|
+
return translatedMember.finish(parameters);
|
|
31507
|
+
}
|
|
31508
|
+
case 7 /* Constructor */:
|
|
31509
|
+
case 8 /* Destructor */:
|
|
31510
|
+
case 6 /* DereferenceOperator */:
|
|
31511
|
+
return void 0;
|
|
31512
|
+
default:
|
|
31513
|
+
Debug.never(entity);
|
|
31514
|
+
}
|
|
31515
|
+
}
|
|
31516
|
+
*translationsDeclarations() {
|
|
31009
31517
|
for (const sourceFile of this.package_.sourceFiles) {
|
|
31010
31518
|
for (const declaration of flattenPackageMemberDeclarationList(sourceFile.getSyntaxNode().declarationList)) {
|
|
31011
31519
|
if (declaration.kind === 123 /* TranslationsDeclaration */) {
|
|
@@ -31158,35 +31666,44 @@ var ReferencedPackagesCollector = class {
|
|
|
31158
31666
|
}
|
|
31159
31667
|
visitTypeEntityMembers(members) {
|
|
31160
31668
|
for (const member of members.getAll()) {
|
|
31161
|
-
|
|
31162
|
-
|
|
31163
|
-
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
|
|
31169
|
-
|
|
31170
|
-
|
|
31171
|
-
|
|
31172
|
-
|
|
31173
|
-
|
|
31174
|
-
|
|
31175
|
-
|
|
31176
|
-
|
|
31177
|
-
|
|
31178
|
-
|
|
31179
|
-
|
|
31180
|
-
|
|
31181
|
-
|
|
31182
|
-
|
|
31183
|
-
|
|
31184
|
-
|
|
31185
|
-
|
|
31186
|
-
|
|
31187
|
-
|
|
31188
|
-
|
|
31189
|
-
|
|
31669
|
+
this.visitTypeMemberEntity(member);
|
|
31670
|
+
}
|
|
31671
|
+
}
|
|
31672
|
+
visitTypeMemberEntity(entity) {
|
|
31673
|
+
switch (entity.kind) {
|
|
31674
|
+
case 0 /* Variable */:
|
|
31675
|
+
this.visitType(entity.getType());
|
|
31676
|
+
break;
|
|
31677
|
+
case 1 /* Function */:
|
|
31678
|
+
this.visitTypeParameterEntities(entity.getTypeParameters());
|
|
31679
|
+
this.visitParameterEntities(entity.getParameters());
|
|
31680
|
+
this.visitType(entity.getReturnType());
|
|
31681
|
+
break;
|
|
31682
|
+
case 5 /* Indexer */:
|
|
31683
|
+
this.visitParameterEntities(entity.getParameters());
|
|
31684
|
+
this.visitType(entity.getType());
|
|
31685
|
+
break;
|
|
31686
|
+
case 6 /* DereferenceOperator */:
|
|
31687
|
+
this.visitType(entity.getType());
|
|
31688
|
+
break;
|
|
31689
|
+
case 7 /* Constructor */:
|
|
31690
|
+
this.visitParameterEntities(entity.getParameters());
|
|
31691
|
+
break;
|
|
31692
|
+
case 8 /* Destructor */:
|
|
31693
|
+
this.visitParameterEntities(entity.getParameters());
|
|
31694
|
+
break;
|
|
31695
|
+
case 9 /* Operator */:
|
|
31696
|
+
this.visitParameterEntities(entity.getParameters());
|
|
31697
|
+
this.visitType(entity.getReturnType());
|
|
31698
|
+
break;
|
|
31699
|
+
default:
|
|
31700
|
+
Debug.never(entity);
|
|
31701
|
+
}
|
|
31702
|
+
this.visitOverriddenTypeMembers(TypeMemberEntity.getOverriddenMembers(entity));
|
|
31703
|
+
}
|
|
31704
|
+
visitOverriddenTypeMembers(members) {
|
|
31705
|
+
for (const member of members) {
|
|
31706
|
+
this.recordEntityUsage(member.getEntity());
|
|
31190
31707
|
}
|
|
31191
31708
|
}
|
|
31192
31709
|
visitType(type) {
|
|
@@ -31793,11 +32310,13 @@ var TypeArgumentInferrer = class {
|
|
|
31793
32310
|
const targetFunctionType = this.analyzer.getUnambiguousTargetFunctionType(targetType);
|
|
31794
32311
|
if (targetFunctionType !== void 0 && this.tryFixTypeParametersContainedByTypesOfFunctionParameters(targetFunctionType)) {
|
|
31795
32312
|
const substitutedFunctionType = targetFunctionType.applySubstitutions(this.createSubstitutions());
|
|
31796
|
-
const literalType = this.analyzer.type.
|
|
32313
|
+
const literalType = this.analyzer.type.ofExpression(
|
|
31797
32314
|
node,
|
|
31798
32315
|
this.analysisOptions.withTargetType(substitutedFunctionType)
|
|
31799
32316
|
);
|
|
31800
|
-
|
|
32317
|
+
if (literalType.kind === "function") {
|
|
32318
|
+
this.inferFromTypes(literalType.getReturnType(), targetFunctionType.getReturnType(), priority);
|
|
32319
|
+
}
|
|
31801
32320
|
}
|
|
31802
32321
|
} else if (node.kind === 69 /* AutotypeCallExpression */) {
|
|
31803
32322
|
} else if (node.kind === 59 /* ArrayLiteral */) {
|
|
@@ -34189,98 +34708,104 @@ var DeclarationsUsageCounter = class {
|
|
|
34189
34708
|
this.analyzer = analyzer;
|
|
34190
34709
|
this.sourceFile = sourceFile;
|
|
34191
34710
|
}
|
|
34192
|
-
count(
|
|
34711
|
+
count(taskController) {
|
|
34193
34712
|
return __async(this, null, function* () {
|
|
34194
|
-
yield
|
|
34195
|
-
|
|
34196
|
-
|
|
34197
|
-
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
|
|
34202
|
-
|
|
34203
|
-
|
|
34204
|
-
|
|
34205
|
-
|
|
34206
|
-
|
|
34207
|
-
|
|
34208
|
-
|
|
34209
|
-
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34214
|
-
|
|
34215
|
-
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34223
|
-
|
|
34224
|
-
|
|
34225
|
-
|
|
34226
|
-
|
|
34227
|
-
|
|
34228
|
-
|
|
34229
|
-
|
|
34230
|
-
|
|
34231
|
-
|
|
34232
|
-
|
|
34233
|
-
|
|
34234
|
-
|
|
34235
|
-
|
|
34236
|
-
|
|
34237
|
-
|
|
34238
|
-
|
|
34239
|
-
|
|
34240
|
-
|
|
34241
|
-
|
|
34242
|
-
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
|
|
34246
|
-
|
|
34247
|
-
|
|
34248
|
-
|
|
34249
|
-
|
|
34250
|
-
|
|
34251
|
-
|
|
34252
|
-
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
|
|
34260
|
-
|
|
34261
|
-
|
|
34262
|
-
|
|
34263
|
-
|
|
34264
|
-
|
|
34265
|
-
|
|
34266
|
-
|
|
34267
|
-
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
|
|
34271
|
-
|
|
34272
|
-
|
|
34273
|
-
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34278
|
-
|
|
34279
|
-
|
|
34280
|
-
|
|
34713
|
+
yield traverseTree(
|
|
34714
|
+
this.sourceFile,
|
|
34715
|
+
false,
|
|
34716
|
+
taskController,
|
|
34717
|
+
(node) => {
|
|
34718
|
+
if (node.kind === 89 /* IdentifierExpression */) {
|
|
34719
|
+
const meaning = this.analyzer.resolveIdentifierExpression(node).meaning;
|
|
34720
|
+
let entity;
|
|
34721
|
+
let accessKind;
|
|
34722
|
+
switch (meaning.kind) {
|
|
34723
|
+
case "variable-access":
|
|
34724
|
+
entity = meaning.variable.getEntity();
|
|
34725
|
+
accessKind = meaning.accessKind;
|
|
34726
|
+
break;
|
|
34727
|
+
case "function-access":
|
|
34728
|
+
entity = meaning.singleFunction?.getEntity();
|
|
34729
|
+
break;
|
|
34730
|
+
case "operator-access":
|
|
34731
|
+
entity = meaning.singleOperator?.getEntity();
|
|
34732
|
+
break;
|
|
34733
|
+
case "package-name-segment-access":
|
|
34734
|
+
break;
|
|
34735
|
+
case "package-alias-access":
|
|
34736
|
+
entity = meaning.packageAlias;
|
|
34737
|
+
break;
|
|
34738
|
+
case "type-access":
|
|
34739
|
+
entity = meaning.singleSuitableType?.getEntity();
|
|
34740
|
+
break;
|
|
34741
|
+
case "constructor-access":
|
|
34742
|
+
entity = meaning.callExpressionMeaning.typeEntity;
|
|
34743
|
+
break;
|
|
34744
|
+
case "mixed-ambiguous-access":
|
|
34745
|
+
case "unresolved":
|
|
34746
|
+
break;
|
|
34747
|
+
default:
|
|
34748
|
+
Debug.never(meaning);
|
|
34749
|
+
}
|
|
34750
|
+
if (entity !== void 0) {
|
|
34751
|
+
this.recordUsage(entity, accessKind);
|
|
34752
|
+
}
|
|
34753
|
+
} else if (node.kind === 76 /* MemberAccessExpression */) {
|
|
34754
|
+
const meaning = this.analyzer.resolveMemberAccessExpression(node).meaning;
|
|
34755
|
+
let entity;
|
|
34756
|
+
let accessKind;
|
|
34757
|
+
switch (meaning.kind) {
|
|
34758
|
+
case "package-variable-access":
|
|
34759
|
+
entity = meaning.variable;
|
|
34760
|
+
accessKind = meaning.accessKind;
|
|
34761
|
+
break;
|
|
34762
|
+
case "package-function-access":
|
|
34763
|
+
entity = meaning.singleFunction?.getEntity();
|
|
34764
|
+
break;
|
|
34765
|
+
case "package-type-access":
|
|
34766
|
+
entity = meaning.singleSuitableType?.getEntity();
|
|
34767
|
+
break;
|
|
34768
|
+
case "constructor-access":
|
|
34769
|
+
entity = meaning.callExpressionMeaning.typeEntity;
|
|
34770
|
+
break;
|
|
34771
|
+
case "package-name-segment-access":
|
|
34772
|
+
break;
|
|
34773
|
+
case "static-field-access":
|
|
34774
|
+
entity = meaning.field.getEntity();
|
|
34775
|
+
accessKind = meaning.accessKind;
|
|
34776
|
+
break;
|
|
34777
|
+
case "static-method-access":
|
|
34778
|
+
entity = meaning.singleFunction?.getEntity();
|
|
34779
|
+
break;
|
|
34780
|
+
case "instance-field-access":
|
|
34781
|
+
entity = meaning.field.getEntity();
|
|
34782
|
+
accessKind = meaning.accessKind;
|
|
34783
|
+
break;
|
|
34784
|
+
case "instance-method-access":
|
|
34785
|
+
entity = meaning.singleFunction?.getEntity();
|
|
34786
|
+
break;
|
|
34787
|
+
case "operator-access":
|
|
34788
|
+
entity = meaning.singleOperator?.getEntity();
|
|
34789
|
+
break;
|
|
34790
|
+
case "unresolved":
|
|
34791
|
+
case "mixed-ambiguous-access":
|
|
34792
|
+
break;
|
|
34793
|
+
default:
|
|
34794
|
+
Debug.never(meaning);
|
|
34795
|
+
}
|
|
34796
|
+
if (entity !== void 0) {
|
|
34797
|
+
this.recordUsage(entity, accessKind);
|
|
34798
|
+
}
|
|
34799
|
+
} else if (node.kind === 10 /* NamedTypeSpecifier */) {
|
|
34800
|
+
const resolved = this.analyzer.resolveNamedTypeSpecifier(node);
|
|
34801
|
+
const entity = resolved.type?.getEntity();
|
|
34802
|
+
if (entity !== void 0) {
|
|
34803
|
+
this.recordUsage(entity, void 0);
|
|
34804
|
+
}
|
|
34281
34805
|
}
|
|
34806
|
+
return void 0;
|
|
34282
34807
|
}
|
|
34283
|
-
|
|
34808
|
+
);
|
|
34284
34809
|
return new DeclarationsUsageMap(this.usageInfoByEntity);
|
|
34285
34810
|
});
|
|
34286
34811
|
}
|
|
@@ -37602,301 +38127,6 @@ var SourcePackageMemberConflictsValidator = class {
|
|
|
37602
38127
|
}
|
|
37603
38128
|
};
|
|
37604
38129
|
|
|
37605
|
-
// source/analysis/TypeNarrower.ts
|
|
37606
|
-
var TypeNarrower = class _TypeNarrower {
|
|
37607
|
-
constructor(analyzer, reference, locale, initialType, controlFlowNode) {
|
|
37608
|
-
this.typeByNode = /* @__PURE__ */ new Map();
|
|
37609
|
-
this.isVariableAssignedInLoopCheckResults = /* @__PURE__ */ new Map();
|
|
37610
|
-
this.analyzer = analyzer;
|
|
37611
|
-
this.reference = reference;
|
|
37612
|
-
this.locale = locale;
|
|
37613
|
-
this.initialType = initialType;
|
|
37614
|
-
this.controlFlowNode = controlFlowNode;
|
|
37615
|
-
}
|
|
37616
|
-
static getTypeOfExpression(analyzer, referenceExpression2, initialType, controlFlowNode) {
|
|
37617
|
-
const reference = getReferenceAtNarrowableExpression(analyzer, referenceExpression2);
|
|
37618
|
-
if (reference === void 0) {
|
|
37619
|
-
return initialType;
|
|
37620
|
-
}
|
|
37621
|
-
const typeNarrower = new _TypeNarrower(analyzer, reference, referenceExpression2.locale, initialType, controlFlowNode);
|
|
37622
|
-
return typeNarrower.getType();
|
|
37623
|
-
}
|
|
37624
|
-
getType() {
|
|
37625
|
-
return this.getTypeAtControlFlowNode(this.controlFlowNode);
|
|
37626
|
-
}
|
|
37627
|
-
getTypeAtControlFlowNode(node) {
|
|
37628
|
-
let result = this.typeByNode.get(node);
|
|
37629
|
-
if (result === void 0) {
|
|
37630
|
-
switch (node.kind) {
|
|
37631
|
-
case "start":
|
|
37632
|
-
case "unreachable":
|
|
37633
|
-
result = this.initialType;
|
|
37634
|
-
break;
|
|
37635
|
-
case "condition":
|
|
37636
|
-
result = this.getTypeAtCondition(node);
|
|
37637
|
-
break;
|
|
37638
|
-
case "assignment":
|
|
37639
|
-
result = this.getTypeAtAssignment(node);
|
|
37640
|
-
break;
|
|
37641
|
-
case "local-variable-declaration":
|
|
37642
|
-
result = this.getTypeAtLocalVariableDeclaration(node);
|
|
37643
|
-
break;
|
|
37644
|
-
case "split":
|
|
37645
|
-
result = this.getTypeAtSplit(node);
|
|
37646
|
-
break;
|
|
37647
|
-
case "loop":
|
|
37648
|
-
result = this.getTypeAtLoop(node);
|
|
37649
|
-
break;
|
|
37650
|
-
default:
|
|
37651
|
-
Debug.never(node);
|
|
37652
|
-
}
|
|
37653
|
-
this.typeByNode.set(node, result);
|
|
37654
|
-
}
|
|
37655
|
-
return result;
|
|
37656
|
-
}
|
|
37657
|
-
getTypeAtCondition(node) {
|
|
37658
|
-
const typeAtPredecessor = this.getTypeAtControlFlowNode(node.predecessor);
|
|
37659
|
-
switch (node.syntaxNode.kind) {
|
|
37660
|
-
case 64 /* BinaryExpression */: {
|
|
37661
|
-
const left = unwrapParenthesizedExpressions(node.syntaxNode.left);
|
|
37662
|
-
const right = unwrapParenthesizedExpressions(node.syntaxNode.right);
|
|
37663
|
-
const operator = node.syntaxNode.operator;
|
|
37664
|
-
if (operator.kind === 0 /* Token */ && (operator.tokenKind === 30 /* EqualsEquals */ || operator.tokenKind === 33 /* ExclamationEquals */)) {
|
|
37665
|
-
if (this.isSameReferenceAsNarrowedExpression(left) && NodeTypeUtils.isNullLiteral(right) || this.isSameReferenceAsNarrowedExpression(right) && NodeTypeUtils.isNullLiteral(left)) {
|
|
37666
|
-
const isEqual = node.isTrue ? operator.tokenKind === 30 /* EqualsEquals */ : !(operator.tokenKind === 30 /* EqualsEquals */);
|
|
37667
|
-
return this.getTypeAtComparisonWithNull(typeAtPredecessor, isEqual);
|
|
37668
|
-
}
|
|
37669
|
-
}
|
|
37670
|
-
return typeAtPredecessor;
|
|
37671
|
-
}
|
|
37672
|
-
case 72 /* IsExpression */: {
|
|
37673
|
-
if (this.isSameReferenceAsNarrowedExpression(node.syntaxNode.expression)) {
|
|
37674
|
-
return this.getTypeAtIsExpression(typeAtPredecessor, node.syntaxNode, node.isTrue);
|
|
37675
|
-
}
|
|
37676
|
-
return typeAtPredecessor;
|
|
37677
|
-
}
|
|
37678
|
-
default:
|
|
37679
|
-
Debug.never(node.syntaxNode);
|
|
37680
|
-
}
|
|
37681
|
-
}
|
|
37682
|
-
getTypeAtAssignment(node) {
|
|
37683
|
-
if (node.syntaxNode.operator.tokenKind !== 58 /* Equals */) {
|
|
37684
|
-
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
37685
|
-
}
|
|
37686
|
-
const reference = getReferenceAtExpressionIfNarrowable(this.analyzer, node.syntaxNode.left);
|
|
37687
|
-
if (reference !== void 0) {
|
|
37688
|
-
if (reference.equals(this.reference)) {
|
|
37689
|
-
const rightType = this.analyzer.type.ofExpression(node.syntaxNode.right);
|
|
37690
|
-
return this.getTypeAtAssignmentOrDeclaration(rightType, node.predecessor, false);
|
|
37691
|
-
} else if (this.reference.contains(reference)) {
|
|
37692
|
-
return this.initialType;
|
|
37693
|
-
}
|
|
37694
|
-
}
|
|
37695
|
-
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
37696
|
-
}
|
|
37697
|
-
getTypeAtLocalVariableDeclaration(node) {
|
|
37698
|
-
const reference = getNarrowableReferenceAtLocalVariableDeclaration(this.analyzer, node.syntaxNode);
|
|
37699
|
-
if (reference.equals(this.reference)) {
|
|
37700
|
-
if (node.syntaxNode.initializer !== void 0) {
|
|
37701
|
-
const initializerType = this.analyzer.type.ofExpression(node.syntaxNode.initializer);
|
|
37702
|
-
return this.getTypeAtAssignmentOrDeclaration(initializerType, node.predecessor, true);
|
|
37703
|
-
} else {
|
|
37704
|
-
return this.initialType;
|
|
37705
|
-
}
|
|
37706
|
-
} else {
|
|
37707
|
-
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
37708
|
-
}
|
|
37709
|
-
}
|
|
37710
|
-
getTypeAtSplit(node) {
|
|
37711
|
-
const types = new Array();
|
|
37712
|
-
for (const predecessor of node.predecessors) {
|
|
37713
|
-
const typeAtPredecessor = this.getTypeAtControlFlowNode(predecessor);
|
|
37714
|
-
this.addTypeIfUnique(types, typeAtPredecessor);
|
|
37715
|
-
}
|
|
37716
|
-
return this.analyzer.typeFactory.getUnionType(types, true);
|
|
37717
|
-
}
|
|
37718
|
-
getTypeAtLoop(node) {
|
|
37719
|
-
if (this.checkIfVariableIsAssignedInLoop(node)) {
|
|
37720
|
-
return this.initialType;
|
|
37721
|
-
} else {
|
|
37722
|
-
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
37723
|
-
}
|
|
37724
|
-
}
|
|
37725
|
-
getTypeAtAssignmentWithImplicitConversion(rightType) {
|
|
37726
|
-
let result;
|
|
37727
|
-
if (this.initialType.kind === "union" && rightType.kind !== "union") {
|
|
37728
|
-
const constituentTypes = this.initialType.originalTypes.filter((t) => this.analyzer.isTypeAssignableTo(rightType, t));
|
|
37729
|
-
result = this.analyzer.typeFactory.getUnionType(constituentTypes);
|
|
37730
|
-
} else if (!this.analyzer.isNullAssignableToType(rightType)) {
|
|
37731
|
-
result = this.analyzer.excludeNullFromType(this.initialType);
|
|
37732
|
-
} else {
|
|
37733
|
-
result = this.initialType;
|
|
37734
|
-
}
|
|
37735
|
-
return result;
|
|
37736
|
-
}
|
|
37737
|
-
getTypeAtComparisonWithNull(type, isEqual) {
|
|
37738
|
-
if (isEqual) {
|
|
37739
|
-
return this.analyzer.includeNullToType(type, this.locale);
|
|
37740
|
-
} else {
|
|
37741
|
-
return this.analyzer.excludeNullFromType(type);
|
|
37742
|
-
}
|
|
37743
|
-
}
|
|
37744
|
-
getTypeAtIsExpression(typeAtPredecessor, node, isTrue) {
|
|
37745
|
-
const checkedType = this.analyzer.type.ofTypeSpecifier(node.typeSpecifier);
|
|
37746
|
-
if (isTrue) {
|
|
37747
|
-
return this.analyzer.typeFactory.getIntersectionType([typeAtPredecessor, checkedType], true);
|
|
37748
|
-
} else {
|
|
37749
|
-
return this.analyzer.excludeTypeFromUnion(typeAtPredecessor, checkedType);
|
|
37750
|
-
}
|
|
37751
|
-
}
|
|
37752
|
-
getTypeAtAssignmentOrDeclaration(rightType, predecessor, isDeclaration) {
|
|
37753
|
-
const typeAssignabilityFlags = this.analyzer.getTypeAssignabilityFlags(rightType, this.initialType);
|
|
37754
|
-
if ((typeAssignabilityFlags & 1 /* NotAssignable */) !== 0) {
|
|
37755
|
-
return this.initialType;
|
|
37756
|
-
}
|
|
37757
|
-
if ((typeAssignabilityFlags & 16 /* ImplicitConversion */) !== 0) {
|
|
37758
|
-
return this.getTypeAtAssignmentWithImplicitConversion(rightType);
|
|
37759
|
-
}
|
|
37760
|
-
if (rightType.isNullType) {
|
|
37761
|
-
return isDeclaration ? this.initialType : this.analyzer.includeNullToType(this.getTypeAtControlFlowNode(predecessor), this.locale);
|
|
37762
|
-
}
|
|
37763
|
-
return rightType;
|
|
37764
|
-
}
|
|
37765
|
-
addTypeIfUnique(types, type) {
|
|
37766
|
-
if (type.kind === "union") {
|
|
37767
|
-
for (const constituentType of type.originalTypes) {
|
|
37768
|
-
this.addTypeIfUnique(types, constituentType);
|
|
37769
|
-
}
|
|
37770
|
-
} else {
|
|
37771
|
-
if (!types.some((t) => t.equals(type))) {
|
|
37772
|
-
types.push(type);
|
|
37773
|
-
}
|
|
37774
|
-
}
|
|
37775
|
-
}
|
|
37776
|
-
checkIfVariableIsAssignedInLoop(node) {
|
|
37777
|
-
let result = this.isVariableAssignedInLoopCheckResults.get(node);
|
|
37778
|
-
if (result === void 0) {
|
|
37779
|
-
result = node.loopingPredecessors.some((p) => this.checkIfVariableIsAssignedAtNode(p, node));
|
|
37780
|
-
this.isVariableAssignedInLoopCheckResults.set(node, result);
|
|
37781
|
-
}
|
|
37782
|
-
return result;
|
|
37783
|
-
}
|
|
37784
|
-
checkIfVariableIsAssignedAtNode(node, loopNode) {
|
|
37785
|
-
if (node === loopNode) {
|
|
37786
|
-
return false;
|
|
37787
|
-
}
|
|
37788
|
-
if (node.kind === "loop") {
|
|
37789
|
-
return this.checkIfVariableIsAssignedInLoop(node);
|
|
37790
|
-
}
|
|
37791
|
-
let result = this.isVariableAssignedInLoopCheckResults.get(node);
|
|
37792
|
-
if (result === void 0) {
|
|
37793
|
-
switch (node.kind) {
|
|
37794
|
-
case "start":
|
|
37795
|
-
case "unreachable":
|
|
37796
|
-
result = false;
|
|
37797
|
-
break;
|
|
37798
|
-
case "condition":
|
|
37799
|
-
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
|
37800
|
-
break;
|
|
37801
|
-
case "split":
|
|
37802
|
-
result = node.predecessors.some((p) => this.checkIfVariableIsAssignedAtNode(p, loopNode));
|
|
37803
|
-
break;
|
|
37804
|
-
case "assignment": {
|
|
37805
|
-
const left = unwrapExpressionForNarrowableReferenceCheck(node.syntaxNode.left);
|
|
37806
|
-
if (isNarrowableReferenceExpression(left) && (this.reference.equalsExpression(left) || this.reference.containsExpression(left))) {
|
|
37807
|
-
result = true;
|
|
37808
|
-
} else {
|
|
37809
|
-
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
|
37810
|
-
}
|
|
37811
|
-
break;
|
|
37812
|
-
}
|
|
37813
|
-
case "local-variable-declaration": {
|
|
37814
|
-
if (this.reference.kind === "local-variable" && getNarrowableReferenceAtLocalVariableDeclaration(this.analyzer, node.syntaxNode).equals(this.reference)) {
|
|
37815
|
-
result = true;
|
|
37816
|
-
} else {
|
|
37817
|
-
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
|
37818
|
-
}
|
|
37819
|
-
break;
|
|
37820
|
-
}
|
|
37821
|
-
default:
|
|
37822
|
-
Debug.never(node);
|
|
37823
|
-
}
|
|
37824
|
-
this.isVariableAssignedInLoopCheckResults.set(node, result);
|
|
37825
|
-
}
|
|
37826
|
-
return result;
|
|
37827
|
-
}
|
|
37828
|
-
isSameReferenceAsNarrowedExpression(referenceExpression2) {
|
|
37829
|
-
const reference = getReferenceAtExpressionIfNarrowable(this.analyzer, referenceExpression2);
|
|
37830
|
-
return reference !== void 0 && reference.equals(this.reference);
|
|
37831
|
-
}
|
|
37832
|
-
};
|
|
37833
|
-
|
|
37834
|
-
// source/analysis/ReturnTypeInferrer.ts
|
|
37835
|
-
var ReturnTypeInferrer = class {
|
|
37836
|
-
constructor(analyzer, block, resultVariable) {
|
|
37837
|
-
this.analyzer = analyzer;
|
|
37838
|
-
this.block = block;
|
|
37839
|
-
this.resultVariable = resultVariable;
|
|
37840
|
-
}
|
|
37841
|
-
infer() {
|
|
37842
|
-
let result;
|
|
37843
|
-
if (this.block.expressionOrStatementList.kind !== 93 /* StatementList */) {
|
|
37844
|
-
result = this.analyzer.type.ofExpression(this.block.expressionOrStatementList);
|
|
37845
|
-
} else {
|
|
37846
|
-
const { isResultVariableUsed, returnedTypes } = this.checkResultVariableIsUsedAndCollectReturnedTypes();
|
|
37847
|
-
if (isResultVariableUsed) {
|
|
37848
|
-
returnedTypes.push(this.getTypeOfResultVariableAtTheEndOfSubprogram());
|
|
37849
|
-
}
|
|
37850
|
-
if (returnedTypes.length === 0) {
|
|
37851
|
-
result = this.analyzer.getLocalizedStandardTypes(this.block.locale).nullType;
|
|
37852
|
-
} else {
|
|
37853
|
-
result = this.analyzer.typeFactory.getUnionType(returnedTypes, true);
|
|
37854
|
-
}
|
|
37855
|
-
}
|
|
37856
|
-
return result;
|
|
37857
|
-
}
|
|
37858
|
-
checkResultVariableIsUsedAndCollectReturnedTypes() {
|
|
37859
|
-
let isResultVariableUsed = false;
|
|
37860
|
-
const returnedTypes = new Array();
|
|
37861
|
-
const visitor = (child) => {
|
|
37862
|
-
if (!isResultVariableUsed && child.kind === 89 /* IdentifierExpression */) {
|
|
37863
|
-
const meaning = this.analyzer.resolveIdentifierExpressionFirstStage(child).meaning;
|
|
37864
|
-
if (meaning.kind === "variable-access" && meaning.variable.getEntity().getOriginalEntity() === this.resultVariable.getOriginalEntity()) {
|
|
37865
|
-
isResultVariableUsed = true;
|
|
37866
|
-
}
|
|
37867
|
-
} else if (child.kind === 116 /* ReturnStatement */ && child.expression !== void 0) {
|
|
37868
|
-
returnedTypes.push(this.analyzer.type.ofExpression(child.expression));
|
|
37869
|
-
}
|
|
37870
|
-
switch (child.kind) {
|
|
37871
|
-
case 15 /* AnonymousTypeSpecifier */:
|
|
37872
|
-
case 56 /* NestedFunctionDeclaration */:
|
|
37873
|
-
case 65 /* FunctionLiteral */:
|
|
37874
|
-
case 66 /* FunctionBlockLiteral */:
|
|
37875
|
-
return;
|
|
37876
|
-
default:
|
|
37877
|
-
visitChildren(child, false, visitor);
|
|
37878
|
-
}
|
|
37879
|
-
};
|
|
37880
|
-
visitChildren(this.block, false, visitor);
|
|
37881
|
-
return { isResultVariableUsed, returnedTypes };
|
|
37882
|
-
}
|
|
37883
|
-
getTypeOfResultVariableAtTheEndOfSubprogram() {
|
|
37884
|
-
const sourceFile = TreeQuery.getSourceFile(this.block, this.analyzer);
|
|
37885
|
-
const controlFlowNodeEndingSubprogram = this.analyzer.getControlFlowGraph(sourceFile).controlFlowNodesEndingSubprogram.get(this.block.parent);
|
|
37886
|
-
if (controlFlowNodeEndingSubprogram === void 0) {
|
|
37887
|
-
return this.analyzer.originalStandardTypes.unresolved;
|
|
37888
|
-
}
|
|
37889
|
-
const typeNarrower = new TypeNarrower(
|
|
37890
|
-
this.analyzer,
|
|
37891
|
-
new NarrowableReference.LocalVariable(this.analyzer, this.resultVariable),
|
|
37892
|
-
sourceFile.package.locale,
|
|
37893
|
-
this.resultVariable.getType(),
|
|
37894
|
-
controlFlowNodeEndingSubprogram
|
|
37895
|
-
);
|
|
37896
|
-
return typeNarrower.getType();
|
|
37897
|
-
}
|
|
37898
|
-
};
|
|
37899
|
-
|
|
37900
38130
|
// source/analysis/SourceFileMembers.ts
|
|
37901
38131
|
var SourceFileMembers = class _SourceFileMembers {
|
|
37902
38132
|
constructor(analyzer, namedMembers, typeExtensions) {
|
|
@@ -38291,6 +38521,58 @@ var ResolvedQualifier_function = class {
|
|
|
38291
38521
|
}
|
|
38292
38522
|
};
|
|
38293
38523
|
|
|
38524
|
+
// source/analysis/TextIdentity.ts
|
|
38525
|
+
var TextIdentity = class {
|
|
38526
|
+
static keyFromTextFragments(fragments) {
|
|
38527
|
+
return fragments.join("_");
|
|
38528
|
+
}
|
|
38529
|
+
static keyFromTextToken(token) {
|
|
38530
|
+
return unescapeText(withoutQuotes(token.value));
|
|
38531
|
+
}
|
|
38532
|
+
static keyFromLocalizableTextLiteral(node) {
|
|
38533
|
+
let result;
|
|
38534
|
+
if (node.code !== void 0) {
|
|
38535
|
+
result = parseIntegerLiteral(node.code.value);
|
|
38536
|
+
} else {
|
|
38537
|
+
result = this.keyFromTextToken(node.text);
|
|
38538
|
+
}
|
|
38539
|
+
return result;
|
|
38540
|
+
}
|
|
38541
|
+
static keyFromLocalizableTextTemplateLiteral(node) {
|
|
38542
|
+
let result;
|
|
38543
|
+
if (node.code !== void 0) {
|
|
38544
|
+
result = parseIntegerLiteral(node.code.value);
|
|
38545
|
+
} else {
|
|
38546
|
+
const fragments = [unescapeText(withoutTemplateQuotes(node.head.value))];
|
|
38547
|
+
node.spanList.spans.forEach((x) => fragments.push(unescapeText(withoutTemplateQuotes(x.text.value))));
|
|
38548
|
+
result = fragments.join("_");
|
|
38549
|
+
}
|
|
38550
|
+
return result;
|
|
38551
|
+
}
|
|
38552
|
+
static keyFromTextTranslationSource(node) {
|
|
38553
|
+
let result;
|
|
38554
|
+
if (node.code !== void 0) {
|
|
38555
|
+
result = parseIntegerLiteral(node.code.value);
|
|
38556
|
+
} else {
|
|
38557
|
+
switch (node.kind) {
|
|
38558
|
+
case 142 /* TranslationTextLiteral */: {
|
|
38559
|
+
result = this.keyFromTextToken(node.text);
|
|
38560
|
+
break;
|
|
38561
|
+
}
|
|
38562
|
+
case 143 /* TranslationTextTemplate */: {
|
|
38563
|
+
const fragments = [unescapeText(withoutTemplateQuotes(node.head.value))];
|
|
38564
|
+
node.spanList.spans.forEach((x) => fragments.push(unescapeText(withoutTemplateQuotes(x.text.value))));
|
|
38565
|
+
result = fragments.join("_");
|
|
38566
|
+
break;
|
|
38567
|
+
}
|
|
38568
|
+
default:
|
|
38569
|
+
Debug.never(node);
|
|
38570
|
+
}
|
|
38571
|
+
}
|
|
38572
|
+
return result;
|
|
38573
|
+
}
|
|
38574
|
+
};
|
|
38575
|
+
|
|
38294
38576
|
// source/analysis/DisplayableEntity.ts
|
|
38295
38577
|
var DisplayableEntity = class {
|
|
38296
38578
|
constructor(analyzer, entity, locale, dialect, contextualSourceFile) {
|
|
@@ -38646,6 +38928,235 @@ var ImplicitImplementationUtils = class {
|
|
|
38646
38928
|
}
|
|
38647
38929
|
};
|
|
38648
38930
|
|
|
38931
|
+
// source/analysis/TypeNarrower.ts
|
|
38932
|
+
var TypeNarrower = class _TypeNarrower {
|
|
38933
|
+
constructor(analyzer, reference, locale, initialType, controlFlowNode) {
|
|
38934
|
+
this.typeByNode = /* @__PURE__ */ new Map();
|
|
38935
|
+
this.isVariableAssignedInLoopCheckResults = /* @__PURE__ */ new Map();
|
|
38936
|
+
this.analyzer = analyzer;
|
|
38937
|
+
this.reference = reference;
|
|
38938
|
+
this.locale = locale;
|
|
38939
|
+
this.initialType = initialType;
|
|
38940
|
+
this.controlFlowNode = controlFlowNode;
|
|
38941
|
+
}
|
|
38942
|
+
static getTypeOfExpression(analyzer, referenceExpression2, initialType, controlFlowNode) {
|
|
38943
|
+
const reference = getReferenceAtNarrowableExpression(analyzer, referenceExpression2);
|
|
38944
|
+
if (reference === void 0) {
|
|
38945
|
+
return initialType;
|
|
38946
|
+
}
|
|
38947
|
+
const typeNarrower = new _TypeNarrower(analyzer, reference, referenceExpression2.locale, initialType, controlFlowNode);
|
|
38948
|
+
return typeNarrower.getType();
|
|
38949
|
+
}
|
|
38950
|
+
getType() {
|
|
38951
|
+
return this.getTypeAtControlFlowNode(this.controlFlowNode);
|
|
38952
|
+
}
|
|
38953
|
+
getTypeAtControlFlowNode(node) {
|
|
38954
|
+
let result = this.typeByNode.get(node);
|
|
38955
|
+
if (result === void 0) {
|
|
38956
|
+
switch (node.kind) {
|
|
38957
|
+
case "start":
|
|
38958
|
+
case "unreachable":
|
|
38959
|
+
result = this.initialType;
|
|
38960
|
+
break;
|
|
38961
|
+
case "condition":
|
|
38962
|
+
result = this.getTypeAtCondition(node);
|
|
38963
|
+
break;
|
|
38964
|
+
case "assignment":
|
|
38965
|
+
result = this.getTypeAtAssignment(node);
|
|
38966
|
+
break;
|
|
38967
|
+
case "local-variable-declaration":
|
|
38968
|
+
result = this.getTypeAtLocalVariableDeclaration(node);
|
|
38969
|
+
break;
|
|
38970
|
+
case "split":
|
|
38971
|
+
result = this.getTypeAtSplit(node);
|
|
38972
|
+
break;
|
|
38973
|
+
case "loop":
|
|
38974
|
+
result = this.getTypeAtLoop(node);
|
|
38975
|
+
break;
|
|
38976
|
+
default:
|
|
38977
|
+
Debug.never(node);
|
|
38978
|
+
}
|
|
38979
|
+
this.typeByNode.set(node, result);
|
|
38980
|
+
}
|
|
38981
|
+
return result;
|
|
38982
|
+
}
|
|
38983
|
+
getTypeAtCondition(node) {
|
|
38984
|
+
const typeAtPredecessor = this.getTypeAtControlFlowNode(node.predecessor);
|
|
38985
|
+
switch (node.syntaxNode.kind) {
|
|
38986
|
+
case 64 /* BinaryExpression */: {
|
|
38987
|
+
const left = unwrapParenthesizedExpressions(node.syntaxNode.left);
|
|
38988
|
+
const right = unwrapParenthesizedExpressions(node.syntaxNode.right);
|
|
38989
|
+
const operator = node.syntaxNode.operator;
|
|
38990
|
+
if (operator.kind === 0 /* Token */ && (operator.tokenKind === 30 /* EqualsEquals */ || operator.tokenKind === 33 /* ExclamationEquals */)) {
|
|
38991
|
+
if (this.isSameReferenceAsNarrowedExpression(left) && NodeTypeUtils.isNullLiteral(right) || this.isSameReferenceAsNarrowedExpression(right) && NodeTypeUtils.isNullLiteral(left)) {
|
|
38992
|
+
const isEqual = node.isTrue ? operator.tokenKind === 30 /* EqualsEquals */ : !(operator.tokenKind === 30 /* EqualsEquals */);
|
|
38993
|
+
return this.getTypeAtComparisonWithNull(typeAtPredecessor, isEqual);
|
|
38994
|
+
}
|
|
38995
|
+
}
|
|
38996
|
+
return typeAtPredecessor;
|
|
38997
|
+
}
|
|
38998
|
+
case 72 /* IsExpression */: {
|
|
38999
|
+
if (this.isSameReferenceAsNarrowedExpression(node.syntaxNode.expression)) {
|
|
39000
|
+
return this.getTypeAtIsExpression(typeAtPredecessor, node.syntaxNode, node.isTrue);
|
|
39001
|
+
}
|
|
39002
|
+
return typeAtPredecessor;
|
|
39003
|
+
}
|
|
39004
|
+
default:
|
|
39005
|
+
Debug.never(node.syntaxNode);
|
|
39006
|
+
}
|
|
39007
|
+
}
|
|
39008
|
+
getTypeAtAssignment(node) {
|
|
39009
|
+
if (node.syntaxNode.operator.tokenKind !== 58 /* Equals */) {
|
|
39010
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
39011
|
+
}
|
|
39012
|
+
const reference = getReferenceAtExpressionIfNarrowable(this.analyzer, node.syntaxNode.left);
|
|
39013
|
+
if (reference !== void 0) {
|
|
39014
|
+
if (reference.equals(this.reference)) {
|
|
39015
|
+
const rightType = this.analyzer.type.ofExpression(node.syntaxNode.right);
|
|
39016
|
+
return this.getTypeAtAssignmentOrDeclaration(rightType, node.predecessor, false);
|
|
39017
|
+
} else if (this.reference.contains(reference)) {
|
|
39018
|
+
return this.initialType;
|
|
39019
|
+
}
|
|
39020
|
+
}
|
|
39021
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
39022
|
+
}
|
|
39023
|
+
getTypeAtLocalVariableDeclaration(node) {
|
|
39024
|
+
const reference = getNarrowableReferenceAtLocalVariableDeclaration(this.analyzer, node.syntaxNode);
|
|
39025
|
+
if (reference.equals(this.reference)) {
|
|
39026
|
+
if (node.syntaxNode.initializer !== void 0) {
|
|
39027
|
+
const initializerType = this.analyzer.type.ofExpression(node.syntaxNode.initializer);
|
|
39028
|
+
return this.getTypeAtAssignmentOrDeclaration(initializerType, node.predecessor, true);
|
|
39029
|
+
} else {
|
|
39030
|
+
return this.initialType;
|
|
39031
|
+
}
|
|
39032
|
+
} else {
|
|
39033
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
39034
|
+
}
|
|
39035
|
+
}
|
|
39036
|
+
getTypeAtSplit(node) {
|
|
39037
|
+
const types = new Array();
|
|
39038
|
+
for (const predecessor of node.predecessors) {
|
|
39039
|
+
const typeAtPredecessor = this.getTypeAtControlFlowNode(predecessor);
|
|
39040
|
+
this.addTypeIfUnique(types, typeAtPredecessor);
|
|
39041
|
+
}
|
|
39042
|
+
return this.analyzer.typeFactory.getUnionType(types, true);
|
|
39043
|
+
}
|
|
39044
|
+
getTypeAtLoop(node) {
|
|
39045
|
+
if (this.checkIfVariableIsAssignedInLoop(node)) {
|
|
39046
|
+
return this.initialType;
|
|
39047
|
+
} else {
|
|
39048
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
|
39049
|
+
}
|
|
39050
|
+
}
|
|
39051
|
+
getTypeAtAssignmentWithImplicitConversion(rightType) {
|
|
39052
|
+
let result;
|
|
39053
|
+
if (this.initialType.kind === "union" && rightType.kind !== "union") {
|
|
39054
|
+
const constituentTypes = this.initialType.originalTypes.filter((t) => this.analyzer.isTypeAssignableTo(rightType, t));
|
|
39055
|
+
result = this.analyzer.typeFactory.getUnionType(constituentTypes);
|
|
39056
|
+
} else if (!this.analyzer.isNullAssignableToType(rightType)) {
|
|
39057
|
+
result = this.analyzer.excludeNullFromType(this.initialType);
|
|
39058
|
+
} else {
|
|
39059
|
+
result = this.initialType;
|
|
39060
|
+
}
|
|
39061
|
+
return result;
|
|
39062
|
+
}
|
|
39063
|
+
getTypeAtComparisonWithNull(type, isEqual) {
|
|
39064
|
+
if (isEqual) {
|
|
39065
|
+
return this.analyzer.includeNullToType(type, this.locale);
|
|
39066
|
+
} else {
|
|
39067
|
+
return this.analyzer.excludeNullFromType(type);
|
|
39068
|
+
}
|
|
39069
|
+
}
|
|
39070
|
+
getTypeAtIsExpression(typeAtPredecessor, node, isTrue) {
|
|
39071
|
+
const checkedType = this.analyzer.type.ofTypeSpecifier(node.typeSpecifier);
|
|
39072
|
+
if (isTrue) {
|
|
39073
|
+
return this.analyzer.typeFactory.getIntersectionType([typeAtPredecessor, checkedType], true);
|
|
39074
|
+
} else {
|
|
39075
|
+
return this.analyzer.excludeTypeFromUnion(typeAtPredecessor, checkedType);
|
|
39076
|
+
}
|
|
39077
|
+
}
|
|
39078
|
+
getTypeAtAssignmentOrDeclaration(rightType, predecessor, isDeclaration) {
|
|
39079
|
+
const typeAssignabilityFlags = this.analyzer.getTypeAssignabilityFlags(rightType, this.initialType);
|
|
39080
|
+
if ((typeAssignabilityFlags & 1 /* NotAssignable */) !== 0) {
|
|
39081
|
+
return this.initialType;
|
|
39082
|
+
}
|
|
39083
|
+
if ((typeAssignabilityFlags & 16 /* ImplicitConversion */) !== 0) {
|
|
39084
|
+
return this.getTypeAtAssignmentWithImplicitConversion(rightType);
|
|
39085
|
+
}
|
|
39086
|
+
if (rightType.isNullType) {
|
|
39087
|
+
return isDeclaration ? this.initialType : this.analyzer.includeNullToType(this.getTypeAtControlFlowNode(predecessor), this.locale);
|
|
39088
|
+
}
|
|
39089
|
+
return rightType;
|
|
39090
|
+
}
|
|
39091
|
+
addTypeIfUnique(types, type) {
|
|
39092
|
+
if (type.kind === "union") {
|
|
39093
|
+
for (const constituentType of type.originalTypes) {
|
|
39094
|
+
this.addTypeIfUnique(types, constituentType);
|
|
39095
|
+
}
|
|
39096
|
+
} else {
|
|
39097
|
+
if (!types.some((t) => t.equals(type))) {
|
|
39098
|
+
types.push(type);
|
|
39099
|
+
}
|
|
39100
|
+
}
|
|
39101
|
+
}
|
|
39102
|
+
checkIfVariableIsAssignedInLoop(node) {
|
|
39103
|
+
let result = this.isVariableAssignedInLoopCheckResults.get(node);
|
|
39104
|
+
if (result === void 0) {
|
|
39105
|
+
result = node.loopingPredecessors.some((p) => this.checkIfVariableIsAssignedAtNode(p, node));
|
|
39106
|
+
this.isVariableAssignedInLoopCheckResults.set(node, result);
|
|
39107
|
+
}
|
|
39108
|
+
return result;
|
|
39109
|
+
}
|
|
39110
|
+
checkIfVariableIsAssignedAtNode(node, loopNode) {
|
|
39111
|
+
if (node === loopNode) {
|
|
39112
|
+
return false;
|
|
39113
|
+
}
|
|
39114
|
+
if (node.kind === "loop") {
|
|
39115
|
+
return this.checkIfVariableIsAssignedInLoop(node);
|
|
39116
|
+
}
|
|
39117
|
+
let result = this.isVariableAssignedInLoopCheckResults.get(node);
|
|
39118
|
+
if (result === void 0) {
|
|
39119
|
+
switch (node.kind) {
|
|
39120
|
+
case "start":
|
|
39121
|
+
case "unreachable":
|
|
39122
|
+
result = false;
|
|
39123
|
+
break;
|
|
39124
|
+
case "condition":
|
|
39125
|
+
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
|
39126
|
+
break;
|
|
39127
|
+
case "split":
|
|
39128
|
+
result = node.predecessors.some((p) => this.checkIfVariableIsAssignedAtNode(p, loopNode));
|
|
39129
|
+
break;
|
|
39130
|
+
case "assignment": {
|
|
39131
|
+
const left = unwrapExpressionForNarrowableReferenceCheck(node.syntaxNode.left);
|
|
39132
|
+
if (isNarrowableReferenceExpression(left) && (this.reference.equalsExpression(left) || this.reference.containsExpression(left))) {
|
|
39133
|
+
result = true;
|
|
39134
|
+
} else {
|
|
39135
|
+
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
|
39136
|
+
}
|
|
39137
|
+
break;
|
|
39138
|
+
}
|
|
39139
|
+
case "local-variable-declaration": {
|
|
39140
|
+
if (this.reference.kind === "local-variable" && getNarrowableReferenceAtLocalVariableDeclaration(this.analyzer, node.syntaxNode).equals(this.reference)) {
|
|
39141
|
+
result = true;
|
|
39142
|
+
} else {
|
|
39143
|
+
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
|
39144
|
+
}
|
|
39145
|
+
break;
|
|
39146
|
+
}
|
|
39147
|
+
default:
|
|
39148
|
+
Debug.never(node);
|
|
39149
|
+
}
|
|
39150
|
+
this.isVariableAssignedInLoopCheckResults.set(node, result);
|
|
39151
|
+
}
|
|
39152
|
+
return result;
|
|
39153
|
+
}
|
|
39154
|
+
isSameReferenceAsNarrowedExpression(referenceExpression2) {
|
|
39155
|
+
const reference = getReferenceAtExpressionIfNarrowable(this.analyzer, referenceExpression2);
|
|
39156
|
+
return reference !== void 0 && reference.equals(this.reference);
|
|
39157
|
+
}
|
|
39158
|
+
};
|
|
39159
|
+
|
|
38649
39160
|
// source/analysis/UserDefinableBinaryOperatorResolver.ts
|
|
38650
39161
|
var UserDefinableBinaryOperatorResolver = class {
|
|
38651
39162
|
constructor(analyzer, left, right, operatorKind, operatorNodeForDiagnostic) {
|
|
@@ -39080,7 +39591,7 @@ var SemanticContextBase = class _SemanticContextBase {
|
|
|
39080
39591
|
}
|
|
39081
39592
|
getTypesOrContainersWithTypes() {
|
|
39082
39593
|
const hidingMatcher = this.asContext.getHidingMatcher();
|
|
39083
|
-
return Query.from(this.
|
|
39594
|
+
return Query.from(this.semanticContexts()).map((c) => c.getOwnTypesOrContainersWithTypes(hidingMatcher)).scan(new Array(), (seen, declarations) => {
|
|
39084
39595
|
const result = Query.from(declarations).filter((d) => seen.every((sd) => !sd.getName().considerEqual(d.getName()))).toArray();
|
|
39085
39596
|
seen.push(...result);
|
|
39086
39597
|
return result;
|
|
@@ -39088,7 +39599,7 @@ var SemanticContextBase = class _SemanticContextBase {
|
|
|
39088
39599
|
}
|
|
39089
39600
|
getTypesOrContainersWithTypesByName(name) {
|
|
39090
39601
|
const hidingMatcher = this.asContext.getHidingMatcher();
|
|
39091
|
-
for (const context of this.
|
|
39602
|
+
for (const context of this.semanticContexts()) {
|
|
39092
39603
|
const result = context.getOwnTypesOrContainersWithTypesByName(name, hidingMatcher);
|
|
39093
39604
|
if (result.length > 0) {
|
|
39094
39605
|
return result;
|
|
@@ -39157,7 +39668,7 @@ var SemanticContextBase = class _SemanticContextBase {
|
|
|
39157
39668
|
getPrimaryTextTranslationEntityByTextKey(key) {
|
|
39158
39669
|
return this.getSourceFileContext().getPrimaryTextTranslationEntityByTextKey(key);
|
|
39159
39670
|
}
|
|
39160
|
-
*
|
|
39671
|
+
*semanticContexts() {
|
|
39161
39672
|
let context = this.asContext;
|
|
39162
39673
|
while (context !== void 0) {
|
|
39163
39674
|
yield context;
|
|
@@ -39362,27 +39873,20 @@ var SubprogramInfo;
|
|
|
39362
39873
|
this.node = node;
|
|
39363
39874
|
}
|
|
39364
39875
|
getReturnType() {
|
|
39365
|
-
return this.
|
|
39876
|
+
return this.getEntity().getReturnType();
|
|
39366
39877
|
}
|
|
39367
39878
|
// Безымянные операция не могут содержать команды "выдать" - ограничение C#.
|
|
39368
39879
|
isGenerator() {
|
|
39369
39880
|
return false;
|
|
39370
39881
|
}
|
|
39371
39882
|
allowsAsyncCalls() {
|
|
39372
|
-
return this.
|
|
39883
|
+
return this.getEntity().isAsync();
|
|
39373
39884
|
}
|
|
39374
39885
|
getNode() {
|
|
39375
39886
|
return this.node;
|
|
39376
39887
|
}
|
|
39377
|
-
|
|
39378
|
-
|
|
39379
|
-
case 66 /* FunctionBlockLiteral */:
|
|
39380
|
-
return this.analyzer.type.ofFunctionBlockLiteral(this.node);
|
|
39381
|
-
case 65 /* FunctionLiteral */:
|
|
39382
|
-
return this.analyzer.type.ofFunctionLiteral(this.node);
|
|
39383
|
-
default:
|
|
39384
|
-
Debug.never(this.node);
|
|
39385
|
-
}
|
|
39888
|
+
getEntity() {
|
|
39889
|
+
return this.analyzer.entity.ofRegularOrBlockFunctionLiteral(this.node);
|
|
39386
39890
|
}
|
|
39387
39891
|
}
|
|
39388
39892
|
SubprogramInfo6.FunctionLiteral = FunctionLiteral3;
|
|
@@ -40808,13 +41312,13 @@ var FunctionBlockLiteralParameterListSemanticContext = class extends SubprogramP
|
|
|
40808
41312
|
return false;
|
|
40809
41313
|
}
|
|
40810
41314
|
getParameterEntities() {
|
|
40811
|
-
return this.analyzer.
|
|
41315
|
+
return this.analyzer.entity.ofFunctionBlockLiteral(this.node).getParameters();
|
|
40812
41316
|
}
|
|
40813
41317
|
getSpecialVariableKinds() {
|
|
40814
41318
|
return [0 /* Result */];
|
|
40815
41319
|
}
|
|
40816
41320
|
createMemberEntities() {
|
|
40817
|
-
return this.analyzer.
|
|
41321
|
+
return this.analyzer.entity.ofFunctionBlockLiteral(this.node).getParameters();
|
|
40818
41322
|
}
|
|
40819
41323
|
createMemberEntitiesForTypeLookup() {
|
|
40820
41324
|
return [];
|
|
@@ -41332,58 +41836,6 @@ var ParametersOfFunctionTypeSemanticContext = class extends SemanticContextValid
|
|
|
41332
41836
|
}
|
|
41333
41837
|
};
|
|
41334
41838
|
|
|
41335
|
-
// source/analysis/TextIdentity.ts
|
|
41336
|
-
var TextIdentity = class {
|
|
41337
|
-
static keyFromTextFragments(fragments) {
|
|
41338
|
-
return fragments.join("_");
|
|
41339
|
-
}
|
|
41340
|
-
static keyFromTextToken(token) {
|
|
41341
|
-
return unescapeText(withoutQuotes(token.value));
|
|
41342
|
-
}
|
|
41343
|
-
static keyFromLocalizableTextLiteral(node) {
|
|
41344
|
-
let result;
|
|
41345
|
-
if (node.code !== void 0) {
|
|
41346
|
-
result = parseIntegerLiteral(node.code.value);
|
|
41347
|
-
} else {
|
|
41348
|
-
result = this.keyFromTextToken(node.text);
|
|
41349
|
-
}
|
|
41350
|
-
return result;
|
|
41351
|
-
}
|
|
41352
|
-
static keyFromLocalizableTextTemplateLiteral(node) {
|
|
41353
|
-
let result;
|
|
41354
|
-
if (node.code !== void 0) {
|
|
41355
|
-
result = parseIntegerLiteral(node.code.value);
|
|
41356
|
-
} else {
|
|
41357
|
-
const fragments = [unescapeText(withoutTemplateQuotes(node.head.value))];
|
|
41358
|
-
node.spanList.spans.forEach((x) => fragments.push(unescapeText(withoutTemplateQuotes(x.text.value))));
|
|
41359
|
-
result = fragments.join("_");
|
|
41360
|
-
}
|
|
41361
|
-
return result;
|
|
41362
|
-
}
|
|
41363
|
-
static keyFromTextTranslationSource(node) {
|
|
41364
|
-
let result;
|
|
41365
|
-
if (node.code !== void 0) {
|
|
41366
|
-
result = parseIntegerLiteral(node.code.value);
|
|
41367
|
-
} else {
|
|
41368
|
-
switch (node.kind) {
|
|
41369
|
-
case 142 /* TranslationTextLiteral */: {
|
|
41370
|
-
result = this.keyFromTextToken(node.text);
|
|
41371
|
-
break;
|
|
41372
|
-
}
|
|
41373
|
-
case 143 /* TranslationTextTemplate */: {
|
|
41374
|
-
const fragments = [unescapeText(withoutTemplateQuotes(node.head.value))];
|
|
41375
|
-
node.spanList.spans.forEach((x) => fragments.push(unescapeText(withoutTemplateQuotes(x.text.value))));
|
|
41376
|
-
result = fragments.join("_");
|
|
41377
|
-
break;
|
|
41378
|
-
}
|
|
41379
|
-
default:
|
|
41380
|
-
Debug.never(node);
|
|
41381
|
-
}
|
|
41382
|
-
}
|
|
41383
|
-
return result;
|
|
41384
|
-
}
|
|
41385
|
-
};
|
|
41386
|
-
|
|
41387
41839
|
// source/analysis/Analyzer.ts
|
|
41388
41840
|
var Analyzer12 = class {
|
|
41389
41841
|
constructor(compilation, tsInteropInputs) {
|
|
@@ -41404,7 +41856,6 @@ var Analyzer12 = class {
|
|
|
41404
41856
|
this.prefixUnaryExpressionOperatorResolutionResults = /* @__PURE__ */ new Map();
|
|
41405
41857
|
this.binaryExpressionUserDefinableOperatorResolutionResults = /* @__PURE__ */ new Map();
|
|
41406
41858
|
this.assignmentStatementOperatorResolutionResults = /* @__PURE__ */ new Map();
|
|
41407
|
-
this.parametersOfFunctionBlockLiterals = /* @__PURE__ */ new Map();
|
|
41408
41859
|
this.extendedTypes = /* @__PURE__ */ new Map();
|
|
41409
41860
|
this.analyzedTranslationPackages = /* @__PURE__ */ new Map();
|
|
41410
41861
|
this.analyzedTextTranslationPackages = /* @__PURE__ */ new Map();
|
|
@@ -41481,7 +41932,7 @@ var Analyzer12 = class {
|
|
|
41481
41932
|
Debug.assert(type.kind === "structured");
|
|
41482
41933
|
implementedEnumerableAspect = type;
|
|
41483
41934
|
} else {
|
|
41484
|
-
implementedEnumerableAspect = Query.from(this.
|
|
41935
|
+
implementedEnumerableAspect = Query.from(this.allAspectsOfType(type)).first((t) => t.getEntity().getOriginalEntity() === enumerableEntity);
|
|
41485
41936
|
}
|
|
41486
41937
|
if (implementedEnumerableAspect !== void 0) {
|
|
41487
41938
|
const parameter = enumerableEntity.getTypeParameters()[0];
|
|
@@ -41627,12 +42078,27 @@ var Analyzer12 = class {
|
|
|
41627
42078
|
checkBlockCallsAsyncMethods(node) {
|
|
41628
42079
|
let result = false;
|
|
41629
42080
|
const visitor = (node2) => {
|
|
42081
|
+
if (result) {
|
|
42082
|
+
return;
|
|
42083
|
+
}
|
|
41630
42084
|
switch (node2.kind) {
|
|
41631
42085
|
case 68 /* CallExpression */: {
|
|
41632
42086
|
const meaning = this.resolveCallExpression(node2).meaning;
|
|
41633
|
-
|
|
41634
|
-
|
|
41635
|
-
|
|
42087
|
+
switch (meaning.kind) {
|
|
42088
|
+
case "function-call":
|
|
42089
|
+
result = meaning.singleFunction?.getEntity().isAsync() === true;
|
|
42090
|
+
break;
|
|
42091
|
+
case "object-function-call":
|
|
42092
|
+
result = meaning.type.isAsync();
|
|
42093
|
+
break;
|
|
42094
|
+
case "operator-call":
|
|
42095
|
+
case "unresolved":
|
|
42096
|
+
case "constructor-call":
|
|
42097
|
+
break;
|
|
42098
|
+
default:
|
|
42099
|
+
Debug.never(meaning);
|
|
42100
|
+
}
|
|
42101
|
+
if (!result) {
|
|
41636
42102
|
visitChildren(node2, false, visitor);
|
|
41637
42103
|
}
|
|
41638
42104
|
break;
|
|
@@ -41768,7 +42234,7 @@ var Analyzer12 = class {
|
|
|
41768
42234
|
}
|
|
41769
42235
|
return result;
|
|
41770
42236
|
}
|
|
41771
|
-
*
|
|
42237
|
+
*getPackageImportsOfDirective(packageImportDirectives) {
|
|
41772
42238
|
for (const d of packageImportDirectives) {
|
|
41773
42239
|
switch (d.kind) {
|
|
41774
42240
|
case 6 /* PackageGroupImportDirective */:
|
|
@@ -42273,7 +42739,7 @@ var Analyzer12 = class {
|
|
|
42273
42739
|
}
|
|
42274
42740
|
return result;
|
|
42275
42741
|
}
|
|
42276
|
-
*
|
|
42742
|
+
*allAspectsOfType(type) {
|
|
42277
42743
|
type = unaliasType(type);
|
|
42278
42744
|
if (type.kind === "structured") {
|
|
42279
42745
|
const enumeratedAspects = /* @__PURE__ */ new Set();
|
|
@@ -42298,7 +42764,7 @@ var Analyzer12 = class {
|
|
|
42298
42764
|
if (type.kind !== "structured") {
|
|
42299
42765
|
return false;
|
|
42300
42766
|
}
|
|
42301
|
-
return Query.any(this.
|
|
42767
|
+
return Query.any(this.allAspectsOfType(type), (a) => a.getEntity().getOriginalEntity() === aspectEntity.getOriginalEntity());
|
|
42302
42768
|
}
|
|
42303
42769
|
resolvePrefixUnaryExpressionUserDefinableOperator(node) {
|
|
42304
42770
|
let result = this.prefixUnaryExpressionOperatorResolutionResults.get(node);
|
|
@@ -42580,26 +43046,6 @@ var Analyzer12 = class {
|
|
|
42580
43046
|
getDefaultTypeParameterConstraint(locale) {
|
|
42581
43047
|
return this.includeNullToType(this.getLocalizedStandardTypes(locale).refObject, locale);
|
|
42582
43048
|
}
|
|
42583
|
-
getFunctionBlockLiteralParameters(node) {
|
|
42584
|
-
let result = this.parametersOfFunctionBlockLiterals.get(node);
|
|
42585
|
-
if (result === void 0) {
|
|
42586
|
-
const type = this.type.ofFunctionBlockLiteral(node);
|
|
42587
|
-
result = this.parametersOfFunctionBlockLiterals.get(node);
|
|
42588
|
-
if (result === void 0) {
|
|
42589
|
-
const packageEntity2 = TreeQuery.getPackageEntity(node, this);
|
|
42590
|
-
result = type.getParameters().map((p) => new IntrinsicParameterEntity(
|
|
42591
|
-
p.getEntity().getName(),
|
|
42592
|
-
p.getType(),
|
|
42593
|
-
packageEntity2,
|
|
42594
|
-
p.isOptional(),
|
|
42595
|
-
p.isVariadic(),
|
|
42596
|
-
new ImplicitFunctionBlockParameterSpecialVariableEntityInfo(p, node)
|
|
42597
|
-
));
|
|
42598
|
-
this.parametersOfFunctionBlockLiterals.set(node, result);
|
|
42599
|
-
}
|
|
42600
|
-
}
|
|
42601
|
-
return result;
|
|
42602
|
-
}
|
|
42603
43049
|
getExtendedType(node) {
|
|
42604
43050
|
let result = this.extendedTypes.get(node);
|
|
42605
43051
|
if (result === void 0) {
|
|
@@ -42841,39 +43287,39 @@ var Analyzer12 = class {
|
|
|
42841
43287
|
return void 0;
|
|
42842
43288
|
}
|
|
42843
43289
|
}
|
|
42844
|
-
collectDeclarationsUsageOfPackages(targetPlatform,
|
|
43290
|
+
collectDeclarationsUsageOfPackages(targetPlatform, taskController) {
|
|
42845
43291
|
return __async(this, null, function* () {
|
|
42846
43292
|
const result = /* @__PURE__ */ new Map();
|
|
42847
43293
|
const packageGraph = new SourcePackageDependencyGraph(this);
|
|
42848
|
-
for (const pkg2 of packageGraph.
|
|
43294
|
+
for (const pkg2 of packageGraph.packagesForTargetPlatform(targetPlatform)) {
|
|
42849
43295
|
for (const sourceFile of pkg2.sourceFiles) {
|
|
42850
43296
|
const sourceFileNode = sourceFile.getSyntaxNode();
|
|
42851
|
-
const usageCountResult = yield this.getDeclarationsUsageOfSourceFile(sourceFileNode,
|
|
43297
|
+
const usageCountResult = yield this.getDeclarationsUsageOfSourceFile(sourceFileNode, taskController);
|
|
42852
43298
|
result.set(sourceFileNode, usageCountResult);
|
|
42853
43299
|
}
|
|
42854
43300
|
}
|
|
42855
43301
|
return result;
|
|
42856
43302
|
});
|
|
42857
43303
|
}
|
|
42858
|
-
getDeclarationsUsageOfSourceFile(sourceFile,
|
|
43304
|
+
getDeclarationsUsageOfSourceFile(sourceFile, taskController) {
|
|
42859
43305
|
return __async(this, null, function* () {
|
|
42860
43306
|
let result = this.namedDeclarationsUsageCountResults.get(sourceFile);
|
|
42861
43307
|
if (result === void 0) {
|
|
42862
43308
|
const counter = new DeclarationsUsageCounter(this, sourceFile);
|
|
42863
|
-
result = yield counter.count(
|
|
43309
|
+
result = yield counter.count(taskController);
|
|
42864
43310
|
this.namedDeclarationsUsageCountResults.set(sourceFile, result);
|
|
42865
43311
|
}
|
|
42866
43312
|
return result;
|
|
42867
43313
|
});
|
|
42868
43314
|
}
|
|
42869
|
-
getPackageAndStaticVariablesInitializationDiagnostics(pkg2,
|
|
43315
|
+
getPackageAndStaticVariablesInitializationDiagnostics(pkg2, taskController) {
|
|
42870
43316
|
return __async(this, null, function* () {
|
|
42871
43317
|
let result = this.packageAndStaticVariablesInitializationDiagnostics.get(pkg2);
|
|
42872
43318
|
if (result === void 0) {
|
|
42873
43319
|
const usageCountResults = new Array();
|
|
42874
43320
|
for (const sourceFile of pkg2.sourceFiles) {
|
|
42875
43321
|
const sourceFileNode = sourceFile.getSyntaxNode();
|
|
42876
|
-
const usageCountResult = yield this.getDeclarationsUsageOfSourceFile(sourceFileNode,
|
|
43322
|
+
const usageCountResult = yield this.getDeclarationsUsageOfSourceFile(sourceFileNode, taskController);
|
|
42877
43323
|
usageCountResults.push(usageCountResult);
|
|
42878
43324
|
}
|
|
42879
43325
|
const diagnostics = new AccumulatingDiagnosticAcceptor();
|
|
@@ -43243,11 +43689,12 @@ var Analyzer12 = class {
|
|
|
43243
43689
|
};
|
|
43244
43690
|
});
|
|
43245
43691
|
}
|
|
43246
|
-
|
|
43247
|
-
|
|
43248
|
-
|
|
43249
|
-
|
|
43250
|
-
|
|
43692
|
+
accumulateSourceFileDiagnosticsComputedLazily(sourceFile, diagnostics) {
|
|
43693
|
+
for (const diagnostic of this.diagnosticsComputedLazily) {
|
|
43694
|
+
if (diagnostic.location?.file === sourceFile) {
|
|
43695
|
+
diagnostics.addDiagnostic(diagnostic);
|
|
43696
|
+
}
|
|
43697
|
+
}
|
|
43251
43698
|
}
|
|
43252
43699
|
validateSourcePackageMemberConflicts(pkg2) {
|
|
43253
43700
|
let result = this.sourcePackageMemberConflictsDiagnostics.get(pkg2);
|
|
@@ -43539,7 +43986,18 @@ var Analyzer12 = class {
|
|
|
43539
43986
|
if (definition.kind !== 0 /* Source */) {
|
|
43540
43987
|
return void 0;
|
|
43541
43988
|
}
|
|
43542
|
-
|
|
43989
|
+
switch (definition.node.kind) {
|
|
43990
|
+
case 25 /* PackageFunctionDeclaration */:
|
|
43991
|
+
case 50 /* MethodDeclaration */:
|
|
43992
|
+
case 56 /* NestedFunctionDeclaration */:
|
|
43993
|
+
return this.getNodeDiagnosticLocation(definition.node.name);
|
|
43994
|
+
case 65 /* FunctionLiteral */:
|
|
43995
|
+
return this.getNodeDiagnosticLocation(definition.node.functionKeyword);
|
|
43996
|
+
case 66 /* FunctionBlockLiteral */:
|
|
43997
|
+
return this.getNodeDiagnosticLocation(definition.node.block.openBraceToken);
|
|
43998
|
+
default:
|
|
43999
|
+
Debug.never(definition.node);
|
|
44000
|
+
}
|
|
43543
44001
|
}
|
|
43544
44002
|
case 2 /* Type */: {
|
|
43545
44003
|
const definition = entity.getDefinition();
|
|
@@ -44012,16 +44470,6 @@ var Type4 = class {
|
|
|
44012
44470
|
ofAccessedOperator(operator) {
|
|
44013
44471
|
return operator.getSignatureType();
|
|
44014
44472
|
}
|
|
44015
|
-
ofRegularOrBlockFunctionLiteral(node, analysisOptions) {
|
|
44016
|
-
switch (node.kind) {
|
|
44017
|
-
case 65 /* FunctionLiteral */:
|
|
44018
|
-
return this.ofFunctionLiteral(node, analysisOptions);
|
|
44019
|
-
case 66 /* FunctionBlockLiteral */:
|
|
44020
|
-
return this.ofFunctionBlockLiteral(node, analysisOptions);
|
|
44021
|
-
default:
|
|
44022
|
-
Debug.never(node);
|
|
44023
|
-
}
|
|
44024
|
-
}
|
|
44025
44473
|
ofFunctionBlockLiteral(node, analysisOptions) {
|
|
44026
44474
|
let result;
|
|
44027
44475
|
const allowCachingAndInferring = analysisOptions?.allowCaching !== false;
|
|
@@ -44029,16 +44477,7 @@ var Type4 = class {
|
|
|
44029
44477
|
result = this.functionLiteralTypes.get(node);
|
|
44030
44478
|
}
|
|
44031
44479
|
if (result === void 0) {
|
|
44032
|
-
|
|
44033
|
-
const targetFunctionType = this.analyzer.getUnambiguousTargetFunctionType(targetType);
|
|
44034
|
-
const allowReportingDiagnostics = analysisOptions?.isResolvingOverload === true;
|
|
44035
|
-
result = this.createFunctionBlockLiteralType(
|
|
44036
|
-
node,
|
|
44037
|
-
targetFunctionType,
|
|
44038
|
-
void 0,
|
|
44039
|
-
allowCachingAndInferring,
|
|
44040
|
-
allowReportingDiagnostics
|
|
44041
|
-
);
|
|
44480
|
+
result = this.ofRegularOrBlockFunctionLiteral(node, analysisOptions);
|
|
44042
44481
|
if (allowCachingAndInferring) {
|
|
44043
44482
|
this.functionLiteralTypes.set(node, result);
|
|
44044
44483
|
}
|
|
@@ -44052,22 +44491,71 @@ var Type4 = class {
|
|
|
44052
44491
|
result = this.functionLiteralTypes.get(node);
|
|
44053
44492
|
}
|
|
44054
44493
|
if (result === void 0) {
|
|
44055
|
-
|
|
44056
|
-
const targetFunctionType = this.analyzer.getUnambiguousTargetFunctionType(targetType);
|
|
44057
|
-
const allowReportingDiagnostics = analysisOptions?.isResolvingOverload === true;
|
|
44058
|
-
result = this.createFunctionLiteralType(
|
|
44059
|
-
node,
|
|
44060
|
-
targetFunctionType,
|
|
44061
|
-
void 0,
|
|
44062
|
-
allowCachingAndInferring,
|
|
44063
|
-
allowReportingDiagnostics
|
|
44064
|
-
);
|
|
44494
|
+
result = this.ofRegularOrBlockFunctionLiteral(node, analysisOptions);
|
|
44065
44495
|
if (allowCachingAndInferring) {
|
|
44066
44496
|
this.functionLiteralTypes.set(node, result);
|
|
44067
44497
|
}
|
|
44068
44498
|
}
|
|
44069
44499
|
return result;
|
|
44070
44500
|
}
|
|
44501
|
+
ofRegularOrBlockFunctionLiteral(node, analysisOptions) {
|
|
44502
|
+
let entity;
|
|
44503
|
+
switch (node.kind) {
|
|
44504
|
+
case 65 /* FunctionLiteral */:
|
|
44505
|
+
entity = this.analyzer.entity.ofFunctionLiteralInternal(node);
|
|
44506
|
+
break;
|
|
44507
|
+
case 66 /* FunctionBlockLiteral */:
|
|
44508
|
+
entity = this.analyzer.entity.ofFunctionBlockLiteralInternal(node);
|
|
44509
|
+
break;
|
|
44510
|
+
default:
|
|
44511
|
+
Debug.never(node);
|
|
44512
|
+
}
|
|
44513
|
+
if (entity.isInferringReturnType || entity.isInferringReturnType) {
|
|
44514
|
+
const diagnostic = this.analyzer.createNodeDiagnostic(
|
|
44515
|
+
303 /* RecursionOccurredWhileCalculatingTheTypeOfTheExpression */,
|
|
44516
|
+
node
|
|
44517
|
+
);
|
|
44518
|
+
this.analyzer.addDiagnosticComputedLazily(diagnostic);
|
|
44519
|
+
return this.analyzer.originalStandardTypes.unresolved;
|
|
44520
|
+
}
|
|
44521
|
+
const targetType = this.analyzer.getTargetTypeOfExpression(node, analysisOptions);
|
|
44522
|
+
const targetFunctionType = this.analyzer.getUnambiguousTargetFunctionType(targetType);
|
|
44523
|
+
const allowCachingAndInferring = analysisOptions?.allowCaching !== false;
|
|
44524
|
+
let result;
|
|
44525
|
+
if (allowCachingAndInferring) {
|
|
44526
|
+
entity.setTargetFunctionType(targetFunctionType);
|
|
44527
|
+
result = this.createFunctionTypeOfFunctionEntity(entity);
|
|
44528
|
+
} else if (!entity.dependsOnTargetType()) {
|
|
44529
|
+
result = this.createFunctionTypeOfFunctionEntity(entity);
|
|
44530
|
+
} else {
|
|
44531
|
+
const allowReportingDiagnostics = analysisOptions?.isResolvingOverload === true;
|
|
44532
|
+
if (allowReportingDiagnostics) {
|
|
44533
|
+
this.reportReturnTypeCanNotBeInferredDiagnostic(node);
|
|
44534
|
+
}
|
|
44535
|
+
result = this.analyzer.originalStandardTypes.unresolved;
|
|
44536
|
+
}
|
|
44537
|
+
return result;
|
|
44538
|
+
}
|
|
44539
|
+
createFunctionTypeOfFunctionEntity(entity) {
|
|
44540
|
+
const unfinishedFunctionTypeEntity = new UnfinishedIntrinsicAnonymousFunctionTypeEntity(
|
|
44541
|
+
this.analyzer,
|
|
44542
|
+
entity.getReturnType(),
|
|
44543
|
+
entity.isAsync(),
|
|
44544
|
+
entity.getContainingPackage(),
|
|
44545
|
+
void 0,
|
|
44546
|
+
void 0
|
|
44547
|
+
);
|
|
44548
|
+
const parameters = entity.getParameters().map((p) => new IntrinsicParameterEntity(
|
|
44549
|
+
p.getName(),
|
|
44550
|
+
p.getType(),
|
|
44551
|
+
unfinishedFunctionTypeEntity.unfinishedValue,
|
|
44552
|
+
p.isOptional(),
|
|
44553
|
+
p.isVariadic(),
|
|
44554
|
+
void 0
|
|
44555
|
+
));
|
|
44556
|
+
const functionTypeEntity = unfinishedFunctionTypeEntity.finish(emptyTypeParameterEntities, parameters);
|
|
44557
|
+
return this.analyzer.typeFactory.getFunctionType(functionTypeEntity, Substitutions.empty());
|
|
44558
|
+
}
|
|
44071
44559
|
ofArrayLiteral(node, analysisOptions) {
|
|
44072
44560
|
const targetType = this.analyzer.getTargetTypeOfExpression(node, analysisOptions);
|
|
44073
44561
|
const targetArrayType = this.analyzer.getUnambiguousTargetArrayType(targetType);
|
|
@@ -44506,142 +44994,6 @@ var Type4 = class {
|
|
|
44506
44994
|
ofInvalidTypeSpecifier(_node) {
|
|
44507
44995
|
return this.analyzer.originalStandardTypes.unresolved;
|
|
44508
44996
|
}
|
|
44509
|
-
createFunctionLiteralType(node, targetType, returnTypeOverride, allowInferringReturnType, allowReportingDiagnostics) {
|
|
44510
|
-
const isAsync = node.asyncKeyword !== void 0 || targetType?.isAsync() === true;
|
|
44511
|
-
let returnType;
|
|
44512
|
-
if (returnTypeOverride !== void 0) {
|
|
44513
|
-
returnType = returnTypeOverride;
|
|
44514
|
-
} else if (node.returnTypeAnnotation !== void 0) {
|
|
44515
|
-
returnType = this.analyzer.type.ofTypeSpecifier(node.returnTypeAnnotation.typeSpecifier);
|
|
44516
|
-
} else if (allowInferringReturnType) {
|
|
44517
|
-
returnType = this.inferAndCacheReturnTypeOfRegularOrBlockFunctionLiteral(node, targetType);
|
|
44518
|
-
} else {
|
|
44519
|
-
if (allowReportingDiagnostics) {
|
|
44520
|
-
this.reportReturnTypeCanNotBeInferredDiagnostic(node);
|
|
44521
|
-
}
|
|
44522
|
-
returnType = this.analyzer.getLocalizedStandardTypes(node.locale).nullType;
|
|
44523
|
-
}
|
|
44524
|
-
const semanticContext = this.analyzer.semanticContext.containing(node);
|
|
44525
|
-
const unfinishedEntity = new UnfinishedIntrinsicAnonymousFunctionTypeEntity(
|
|
44526
|
-
this.analyzer,
|
|
44527
|
-
returnType,
|
|
44528
|
-
isAsync,
|
|
44529
|
-
semanticContext.getContainingPackage(),
|
|
44530
|
-
void 0,
|
|
44531
|
-
EntityContext.fromSemanticContext(semanticContext)
|
|
44532
|
-
);
|
|
44533
|
-
const targetTypeParameters = targetType?.getParameters();
|
|
44534
|
-
const parameters = node.parameterClause.parameterList.parameters.map((p, i) => {
|
|
44535
|
-
const name = this.analyzer.createNameFromIdentifier(p.name);
|
|
44536
|
-
let type;
|
|
44537
|
-
if (p.typeAnnotation !== void 0) {
|
|
44538
|
-
type = this.analyzer.type.ofTypeSpecifier(p.typeAnnotation.typeSpecifier);
|
|
44539
|
-
} else if (targetTypeParameters !== void 0 && i < targetTypeParameters.length) {
|
|
44540
|
-
type = targetTypeParameters[i].getType();
|
|
44541
|
-
} else {
|
|
44542
|
-
type = this.analyzer.originalStandardTypes.unresolved;
|
|
44543
|
-
}
|
|
44544
|
-
return new IntrinsicParameterEntity(
|
|
44545
|
-
name,
|
|
44546
|
-
type,
|
|
44547
|
-
unfinishedEntity.unfinishedValue,
|
|
44548
|
-
p.defaultValue !== void 0,
|
|
44549
|
-
false,
|
|
44550
|
-
void 0
|
|
44551
|
-
);
|
|
44552
|
-
}).toArray();
|
|
44553
|
-
const entity = unfinishedEntity.finish([], parameters);
|
|
44554
|
-
return this.analyzer.typeFactory.getFunctionType(entity, Substitutions.empty());
|
|
44555
|
-
}
|
|
44556
|
-
createFunctionBlockLiteralType(node, targetType, returnTypeOverride, allowInferringReturnType, allowReportingDiagnostics) {
|
|
44557
|
-
let returnType;
|
|
44558
|
-
if (returnTypeOverride !== void 0) {
|
|
44559
|
-
returnType = returnTypeOverride;
|
|
44560
|
-
} else if (node.block.expressionOrStatementList.kind !== 93 /* StatementList */ && targetType !== void 0 && targetType.getReturnType().isNullType) {
|
|
44561
|
-
returnType = targetType.getReturnType();
|
|
44562
|
-
} else if (allowInferringReturnType) {
|
|
44563
|
-
returnType = this.inferAndCacheReturnTypeOfRegularOrBlockFunctionLiteral(node, targetType);
|
|
44564
|
-
} else {
|
|
44565
|
-
if (allowReportingDiagnostics) {
|
|
44566
|
-
this.reportReturnTypeCanNotBeInferredDiagnostic(node);
|
|
44567
|
-
}
|
|
44568
|
-
returnType = this.analyzer.getLocalizedStandardTypes(node.locale).nullType;
|
|
44569
|
-
}
|
|
44570
|
-
const semanticContext = this.analyzer.semanticContext.containing(node);
|
|
44571
|
-
const unfinishedEntity = new UnfinishedIntrinsicAnonymousFunctionTypeEntity(
|
|
44572
|
-
this.analyzer,
|
|
44573
|
-
returnType,
|
|
44574
|
-
false,
|
|
44575
|
-
semanticContext.getContainingPackage(),
|
|
44576
|
-
void 0,
|
|
44577
|
-
EntityContext.fromSemanticContext(semanticContext)
|
|
44578
|
-
);
|
|
44579
|
-
const parameters = targetType?.getParameters().map((p) => new IntrinsicParameterEntity(
|
|
44580
|
-
p.getName(),
|
|
44581
|
-
p.getType(),
|
|
44582
|
-
unfinishedEntity.unfinishedValue,
|
|
44583
|
-
p.isOptional(),
|
|
44584
|
-
p.isVariadic(),
|
|
44585
|
-
void 0
|
|
44586
|
-
)) ?? [];
|
|
44587
|
-
const entity = unfinishedEntity.finish([], parameters);
|
|
44588
|
-
return this.analyzer.typeFactory.getFunctionType(entity, Substitutions.empty());
|
|
44589
|
-
}
|
|
44590
|
-
inferAndCacheReturnTypeOfRegularOrBlockFunctionLiteral(node, targetFunctionType) {
|
|
44591
|
-
const cachedType = this.functionLiteralTypes.get(node);
|
|
44592
|
-
if (cachedType !== void 0) {
|
|
44593
|
-
return cachedType.getReturnType();
|
|
44594
|
-
}
|
|
44595
|
-
let typeForReturnTypeInference;
|
|
44596
|
-
const locale = node.locale;
|
|
44597
|
-
const standardTypes = this.analyzer.getLocalizedStandardTypes(locale);
|
|
44598
|
-
const returnTypeDuringInference = this.analyzer.includeNullToType(standardTypes.refObject, locale);
|
|
44599
|
-
if (node.kind === 65 /* FunctionLiteral */) {
|
|
44600
|
-
typeForReturnTypeInference = this.createFunctionLiteralType(
|
|
44601
|
-
node,
|
|
44602
|
-
targetFunctionType,
|
|
44603
|
-
returnTypeDuringInference,
|
|
44604
|
-
false,
|
|
44605
|
-
false
|
|
44606
|
-
);
|
|
44607
|
-
} else {
|
|
44608
|
-
typeForReturnTypeInference = this.createFunctionBlockLiteralType(
|
|
44609
|
-
node,
|
|
44610
|
-
targetFunctionType,
|
|
44611
|
-
returnTypeDuringInference,
|
|
44612
|
-
false,
|
|
44613
|
-
false
|
|
44614
|
-
);
|
|
44615
|
-
}
|
|
44616
|
-
this.functionLiteralTypes.set(node, typeForReturnTypeInference);
|
|
44617
|
-
const resultVariable = node.kind === 65 /* FunctionLiteral */ ? this.analyzer.resultLocalVariableEntity.ofFunctionLiteral(node) : this.analyzer.resultLocalVariableEntity.ofFunctionBlockLiteral(node);
|
|
44618
|
-
const inferrer = new ReturnTypeInferrer(this.analyzer, node.block, resultVariable);
|
|
44619
|
-
const returnType = inferrer.infer();
|
|
44620
|
-
const typeWithInferredReturnType = this.replaceReturnTypeOfFunctionType(typeForReturnTypeInference, returnType);
|
|
44621
|
-
this.functionLiteralTypes.set(node, typeWithInferredReturnType);
|
|
44622
|
-
return returnType;
|
|
44623
|
-
}
|
|
44624
|
-
replaceReturnTypeOfFunctionType(type, returnType) {
|
|
44625
|
-
const templateTypeEntity = type.getEntity();
|
|
44626
|
-
const unfinishedEntity = new UnfinishedIntrinsicAnonymousFunctionTypeEntity(
|
|
44627
|
-
this.analyzer,
|
|
44628
|
-
returnType,
|
|
44629
|
-
templateTypeEntity.isAsync(),
|
|
44630
|
-
templateTypeEntity.getContainingPackage(),
|
|
44631
|
-
void 0,
|
|
44632
|
-
templateTypeEntity.getContext()
|
|
44633
|
-
);
|
|
44634
|
-
const parameters = type.getParameters().map((p) => new IntrinsicParameterEntity(
|
|
44635
|
-
p.getName(),
|
|
44636
|
-
p.getType(),
|
|
44637
|
-
unfinishedEntity.unfinishedValue,
|
|
44638
|
-
p.isOptional(),
|
|
44639
|
-
p.isVariadic(),
|
|
44640
|
-
p.getEntity().isSpecial()
|
|
44641
|
-
));
|
|
44642
|
-
const entity = unfinishedEntity.finish([], parameters);
|
|
44643
|
-
return this.analyzer.typeFactory.getFunctionType(entity, Substitutions.empty());
|
|
44644
|
-
}
|
|
44645
44997
|
reportReturnTypeCanNotBeInferredDiagnostic(node) {
|
|
44646
44998
|
if (!this.nodesForWhichReturnTypeInferenceDiagnosticHasBeenReported.has(node)) {
|
|
44647
44999
|
const nodeForDiagnostic = node.kind === 65 /* FunctionLiteral */ ? node.functionKeyword : node.block.openBraceToken;
|
|
@@ -45008,7 +45360,7 @@ var ReturnType = class {
|
|
|
45008
45360
|
return this.analyzer.entity.ofAnonymousFunctionTypeDeclaration(node).getReturnType();
|
|
45009
45361
|
}
|
|
45010
45362
|
ofFunctionBlockLiteral(node) {
|
|
45011
|
-
return this.analyzer.
|
|
45363
|
+
return this.analyzer.entity.ofFunctionBlockLiteral(node).getReturnType();
|
|
45012
45364
|
}
|
|
45013
45365
|
ofPackageFunctionDeclaration(node) {
|
|
45014
45366
|
return this.analyzer.entity.ofPackageFunctionDeclaration(node).getReturnType();
|
|
@@ -45020,7 +45372,7 @@ var ReturnType = class {
|
|
|
45020
45372
|
return this.analyzer.entity.ofNestedFunctionDeclaration(node).getReturnType();
|
|
45021
45373
|
}
|
|
45022
45374
|
ofFunctionLiteral(node) {
|
|
45023
|
-
return this.analyzer.
|
|
45375
|
+
return this.analyzer.entity.ofFunctionLiteral(node).getReturnType();
|
|
45024
45376
|
}
|
|
45025
45377
|
ofMethodDeclaration(node) {
|
|
45026
45378
|
return this.analyzer.entity.ofMethodDeclaration(node).getReturnType();
|
|
@@ -45086,6 +45438,8 @@ var Entity4 = class {
|
|
|
45086
45438
|
this.packageAliasEntities = /* @__PURE__ */ new Map();
|
|
45087
45439
|
this.translationTextTemplateParameterEntities = /* @__PURE__ */ new Map();
|
|
45088
45440
|
this.textTranslationDeclarationEntities = /* @__PURE__ */ new Map();
|
|
45441
|
+
this.functionLiteralEntities = /* @__PURE__ */ new Map();
|
|
45442
|
+
this.functionBlockLiteralEntities = /* @__PURE__ */ new Map();
|
|
45089
45443
|
}
|
|
45090
45444
|
ofPackage(pkg2) {
|
|
45091
45445
|
let result = this.packageEntities.get(pkg2);
|
|
@@ -45181,8 +45535,7 @@ var Entity4 = class {
|
|
|
45181
45535
|
if (result === void 0) {
|
|
45182
45536
|
const owner = node.parent.parent.parent;
|
|
45183
45537
|
if (owner.kind === 65 /* FunctionLiteral */) {
|
|
45184
|
-
result =
|
|
45185
|
-
this.parameterEntities.set(node, result);
|
|
45538
|
+
result = this.ofFunctionLiteralParameterDeclarationInternal(node, owner);
|
|
45186
45539
|
} else if (owner.kind === 45 /* IndexedElementGetterDeclaration */ || owner.kind === 46 /* IndexedElementSetterDeclaration */) {
|
|
45187
45540
|
const memberBlock = TypeMemberQuery.getOutermostMemberBlock(owner);
|
|
45188
45541
|
this.createIndexerAndParameterEntities(memberBlock);
|
|
@@ -45529,6 +45882,47 @@ var Entity4 = class {
|
|
|
45529
45882
|
}
|
|
45530
45883
|
return result;
|
|
45531
45884
|
}
|
|
45885
|
+
ofFunctionLiteral(node) {
|
|
45886
|
+
return this.ofFunctionLiteralInternal(node);
|
|
45887
|
+
}
|
|
45888
|
+
ofFunctionBlockLiteral(node) {
|
|
45889
|
+
return this.ofFunctionBlockLiteralInternal(node);
|
|
45890
|
+
}
|
|
45891
|
+
ofRegularOrBlockFunctionLiteral(node) {
|
|
45892
|
+
switch (node.kind) {
|
|
45893
|
+
case 65 /* FunctionLiteral */:
|
|
45894
|
+
return this.ofFunctionLiteral(node);
|
|
45895
|
+
case 66 /* FunctionBlockLiteral */:
|
|
45896
|
+
return this.ofFunctionBlockLiteral(node);
|
|
45897
|
+
default:
|
|
45898
|
+
Debug.never(node);
|
|
45899
|
+
}
|
|
45900
|
+
}
|
|
45901
|
+
ofFunctionLiteralInternal(node) {
|
|
45902
|
+
let result = this.functionLiteralEntities.get(node);
|
|
45903
|
+
if (result === void 0) {
|
|
45904
|
+
result = new FunctionLiteralEntity(this.analyzer, node);
|
|
45905
|
+
this.functionLiteralEntities.set(node, result);
|
|
45906
|
+
}
|
|
45907
|
+
return result;
|
|
45908
|
+
}
|
|
45909
|
+
ofFunctionBlockLiteralInternal(node) {
|
|
45910
|
+
let result = this.functionBlockLiteralEntities.get(node);
|
|
45911
|
+
if (result === void 0) {
|
|
45912
|
+
result = new FunctionBlockLiteralEntity(this.analyzer, node);
|
|
45913
|
+
this.functionBlockLiteralEntities.set(node, result);
|
|
45914
|
+
}
|
|
45915
|
+
return result;
|
|
45916
|
+
}
|
|
45917
|
+
ofFunctionLiteralParameterDeclarationInternal(node, literal) {
|
|
45918
|
+
let result = this.parameterEntities.get(node);
|
|
45919
|
+
if (result === void 0) {
|
|
45920
|
+
result = new FunctionLiteralParameterDeclarationEntity(this.analyzer, node, literal);
|
|
45921
|
+
this.parameterEntities.set(node, result);
|
|
45922
|
+
}
|
|
45923
|
+
Debug.assert(result instanceof FunctionLiteralParameterDeclarationEntity);
|
|
45924
|
+
return result;
|
|
45925
|
+
}
|
|
45532
45926
|
getContainingPackageLoadedFromDts(node) {
|
|
45533
45927
|
const pkg2 = TreeQuery.getSourcePackage(node, this.analyzer);
|
|
45534
45928
|
if (pkg2.kind === "program" && pkg2.configuration.targetPlatform?.kind === "javascript" && pkg2.configuration.targetPlatform.interfacePackageImplementation?.loadFromDts === true) {
|
|
@@ -45935,7 +46329,7 @@ var SourceFileMembersMap = class {
|
|
|
45935
46329
|
if (result === void 0) {
|
|
45936
46330
|
const namedMembers = new Array();
|
|
45937
46331
|
const typeExtensionEntities = new Array();
|
|
45938
|
-
const packageImports = this.analyzer.
|
|
46332
|
+
const packageImports = this.analyzer.getPackageImportsOfDirective(
|
|
45939
46333
|
node.packageImportDirectiveList.packageImportDirectives
|
|
45940
46334
|
);
|
|
45941
46335
|
for (const packageImport of packageImports) {
|
|
@@ -46132,7 +46526,7 @@ var OverriddenMember = class {
|
|
|
46132
46526
|
const shadowedMembers = new Array();
|
|
46133
46527
|
if (this.entityCanOverrideOrShadow(member.getEntity())) {
|
|
46134
46528
|
let overridingMemberType;
|
|
46135
|
-
for (const lookup of this.
|
|
46529
|
+
for (const lookup of this.typeMemberLookups(member.getEntity(), contextualNode)) {
|
|
46136
46530
|
const overriddenOrShadowedMembers = overriddenOrShadowedMemberFinder(member, lookup);
|
|
46137
46531
|
for (const overriddenOrShadowedMember of overriddenOrShadowedMembers) {
|
|
46138
46532
|
if (!isMemberOfCorrectKind(overriddenOrShadowedMember)) {
|
|
@@ -46212,14 +46606,14 @@ var OverriddenMember = class {
|
|
|
46212
46606
|
indexerFromBaseType
|
|
46213
46607
|
);
|
|
46214
46608
|
}
|
|
46215
|
-
*
|
|
46609
|
+
*typeMemberLookups(entity, contextualNode) {
|
|
46216
46610
|
const containingEntity = entity.getContainingEntity();
|
|
46217
46611
|
if (containingEntity.kind !== 2 /* Type */) {
|
|
46218
46612
|
return;
|
|
46219
46613
|
}
|
|
46220
46614
|
const semanticContext = this.analyzer.semanticContext.containing(contextualNode);
|
|
46221
46615
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
|
46222
|
-
for (const type of this.
|
|
46616
|
+
for (const type of this.typesForOverriddenMemberLookup(containingEntity)) {
|
|
46223
46617
|
yield BoundTypeMemberLookup.ofType(
|
|
46224
46618
|
this.analyzer,
|
|
46225
46619
|
type,
|
|
@@ -46230,7 +46624,7 @@ var OverriddenMember = class {
|
|
|
46230
46624
|
);
|
|
46231
46625
|
}
|
|
46232
46626
|
}
|
|
46233
|
-
*
|
|
46627
|
+
*typesForOverriddenMemberLookup(entity) {
|
|
46234
46628
|
switch (entity.typeEntityKind) {
|
|
46235
46629
|
case 1 /* Structured */: {
|
|
46236
46630
|
const baseObjectType = entity.getBaseObjectType().cycleFree;
|
|
@@ -47244,7 +47638,7 @@ var PackageImports = class {
|
|
|
47244
47638
|
const diagnostics = new Array();
|
|
47245
47639
|
const packageImportInfoByPackageImport = /* @__PURE__ */ new Map();
|
|
47246
47640
|
const packagesImportedWithoutAlias = /* @__PURE__ */ new Set();
|
|
47247
|
-
const packageImports = this.analyzer.
|
|
47641
|
+
const packageImports = this.analyzer.getPackageImportsOfDirective(sourceFile.getSyntaxNode().packageImportDirectiveList.packageImportDirectives);
|
|
47248
47642
|
for (const packageImport of packageImports) {
|
|
47249
47643
|
let isAliasedImport;
|
|
47250
47644
|
if (packageImport.alias !== void 0) {
|
|
@@ -47721,7 +48115,7 @@ var SignatureComparer = class {
|
|
|
47721
48115
|
this.stubParameterTypes = new Array();
|
|
47722
48116
|
}
|
|
47723
48117
|
areEqualFunctionEntities(function1, function2, options) {
|
|
47724
|
-
if ((options & 1 /* CompareNames */) !== 0 && !function1.
|
|
48118
|
+
if ((options & 1 /* CompareNames */) !== 0 && !function1.getNaming().considerEqual(function2.getNaming(), false)) {
|
|
47725
48119
|
return false;
|
|
47726
48120
|
}
|
|
47727
48121
|
const parameters1 = function1.getParameters();
|
|
@@ -49468,8 +49862,8 @@ var TypeMemberConflictsValidator = class {
|
|
|
49468
49862
|
}
|
|
49469
49863
|
};
|
|
49470
49864
|
|
|
49471
|
-
// source/analysis/
|
|
49472
|
-
var
|
|
49865
|
+
// source/analysis/SourceFileAnalyzer.ts
|
|
49866
|
+
var SourceFileAnalyzer = class {
|
|
49473
49867
|
constructor(analyzer, sourceFile) {
|
|
49474
49868
|
this.translationPackage_ = new Cached();
|
|
49475
49869
|
this.textTranslationPackage_ = new Cached();
|
|
@@ -49481,9 +49875,6 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
49481
49875
|
this.diagnosticArgumentFactory = analyzer.semanticContext.ofSourceFile(sourceFile.getSyntaxNode()).getDiagnosticArgumentFactory();
|
|
49482
49876
|
this.modifierValidator = new ModifierValidator(analyzer, this.diagnosticAcceptor);
|
|
49483
49877
|
}
|
|
49484
|
-
static {
|
|
49485
|
-
this.CancellationTokenThrottleTime = 50;
|
|
49486
|
-
}
|
|
49487
49878
|
get translationPackage() {
|
|
49488
49879
|
return this.translationPackage_.getOrInsertWith(() => {
|
|
49489
49880
|
if (this.sourceFile.package.kind === "translation") {
|
|
@@ -49506,44 +49897,48 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
49506
49897
|
get standardTypes() {
|
|
49507
49898
|
return this.standardTypes_.getOrInsertWith(() => this.analyzer.getLocalizedStandardTypes(this.sourceFile.package.locale));
|
|
49508
49899
|
}
|
|
49509
|
-
|
|
49900
|
+
analyze(taskController) {
|
|
49510
49901
|
return __async(this, null, function* () {
|
|
49511
49902
|
this.addDiagnostics(this.sourceFile.parse().diagnostics.map((d) => new Diagnostic(d.data, new DiagnosticLocation(d.range, this.sourceFile))));
|
|
49512
49903
|
PerformanceMeasurement.markStart(1 /* Analyzing */);
|
|
49513
49904
|
const sourceFileNode = this.sourceFile.getSyntaxNode();
|
|
49514
49905
|
this.namedDeclarationsUsageMap = yield this.analyzer.getDeclarationsUsageOfSourceFile(
|
|
49515
49906
|
sourceFileNode,
|
|
49516
|
-
|
|
49907
|
+
taskController
|
|
49517
49908
|
);
|
|
49518
49909
|
if (!this.isInterfacePackageFile) {
|
|
49519
|
-
const variableInitializationDiagnostics = yield this.analyzer.getPackageAndStaticVariablesInitializationDiagnostics(this.sourceFile.package,
|
|
49910
|
+
const variableInitializationDiagnostics = yield this.analyzer.getPackageAndStaticVariablesInitializationDiagnostics(this.sourceFile.package, taskController);
|
|
49520
49911
|
this.addDiagnosticsLocatedInAnalyzedFile(variableInitializationDiagnostics);
|
|
49521
49912
|
}
|
|
49522
49913
|
this.modifierValidator.validateTopLevelPackageMembers(sourceFileNode.declarationList);
|
|
49523
|
-
this.translationPackage?.accumulateDiagnosticsForSourceFile(this.sourceFile, this.diagnosticAcceptor);
|
|
49524
49914
|
if (this.sourceFile.package.kind === "program") {
|
|
49525
|
-
|
|
49526
|
-
|
|
49915
|
+
this.addDiagnosticsLocatedInAnalyzedFile(
|
|
49916
|
+
this.analyzer.validateSourcePackageMemberConflicts(this.sourceFile.package)
|
|
49917
|
+
);
|
|
49918
|
+
}
|
|
49919
|
+
if (this.translationPackage !== void 0) {
|
|
49920
|
+
this.translationPackage.ensureAllLazyDiagnosticsReportedForSourceFile(this.sourceFile);
|
|
49921
|
+
this.translationPackage.accumulateDiagnosticForSourceFile(this.sourceFile, this.diagnosticAcceptor);
|
|
49527
49922
|
}
|
|
49528
49923
|
this.analyzer.getSourceFileMembers(sourceFileNode).validateNameConflicts(this.diagnosticAcceptor);
|
|
49529
49924
|
const packageImportInfos = this.analyzer.packageImports.analyzeExplicitPackageImports(this.sourceFile);
|
|
49530
49925
|
this.addDiagnostics(packageImportInfos.diagnostics);
|
|
49531
|
-
yield
|
|
49926
|
+
yield traverseTree(
|
|
49532
49927
|
sourceFileNode,
|
|
49533
|
-
cancellationToken,
|
|
49534
|
-
_DiagnosticCollector.CancellationTokenThrottleTime,
|
|
49535
49928
|
false,
|
|
49536
|
-
|
|
49929
|
+
taskController,
|
|
49930
|
+
(node, controller) => {
|
|
49931
|
+
return this.analyzeNode(node, controller);
|
|
49932
|
+
}
|
|
49537
49933
|
);
|
|
49538
49934
|
const unreachableCodeDiagnostics = this.analyzer.getControlFlowGraph(this.sourceFile).unreachableCodeDiagnostics;
|
|
49539
49935
|
this.addDiagnostics(unreachableCodeDiagnostics);
|
|
49540
|
-
|
|
49541
|
-
this.addDiagnostics(diagnosticsComputedLazily);
|
|
49936
|
+
this.analyzer.accumulateSourceFileDiagnosticsComputedLazily(this.sourceFile, this.diagnosticAcceptor);
|
|
49542
49937
|
PerformanceMeasurement.markEnd();
|
|
49543
49938
|
return this.diagnostics;
|
|
49544
49939
|
});
|
|
49545
49940
|
}
|
|
49546
|
-
|
|
49941
|
+
analyzeNode(node, controller) {
|
|
49547
49942
|
switch (node.kind) {
|
|
49548
49943
|
case 89 /* IdentifierExpression */: {
|
|
49549
49944
|
this.checkIdentifierExpression(node);
|
|
@@ -49639,7 +50034,7 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
49639
50034
|
252 /* TranslationsCanOnlyBeDeclaredInTranslationPackage */,
|
|
49640
50035
|
node.translationsKeyword
|
|
49641
50036
|
));
|
|
49642
|
-
|
|
50037
|
+
controller.skipChildrenTraverse();
|
|
49643
50038
|
} else if (this.sourceFile.package.kind === "translation") {
|
|
49644
50039
|
if (this.translationPackage === void 0) {
|
|
49645
50040
|
this.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
@@ -49647,7 +50042,7 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
49647
50042
|
node.translationsKeyword,
|
|
49648
50043
|
[this.sourceFile.package.configuration.targetPackageName.toString()]
|
|
49649
50044
|
));
|
|
49650
|
-
|
|
50045
|
+
controller.skipChildrenTraverse();
|
|
49651
50046
|
}
|
|
49652
50047
|
} else if (this.sourceFile.package.kind === "text-translation") {
|
|
49653
50048
|
const textTranslationPackage = this.textTranslationPackage;
|
|
@@ -49657,7 +50052,7 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
49657
50052
|
node.translationsKeyword,
|
|
49658
50053
|
[this.sourceFile.package.configuration.targetPackageName.toString()]
|
|
49659
50054
|
));
|
|
49660
|
-
|
|
50055
|
+
controller.skipChildrenTraverse();
|
|
49661
50056
|
} else {
|
|
49662
50057
|
if (textTranslationPackage.isPrimary()) {
|
|
49663
50058
|
const targetPackage = textTranslationPackage.getTargetPackage();
|
|
@@ -49666,7 +50061,7 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
49666
50061
|
(p) => p.isPrimary() && p !== textTranslationPackage
|
|
49667
50062
|
)) {
|
|
49668
50063
|
this.addDiagnostic(this.analyzer.createNodeDiagnostic(
|
|
49669
|
-
|
|
50064
|
+
392 /* OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary */,
|
|
49670
50065
|
node.translationsKeyword,
|
|
49671
50066
|
[]
|
|
49672
50067
|
));
|
|
@@ -50197,6 +50592,7 @@ var DiagnosticCollector = class _DiagnosticCollector {
|
|
|
50197
50592
|
break;
|
|
50198
50593
|
}
|
|
50199
50594
|
}
|
|
50595
|
+
return void 0;
|
|
50200
50596
|
}
|
|
50201
50597
|
checkTypeParameterList(node) {
|
|
50202
50598
|
const typeParameterDeclarations = node.typeParameters.toArray();
|
|
@@ -51732,11 +52128,11 @@ var SourcePackageDependencyGraph = class {
|
|
|
51732
52128
|
* Перечислить все пакеты и их зависимости, включая транзитивные, начиная от корневых пакетов.
|
|
51733
52129
|
* @param platformKind Связывать многоплатформенные пакеты с реализацией для заданной платформы.
|
|
51734
52130
|
*/
|
|
51735
|
-
*
|
|
52131
|
+
*packagesForTargetPlatform(platformKind) {
|
|
51736
52132
|
const enumeratedPackages = /* @__PURE__ */ new Set();
|
|
51737
52133
|
for (const rootPackage of this.rootPackages) {
|
|
51738
52134
|
const node = this.getNodeForPackage(rootPackage);
|
|
51739
|
-
yield* __yieldStar(this.
|
|
52135
|
+
yield* __yieldStar(this.nodeAndDependenciesRecursively(node, platformKind, enumeratedPackages));
|
|
51740
52136
|
}
|
|
51741
52137
|
for (const pkg2 of this.analyzer.enumerateAnalyzedTextTranslationPackages()) {
|
|
51742
52138
|
yield pkg2.getDefinition();
|
|
@@ -51795,12 +52191,12 @@ var SourcePackageDependencyGraph = class {
|
|
|
51795
52191
|
}
|
|
51796
52192
|
return result;
|
|
51797
52193
|
}
|
|
51798
|
-
*
|
|
52194
|
+
*nodeAndDependenciesRecursively(node, platformKind, enumeratedPackages) {
|
|
51799
52195
|
if (!enumeratedPackages.has(node.pkg)) {
|
|
51800
52196
|
yield node.pkg;
|
|
51801
52197
|
enumeratedPackages.add(node.pkg);
|
|
51802
52198
|
for (const link of node.links) {
|
|
51803
|
-
yield* __yieldStar(this.
|
|
52199
|
+
yield* __yieldStar(this.nodeAndDependenciesRecursively(link.node, platformKind, enumeratedPackages));
|
|
51804
52200
|
for (const translationPackage of link.translationPackages) {
|
|
51805
52201
|
const sourceTranslationPackage = translationPackage.getDefinition();
|
|
51806
52202
|
if (!enumeratedPackages.has(sourceTranslationPackage)) {
|
|
@@ -51810,7 +52206,7 @@ var SourcePackageDependencyGraph = class {
|
|
|
51810
52206
|
}
|
|
51811
52207
|
const implementationPackageNode = link.implementationPackageByPlatformKind.get(platformKind);
|
|
51812
52208
|
if (implementationPackageNode !== void 0) {
|
|
51813
|
-
yield* __yieldStar(this.
|
|
52209
|
+
yield* __yieldStar(this.nodeAndDependenciesRecursively(
|
|
51814
52210
|
implementationPackageNode,
|
|
51815
52211
|
platformKind,
|
|
51816
52212
|
enumeratedPackages
|
|
@@ -52358,6 +52754,72 @@ DestructorDeclarationEntity = __decorateClass([
|
|
|
52358
52754
|
entityToStringDecorator
|
|
52359
52755
|
], DestructorDeclarationEntity);
|
|
52360
52756
|
|
|
52757
|
+
// source/analysis/ReturnTypeInferrer.ts
|
|
52758
|
+
var ReturnTypeInferrer = class {
|
|
52759
|
+
constructor(analyzer, block, resultVariable) {
|
|
52760
|
+
this.analyzer = analyzer;
|
|
52761
|
+
this.block = block;
|
|
52762
|
+
this.resultVariable = resultVariable;
|
|
52763
|
+
}
|
|
52764
|
+
infer() {
|
|
52765
|
+
let result;
|
|
52766
|
+
if (this.block.expressionOrStatementList.kind !== 93 /* StatementList */) {
|
|
52767
|
+
result = this.analyzer.type.ofExpression(this.block.expressionOrStatementList);
|
|
52768
|
+
} else {
|
|
52769
|
+
const { isResultVariableUsed, returnedTypes } = this.checkResultVariableIsUsedAndCollectReturnedTypes();
|
|
52770
|
+
if (isResultVariableUsed) {
|
|
52771
|
+
returnedTypes.push(this.getTypeOfResultVariableAtTheEndOfSubprogram());
|
|
52772
|
+
}
|
|
52773
|
+
if (returnedTypes.length === 0) {
|
|
52774
|
+
result = this.analyzer.getLocalizedStandardTypes(this.block.locale).nullType;
|
|
52775
|
+
} else {
|
|
52776
|
+
result = this.analyzer.typeFactory.getUnionType(returnedTypes, true);
|
|
52777
|
+
}
|
|
52778
|
+
}
|
|
52779
|
+
return result;
|
|
52780
|
+
}
|
|
52781
|
+
checkResultVariableIsUsedAndCollectReturnedTypes() {
|
|
52782
|
+
let isResultVariableUsed = false;
|
|
52783
|
+
const returnedTypes = new Array();
|
|
52784
|
+
const visitor = (child) => {
|
|
52785
|
+
if (!isResultVariableUsed && child.kind === 89 /* IdentifierExpression */) {
|
|
52786
|
+
const meaning = this.analyzer.resolveIdentifierExpressionFirstStage(child).meaning;
|
|
52787
|
+
if (meaning.kind === "variable-access" && meaning.variable.getEntity().getOriginalEntity() === this.resultVariable.getOriginalEntity()) {
|
|
52788
|
+
isResultVariableUsed = true;
|
|
52789
|
+
}
|
|
52790
|
+
} else if (child.kind === 116 /* ReturnStatement */ && child.expression !== void 0) {
|
|
52791
|
+
returnedTypes.push(this.analyzer.type.ofExpression(child.expression));
|
|
52792
|
+
}
|
|
52793
|
+
switch (child.kind) {
|
|
52794
|
+
case 15 /* AnonymousTypeSpecifier */:
|
|
52795
|
+
case 56 /* NestedFunctionDeclaration */:
|
|
52796
|
+
case 65 /* FunctionLiteral */:
|
|
52797
|
+
case 66 /* FunctionBlockLiteral */:
|
|
52798
|
+
return;
|
|
52799
|
+
default:
|
|
52800
|
+
visitChildren(child, false, visitor);
|
|
52801
|
+
}
|
|
52802
|
+
};
|
|
52803
|
+
visitChildren(this.block, false, visitor);
|
|
52804
|
+
return { isResultVariableUsed, returnedTypes };
|
|
52805
|
+
}
|
|
52806
|
+
getTypeOfResultVariableAtTheEndOfSubprogram() {
|
|
52807
|
+
const sourceFile = TreeQuery.getSourceFile(this.block, this.analyzer);
|
|
52808
|
+
const controlFlowNodeEndingSubprogram = this.analyzer.getControlFlowGraph(sourceFile).controlFlowNodesEndingSubprogram.get(this.block.parent);
|
|
52809
|
+
if (controlFlowNodeEndingSubprogram === void 0) {
|
|
52810
|
+
return this.analyzer.originalStandardTypes.unresolved;
|
|
52811
|
+
}
|
|
52812
|
+
const typeNarrower = new TypeNarrower(
|
|
52813
|
+
this.analyzer,
|
|
52814
|
+
new NarrowableReference.LocalVariable(this.analyzer, this.resultVariable),
|
|
52815
|
+
sourceFile.package.locale,
|
|
52816
|
+
this.resultVariable.getType(),
|
|
52817
|
+
controlFlowNodeEndingSubprogram
|
|
52818
|
+
);
|
|
52819
|
+
return typeNarrower.getType();
|
|
52820
|
+
}
|
|
52821
|
+
};
|
|
52822
|
+
|
|
52361
52823
|
// source/entities/source/SourceFunctionEntity.ts
|
|
52362
52824
|
var PackageFunctionDeclarationEntity = class {
|
|
52363
52825
|
constructor(analyzer, node) {
|
|
@@ -52381,6 +52843,9 @@ var PackageFunctionDeclarationEntity = class {
|
|
|
52381
52843
|
getName() {
|
|
52382
52844
|
return this.name;
|
|
52383
52845
|
}
|
|
52846
|
+
getNaming() {
|
|
52847
|
+
return new EntityNaming_named(this.name);
|
|
52848
|
+
}
|
|
52384
52849
|
getContainingPackage() {
|
|
52385
52850
|
return TreeQuery.getPackageEntity(this.node, this.analyzer);
|
|
52386
52851
|
}
|
|
@@ -52449,6 +52914,9 @@ var MethodDeclarationEntity = class {
|
|
|
52449
52914
|
getName() {
|
|
52450
52915
|
return this.name;
|
|
52451
52916
|
}
|
|
52917
|
+
getNaming() {
|
|
52918
|
+
return new EntityNaming_named(this.name);
|
|
52919
|
+
}
|
|
52452
52920
|
getTypeParameters() {
|
|
52453
52921
|
return this.typeParameters.getOrInsertWith(() => this.node.typeParameterClause?.typeParameterList.typeParameters.map((t) => this.analyzer.entity.ofTypeParameterDeclaration(t)).toArray() ?? emptyTypeParameterEntities);
|
|
52454
52922
|
}
|
|
@@ -52533,6 +53001,9 @@ var NestedFunctionDeclarationEntity = class {
|
|
|
52533
53001
|
getName() {
|
|
52534
53002
|
return this.name;
|
|
52535
53003
|
}
|
|
53004
|
+
getNaming() {
|
|
53005
|
+
return new EntityNaming_named(this.name);
|
|
53006
|
+
}
|
|
52536
53007
|
getContainingPackage() {
|
|
52537
53008
|
return TreeQuery.getPackageEntity(this.node, this.analyzer);
|
|
52538
53009
|
}
|
|
@@ -52579,6 +53050,281 @@ var NestedFunctionDeclarationEntity = class {
|
|
|
52579
53050
|
NestedFunctionDeclarationEntity = __decorateClass([
|
|
52580
53051
|
entityToStringDecorator
|
|
52581
53052
|
], NestedFunctionDeclarationEntity);
|
|
53053
|
+
var FunctionLiteralEntity = class {
|
|
53054
|
+
constructor(analyzer, node) {
|
|
53055
|
+
this.analyzer = analyzer;
|
|
53056
|
+
this.node = node;
|
|
53057
|
+
this.kind = 1 /* Function */;
|
|
53058
|
+
this.subkind = "anonymous";
|
|
53059
|
+
this.isTargetTypeSet = false;
|
|
53060
|
+
this.parameters = new Cached();
|
|
53061
|
+
this.isInferringReturnType_ = false;
|
|
53062
|
+
this.areParameterTypesSet = node.parameterClause.parameterList.parameters.all((p) => p.typeAnnotation !== void 0);
|
|
53063
|
+
}
|
|
53064
|
+
get isInferringReturnType() {
|
|
53065
|
+
return this.isInferringReturnType_;
|
|
53066
|
+
}
|
|
53067
|
+
get isInferringIsAsync() {
|
|
53068
|
+
return false;
|
|
53069
|
+
}
|
|
53070
|
+
setTargetFunctionType(type) {
|
|
53071
|
+
if (!this.isTargetTypeSet) {
|
|
53072
|
+
this.targetType = type;
|
|
53073
|
+
this.isTargetTypeSet = true;
|
|
53074
|
+
this.setParameterTypes(this.targetType);
|
|
53075
|
+
} else {
|
|
53076
|
+
Debug.assert(
|
|
53077
|
+
this.targetType === void 0 && type === void 0 || this.targetType !== void 0 && type !== void 0 && this.targetType.equals(type),
|
|
53078
|
+
"\u0414\u043B\u044F \u0431\u0435\u0437\u044B\u043C\u044F\u043D\u043D\u043E\u0439 \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u0443\u0436\u0435 \u0431\u044B\u043B \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u0434\u0440\u0443\u0433\u043E\u0439 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u0442\u0438\u043F."
|
|
53079
|
+
);
|
|
53080
|
+
}
|
|
53081
|
+
}
|
|
53082
|
+
dependsOnTargetType() {
|
|
53083
|
+
return this.node.returnTypeAnnotation === void 0 || this.node.parameterClause.parameterList.parameters.any((p) => p.typeAnnotation === void 0);
|
|
53084
|
+
}
|
|
53085
|
+
getNaming() {
|
|
53086
|
+
return new EntityNaming_anonymous();
|
|
53087
|
+
}
|
|
53088
|
+
getContainingPackage() {
|
|
53089
|
+
return TreeQuery.getPackageEntity(this.node, this.analyzer);
|
|
53090
|
+
}
|
|
53091
|
+
getTypeParameters() {
|
|
53092
|
+
return emptyTypeParameterEntities;
|
|
53093
|
+
}
|
|
53094
|
+
getParameters() {
|
|
53095
|
+
return this.parameters.getOrInsertWith(() => this.node.parameterClause.parameterList.parameters.map((p) => this.analyzer.entity.ofFunctionLiteralParameterDeclarationInternal(p, this.node)).toArray());
|
|
53096
|
+
}
|
|
53097
|
+
getReturnType() {
|
|
53098
|
+
if (this.returnType === void 0) {
|
|
53099
|
+
if (this.node.returnTypeAnnotation !== void 0) {
|
|
53100
|
+
this.returnType = this.analyzer.type.ofTypeSpecifier(this.node.returnTypeAnnotation.typeSpecifier);
|
|
53101
|
+
} else {
|
|
53102
|
+
this.ensureTargetTypeIsSet();
|
|
53103
|
+
if (this.returnType === void 0) {
|
|
53104
|
+
if (this.targetType !== void 0 && this.node.block.expressionOrStatementList.kind !== 93 /* StatementList */ && this.targetType.getReturnType().isNullType) {
|
|
53105
|
+
this.returnType = this.analyzer.getLocalizedStandardTypes(this.node.locale).nullType;
|
|
53106
|
+
} else {
|
|
53107
|
+
this.ensureParameterTypesAreSet();
|
|
53108
|
+
this.returnType = this.analyzer.includeNullToType(
|
|
53109
|
+
this.analyzer.getLocalizedStandardTypes(this.node.locale).refObject,
|
|
53110
|
+
this.node.locale
|
|
53111
|
+
);
|
|
53112
|
+
const returnTypeInferrer = new ReturnTypeInferrer(
|
|
53113
|
+
this.analyzer,
|
|
53114
|
+
this.node.block,
|
|
53115
|
+
this.analyzer.resultLocalVariableEntity.ofFunctionLiteral(this.node)
|
|
53116
|
+
);
|
|
53117
|
+
this.isInferringReturnType_ = true;
|
|
53118
|
+
this.returnType = returnTypeInferrer.infer();
|
|
53119
|
+
this.isInferringReturnType_ = false;
|
|
53120
|
+
}
|
|
53121
|
+
}
|
|
53122
|
+
}
|
|
53123
|
+
}
|
|
53124
|
+
return this.returnType;
|
|
53125
|
+
}
|
|
53126
|
+
getDefinition() {
|
|
53127
|
+
return { kind: 0 /* Source */, node: this.node };
|
|
53128
|
+
}
|
|
53129
|
+
isAsync() {
|
|
53130
|
+
return this.node.asyncKeyword !== void 0;
|
|
53131
|
+
}
|
|
53132
|
+
isHidden() {
|
|
53133
|
+
return void 0;
|
|
53134
|
+
}
|
|
53135
|
+
getTags() {
|
|
53136
|
+
return emptyTags;
|
|
53137
|
+
}
|
|
53138
|
+
getTypeParametersArity() {
|
|
53139
|
+
return this.getTypeParameters().length;
|
|
53140
|
+
}
|
|
53141
|
+
getSubstitutionApplicationMode() {
|
|
53142
|
+
return 1 /* SubstituteOwnSubstitutionsAndMerge */;
|
|
53143
|
+
}
|
|
53144
|
+
getTranslation() {
|
|
53145
|
+
return void 0;
|
|
53146
|
+
}
|
|
53147
|
+
getLocale() {
|
|
53148
|
+
return this.node.locale;
|
|
53149
|
+
}
|
|
53150
|
+
getDialect() {
|
|
53151
|
+
return this.node.dialect;
|
|
53152
|
+
}
|
|
53153
|
+
getOriginalEntity() {
|
|
53154
|
+
return this;
|
|
53155
|
+
}
|
|
53156
|
+
ensureParameterTypesAreSet() {
|
|
53157
|
+
if (!this.areParameterTypesSet) {
|
|
53158
|
+
this.ensureTargetTypeIsSet();
|
|
53159
|
+
if (!this.areParameterTypesSet) {
|
|
53160
|
+
this.setParameterTypes(this.targetType);
|
|
53161
|
+
}
|
|
53162
|
+
}
|
|
53163
|
+
}
|
|
53164
|
+
ensureTargetTypeIsSet() {
|
|
53165
|
+
if (!this.isTargetTypeSet) {
|
|
53166
|
+
const targetType = this.analyzer.getTargetTypeOfExpression(this.node);
|
|
53167
|
+
if (!this.isTargetTypeSet) {
|
|
53168
|
+
const targetFunctionType = this.analyzer.getUnambiguousTargetFunctionType(targetType);
|
|
53169
|
+
this.targetType = targetFunctionType;
|
|
53170
|
+
this.isTargetTypeSet = true;
|
|
53171
|
+
}
|
|
53172
|
+
}
|
|
53173
|
+
}
|
|
53174
|
+
setParameterTypes(targetType) {
|
|
53175
|
+
const parametersOfTargetType = targetType?.getParameters();
|
|
53176
|
+
let i = 0;
|
|
53177
|
+
for (const parameterEntity2 of this.getParameters()) {
|
|
53178
|
+
const type = parametersOfTargetType?.[i]?.getType() ?? this.analyzer.originalStandardTypes.unresolved;
|
|
53179
|
+
parameterEntity2.setTypeIfHasNoTypeSpecifier(type);
|
|
53180
|
+
i++;
|
|
53181
|
+
}
|
|
53182
|
+
}
|
|
53183
|
+
};
|
|
53184
|
+
FunctionLiteralEntity = __decorateClass([
|
|
53185
|
+
entityToStringDecorator
|
|
53186
|
+
], FunctionLiteralEntity);
|
|
53187
|
+
var FunctionBlockLiteralEntity = class {
|
|
53188
|
+
constructor(analyzer, node) {
|
|
53189
|
+
this.analyzer = analyzer;
|
|
53190
|
+
this.node = node;
|
|
53191
|
+
this.kind = 1 /* Function */;
|
|
53192
|
+
this.subkind = "anonymous";
|
|
53193
|
+
this.isTargetTypeSet = false;
|
|
53194
|
+
this.isInferringReturnType_ = false;
|
|
53195
|
+
this.isInferringIsAsync_ = false;
|
|
53196
|
+
}
|
|
53197
|
+
get isInferringReturnType() {
|
|
53198
|
+
return this.isInferringReturnType_;
|
|
53199
|
+
}
|
|
53200
|
+
get isInferringIsAsync() {
|
|
53201
|
+
return this.isInferringIsAsync_;
|
|
53202
|
+
}
|
|
53203
|
+
setTargetFunctionType(type) {
|
|
53204
|
+
if (!this.isTargetTypeSet) {
|
|
53205
|
+
this.targetType = type;
|
|
53206
|
+
this.isTargetTypeSet = true;
|
|
53207
|
+
this.parameters = this.createParameters(this.targetType);
|
|
53208
|
+
} else {
|
|
53209
|
+
Debug.assert(
|
|
53210
|
+
this.targetType === void 0 && type === void 0 || this.targetType !== void 0 && type !== void 0 && this.targetType.equals(type),
|
|
53211
|
+
"\u0414\u043B\u044F \u0431\u0435\u0437\u044B\u043C\u044F\u043D\u043D\u043E\u0439 \u0444\u0443\u043D\u043A\u0446\u0438\u0438 \u0443\u0436\u0435 \u0431\u044B\u043B \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D \u0434\u0440\u0443\u0433\u043E\u0439 \u0446\u0435\u043B\u0435\u0432\u043E\u0439 \u0442\u0438\u043F."
|
|
53212
|
+
);
|
|
53213
|
+
}
|
|
53214
|
+
}
|
|
53215
|
+
dependsOnTargetType() {
|
|
53216
|
+
return true;
|
|
53217
|
+
}
|
|
53218
|
+
getNaming() {
|
|
53219
|
+
return new EntityNaming_anonymous();
|
|
53220
|
+
}
|
|
53221
|
+
getContainingPackage() {
|
|
53222
|
+
return TreeQuery.getPackageEntity(this.node, this.analyzer);
|
|
53223
|
+
}
|
|
53224
|
+
getTypeParameters() {
|
|
53225
|
+
return emptyTypeParameterEntities;
|
|
53226
|
+
}
|
|
53227
|
+
getParameters() {
|
|
53228
|
+
this.ensureParametersAreCreated();
|
|
53229
|
+
Debug.assertNotNull(this.parameters);
|
|
53230
|
+
return this.parameters;
|
|
53231
|
+
}
|
|
53232
|
+
getReturnType() {
|
|
53233
|
+
if (this.returnType === void 0) {
|
|
53234
|
+
this.ensureTargetTypeIsSet();
|
|
53235
|
+
if (this.returnType === void 0) {
|
|
53236
|
+
if (this.targetType !== void 0 && this.node.block.expressionOrStatementList.kind !== 93 /* StatementList */ && this.targetType.getReturnType().isNullType) {
|
|
53237
|
+
this.returnType = this.analyzer.getLocalizedStandardTypes(this.node.locale).nullType;
|
|
53238
|
+
} else {
|
|
53239
|
+
this.ensureParametersAreCreated();
|
|
53240
|
+
this.returnType = this.analyzer.includeNullToType(
|
|
53241
|
+
this.analyzer.getLocalizedStandardTypes(this.node.locale).refObject,
|
|
53242
|
+
this.node.locale
|
|
53243
|
+
);
|
|
53244
|
+
const returnTypeInferrer = new ReturnTypeInferrer(
|
|
53245
|
+
this.analyzer,
|
|
53246
|
+
this.node.block,
|
|
53247
|
+
this.analyzer.resultLocalVariableEntity.ofFunctionBlockLiteral(this.node)
|
|
53248
|
+
);
|
|
53249
|
+
this.isInferringReturnType_ = true;
|
|
53250
|
+
this.returnType = returnTypeInferrer.infer();
|
|
53251
|
+
this.isInferringReturnType_ = false;
|
|
53252
|
+
}
|
|
53253
|
+
}
|
|
53254
|
+
}
|
|
53255
|
+
return this.returnType;
|
|
53256
|
+
}
|
|
53257
|
+
getDefinition() {
|
|
53258
|
+
return { kind: 0 /* Source */, node: this.node };
|
|
53259
|
+
}
|
|
53260
|
+
isAsync() {
|
|
53261
|
+
if (this.isAsync_ === void 0) {
|
|
53262
|
+
this.ensureParametersAreCreated();
|
|
53263
|
+
if (this.isAsync_ === void 0) {
|
|
53264
|
+
this.isAsync_ = true;
|
|
53265
|
+
this.isInferringIsAsync_ = true;
|
|
53266
|
+
this.isAsync_ = this.analyzer.checkBlockCallsAsyncMethods(this.node.block);
|
|
53267
|
+
this.isInferringIsAsync_ = false;
|
|
53268
|
+
}
|
|
53269
|
+
}
|
|
53270
|
+
return this.isAsync_;
|
|
53271
|
+
}
|
|
53272
|
+
isHidden() {
|
|
53273
|
+
return void 0;
|
|
53274
|
+
}
|
|
53275
|
+
getTags() {
|
|
53276
|
+
return emptyTags;
|
|
53277
|
+
}
|
|
53278
|
+
getTypeParametersArity() {
|
|
53279
|
+
return this.getTypeParameters().length;
|
|
53280
|
+
}
|
|
53281
|
+
getSubstitutionApplicationMode() {
|
|
53282
|
+
return 1 /* SubstituteOwnSubstitutionsAndMerge */;
|
|
53283
|
+
}
|
|
53284
|
+
getTranslation() {
|
|
53285
|
+
return void 0;
|
|
53286
|
+
}
|
|
53287
|
+
getLocale() {
|
|
53288
|
+
return this.node.locale;
|
|
53289
|
+
}
|
|
53290
|
+
getDialect() {
|
|
53291
|
+
return this.node.dialect;
|
|
53292
|
+
}
|
|
53293
|
+
getOriginalEntity() {
|
|
53294
|
+
return this;
|
|
53295
|
+
}
|
|
53296
|
+
ensureParametersAreCreated() {
|
|
53297
|
+
if (this.parameters === void 0) {
|
|
53298
|
+
this.ensureTargetTypeIsSet();
|
|
53299
|
+
if (this.parameters === void 0) {
|
|
53300
|
+
this.parameters = this.createParameters(this.targetType);
|
|
53301
|
+
}
|
|
53302
|
+
}
|
|
53303
|
+
}
|
|
53304
|
+
ensureTargetTypeIsSet() {
|
|
53305
|
+
if (!this.isTargetTypeSet) {
|
|
53306
|
+
const targetType = this.analyzer.getTargetTypeOfExpression(this.node);
|
|
53307
|
+
if (!this.isTargetTypeSet) {
|
|
53308
|
+
const targetFunctionType = this.analyzer.getUnambiguousTargetFunctionType(targetType);
|
|
53309
|
+
this.targetType = targetFunctionType;
|
|
53310
|
+
this.isTargetTypeSet = true;
|
|
53311
|
+
}
|
|
53312
|
+
}
|
|
53313
|
+
}
|
|
53314
|
+
createParameters(targetType) {
|
|
53315
|
+
return targetType?.getParameters().map((p) => new IntrinsicParameterEntity(
|
|
53316
|
+
p.getEntity().getName(),
|
|
53317
|
+
p.getType(),
|
|
53318
|
+
this.getContainingPackage(),
|
|
53319
|
+
p.isOptional(),
|
|
53320
|
+
p.isVariadic(),
|
|
53321
|
+
new ImplicitFunctionBlockParameterSpecialVariableEntityInfo(p, this.node)
|
|
53322
|
+
)) ?? [];
|
|
53323
|
+
}
|
|
53324
|
+
};
|
|
53325
|
+
FunctionBlockLiteralEntity = __decorateClass([
|
|
53326
|
+
entityToStringDecorator
|
|
53327
|
+
], FunctionBlockLiteralEntity);
|
|
52582
53328
|
|
|
52583
53329
|
// source/entities/source/SourceFunctionTypeEntity.ts
|
|
52584
53330
|
var PackageFunctionTypeDeclarationEntity = class {
|
|
@@ -55106,7 +55852,7 @@ var ParameterDeclarationEntity = class {
|
|
|
55106
55852
|
case 51 /* OperatorDeclaration */:
|
|
55107
55853
|
return this.analyzer.entity.ofOperatorDeclaration(containingDeclaration);
|
|
55108
55854
|
case 65 /* FunctionLiteral */:
|
|
55109
|
-
return
|
|
55855
|
+
return this.analyzer.entity.ofFunctionLiteral(containingDeclaration);
|
|
55110
55856
|
default:
|
|
55111
55857
|
Debug.never(containingDeclaration);
|
|
55112
55858
|
}
|
|
@@ -55260,21 +56006,29 @@ var FunctionLiteralParameterDeclarationEntity = class {
|
|
|
55260
56006
|
this.functionLiteral = functionLiteral2;
|
|
55261
56007
|
this.kind = 0 /* Variable */;
|
|
55262
56008
|
this.subkind = "parameter";
|
|
55263
|
-
this.type = new Cached();
|
|
55264
56009
|
this.parameterIndex = functionLiteral2.parameterClause.parameterList.parameters.indexOf(node);
|
|
55265
56010
|
Debug.assert(this.parameterIndex >= 0);
|
|
55266
56011
|
this.name = analyzer.createNameFromIdentifier(node.name);
|
|
55267
56012
|
}
|
|
56013
|
+
setTypeIfHasNoTypeSpecifier(type) {
|
|
56014
|
+
if (this.node.typeAnnotation === void 0) {
|
|
56015
|
+
this.type = type;
|
|
56016
|
+
}
|
|
56017
|
+
}
|
|
55268
56018
|
getName() {
|
|
55269
56019
|
return this.name;
|
|
55270
56020
|
}
|
|
55271
56021
|
getType() {
|
|
55272
|
-
|
|
55273
|
-
|
|
55274
|
-
|
|
55275
|
-
|
|
55276
|
-
|
|
55277
|
-
|
|
56022
|
+
if (this.type === void 0) {
|
|
56023
|
+
if (this.node.typeAnnotation !== void 0) {
|
|
56024
|
+
this.type = this.analyzer.type.ofTypeSpecifier(this.node.typeAnnotation.typeSpecifier);
|
|
56025
|
+
} else {
|
|
56026
|
+
this.getContainingFunctionLiteralEntity().ensureParameterTypesAreSet();
|
|
56027
|
+
Debug.assertNotNull(this.type);
|
|
56028
|
+
Debug.cast(this.type);
|
|
56029
|
+
}
|
|
56030
|
+
}
|
|
56031
|
+
return this.type;
|
|
55278
56032
|
}
|
|
55279
56033
|
getDefinition() {
|
|
55280
56034
|
return { kind: 0 /* Source */, value: { kind: "single", node: this.node } };
|
|
@@ -55298,7 +56052,7 @@ var FunctionLiteralParameterDeclarationEntity = class {
|
|
|
55298
56052
|
return this.analyzer.tags.ofNodeWithTags(this.node);
|
|
55299
56053
|
}
|
|
55300
56054
|
getContainingEntity() {
|
|
55301
|
-
return
|
|
56055
|
+
return this.getContainingFunctionLiteralEntity();
|
|
55302
56056
|
}
|
|
55303
56057
|
getContainingPackage() {
|
|
55304
56058
|
return TreeQuery.getPackageEntity(this.node, this.analyzer);
|
|
@@ -55321,6 +56075,9 @@ var FunctionLiteralParameterDeclarationEntity = class {
|
|
|
55321
56075
|
getOriginalEntity() {
|
|
55322
56076
|
return this;
|
|
55323
56077
|
}
|
|
56078
|
+
getContainingFunctionLiteralEntity() {
|
|
56079
|
+
return this.analyzer.entity.ofFunctionLiteralInternal(this.functionLiteral);
|
|
56080
|
+
}
|
|
55324
56081
|
};
|
|
55325
56082
|
FunctionLiteralParameterDeclarationEntity = __decorateClass([
|
|
55326
56083
|
entityToStringDecorator
|
|
@@ -58105,7 +58862,7 @@ var EmitterContext = class {
|
|
|
58105
58862
|
isAspectTypeEntity(entity) {
|
|
58106
58863
|
return entity.typeOrExtensionKind === 0 /* StructuredType */ && entity.details.structuredTypeKind === 2 /* Aspect */;
|
|
58107
58864
|
}
|
|
58108
|
-
*
|
|
58865
|
+
*allOverriddenMembers(entity) {
|
|
58109
58866
|
if (entity.details.overriddenMembers.length === 0) {
|
|
58110
58867
|
return;
|
|
58111
58868
|
}
|
|
@@ -58366,12 +59123,12 @@ var EntityFinder = class _EntityFinder {
|
|
|
58366
59123
|
findPackageFunctionEntity(keyText) {
|
|
58367
59124
|
const key = this.parsePackageFunctionEntityKey(keyText);
|
|
58368
59125
|
const originalEntity = this.findOriginalPackageFunctionEntityByParsedKey(key, keyText);
|
|
58369
|
-
return this.ectx.entityMap.
|
|
59126
|
+
return this.ectx.entityMap.getNamedFunctionEntity(originalEntity);
|
|
58370
59127
|
}
|
|
58371
59128
|
findMethodEntity(keyText) {
|
|
58372
59129
|
const key = this.parseMethodEntityKey(keyText);
|
|
58373
59130
|
const originalEntity = this.findOriginalMethodEntityByParsedKey(key, keyText);
|
|
58374
|
-
return this.ectx.entityMap.
|
|
59131
|
+
return this.ectx.entityMap.getNamedFunctionEntity(originalEntity);
|
|
58375
59132
|
}
|
|
58376
59133
|
findConstructorEntity(keyText) {
|
|
58377
59134
|
const key = this.parseConstructorEntityKey(keyText);
|
|
@@ -58636,7 +59393,7 @@ var EntityMap = class _EntityMap {
|
|
|
58636
59393
|
}
|
|
58637
59394
|
return result;
|
|
58638
59395
|
}
|
|
58639
|
-
|
|
59396
|
+
getNamedFunctionEntity(entity) {
|
|
58640
59397
|
entity = entity.getOriginalEntity();
|
|
58641
59398
|
let result = this.functions.get(entity);
|
|
58642
59399
|
if (result === void 0) {
|
|
@@ -58647,7 +59404,7 @@ var EntityMap = class _EntityMap {
|
|
|
58647
59404
|
linkedEntity = this.analyzer.linkedEntity.ofMethod(entity, this.targetPlatform);
|
|
58648
59405
|
}
|
|
58649
59406
|
if (linkedEntity !== void 0) {
|
|
58650
|
-
result = this.
|
|
59407
|
+
result = this.getNamedFunctionEntity(linkedEntity);
|
|
58651
59408
|
this.functions.set(entity, result);
|
|
58652
59409
|
} else {
|
|
58653
59410
|
result = new MappedFunctionEntity(entity, 0 /* RegularFunction */);
|
|
@@ -58665,11 +59422,11 @@ var EntityMap = class _EntityMap {
|
|
|
58665
59422
|
result.details.isStatic = entity.isStatic();
|
|
58666
59423
|
result.details.isAbstract = TypeMemberEntity.isAbstract(entity);
|
|
58667
59424
|
result.details.isBasic = TypeMemberEntity.isBasic(entity);
|
|
58668
|
-
result.details.overriddenMembers = entity.getOverriddenMembers().map((m) => this.
|
|
59425
|
+
result.details.overriddenMembers = entity.getOverriddenMembers().map((m) => this.getNamedFunctionEntity(m.getEntity()));
|
|
58669
59426
|
if (result.ifTypeMemberThenContainingType.typeOrExtensionKind === 1 /* AliasType */ && entity.markedBasic()) {
|
|
58670
59427
|
const realBasicMethod = this.analyzer.getBasicMethodOfOriginalTypeForBasicMethodOfAliasType(entity);
|
|
58671
59428
|
if (realBasicMethod !== void 0) {
|
|
58672
|
-
result.details.ifBasicAliasTypeMethodThenRealMethod = this.
|
|
59429
|
+
result.details.ifBasicAliasTypeMethodThenRealMethod = this.getNamedFunctionEntity(realBasicMethod);
|
|
58673
59430
|
}
|
|
58674
59431
|
}
|
|
58675
59432
|
if (result.containingPackage.details.isJavaScriptPackage !== void 0 && this.analyzer.isEnumeratorMethodSignature(entity)) {
|
|
@@ -59159,7 +59916,7 @@ var EntityMap = class _EntityMap {
|
|
|
59159
59916
|
result.push(this.getVariableEntity(member));
|
|
59160
59917
|
break;
|
|
59161
59918
|
case 1 /* Function */:
|
|
59162
|
-
result.push(this.
|
|
59919
|
+
result.push(this.getNamedFunctionEntity(member));
|
|
59163
59920
|
break;
|
|
59164
59921
|
default:
|
|
59165
59922
|
Debug.never(member);
|
|
@@ -59261,8 +60018,8 @@ var EntityMap = class _EntityMap {
|
|
|
59261
60018
|
_EntityMap.implicitImplementationMemberKindsMismatchErrorMessage
|
|
59262
60019
|
);
|
|
59263
60020
|
return {
|
|
59264
|
-
abstractMember: this.
|
|
59265
|
-
implementingMember: this.
|
|
60021
|
+
abstractMember: this.getNamedFunctionEntity(abstractMemberEntity),
|
|
60022
|
+
implementingMember: this.getNamedFunctionEntity(implementingMemberEntity)
|
|
59266
60023
|
};
|
|
59267
60024
|
}
|
|
59268
60025
|
case 9 /* Operator */: {
|
|
@@ -61970,7 +62727,7 @@ var GeneralLoweringContext = class {
|
|
|
61970
62727
|
return this.inlineJsFunction_.getOrInsertWith(() => this.ectx.entityFinder.findPackageFunctionEntity(WellKnownDeclarationKeys.inlineJsFunction));
|
|
61971
62728
|
}
|
|
61972
62729
|
get enumeratorMethod() {
|
|
61973
|
-
return this.enumeratorMethod_.getOrInsertWith(() => this.ectx.entityMap.
|
|
62730
|
+
return this.enumeratorMethod_.getOrInsertWith(() => this.ectx.entityMap.getNamedFunctionEntity(this.ectx.analyzer.originalWellKnownDeclarations.enumeratorMethod));
|
|
61974
62731
|
}
|
|
61975
62732
|
get errorConstructor() {
|
|
61976
62733
|
return this.errorConstructor_.getOrInsertWith(() => this.ectx.entityFinder.findConstructorEntity(WellKnownDeclarationKeys.errorConstructor));
|
|
@@ -62002,7 +62759,7 @@ var GeneralLoweringContext = class {
|
|
|
62002
62759
|
get translatorLanguageField() {
|
|
62003
62760
|
return this.translatorLanguageField_.getOrInsertWith(() => this.ectx.entityFinder.findFieldEntity(WellKnownDeclarationKeys.translatorLanguageField));
|
|
62004
62761
|
}
|
|
62005
|
-
*
|
|
62762
|
+
*declarationsOfAllPackages() {
|
|
62006
62763
|
for (const pkg2 of this.packages) {
|
|
62007
62764
|
yield* __yieldStar(pkg2.ir.declarations);
|
|
62008
62765
|
}
|
|
@@ -62366,7 +63123,7 @@ var ImplicitImplementationLowering = class {
|
|
|
62366
63123
|
this.ctx = ctx;
|
|
62367
63124
|
}
|
|
62368
63125
|
lower() {
|
|
62369
|
-
for (const declaration of this.ctx.
|
|
63126
|
+
for (const declaration of this.ctx.declarationsOfAllPackages()) {
|
|
62370
63127
|
if (declaration.kind === 23 /* PackageTypeDeclaration */) {
|
|
62371
63128
|
const implicitImplementations = declaration.entity.details.implicitlyImplementedAbstractMembersByImplementingMember;
|
|
62372
63129
|
if (implicitImplementations.size > 0) {
|
|
@@ -62765,7 +63522,7 @@ var AspectsLowering = class {
|
|
|
62765
63522
|
return void 0;
|
|
62766
63523
|
}
|
|
62767
63524
|
const result = new Array();
|
|
62768
|
-
for (const overriddenMember of this.ctx.ectx.
|
|
63525
|
+
for (const overriddenMember of this.ctx.ectx.allOverriddenMembers(entity)) {
|
|
62769
63526
|
if (overriddenMember.ifTypeMemberThenContainingType !== void 0 && this.ctx.ectx.isAspectTypeEntity(overriddenMember.ifTypeMemberThenContainingType)) {
|
|
62770
63527
|
result.push(overriddenMember);
|
|
62771
63528
|
}
|
|
@@ -62983,7 +63740,7 @@ var AliasTypeAndExtensionLowering = class {
|
|
|
62983
63740
|
this.ctx = ctx;
|
|
62984
63741
|
}
|
|
62985
63742
|
lower() {
|
|
62986
|
-
for (const declaration of this.ctx.
|
|
63743
|
+
for (const declaration of this.ctx.declarationsOfAllPackages()) {
|
|
62987
63744
|
if (!(declaration.kind === 23 /* PackageTypeDeclaration */ && (declaration.entity.typeOrExtensionKind === 1 /* AliasType */ || declaration.entity.typeOrExtensionKind === 5 /* TypeExtension */))) {
|
|
62988
63745
|
continue;
|
|
62989
63746
|
}
|
|
@@ -63313,7 +64070,7 @@ var PlainObjectConstructorsLowering = class {
|
|
|
63313
64070
|
this.ctx = ctx;
|
|
63314
64071
|
}
|
|
63315
64072
|
lower() {
|
|
63316
|
-
for (const declaration of this.ctx.
|
|
64073
|
+
for (const declaration of this.ctx.declarationsOfAllPackages()) {
|
|
63317
64074
|
if (!(declaration.kind === 23 /* PackageTypeDeclaration */ && declaration.entity.typeOrExtensionKind === 0 /* StructuredType */ && declaration.entity.details.structuredTypeKind === 1 /* PlainObject */)) {
|
|
63318
64075
|
continue;
|
|
63319
64076
|
}
|
|
@@ -63398,7 +64155,7 @@ var OverloadedConstructorsLowering = class {
|
|
|
63398
64155
|
}
|
|
63399
64156
|
lower() {
|
|
63400
64157
|
const groupByOriginalConstructor = /* @__PURE__ */ new Map();
|
|
63401
|
-
for (const declaration of this.ctx.
|
|
64158
|
+
for (const declaration of this.ctx.declarationsOfAllPackages()) {
|
|
63402
64159
|
if (!(declaration.kind === 23 /* PackageTypeDeclaration */ && declaration.entity.typeOrExtensionKind === 0 /* StructuredType */ && declaration.entity.details.structuredTypeKind === 0 /* RefObject */)) {
|
|
63403
64160
|
continue;
|
|
63404
64161
|
}
|
|
@@ -63636,7 +64393,7 @@ var MiscLowering = class {
|
|
|
63636
64393
|
}
|
|
63637
64394
|
}
|
|
63638
64395
|
static addMissingCallsOfBaseConstructorsWithoutParameters(ctx) {
|
|
63639
|
-
for (const declaration of ctx.
|
|
64396
|
+
for (const declaration of ctx.declarationsOfAllPackages()) {
|
|
63640
64397
|
if (!(declaration.kind === 23 /* PackageTypeDeclaration */ && declaration.entity.baseObjectType !== void 0)) {
|
|
63641
64398
|
continue;
|
|
63642
64399
|
}
|
|
@@ -64115,7 +64872,7 @@ var VariableProxyLowering = class {
|
|
|
64115
64872
|
}
|
|
64116
64873
|
lower() {
|
|
64117
64874
|
const proxyVariableByOriginal = /* @__PURE__ */ new Map();
|
|
64118
|
-
for (const declaration of this.ctx.
|
|
64875
|
+
for (const declaration of this.ctx.declarationsOfAllPackages()) {
|
|
64119
64876
|
if (!(declaration.kind === 23 /* PackageTypeDeclaration */ && declaration.entity.typeOrExtensionKind === 0 /* StructuredType */)) {
|
|
64120
64877
|
continue;
|
|
64121
64878
|
}
|
|
@@ -65723,7 +66480,7 @@ var IrBuilder = class {
|
|
|
65723
66480
|
return void 0;
|
|
65724
66481
|
}
|
|
65725
66482
|
const originalEntity = this.analyzer.entity.ofPackageFunctionDeclaration(declaration);
|
|
65726
|
-
const entity = this.entityMap.
|
|
66483
|
+
const entity = this.entityMap.getNamedFunctionEntity(originalEntity);
|
|
65727
66484
|
const parameters = this.buildParameterList(declaration.parameterClause.parameterList);
|
|
65728
66485
|
const body = this.buildFunctionBlockOfFunction(
|
|
65729
66486
|
declaration.block,
|
|
@@ -66104,7 +66861,7 @@ var IrBuilder = class {
|
|
|
66104
66861
|
return void 0;
|
|
66105
66862
|
}
|
|
66106
66863
|
const originalEntity = this.analyzer.entity.ofMethodDeclaration(declaration);
|
|
66107
|
-
const entity = this.entityMap.
|
|
66864
|
+
const entity = this.entityMap.getNamedFunctionEntity(originalEntity);
|
|
66108
66865
|
const decorators = this.buildDecorators(declaration.tagList);
|
|
66109
66866
|
const parameters = this.buildParameterList(declaration.parameterClause.parameterList);
|
|
66110
66867
|
const body = this.buildFunctionBlockOfFunction(
|
|
@@ -66252,7 +67009,7 @@ var IrBuilder = class {
|
|
|
66252
67009
|
if (checkResult.kind === "ok" && checkResult.value.ifTypeDoesNotImplementEnumerableThenEnumeratorMethod !== void 0) {
|
|
66253
67010
|
const method = checkResult.value.ifTypeDoesNotImplementEnumerableThenEnumeratorMethod;
|
|
66254
67011
|
ifExpressionIsNotEnumerableThenEnumeratorMethod = accessedFunction(
|
|
66255
|
-
this.entityMap.
|
|
67012
|
+
this.entityMap.getNamedFunctionEntity(method.getEntity()),
|
|
66256
67013
|
this.entityMap.getType(method.getReturnType())
|
|
66257
67014
|
);
|
|
66258
67015
|
}
|
|
@@ -66305,7 +67062,7 @@ var IrBuilder = class {
|
|
|
66305
67062
|
this.analyzer.resultLocalVariableEntity.ofNestedFunctionDeclaration(statement.declaration)
|
|
66306
67063
|
);
|
|
66307
67064
|
const originalEntity = this.analyzer.entity.ofNestedFunctionDeclaration(declaration);
|
|
66308
|
-
const entity = this.entityMap.
|
|
67065
|
+
const entity = this.entityMap.getNamedFunctionEntity(originalEntity);
|
|
66309
67066
|
const isAsync = this.analyzer.entity.ofNestedFunctionDeclaration(declaration).isAsync();
|
|
66310
67067
|
this.buildAndSaveTypeIfIsAnonymousTypeSpecifier(declaration.returnTypeAnnotation?.typeSpecifier);
|
|
66311
67068
|
return nestedFunctionDeclarationStatement(
|
|
@@ -66665,7 +67422,7 @@ var IrBuilder = class {
|
|
|
66665
67422
|
if (expression.expression.kind === 88 /* BaseExpression */) {
|
|
66666
67423
|
const meaning2 = this.analyzer.resolveBaseExpression(expression.expression).meaning;
|
|
66667
67424
|
if (meaning2.kind === "overridden-method-access") {
|
|
66668
|
-
const entity = this.entityMap.
|
|
67425
|
+
const entity = this.entityMap.getNamedFunctionEntity(meaning2.method.getEntity());
|
|
66669
67426
|
const returnType2 = this.entityMap.getType(meaning2.method.getReturnType());
|
|
66670
67427
|
receiver = methodAccessExpression(
|
|
66671
67428
|
baseExpression(),
|
|
@@ -66846,21 +67603,21 @@ var IrBuilder = class {
|
|
|
66846
67603
|
expression.block,
|
|
66847
67604
|
this.analyzer.resultLocalVariableEntity.ofFunctionLiteral(expression)
|
|
66848
67605
|
);
|
|
66849
|
-
const
|
|
66850
|
-
const isAsync =
|
|
66851
|
-
const returnType = this.entityMap.getType(
|
|
67606
|
+
const originalEntity = this.analyzer.entity.ofFunctionLiteral(expression);
|
|
67607
|
+
const isAsync = originalEntity.isAsync();
|
|
67608
|
+
const returnType = this.entityMap.getType(originalEntity.getReturnType());
|
|
66852
67609
|
this.buildAndSaveTypeIfIsAnonymousTypeSpecifier(expression.returnTypeAnnotation?.typeSpecifier);
|
|
66853
67610
|
return functionLiteral(parameters, body, isAsync, returnType, this.getSourceLocation(expression));
|
|
66854
67611
|
}
|
|
66855
67612
|
buildFunctionBlockLiteral(expression) {
|
|
66856
|
-
const
|
|
67613
|
+
const originalEntity = this.analyzer.entity.ofFunctionBlockLiteral(expression);
|
|
67614
|
+
const parameters = originalEntity.getParameters().map((p) => parameterDeclaration(this.entityMap.getVariableEntity(p), void 0, false));
|
|
66857
67615
|
const body = this.buildFunctionBlockOfFunction(
|
|
66858
67616
|
expression.block,
|
|
66859
67617
|
this.analyzer.resultLocalVariableEntity.ofFunctionBlockLiteral(expression)
|
|
66860
67618
|
);
|
|
66861
|
-
const
|
|
66862
|
-
const
|
|
66863
|
-
const returnType = this.entityMap.getType(type.getReturnType());
|
|
67619
|
+
const isAsync = originalEntity.isAsync();
|
|
67620
|
+
const returnType = this.entityMap.getType(originalEntity.getReturnType());
|
|
66864
67621
|
return functionLiteral(parameters, body, isAsync, returnType, this.getSourceLocation(expression));
|
|
66865
67622
|
}
|
|
66866
67623
|
buildParenthesizedExpression(expression) {
|
|
@@ -66919,7 +67676,7 @@ var IrBuilder = class {
|
|
|
66919
67676
|
Logger.errorAtNode("Ambiguous method access.", expression);
|
|
66920
67677
|
return textLiteral("Ambiguous method access.");
|
|
66921
67678
|
}
|
|
66922
|
-
const entity = this.entityMap.
|
|
67679
|
+
const entity = this.entityMap.getNamedFunctionEntity(func.getEntity());
|
|
66923
67680
|
const returnType = this.entityMap.getType(func.getReturnType());
|
|
66924
67681
|
const isCallee = this.expressionIsCallee(expression);
|
|
66925
67682
|
return functionAccessExpression(
|
|
@@ -66958,7 +67715,7 @@ var IrBuilder = class {
|
|
|
66958
67715
|
const typeEntity = this.getEntityFromType(meaning.type);
|
|
66959
67716
|
const typeAccess = typeAccessExpression(typeEntity);
|
|
66960
67717
|
const isCallee = this.expressionIsCallee(expression);
|
|
66961
|
-
const entity = this.entityMap.
|
|
67718
|
+
const entity = this.entityMap.getNamedFunctionEntity(method.getEntity());
|
|
66962
67719
|
const returnType = this.entityMap.getType(method.getReturnType());
|
|
66963
67720
|
return methodAccessExpression(
|
|
66964
67721
|
typeAccess,
|
|
@@ -67001,7 +67758,7 @@ var IrBuilder = class {
|
|
|
67001
67758
|
const expressionIr = this.buildExpression(expression.expression);
|
|
67002
67759
|
const isOptionalAccess = expression.expression.kind === 62 /* AssumptionExpression */;
|
|
67003
67760
|
const isCallee = this.expressionIsCallee(expression);
|
|
67004
|
-
const entity = this.entityMap.
|
|
67761
|
+
const entity = this.entityMap.getNamedFunctionEntity(originalFunctionEntity);
|
|
67005
67762
|
const returnType = this.entityMap.getType(method.getReturnType());
|
|
67006
67763
|
return methodAccessExpression(
|
|
67007
67764
|
expressionIr,
|
|
@@ -67280,7 +68037,7 @@ var IrBuilder = class {
|
|
|
67280
68037
|
receiver = this.createExplicitReceiver(originalEntity);
|
|
67281
68038
|
}
|
|
67282
68039
|
const isCallee = this.expressionIsCallee(expression);
|
|
67283
|
-
const entity = this.entityMap.
|
|
68040
|
+
const entity = this.entityMap.getNamedFunctionEntity(originalEntity);
|
|
67284
68041
|
const returnType = this.entityMap.getType(suitableFunction.getReturnType());
|
|
67285
68042
|
return receiver !== void 0 ? methodAccessExpression(
|
|
67286
68043
|
receiver,
|
|
@@ -67395,7 +68152,7 @@ var IrBuilder = class {
|
|
|
67395
68152
|
}
|
|
67396
68153
|
buildTagAsDecorator(tag, func) {
|
|
67397
68154
|
const args = tag.argumentList !== void 0 ? this.buildArgumentList(tag.argumentList, func.getEntity().getParameters()) : orderedArguments([], false);
|
|
67398
|
-
const entity = this.entityMap.
|
|
68155
|
+
const entity = this.entityMap.getNamedFunctionEntity(func.getEntity());
|
|
67399
68156
|
const returnType = this.entityMap.getType(func.getReturnType());
|
|
67400
68157
|
const functionCall = functionCallExpression(
|
|
67401
68158
|
accessedFunction(entity, returnType),
|
|
@@ -68977,12 +69734,12 @@ var Emitter = class _Emitter {
|
|
|
68977
69734
|
static {
|
|
68978
69735
|
this.IndexFileName = "index.mjs";
|
|
68979
69736
|
}
|
|
68980
|
-
emitToFileSystem(outputUri, outputAcceptor,
|
|
69737
|
+
emitToFileSystem(outputUri, outputAcceptor, taskController) {
|
|
68981
69738
|
return __async(this, null, function* () {
|
|
68982
69739
|
PerformanceMeasurement.markStart(2 /* Emitting */);
|
|
68983
69740
|
const declarationsUsageInfo = yield this.analyzer.collectDeclarationsUsageOfPackages(
|
|
68984
69741
|
this.targetPlatform,
|
|
68985
|
-
|
|
69742
|
+
taskController
|
|
68986
69743
|
);
|
|
68987
69744
|
const emitterPackages = Query.from(this.enumerateEmittingSourcePackages()).map((p) => this.createEmitterPackageFromSource(p, declarationsUsageInfo)).toArray();
|
|
68988
69745
|
const generalLowering = new GeneralLowering(this.ectx, emitterPackages);
|
|
@@ -69017,12 +69774,12 @@ var Emitter = class _Emitter {
|
|
|
69017
69774
|
PerformanceMeasurement.markEnd();
|
|
69018
69775
|
});
|
|
69019
69776
|
}
|
|
69020
|
-
emitToString(
|
|
69777
|
+
emitToString(taskController) {
|
|
69021
69778
|
return __async(this, null, function* () {
|
|
69022
69779
|
PerformanceMeasurement.markStart(2 /* Emitting */);
|
|
69023
69780
|
const declarationsUsageInfo = yield this.analyzer.collectDeclarationsUsageOfPackages(
|
|
69024
69781
|
this.targetPlatform,
|
|
69025
|
-
|
|
69782
|
+
taskController
|
|
69026
69783
|
);
|
|
69027
69784
|
const emitterPackages = Query.from(this.enumerateEmittingSourcePackages()).map((p) => this.createEmitterPackageFromSource(p, declarationsUsageInfo)).toArray();
|
|
69028
69785
|
const generalLowering = new GeneralLowering(this.ectx, emitterPackages);
|
|
@@ -69054,7 +69811,7 @@ var Emitter = class _Emitter {
|
|
|
69054
69811
|
}
|
|
69055
69812
|
enumerateEmittingSourcePackages() {
|
|
69056
69813
|
const packageGraph = new SourcePackageDependencyGraph(this.analyzer);
|
|
69057
|
-
return Query.from(packageGraph.
|
|
69814
|
+
return Query.from(packageGraph.packagesForTargetPlatform(this.targetPlatform)).filter((p) => p.kind === "program" && !p.configuration.isInterfacePackage() || p.kind === "text-translation");
|
|
69058
69815
|
}
|
|
69059
69816
|
createPackageWithMainFunction(packages, mainSourcePackage) {
|
|
69060
69817
|
const packageEntity2 = packageEntity("Launch", mainSourcePackage.locale, true, false);
|
|
@@ -70104,10 +70861,8 @@ export {
|
|
|
70104
70861
|
isNonEmptyArray,
|
|
70105
70862
|
Option,
|
|
70106
70863
|
Result,
|
|
70107
|
-
ThrottledCancellationToken,
|
|
70108
70864
|
TreeQuery,
|
|
70109
70865
|
TypeMemberQuery,
|
|
70110
|
-
traverseTreeWithCancellationToken,
|
|
70111
70866
|
traverseTree,
|
|
70112
70867
|
TraversalController,
|
|
70113
70868
|
Uri,
|
|
@@ -70116,7 +70871,8 @@ export {
|
|
|
70116
70871
|
setUserLocale,
|
|
70117
70872
|
WithDiagnostics_ok,
|
|
70118
70873
|
WithDiagnostics_error,
|
|
70119
|
-
|
|
70874
|
+
TaskController,
|
|
70875
|
+
yieldTask,
|
|
70120
70876
|
Diagnostic,
|
|
70121
70877
|
DiagnosticLocation,
|
|
70122
70878
|
DiagnosticAcceptorWithArgumentFactory,
|
|
@@ -70195,6 +70951,7 @@ export {
|
|
|
70195
70951
|
isNamedTypeMemberEntity,
|
|
70196
70952
|
isEntityWithTypeParameters,
|
|
70197
70953
|
isEntityWithParameters,
|
|
70954
|
+
isNamedFunctionEntity,
|
|
70198
70955
|
EntityContext,
|
|
70199
70956
|
entityToStringDecorator,
|
|
70200
70957
|
EntityHidingLevel_type,
|
|
@@ -70254,9 +71011,15 @@ export {
|
|
|
70254
71011
|
modifierToModifierFlag,
|
|
70255
71012
|
DereferenceOperatorDeclarationEntity,
|
|
70256
71013
|
DestructorDeclarationEntity,
|
|
71014
|
+
NodeTypeUtils,
|
|
71015
|
+
visitChildren,
|
|
71016
|
+
visitChildrenRecursively,
|
|
71017
|
+
isNarrowableReferenceExpression,
|
|
70257
71018
|
PackageFunctionDeclarationEntity,
|
|
70258
71019
|
MethodDeclarationEntity,
|
|
70259
71020
|
NestedFunctionDeclarationEntity,
|
|
71021
|
+
FunctionLiteralEntity,
|
|
71022
|
+
FunctionBlockLiteralEntity,
|
|
70260
71023
|
PackageFunctionTypeDeclarationEntity,
|
|
70261
71024
|
AnonymousFunctionTypeDeclarationEntity,
|
|
70262
71025
|
PackageVariableGetterDeclarationEntity,
|
|
@@ -70314,7 +71077,6 @@ export {
|
|
|
70314
71077
|
TextTranslationDeclarationEntity,
|
|
70315
71078
|
SourceTypeExtensionEntity,
|
|
70316
71079
|
SourceTypeParameterEntity,
|
|
70317
|
-
NodeTypeUtils,
|
|
70318
71080
|
PackageVariableDeclarationEntity,
|
|
70319
71081
|
ComputedPackageVariableDeclarationEntity,
|
|
70320
71082
|
FieldDeclarationEntity,
|
|
@@ -70355,9 +71117,6 @@ export {
|
|
|
70355
71117
|
AccessedFunctionParameter,
|
|
70356
71118
|
ImportedPackageNameTree,
|
|
70357
71119
|
PackageMemberLookup,
|
|
70358
|
-
visitChildren,
|
|
70359
|
-
visitChildrenRecursively,
|
|
70360
|
-
isNarrowableReferenceExpression,
|
|
70361
71120
|
SourceFileMembers,
|
|
70362
71121
|
semantic_context_exports,
|
|
70363
71122
|
Analyzer12 as Analyzer,
|
|
@@ -70381,7 +71140,7 @@ export {
|
|
|
70381
71140
|
ExpressionDenotesOperatorCheckResult,
|
|
70382
71141
|
DeclaredTypeMemberEntities,
|
|
70383
71142
|
ExpressionAnalysisOptions2 as ExpressionAnalysisOptions,
|
|
70384
|
-
|
|
71143
|
+
SourceFileAnalyzer,
|
|
70385
71144
|
SourcePackageDependencyGraph,
|
|
70386
71145
|
WellKnownDeclarationsLoadError,
|
|
70387
71146
|
LocalizedWellKnownDeclarations,
|