@artel/artc 0.6.26027 → 0.6.26029
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 +2 -2
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +1 -1
- package/build/{chunk-HOPCXROF.js → chunk-EF7FQVSZ.js} +1 -1
- package/build/{chunk-4HXQNBLV.js → chunk-F54T7XQ7.js} +2 -2
- package/build/{chunk-IJGHVDYP.js → chunk-OFV2Q5YR.js} +1145 -1011
- package/build/types/analysis/a/SourceFileAnalyzer.d.ts +59 -28
- package/build/types/diagnostic/DiagnosticCode.d.ts +1 -0
- package/build/types/emitter/Entities.d.ts +3 -0
- package/build/types/emitter/IrFactory.d.ts +1 -1
- package/build/types/emitter/Transformer.d.ts +2 -0
- package/build/types/emitter/ir/Nodes.d.ts +2 -1
- package/package.json +1 -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.26029" : "";
|
|
768
768
|
var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel", ".\u0430\u0440\u0442\u043C", ".\u0430\u0440\u0442\u0435\u043B\u044C\u043C", ".artm", ".artelm"];
|
|
769
769
|
var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
|
|
770
770
|
var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
|
|
@@ -3913,7 +3913,7 @@ var StructuredTypeKind = /* @__PURE__ */ ((StructuredTypeKind3) => {
|
|
|
3913
3913
|
|
|
3914
3914
|
// source/entities/TypeEntity.ts
|
|
3915
3915
|
var TypeEntity;
|
|
3916
|
-
((
|
|
3916
|
+
((TypeEntity15) => {
|
|
3917
3917
|
function isAbstract(entity) {
|
|
3918
3918
|
switch (entity.typeEntityKind) {
|
|
3919
3919
|
case 1 /* Structured */:
|
|
@@ -3928,7 +3928,7 @@ var TypeEntity;
|
|
|
3928
3928
|
Debug.never(entity);
|
|
3929
3929
|
}
|
|
3930
3930
|
}
|
|
3931
|
-
|
|
3931
|
+
TypeEntity15.isAbstract = isAbstract;
|
|
3932
3932
|
function isAbstractOrAliasedAbstract(entity) {
|
|
3933
3933
|
switch (entity.typeEntityKind) {
|
|
3934
3934
|
case 1 /* Structured */:
|
|
@@ -3946,7 +3946,7 @@ var TypeEntity;
|
|
|
3946
3946
|
Debug.never(entity);
|
|
3947
3947
|
}
|
|
3948
3948
|
}
|
|
3949
|
-
|
|
3949
|
+
TypeEntity15.isAbstractOrAliasedAbstract = isAbstractOrAliasedAbstract;
|
|
3950
3950
|
function isBasic(entity) {
|
|
3951
3951
|
switch (entity.typeEntityKind) {
|
|
3952
3952
|
case 1 /* Structured */:
|
|
@@ -3961,7 +3961,7 @@ var TypeEntity;
|
|
|
3961
3961
|
Debug.never(entity);
|
|
3962
3962
|
}
|
|
3963
3963
|
}
|
|
3964
|
-
|
|
3964
|
+
TypeEntity15.isBasic = isBasic;
|
|
3965
3965
|
function isBasicOrAliasedBasic(entity) {
|
|
3966
3966
|
switch (entity.typeEntityKind) {
|
|
3967
3967
|
case 1 /* Structured */:
|
|
@@ -3979,7 +3979,7 @@ var TypeEntity;
|
|
|
3979
3979
|
Debug.never(entity);
|
|
3980
3980
|
}
|
|
3981
3981
|
}
|
|
3982
|
-
|
|
3982
|
+
TypeEntity15.isBasicOrAliasedBasic = isBasicOrAliasedBasic;
|
|
3983
3983
|
})(TypeEntity || (TypeEntity = {}));
|
|
3984
3984
|
var TypeEntityKind = /* @__PURE__ */ ((TypeEntityKind2) => {
|
|
3985
3985
|
TypeEntityKind2[TypeEntityKind2["Function"] = 0] = "Function";
|
|
@@ -12255,6 +12255,7 @@ var DiagnosticCode = /* @__PURE__ */ ((DiagnosticCode2) => {
|
|
|
12255
12255
|
DiagnosticCode2[DiagnosticCode2["CannotAssignValueBecauseWriteFunctionIsNotDefined"] = 2243] = "CannotAssignValueBecauseWriteFunctionIsNotDefined";
|
|
12256
12256
|
DiagnosticCode2[DiagnosticCode2["CannotAssignValueBecauseWriteFunctionIsHidden"] = 2244] = "CannotAssignValueBecauseWriteFunctionIsHidden";
|
|
12257
12257
|
DiagnosticCode2[DiagnosticCode2["ReadFunctionMustHaveTheSameTypeAsWriteFunction"] = 2245] = "ReadFunctionMustHaveTheSameTypeAsWriteFunction";
|
|
12258
|
+
DiagnosticCode2[DiagnosticCode2["AspectHasAlreadyBeenExtendedWithDifferentTypeArguments0"] = 2246] = "AspectHasAlreadyBeenExtendedWithDifferentTypeArguments0";
|
|
12258
12259
|
DiagnosticCode2[DiagnosticCode2["CannotFindTsLibDirectoryBaseSearchPaths0"] = 3e3] = "CannotFindTsLibDirectoryBaseSearchPaths0";
|
|
12259
12260
|
DiagnosticCode2[DiagnosticCode2["SourceFile0IsNotPartOfThePackageAndWontBeLoaded"] = 3001] = "SourceFile0IsNotPartOfThePackageAndWontBeLoaded";
|
|
12260
12261
|
DiagnosticCode2[DiagnosticCode2["ProgramWithoutMainPackageCannotBeCompiled"] = 3002] = "ProgramWithoutMainPackageCannotBeCompiled";
|
|
@@ -12600,6 +12601,7 @@ var englishErrorMessages = {
|
|
|
12600
12601
|
[2243 /* CannotAssignValueBecauseWriteFunctionIsNotDefined */]: "Cannot assign value because write function is not defined.",
|
|
12601
12602
|
[2244 /* CannotAssignValueBecauseWriteFunctionIsHidden */]: "Cannot assign value because write function is hidden.",
|
|
12602
12603
|
[2245 /* ReadFunctionMustHaveTheSameTypeAsWriteFunction */]: "Read function must have the same type as write function.",
|
|
12604
|
+
[2246 /* AspectHasAlreadyBeenExtendedWithDifferentTypeArguments0 */]: "Aspect has already been extended with different type arguments: '{0}'.",
|
|
12603
12605
|
[3e3 /* CannotFindTsLibDirectoryBaseSearchPaths0 */]: "Can not find directory with TypeScript library. Base search paths: {0}.",
|
|
12604
12606
|
[3001 /* SourceFile0IsNotPartOfThePackageAndWontBeLoaded */]: "Source file '{0}' is not part of the package and won't be loaded.",
|
|
12605
12607
|
[3002 /* ProgramWithoutMainPackageCannotBeCompiled */]: "Program without main package cannot be compiled.",
|
|
@@ -12899,6 +12901,7 @@ var russianErrorMessages = {
|
|
|
12899
12901
|
[2243 /* CannotAssignValueBecauseWriteFunctionIsNotDefined */]: "\u041D\u0435\u043B\u044C\u0437\u044F \u043F\u0440\u0438\u0441\u0432\u043E\u0438\u0442\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435, \u043F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u0443\u043D\u043A\u0446\u0438\u044F \u0437\u0430\u043F\u0438\u0441\u0438.",
|
|
12900
12902
|
[2244 /* CannotAssignValueBecauseWriteFunctionIsHidden */]: "\u041D\u0435\u043B\u044C\u0437\u044F \u043F\u0440\u0438\u0441\u0432\u043E\u0438\u0442\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435, \u043F\u043E\u0441\u043A\u043E\u043B\u044C\u043A\u0443 \u0444\u0443\u043D\u043A\u0446\u0438\u044F \u0437\u0430\u043F\u0438\u0441\u0438 \u0441\u043A\u0440\u044B\u0442\u0430.",
|
|
12901
12903
|
[2245 /* ReadFunctionMustHaveTheSameTypeAsWriteFunction */]: "\u0424\u0443\u043D\u043A\u0446\u0438\u044F \u0447\u0442\u0435\u043D\u0438\u044F \u0434\u043E\u043B\u0436\u043D\u0430 \u0438\u043C\u0435\u0442\u044C \u0442\u0430\u043A\u043E\u0439 \u0436\u0435 \u0442\u0438\u043F, \u043A\u0430\u043A \u0444\u0443\u043D\u043A\u0446\u0438\u044F \u0437\u0430\u043F\u0438\u0441\u0438.",
|
|
12904
|
+
[2246 /* AspectHasAlreadyBeenExtendedWithDifferentTypeArguments0 */]: "\u0410\u0441\u043F\u0435\u043A\u0442 \u0443\u0436\u0435 \u0431\u044B\u043B \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D \u0441 \u0434\u0440\u0443\u0433\u0438\u043C\u0438 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u0430\u043C\u0438 \u0442\u0438\u043F\u0430: '{0}'.",
|
|
12902
12905
|
[3e3 /* 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}.",
|
|
12903
12906
|
[3001 /* 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.",
|
|
12904
12907
|
[3002 /* 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.",
|
|
@@ -26794,6 +26797,7 @@ var FunctionEntityDetails = class {
|
|
|
26794
26797
|
this.isJavaScriptIteratorMethod = false;
|
|
26795
26798
|
this.hasObjectParameter = false;
|
|
26796
26799
|
this.isSetter = false;
|
|
26800
|
+
this.nameSource = void 0;
|
|
26797
26801
|
}
|
|
26798
26802
|
};
|
|
26799
26803
|
var VariableEntityDetails = class {
|
|
@@ -26808,6 +26812,7 @@ var VariableEntityDetails = class {
|
|
|
26808
26812
|
this.isStatic = false;
|
|
26809
26813
|
this.isConst = false;
|
|
26810
26814
|
this.isObjectParameter = false;
|
|
26815
|
+
this.nameSource = void 0;
|
|
26811
26816
|
}
|
|
26812
26817
|
};
|
|
26813
26818
|
var TypeOrExtensionEntityDetails = class {
|
|
@@ -26822,6 +26827,7 @@ var TypeOrExtensionEntityDetails = class {
|
|
|
26822
26827
|
*/
|
|
26823
26828
|
this.areOwnComputedNamesOfMembersResolved = false;
|
|
26824
26829
|
this.implicitlyImplementedAbstractMembersByImplementingMember = /* @__PURE__ */ new Map();
|
|
26830
|
+
this.nameSource = void 0;
|
|
26825
26831
|
}
|
|
26826
26832
|
};
|
|
26827
26833
|
var PackageEntityDetails = class {
|
|
@@ -28099,10 +28105,11 @@ var FunctionLiteral2 = class _FunctionLiteral {
|
|
|
28099
28105
|
}
|
|
28100
28106
|
};
|
|
28101
28107
|
var JsFunctionLiteral = class _JsFunctionLiteral {
|
|
28102
|
-
constructor(parameters, body, isAsync, returnType, sourceLocation) {
|
|
28108
|
+
constructor(parameters, body, isAsync, isGenerator, returnType, sourceLocation) {
|
|
28103
28109
|
this.parameters = parameters;
|
|
28104
28110
|
this.body = body;
|
|
28105
28111
|
this.isAsync = isAsync;
|
|
28112
|
+
this.isGenerator = isGenerator;
|
|
28106
28113
|
this.returnType = returnType;
|
|
28107
28114
|
this.sourceLocation = sourceLocation;
|
|
28108
28115
|
this.kind = 39 /* JsFunctionLiteral */;
|
|
@@ -28112,6 +28119,7 @@ var JsFunctionLiteral = class _JsFunctionLiteral {
|
|
|
28112
28119
|
this.parameters.map((p) => p.clone()),
|
|
28113
28120
|
this.body.clone(),
|
|
28114
28121
|
this.isAsync,
|
|
28122
|
+
this.isGenerator,
|
|
28115
28123
|
this.returnType,
|
|
28116
28124
|
this.sourceLocation
|
|
28117
28125
|
);
|
|
@@ -30561,8 +30569,8 @@ function functionAccessExpression(func, isCallee, sourceLocation) {
|
|
|
30561
30569
|
function functionLiteral(parameters, body, isAsync, returnType, sourceLocation) {
|
|
30562
30570
|
return new FunctionLiteral2(parameters, body, isAsync, returnType, sourceLocation);
|
|
30563
30571
|
}
|
|
30564
|
-
function jsFunctionLiteral(parameters, body, isAsync, returnType, sourceLocation) {
|
|
30565
|
-
return new JsFunctionLiteral(parameters, body, isAsync, returnType, sourceLocation);
|
|
30572
|
+
function jsFunctionLiteral(parameters, body, isAsync, isGenerator, returnType, sourceLocation) {
|
|
30573
|
+
return new JsFunctionLiteral(parameters, body, isAsync, isGenerator, returnType, sourceLocation);
|
|
30566
30574
|
}
|
|
30567
30575
|
function nestedFunctionDeclarationStatement(entity, parameters, body, isAsync, isGenerator, sourceLocation) {
|
|
30568
30576
|
const declaration = new NestedFunctionDeclaration2(entity, parameters, body, isAsync, isGenerator, sourceLocation);
|
|
@@ -31077,6 +31085,9 @@ var Transformer = class {
|
|
|
31077
31085
|
get transformedDeclaration() {
|
|
31078
31086
|
return this.transformedDeclaration_;
|
|
31079
31087
|
}
|
|
31088
|
+
get transformedTypeDeclaration() {
|
|
31089
|
+
return this.transformedTypeDeclaration_;
|
|
31090
|
+
}
|
|
31080
31091
|
transformChildren(node) {
|
|
31081
31092
|
switch (node.kind) {
|
|
31082
31093
|
case 0 /* AsExpression */:
|
|
@@ -31822,13 +31833,16 @@ var Transformer = class {
|
|
|
31822
31833
|
}
|
|
31823
31834
|
transformPackageTypeDeclarationChildren(declaration) {
|
|
31824
31835
|
const saveTransformedDeclaration = this.transformedDeclaration_;
|
|
31836
|
+
const saveTransformedTypeDeclaration = this.transformedTypeDeclaration_;
|
|
31825
31837
|
this.transformedDeclaration_ = declaration;
|
|
31838
|
+
this.transformedTypeDeclaration_ = declaration;
|
|
31826
31839
|
declaration.decorators = declaration.decorators.map((d) => this.transformDecorator(d));
|
|
31827
31840
|
declaration.members = this.transformArrayWithErrorBoundary(
|
|
31828
31841
|
declaration.members,
|
|
31829
31842
|
(m) => this.transformTypeMemberDeclaration(m)
|
|
31830
31843
|
);
|
|
31831
31844
|
this.transformedDeclaration_ = saveTransformedDeclaration;
|
|
31845
|
+
this.transformedTypeDeclaration_ = saveTransformedTypeDeclaration;
|
|
31832
31846
|
}
|
|
31833
31847
|
transformTypeMemberDeclaration(declaration) {
|
|
31834
31848
|
let result;
|
|
@@ -32023,9 +32037,12 @@ var Transformer = class {
|
|
|
32023
32037
|
}
|
|
32024
32038
|
transformPackageVariantTypeDeclarationChildren(declaration) {
|
|
32025
32039
|
const saveTransformedDeclaration = this.transformedDeclaration_;
|
|
32040
|
+
const saveTransformedTypeDeclaration = this.transformedTypeDeclaration_;
|
|
32026
32041
|
this.transformedDeclaration_ = declaration;
|
|
32042
|
+
this.transformedTypeDeclaration_ = declaration;
|
|
32027
32043
|
declaration.variants = declaration.variants.map((v) => this.transformVariantValueDeclaration(v));
|
|
32028
32044
|
this.transformedDeclaration_ = saveTransformedDeclaration;
|
|
32045
|
+
this.transformedTypeDeclaration_ = saveTransformedTypeDeclaration;
|
|
32029
32046
|
}
|
|
32030
32047
|
transformVariantValueDeclaration(node) {
|
|
32031
32048
|
let action;
|
|
@@ -33073,6 +33090,15 @@ var GeneralLoweringContext = class {
|
|
|
33073
33090
|
createJsFunctionCallMethodAccess(object, isOptionalChaining) {
|
|
33074
33091
|
return jsPropertyAccessExpression(object, isOptionalChaining, "call", this.ectx.standardTypes.func);
|
|
33075
33092
|
}
|
|
33093
|
+
createBindMethodCall(object, isOptionalChaining, argument2) {
|
|
33094
|
+
const bindMethodAccess = jsPropertyAccessExpression(
|
|
33095
|
+
object,
|
|
33096
|
+
isOptionalChaining,
|
|
33097
|
+
"bind",
|
|
33098
|
+
this.ectx.standardTypes.func
|
|
33099
|
+
);
|
|
33100
|
+
return callExpression(bindMethodAccess, false, [argument2], false, this.ectx.standardTypes.object, false);
|
|
33101
|
+
}
|
|
33076
33102
|
createKeyForComputedNameWithSymbolKey(symbolDeclaration) {
|
|
33077
33103
|
return symbolDeclaration.ifTypeMemberThenContainingType !== void 0 ? staticFieldGetAccess(symbolDeclaration) : variableGetAccess(symbolDeclaration);
|
|
33078
33104
|
}
|
|
@@ -35634,9 +35660,19 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
|
|
|
35634
35660
|
this.objectParameterLowering.tryRemoveObjectParameterFromNestedFunction(node);
|
|
35635
35661
|
return preserveNode();
|
|
35636
35662
|
},
|
|
35663
|
+
transformNestedFunctionDeclarationStatement: (node) => {
|
|
35664
|
+
if (transformer.transformedTypeDeclaration !== void 0 && !node.declaration.entity.details.hasObjectParameter) {
|
|
35665
|
+
return replaceStatement(this.bindThisToNestedFunctionDeclaration(node));
|
|
35666
|
+
}
|
|
35667
|
+
return preserveStatement();
|
|
35668
|
+
},
|
|
35637
35669
|
transformFunctionJsObjectLiteralProperty: (node) => {
|
|
35638
35670
|
this.objectParameterLowering.tryRemoveObjectParameterFromFunctionJsObjectLiteralProperty(node);
|
|
35639
35671
|
return preserveNode();
|
|
35672
|
+
},
|
|
35673
|
+
transformBlockStatement: (node) => {
|
|
35674
|
+
this.moveNestedFunctionsToTheBeginningOfTheBlock(node);
|
|
35675
|
+
return preserveStatement();
|
|
35640
35676
|
}
|
|
35641
35677
|
});
|
|
35642
35678
|
transformer.transformPackage(this.pkg.ir);
|
|
@@ -35855,6 +35891,40 @@ var UsagesLowering = class _UsagesLowering extends ExecutableCodeLowering {
|
|
|
35855
35891
|
const { expression, tempVariables } = this.replaceCompoundAssignmentWithSimpleAssignment(node);
|
|
35856
35892
|
return replaceExpression(expression, tempVariables);
|
|
35857
35893
|
}
|
|
35894
|
+
moveNestedFunctionsToTheBeginningOfTheBlock(node) {
|
|
35895
|
+
const statements = node.statements;
|
|
35896
|
+
if (!statements.some((s) => s.kind === 33 /* NestedFunctionDeclarationStatement */)) {
|
|
35897
|
+
return;
|
|
35898
|
+
}
|
|
35899
|
+
node.statements = [
|
|
35900
|
+
...statements.filter((s) => s.kind === 33 /* NestedFunctionDeclarationStatement */),
|
|
35901
|
+
...statements.filter((s) => s.kind !== 33 /* NestedFunctionDeclarationStatement */)
|
|
35902
|
+
];
|
|
35903
|
+
}
|
|
35904
|
+
bindThisToNestedFunctionDeclaration(node) {
|
|
35905
|
+
const declaration = node.declaration;
|
|
35906
|
+
const jsFunctionLiteral2 = jsFunctionLiteral(
|
|
35907
|
+
declaration.parameters,
|
|
35908
|
+
declaration.body,
|
|
35909
|
+
declaration.isAsync,
|
|
35910
|
+
declaration.isGenerator,
|
|
35911
|
+
declaration.entity.returnType,
|
|
35912
|
+
declaration.sourceLocation
|
|
35913
|
+
);
|
|
35914
|
+
const bindCall = this.ctx.createBindMethodCall(
|
|
35915
|
+
jsFunctionLiteral2,
|
|
35916
|
+
false,
|
|
35917
|
+
thisExpression(this.ctx.ectx.standardTypes.object)
|
|
35918
|
+
);
|
|
35919
|
+
const localVariableEntity2 = localVariableEntity(
|
|
35920
|
+
declaration.entity.name,
|
|
35921
|
+
this.ctx.ectx.standardTypes.func,
|
|
35922
|
+
this.packageEntity,
|
|
35923
|
+
true
|
|
35924
|
+
);
|
|
35925
|
+
declaration.entity.details.nameSource = localVariableEntity2;
|
|
35926
|
+
return localVariableDeclarationStatement(localVariableEntity2, bindCall, node.sourceLocation);
|
|
35927
|
+
}
|
|
35858
35928
|
};
|
|
35859
35929
|
var OperatorsUsageLowering = class extends ExecutableCodeLowering {
|
|
35860
35930
|
tryLowerPrefixUnaryExpression(node) {
|
|
@@ -36417,6 +36487,7 @@ var ObjectParameterLowering = class extends ExecutableCodeLowering {
|
|
|
36417
36487
|
node.parameters.slice(1),
|
|
36418
36488
|
node.body,
|
|
36419
36489
|
node.isAsync,
|
|
36490
|
+
false,
|
|
36420
36491
|
node.returnType,
|
|
36421
36492
|
node.sourceLocation
|
|
36422
36493
|
);
|
|
@@ -39281,7 +39352,8 @@ var _IrToJs = class _IrToJs {
|
|
|
39281
39352
|
const parameters = this.convertParameters(expression.parameters);
|
|
39282
39353
|
const body = this.convertBlockStatement(expression.body);
|
|
39283
39354
|
const async = expression.isAsync;
|
|
39284
|
-
const
|
|
39355
|
+
const generator = expression.isGenerator;
|
|
39356
|
+
const result = js.functionExpression(void 0, parameters, body, generator, async);
|
|
39285
39357
|
this.addNodeLocation(result, expression);
|
|
39286
39358
|
return result;
|
|
39287
39359
|
}
|
|
@@ -39942,7 +40014,11 @@ var _IrToJs = class _IrToJs {
|
|
|
39942
40014
|
}
|
|
39943
40015
|
}
|
|
39944
40016
|
getEntityName(entity) {
|
|
39945
|
-
|
|
40017
|
+
let namedEntity = entity;
|
|
40018
|
+
while (namedEntity.details.nameSource !== void 0) {
|
|
40019
|
+
namedEntity = namedEntity.details.nameSource;
|
|
40020
|
+
}
|
|
40021
|
+
return this.entityNameOverrides?.get(namedEntity) ?? namedEntity.name;
|
|
39946
40022
|
}
|
|
39947
40023
|
convertArrayWithErrorBoundary(array, convert) {
|
|
39948
40024
|
const result = new Array();
|
|
@@ -60694,518 +60770,375 @@ var SourceFileAnalyzer = class {
|
|
|
60694
60770
|
});
|
|
60695
60771
|
}
|
|
60696
60772
|
analyzeNode(node, controller) {
|
|
60773
|
+
let result = void 0;
|
|
60697
60774
|
switch (node.kind) {
|
|
60698
|
-
case 86 /* IdentifierExpression */:
|
|
60775
|
+
case 86 /* IdentifierExpression */:
|
|
60699
60776
|
this.checkIdentifierExpression(node);
|
|
60700
60777
|
break;
|
|
60701
|
-
|
|
60702
|
-
case 65 /* CallExpression */: {
|
|
60778
|
+
case 65 /* CallExpression */:
|
|
60703
60779
|
this.checkCallExpression(node);
|
|
60704
60780
|
break;
|
|
60705
|
-
|
|
60706
|
-
|
|
60707
|
-
this.analyzer.resolveAutotypeCallExpression(node);
|
|
60781
|
+
case 66 /* AutotypeCallExpression */:
|
|
60782
|
+
this.checkAutotypeCallExpression(node);
|
|
60708
60783
|
break;
|
|
60709
|
-
|
|
60710
|
-
case 67 /* IndexedAccessExpression */: {
|
|
60784
|
+
case 67 /* IndexedAccessExpression */:
|
|
60711
60785
|
this.checkIndexedAccessExpression(node);
|
|
60712
60786
|
break;
|
|
60713
|
-
|
|
60714
|
-
case 75 /* DereferenceExpression */: {
|
|
60787
|
+
case 75 /* DereferenceExpression */:
|
|
60715
60788
|
this.checkDereferenceExpression(node);
|
|
60716
60789
|
break;
|
|
60717
|
-
|
|
60718
|
-
|
|
60719
|
-
this.analyzer.resolveTag(node);
|
|
60790
|
+
case 150 /* Tag */:
|
|
60791
|
+
this.checkTag(node);
|
|
60720
60792
|
break;
|
|
60721
|
-
|
|
60722
|
-
|
|
60723
|
-
const resolutionResult = this.analyzer.resolveNamedTypeSpecifier(node);
|
|
60724
|
-
if (resolutionResult.type !== void 0) {
|
|
60725
|
-
const entity = resolutionResult.type.getEntity();
|
|
60726
|
-
if (entity !== void 0) {
|
|
60727
|
-
const typeArgumentCount = node.typeArgumentClause?.typeArgumentList.typeArguments.count() ?? 0;
|
|
60728
|
-
this.analyzer.checkTypeArgumentCount(
|
|
60729
|
-
typeArgumentCount,
|
|
60730
|
-
entity.getTypeParameters(),
|
|
60731
|
-
this.diagnosticAcceptor,
|
|
60732
|
-
node.typeArgumentClause ?? node.qualifiedName
|
|
60733
|
-
);
|
|
60734
|
-
const substitutions = resolutionResult.type.getSubstitutions();
|
|
60735
|
-
this.checkTypeArgumentTypesAreAssignableToConstraints(
|
|
60736
|
-
entity.getTypeParameters(),
|
|
60737
|
-
substitutions,
|
|
60738
|
-
void 0,
|
|
60739
|
-
node.typeArgumentClause ?? node
|
|
60740
|
-
);
|
|
60741
|
-
}
|
|
60742
|
-
}
|
|
60793
|
+
case 10 /* NamedTypeSpecifier */:
|
|
60794
|
+
this.checkNamedTypeSpecifier(node);
|
|
60743
60795
|
break;
|
|
60744
|
-
|
|
60745
|
-
case 37 /* ExtendedTypeClause */: {
|
|
60796
|
+
case 37 /* ExtendedTypeClause */:
|
|
60746
60797
|
break;
|
|
60747
|
-
|
|
60748
|
-
case 73 /* MemberAccessExpression */: {
|
|
60798
|
+
case 73 /* MemberAccessExpression */:
|
|
60749
60799
|
this.checkMemberAccessExpression(node);
|
|
60750
60800
|
break;
|
|
60751
|
-
|
|
60752
|
-
|
|
60753
|
-
this.analyzer.resolveLocalizableTextOrTextTemplate(node);
|
|
60801
|
+
case 82 /* LocalizableTextLiteral */:
|
|
60802
|
+
this.checkLocalizableTextLiteral(node);
|
|
60754
60803
|
break;
|
|
60755
|
-
|
|
60756
|
-
|
|
60757
|
-
const resolved = this.analyzer.resolveLocalizableTextOrTextTemplate(node);
|
|
60758
|
-
if (resolved !== void 0) {
|
|
60759
|
-
const spans = node.spanList.spans;
|
|
60760
|
-
const parameters = resolved.getParameters();
|
|
60761
|
-
if (spans.length === parameters.length) {
|
|
60762
|
-
for (let i = 0; i < spans.length; i++) {
|
|
60763
|
-
const argument2 = spans[i].expression;
|
|
60764
|
-
const parameter = parameters[i];
|
|
60765
|
-
this.checkExpressionTypeIsAssignableToTargetType(argument2, parameter.getType());
|
|
60766
|
-
}
|
|
60767
|
-
}
|
|
60768
|
-
}
|
|
60804
|
+
case 77 /* LocalizableTextTemplateLiteral */:
|
|
60805
|
+
this.checkLocalizableTextTemplateLiteral(node);
|
|
60769
60806
|
break;
|
|
60770
|
-
|
|
60771
|
-
|
|
60772
|
-
if (this.sourceFile.package.kind === "program") {
|
|
60773
|
-
this.createAndAddDiagnostic(
|
|
60774
|
-
2051 /* TranslationsCanOnlyBeDeclaredInTranslationPackage */,
|
|
60775
|
-
node.translationsKeyword
|
|
60776
|
-
);
|
|
60777
|
-
controller.skipChildrenTraverse();
|
|
60778
|
-
} else if (this.sourceFile.package.kind === "translation") {
|
|
60779
|
-
if (this.resolvedTranslationPackage === void 0) {
|
|
60780
|
-
this.createAndAddDiagnostic(
|
|
60781
|
-
2052 /* UnknownTranslatingPackage0 */,
|
|
60782
|
-
node.translationsKeyword,
|
|
60783
|
-
[this.sourceFile.package.configuration.targetPackageName.toString()]
|
|
60784
|
-
);
|
|
60785
|
-
controller.skipChildrenTraverse();
|
|
60786
|
-
}
|
|
60787
|
-
} else if (this.sourceFile.package.kind === "text-translation") {
|
|
60788
|
-
const textTranslationPackage = this.textTranslationPackage;
|
|
60789
|
-
const targetPackage = textTranslationPackage?.getTargetPackage();
|
|
60790
|
-
if (targetPackage === void 0 || textTranslationPackage === void 0) {
|
|
60791
|
-
this.createAndAddDiagnostic(
|
|
60792
|
-
2052 /* UnknownTranslatingPackage0 */,
|
|
60793
|
-
node.translationsKeyword,
|
|
60794
|
-
[this.sourceFile.package.configuration.targetPackageName.toString()]
|
|
60795
|
-
);
|
|
60796
|
-
controller.skipChildrenTraverse();
|
|
60797
|
-
} else {
|
|
60798
|
-
if (textTranslationPackage.isPrimary()) {
|
|
60799
|
-
const packages = this.analyzer.getTextTranslationPackagesOfTargetPackage(targetPackage);
|
|
60800
|
-
if (packages !== void 0 && packages.some((p) => p.isPrimary() && p !== textTranslationPackage)) {
|
|
60801
|
-
this.createAndAddDiagnostic(
|
|
60802
|
-
2196 /* OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary */,
|
|
60803
|
-
node.translationsKeyword,
|
|
60804
|
-
[]
|
|
60805
|
-
);
|
|
60806
|
-
}
|
|
60807
|
-
}
|
|
60808
|
-
if (this.sourceFile.package.sourceFiles[0] === this.sourceFile) {
|
|
60809
|
-
this.addNotTranslatedTextsDiagnostics(textTranslationPackage, node.translationsKeyword);
|
|
60810
|
-
}
|
|
60811
|
-
}
|
|
60812
|
-
}
|
|
60807
|
+
case 121 /* TranslationsDeclaration */:
|
|
60808
|
+
this.checkTranslationsDeclaration(node, controller);
|
|
60813
60809
|
break;
|
|
60814
|
-
}
|
|
60815
60810
|
case 138 /* TextTranslationDeclaration */:
|
|
60816
|
-
case 139 /* TextTranslationFunctionDeclaration */:
|
|
60811
|
+
case 139 /* TextTranslationFunctionDeclaration */:
|
|
60817
60812
|
this.checkTextTranslationDeclaration(node);
|
|
60818
60813
|
break;
|
|
60819
|
-
}
|
|
60820
60814
|
case 27 /* PackageClassDeclaration */:
|
|
60821
60815
|
case 28 /* PackageStructureDeclaration */:
|
|
60822
|
-
case 29 /* PackageAspectDeclaration */:
|
|
60823
|
-
|
|
60824
|
-
|
|
60825
|
-
case 31 /* PackageVariantDeclaration */:
|
|
60816
|
+
case 29 /* PackageAspectDeclaration */:
|
|
60817
|
+
result = this.checkPackageStructuredTypeDeclaration(node, controller);
|
|
60818
|
+
break;
|
|
60819
|
+
case 31 /* PackageVariantDeclaration */:
|
|
60826
60820
|
this.checkPackageVariantDeclaration(node);
|
|
60827
60821
|
break;
|
|
60828
|
-
|
|
60829
|
-
case 32 /* PackageVariableDeclaration */: {
|
|
60822
|
+
case 32 /* PackageVariableDeclaration */:
|
|
60830
60823
|
this.checkPackageVariableDeclaration(node);
|
|
60831
60824
|
break;
|
|
60832
|
-
|
|
60833
|
-
case 23 /* PackageFunctionDeclaration */: {
|
|
60825
|
+
case 23 /* PackageFunctionDeclaration */:
|
|
60834
60826
|
this.checkPackageFunctionDeclaration(node);
|
|
60835
60827
|
break;
|
|
60836
|
-
|
|
60837
|
-
case 33 /* PackageVariableGetterDeclaration */: {
|
|
60828
|
+
case 33 /* PackageVariableGetterDeclaration */:
|
|
60838
60829
|
this.checkPackageVariableGetterDeclaration(node);
|
|
60839
60830
|
break;
|
|
60840
|
-
|
|
60841
|
-
case 34 /* PackageVariableSetterDeclaration */: {
|
|
60831
|
+
case 34 /* PackageVariableSetterDeclaration */:
|
|
60842
60832
|
this.checkPackageVariableSetterDeclaration(node);
|
|
60843
60833
|
break;
|
|
60844
|
-
|
|
60845
|
-
|
|
60846
|
-
if (this.isInterfacePackageFile) {
|
|
60847
|
-
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, node);
|
|
60848
|
-
}
|
|
60834
|
+
case 21 /* PackageConstructorDeclaration */:
|
|
60835
|
+
this.checkPackageConstructorDeclaration(node);
|
|
60849
60836
|
break;
|
|
60850
|
-
|
|
60851
|
-
|
|
60852
|
-
if (this.isInterfacePackageFile) {
|
|
60853
|
-
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, node.runKeyword);
|
|
60854
|
-
}
|
|
60837
|
+
case 22 /* PackageEntryPointDeclaration */:
|
|
60838
|
+
this.checkPackageEntryPointDeclaration(node);
|
|
60855
60839
|
break;
|
|
60856
|
-
|
|
60857
|
-
case 40 /* ConstructorDeclaration */: {
|
|
60840
|
+
case 40 /* ConstructorDeclaration */:
|
|
60858
60841
|
this.checkConstructorDeclaration(node);
|
|
60859
60842
|
break;
|
|
60860
|
-
|
|
60861
|
-
|
|
60862
|
-
const entity = this.analyzer.entity.ofDestructorDeclaration(node);
|
|
60863
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
60864
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.destructionKeyword);
|
|
60865
|
-
this.analyzer.semanticContext.ofDestructorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
60843
|
+
case 41 /* DestructorDeclaration */:
|
|
60844
|
+
this.checkDestructorDeclaration(node);
|
|
60866
60845
|
break;
|
|
60867
|
-
|
|
60868
|
-
case 49 /* FieldDeclaration */: {
|
|
60846
|
+
case 49 /* FieldDeclaration */:
|
|
60869
60847
|
this.checkFieldDeclaration(node);
|
|
60870
60848
|
break;
|
|
60871
|
-
|
|
60872
|
-
case 47 /* MethodDeclaration */: {
|
|
60849
|
+
case 47 /* MethodDeclaration */:
|
|
60873
60850
|
this.checkMethodDeclaration(node);
|
|
60874
60851
|
break;
|
|
60875
|
-
|
|
60876
|
-
case 50 /* FieldGetterDeclaration */: {
|
|
60852
|
+
case 50 /* FieldGetterDeclaration */:
|
|
60877
60853
|
this.checkFieldGetterDeclaration(node);
|
|
60878
60854
|
break;
|
|
60879
|
-
|
|
60880
|
-
case 51 /* FieldSetterDeclaration */: {
|
|
60855
|
+
case 51 /* FieldSetterDeclaration */:
|
|
60881
60856
|
this.checkFieldSetterDeclaration(node);
|
|
60882
60857
|
break;
|
|
60883
|
-
|
|
60884
|
-
case 42 /* IndexedElementGetterDeclaration */: {
|
|
60858
|
+
case 42 /* IndexedElementGetterDeclaration */:
|
|
60885
60859
|
this.checkIndexedElementGetterDeclaration(node);
|
|
60886
60860
|
break;
|
|
60887
|
-
|
|
60888
|
-
case 43 /* IndexedElementSetterDeclaration */: {
|
|
60861
|
+
case 43 /* IndexedElementSetterDeclaration */:
|
|
60889
60862
|
this.checkIndexedElementSetterDeclaration(node);
|
|
60890
60863
|
break;
|
|
60891
|
-
|
|
60892
|
-
case 45 /* DereferencedVariableGetterDeclaration */: {
|
|
60864
|
+
case 45 /* DereferencedVariableGetterDeclaration */:
|
|
60893
60865
|
this.checkDereferencedVariableGetterDeclaration(node);
|
|
60894
60866
|
break;
|
|
60895
|
-
|
|
60896
|
-
case 46 /* DereferencedVariableSetterDeclaration */: {
|
|
60867
|
+
case 46 /* DereferencedVariableSetterDeclaration */:
|
|
60897
60868
|
this.checkDereferencedVariableSetterDeclaration(node);
|
|
60898
60869
|
break;
|
|
60899
|
-
|
|
60900
|
-
case 53 /* NestedFunctionDeclaration */: {
|
|
60870
|
+
case 53 /* NestedFunctionDeclaration */:
|
|
60901
60871
|
this.checkNestedFunctionDeclaration(node);
|
|
60902
60872
|
break;
|
|
60903
|
-
|
|
60904
|
-
case 92 /* StatementBlock */: {
|
|
60873
|
+
case 92 /* StatementBlock */:
|
|
60905
60874
|
this.checkStatementBlock(node);
|
|
60906
60875
|
break;
|
|
60907
|
-
|
|
60908
|
-
case 93 /* FunctionBlock */: {
|
|
60876
|
+
case 93 /* FunctionBlock */:
|
|
60909
60877
|
this.checkFunctionBlock(node);
|
|
60910
60878
|
break;
|
|
60911
|
-
|
|
60912
|
-
|
|
60913
|
-
const checkResult = this.analyzer.checkExpressionCanBeUsedInForLoop(node.enumeratedExpression);
|
|
60914
|
-
if (checkResult.kind === "error") {
|
|
60915
|
-
this.addDiagnostics(checkResult.value);
|
|
60916
|
-
}
|
|
60917
|
-
this.analyzer.semanticContext.ofForStatement(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
60879
|
+
case 105 /* ForStatement */:
|
|
60880
|
+
this.checkForStatement(node);
|
|
60918
60881
|
break;
|
|
60919
|
-
|
|
60920
|
-
|
|
60921
|
-
this.analyzer.semanticContext.ofCatchClause(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
60882
|
+
case 99 /* CatchClause */:
|
|
60883
|
+
this.checkCatchClause(node);
|
|
60922
60884
|
break;
|
|
60923
|
-
|
|
60924
|
-
|
|
60925
|
-
this.analyzer.resolvePrefixUnaryExpressionUserDefinableOperator(node);
|
|
60885
|
+
case 72 /* PrefixUnaryExpression */:
|
|
60886
|
+
this.checkPrefixUnaryExpression(node);
|
|
60926
60887
|
break;
|
|
60927
|
-
|
|
60928
|
-
case 61 /* BinaryExpression */: {
|
|
60888
|
+
case 61 /* BinaryExpression */:
|
|
60929
60889
|
this.checkBinaryExpression(node);
|
|
60930
60890
|
break;
|
|
60931
|
-
|
|
60932
|
-
|
|
60933
|
-
if (this.checkAssignmentIsValid(node)) {
|
|
60934
|
-
if (node.operator.tokenKind === 64 /* Equals */) {
|
|
60935
|
-
this.checkExpressionTypeIsAssignableToTargetType(node.right, this.analyzer.type.ofExpression(node.left));
|
|
60936
|
-
}
|
|
60937
|
-
}
|
|
60938
|
-
const operatorKind = this.analyzer.getBinaryOperatorKindIfCompoundAssignmentOperator(node.operator);
|
|
60939
|
-
if (operatorKind !== void 0) {
|
|
60940
|
-
const operator = this.analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
|
|
60941
|
-
if (operator !== void 0) {
|
|
60942
|
-
const returnType = operator.getReturnType();
|
|
60943
|
-
const leftType = this.analyzer.type.ofExpression(node.left);
|
|
60944
|
-
if (!this.analyzer.isTypeAssignableTo(returnType, leftType)) {
|
|
60945
|
-
this.addTypeAssignabilityDiagnosticIfBothTypesResolved(
|
|
60946
|
-
returnType,
|
|
60947
|
-
leftType,
|
|
60948
|
-
node.right,
|
|
60949
|
-
2032 /* Type0IsNotAssignableToType1 */
|
|
60950
|
-
);
|
|
60951
|
-
}
|
|
60952
|
-
}
|
|
60953
|
-
}
|
|
60891
|
+
case 90 /* AssignmentStatement */:
|
|
60892
|
+
this.checkAssignmentStatement(node);
|
|
60954
60893
|
break;
|
|
60955
|
-
|
|
60956
|
-
|
|
60957
|
-
const entity = this.analyzer.entity.ofTypeExtensionDeclaration(node);
|
|
60958
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
60959
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
60960
|
-
node.memberBlock.memberList,
|
|
60961
|
-
6 /* TypeExtension */,
|
|
60962
|
-
false,
|
|
60963
|
-
false
|
|
60964
|
-
);
|
|
60965
|
-
this.overrideChecker.checkMembers(entity.getMembers());
|
|
60966
|
-
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
60894
|
+
case 35 /* TypeExtensionDeclaration */:
|
|
60895
|
+
this.checkTypeExtensionDeclaration(node);
|
|
60967
60896
|
break;
|
|
60968
|
-
|
|
60969
|
-
|
|
60970
|
-
this.analyzer.resolveObjectExpression(node);
|
|
60897
|
+
case 84 /* ObjectExpression */:
|
|
60898
|
+
this.checkObjectExpression(node);
|
|
60971
60899
|
break;
|
|
60972
|
-
|
|
60973
|
-
|
|
60974
|
-
const meaning = this.analyzer.resolveBaseExpression(node);
|
|
60975
|
-
if (meaning.kind === "base-object-access") {
|
|
60976
|
-
let parent = node.getParentSkippingParenthesizedExpressions();
|
|
60977
|
-
if (parent.kind === 60 /* AsExpression */) {
|
|
60978
|
-
parent = parent.getParentSkippingParenthesizedExpressions();
|
|
60979
|
-
}
|
|
60980
|
-
if (!(parent.kind === 73 /* MemberAccessExpression */ || parent.kind === 67 /* IndexedAccessExpression */ || parent.kind === 75 /* DereferenceExpression */)) {
|
|
60981
|
-
this.createAndAddDiagnostic(2059 /* BaseCannotBeUsedAsAnExpressionInItself */, node);
|
|
60982
|
-
}
|
|
60983
|
-
} else if (meaning.kind === "overridden-method-access" && meaning.method.kind === "substituted-function") {
|
|
60984
|
-
const typeArgumentClause = getParentGenericSpecializationExpression(node)?.typeArgumentClause;
|
|
60985
|
-
this.checkTypeArgumentTypesAreAssignableToConstraints(
|
|
60986
|
-
meaning.method.getTypeParameters(),
|
|
60987
|
-
meaning.method.value.getSubstitutions(),
|
|
60988
|
-
meaning.method.value.getOuterSubstitutions(),
|
|
60989
|
-
typeArgumentClause ?? node
|
|
60990
|
-
);
|
|
60991
|
-
}
|
|
60900
|
+
case 85 /* BaseExpression */:
|
|
60901
|
+
this.checkBaseExpression(node);
|
|
60992
60902
|
break;
|
|
60993
|
-
|
|
60994
|
-
case 114 /* ReturnStatement */: {
|
|
60903
|
+
case 114 /* ReturnStatement */:
|
|
60995
60904
|
this.checkReturnStatement(node);
|
|
60996
60905
|
break;
|
|
60997
|
-
|
|
60998
|
-
case 120 /* YieldStatement */: {
|
|
60906
|
+
case 120 /* YieldStatement */:
|
|
60999
60907
|
this.checkYieldStatement(node);
|
|
61000
60908
|
break;
|
|
61001
|
-
|
|
61002
|
-
|
|
61003
|
-
const entity = this.analyzer.entity.ofPackageAliasTypeDeclaration(node);
|
|
61004
|
-
if (entity.getAliasedType().causesCycle) {
|
|
61005
|
-
this.createAndAddDiagnostic(2080 /* TypeAliasReferencesItself */, node.name);
|
|
61006
|
-
}
|
|
61007
|
-
if (node.typeParameterClause !== void 0) {
|
|
61008
|
-
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61009
|
-
}
|
|
61010
|
-
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61011
|
-
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61012
|
-
const semanticContext = this.analyzer.semanticContext.outermostSemanticContextOfTypeDeclaration(node);
|
|
61013
|
-
new BaseMemberConflictsValidator(
|
|
61014
|
-
this.analyzer,
|
|
61015
|
-
entity,
|
|
61016
|
-
semanticContext.getDiagnosticArgumentFactory(),
|
|
61017
|
-
this.diagnosticAcceptor,
|
|
61018
|
-
node.name
|
|
61019
|
-
).validate();
|
|
60909
|
+
case 19 /* PackageAliasTypeDeclaration */:
|
|
60910
|
+
this.checkPackageAliasTypeDeclaration(node);
|
|
61020
60911
|
break;
|
|
61021
|
-
|
|
61022
|
-
|
|
61023
|
-
const entity = this.analyzer.entity.ofPackageReducedTypeDeclaration(node);
|
|
61024
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61025
|
-
if (entity.getReductionSource().causesCycle) {
|
|
61026
|
-
this.createAndAddDiagnostic(2081 /* ReducedTypeReferencesItself */, node.name);
|
|
61027
|
-
}
|
|
61028
|
-
if (node.typeParameterClause !== void 0) {
|
|
61029
|
-
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61030
|
-
}
|
|
61031
|
-
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61032
|
-
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
60912
|
+
case 30 /* PackageReducedTypeDeclaration */:
|
|
60913
|
+
this.checkPackageReducedTypeDeclaration(node);
|
|
61033
60914
|
break;
|
|
61034
|
-
|
|
61035
|
-
case 158 /* TypeParameterList */: {
|
|
60915
|
+
case 158 /* TypeParameterList */:
|
|
61036
60916
|
this.checkTypeParameterList(node);
|
|
61037
60917
|
break;
|
|
61038
|
-
|
|
61039
|
-
case 146 /* TypeParameterDeclaration */: {
|
|
60918
|
+
case 146 /* TypeParameterDeclaration */:
|
|
61040
60919
|
this.checkTypeParameterDeclaration(node);
|
|
61041
60920
|
break;
|
|
61042
|
-
|
|
61043
|
-
case 87 /* GenericSpecializationExpression */: {
|
|
60921
|
+
case 87 /* GenericSpecializationExpression */:
|
|
61044
60922
|
this.checkGenericSpecializationExpression(node);
|
|
61045
60923
|
break;
|
|
61046
|
-
|
|
61047
|
-
|
|
61048
|
-
const entity = this.analyzer.entity.ofLocalVariableDeclaration(node);
|
|
61049
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61050
|
-
if (node.typeAnnotation === void 0 && node.initializer === void 0) {
|
|
61051
|
-
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
61052
|
-
} else if (node.initializer !== void 0 && node.typeAnnotation !== void 0) {
|
|
61053
|
-
this.checkExpressionTypeIsAssignableToTargetType(
|
|
61054
|
-
node.initializer,
|
|
61055
|
-
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
61056
|
-
);
|
|
61057
|
-
}
|
|
61058
|
-
this.checkIfVariableIsUnused(entity, node.name);
|
|
60924
|
+
case 54 /* LocalVariableDeclaration */:
|
|
60925
|
+
this.checkLocalVariableDeclaration(node);
|
|
61059
60926
|
break;
|
|
61060
|
-
|
|
61061
|
-
|
|
61062
|
-
const entity = this.analyzer.entity.ofForStatementVariableDeclaration(node);
|
|
61063
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61064
|
-
this.checkIfVariableIsUnused(entity, node.name);
|
|
60927
|
+
case 55 /* ForStatementVariableDeclaration */:
|
|
60928
|
+
this.checkForStatementVariableDeclaration(node);
|
|
61065
60929
|
break;
|
|
61066
|
-
|
|
61067
|
-
|
|
61068
|
-
const entity = this.analyzer.entity.ofErrorVariableDeclaration(node);
|
|
61069
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61070
|
-
this.checkIfVariableIsUnused(entity, node.name);
|
|
60930
|
+
case 100 /* ErrorVariableDeclaration */:
|
|
60931
|
+
this.checkErrorVariableDeclaration(node);
|
|
61071
60932
|
break;
|
|
61072
|
-
|
|
61073
|
-
case 154 /* ParameterList */: {
|
|
60933
|
+
case 154 /* ParameterList */:
|
|
61074
60934
|
this.checkParameterList(node);
|
|
61075
60935
|
break;
|
|
61076
|
-
|
|
61077
|
-
case 147 /* ParameterDeclaration */: {
|
|
60936
|
+
case 147 /* ParameterDeclaration */:
|
|
61078
60937
|
this.checkParameterDeclaration(node);
|
|
61079
60938
|
break;
|
|
61080
|
-
|
|
61081
|
-
case 62 /* FunctionLiteral */: {
|
|
60939
|
+
case 62 /* FunctionLiteral */:
|
|
61082
60940
|
this.checkFunctionLiteral(node);
|
|
61083
60941
|
break;
|
|
61084
|
-
|
|
61085
|
-
case 63 /* FunctionBlockLiteral */: {
|
|
60942
|
+
case 63 /* FunctionBlockLiteral */:
|
|
61086
60943
|
this.checkFunctionBlockLiteral(node);
|
|
61087
60944
|
break;
|
|
61088
|
-
|
|
61089
|
-
|
|
61090
|
-
this.analyzer.semanticContext.ofFunctionTypeDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
60945
|
+
case 17 /* AnonymousFunctionTypeDeclaration */:
|
|
60946
|
+
this.checkAnonymousFunctionTypeDeclaration(node);
|
|
61091
60947
|
break;
|
|
61092
|
-
|
|
61093
|
-
|
|
61094
|
-
const entity = this.analyzer.entity.ofAnonymousStructuredTypeDeclaration(node);
|
|
61095
|
-
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61096
|
-
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61097
|
-
const semanticContext = this.analyzer.semanticContext.outermostSemanticContextOfTypeDeclaration(node);
|
|
61098
|
-
new BaseMemberConflictsValidator(
|
|
61099
|
-
this.analyzer,
|
|
61100
|
-
entity,
|
|
61101
|
-
semanticContext.getDiagnosticArgumentFactory(),
|
|
61102
|
-
this.diagnosticAcceptor,
|
|
61103
|
-
node.classKeyword
|
|
61104
|
-
).validate();
|
|
61105
|
-
const typeMemberImplementationCheckResult = this.analyzer.getTypeMemberImplementationCheckResult(entity);
|
|
61106
|
-
this.attachNodeLocationAndAddDiagnostics(
|
|
61107
|
-
typeMemberImplementationCheckResult.diagnosticsData,
|
|
61108
|
-
node.classKeyword
|
|
61109
|
-
);
|
|
61110
|
-
if (!this.isInterfacePackageFile) {
|
|
61111
|
-
this.addDiagnostics(this.analyzer.getOwnAndBaseConstructorCallsCheckResult(node).diagnostics);
|
|
61112
|
-
new InstanceFieldsInitializationValidator(
|
|
61113
|
-
this.analyzer,
|
|
61114
|
-
node,
|
|
61115
|
-
this.namedDeclarationsUsageMap,
|
|
61116
|
-
this.diagnosticAcceptor
|
|
61117
|
-
).validate();
|
|
61118
|
-
}
|
|
60948
|
+
case 18 /* AnonymousClassDeclaration */:
|
|
60949
|
+
this.checkAnonymousClassDeclaration(node);
|
|
61119
60950
|
break;
|
|
61120
|
-
|
|
61121
|
-
case 26 /* TypeMemberDeclarationBlock */: {
|
|
60951
|
+
case 26 /* TypeMemberDeclarationBlock */:
|
|
61122
60952
|
this.checkTypeMemberDeclarationBlock(node);
|
|
61123
60953
|
break;
|
|
61124
|
-
|
|
61125
|
-
|
|
61126
|
-
this.checkExpressionTypeIsAssignableToTargetType(
|
|
61127
|
-
node.value,
|
|
61128
|
-
this.analyzer.getTargetTypeOfExpression(node.value)
|
|
61129
|
-
);
|
|
60954
|
+
case 148 /* Argument */:
|
|
60955
|
+
this.checkArgument(node);
|
|
61130
60956
|
break;
|
|
61131
|
-
|
|
61132
|
-
case 102 /* ErrorStatement */: {
|
|
60957
|
+
case 102 /* ErrorStatement */:
|
|
61133
60958
|
this.checkErrorStatement(node);
|
|
61134
60959
|
break;
|
|
61135
|
-
|
|
61136
|
-
|
|
61137
|
-
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
60960
|
+
case 106 /* IfStatement */:
|
|
60961
|
+
this.checkIfStatement(node);
|
|
61138
60962
|
break;
|
|
61139
|
-
|
|
61140
|
-
|
|
61141
|
-
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
60963
|
+
case 108 /* ElseIfClause */:
|
|
60964
|
+
this.checkElseIfClause(node);
|
|
61142
60965
|
break;
|
|
61143
|
-
|
|
61144
|
-
|
|
61145
|
-
if (node.condition !== void 0) {
|
|
61146
|
-
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
61147
|
-
}
|
|
60966
|
+
case 113 /* LoopStatement */:
|
|
60967
|
+
this.checkLoopStatement(node);
|
|
61148
60968
|
break;
|
|
61149
|
-
|
|
61150
|
-
|
|
61151
|
-
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
60969
|
+
case 119 /* WhileStatement */:
|
|
60970
|
+
this.checkWhileStatement(node);
|
|
61152
60971
|
break;
|
|
61153
|
-
|
|
61154
|
-
|
|
61155
|
-
const matchedExpressionType = this.analyzer.type.ofExpression(node.parent.parent.parent.expression);
|
|
61156
|
-
for (const expression of node.matchExpressions) {
|
|
61157
|
-
this.checkExpressionTypeIsAssignableToTargetType(expression, matchedExpressionType);
|
|
61158
|
-
}
|
|
60972
|
+
case 117 /* MatchExpressionList */:
|
|
60973
|
+
this.checkMatchExpressionList(node);
|
|
61159
60974
|
break;
|
|
61160
|
-
|
|
61161
|
-
|
|
61162
|
-
if (!this.analyzer.expressionCanBeReferenced(node.expression)) {
|
|
61163
|
-
this.createAndAddDiagnostic(2189 /* ExpressionCannotBeReferenced */, node.expression);
|
|
61164
|
-
}
|
|
60975
|
+
case 74 /* ReferenceExpression */:
|
|
60976
|
+
this.checkReferenceExpression(node);
|
|
61165
60977
|
break;
|
|
61166
|
-
}
|
|
61167
60978
|
case 94 /* BreakLoopStatement */:
|
|
61168
|
-
case 95 /* ContinueLoopStatement */:
|
|
60979
|
+
case 95 /* ContinueLoopStatement */:
|
|
61169
60980
|
this.checkBreakLoopOrContinueLoopStatement(node);
|
|
61170
60981
|
break;
|
|
61171
|
-
|
|
61172
|
-
|
|
61173
|
-
this.analyzer.resolveOwnConstructorCallExpression(node);
|
|
60982
|
+
case 89 /* OwnConstructorCallExpression */:
|
|
60983
|
+
this.checkOwnConstructorCallExpression(node);
|
|
61174
60984
|
break;
|
|
61175
|
-
|
|
61176
|
-
case 59 /* AssumptionExpression */: {
|
|
60985
|
+
case 59 /* AssumptionExpression */:
|
|
61177
60986
|
this.checkAssumptionExpression(node);
|
|
61178
60987
|
break;
|
|
60988
|
+
}
|
|
60989
|
+
return result;
|
|
60990
|
+
}
|
|
60991
|
+
checkTag(node) {
|
|
60992
|
+
this.analyzer.resolveTag(node);
|
|
60993
|
+
}
|
|
60994
|
+
checkPackageReducedTypeDeclaration(node) {
|
|
60995
|
+
const entity = this.analyzer.entity.ofPackageReducedTypeDeclaration(node);
|
|
60996
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
60997
|
+
if (entity.getReductionSource().causesCycle) {
|
|
60998
|
+
this.createAndAddDiagnostic(2081 /* ReducedTypeReferencesItself */, node.name);
|
|
60999
|
+
}
|
|
61000
|
+
if (node.typeParameterClause !== void 0) {
|
|
61001
|
+
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61002
|
+
}
|
|
61003
|
+
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61004
|
+
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61005
|
+
}
|
|
61006
|
+
checkPackageAliasTypeDeclaration(node) {
|
|
61007
|
+
const entity = this.analyzer.entity.ofPackageAliasTypeDeclaration(node);
|
|
61008
|
+
if (entity.getAliasedType().causesCycle) {
|
|
61009
|
+
this.createAndAddDiagnostic(2080 /* TypeAliasReferencesItself */, node.name);
|
|
61010
|
+
}
|
|
61011
|
+
if (node.typeParameterClause !== void 0) {
|
|
61012
|
+
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61013
|
+
}
|
|
61014
|
+
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61015
|
+
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61016
|
+
const semanticContext = this.analyzer.semanticContext.outermostSemanticContextOfTypeDeclaration(node);
|
|
61017
|
+
new BaseMemberConflictsValidator(
|
|
61018
|
+
this.analyzer,
|
|
61019
|
+
entity,
|
|
61020
|
+
semanticContext.getDiagnosticArgumentFactory(),
|
|
61021
|
+
this.diagnosticAcceptor,
|
|
61022
|
+
node.name
|
|
61023
|
+
).validate();
|
|
61024
|
+
}
|
|
61025
|
+
checkPackageEntryPointDeclaration(node) {
|
|
61026
|
+
if (this.isInterfacePackageFile) {
|
|
61027
|
+
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, node.runKeyword);
|
|
61028
|
+
}
|
|
61029
|
+
}
|
|
61030
|
+
checkPackageConstructorDeclaration(node) {
|
|
61031
|
+
if (this.isInterfacePackageFile) {
|
|
61032
|
+
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, node);
|
|
61033
|
+
}
|
|
61034
|
+
}
|
|
61035
|
+
checkTranslationsDeclaration(node, controller) {
|
|
61036
|
+
if (this.sourceFile.package.kind === "program") {
|
|
61037
|
+
this.createAndAddDiagnostic(
|
|
61038
|
+
2051 /* TranslationsCanOnlyBeDeclaredInTranslationPackage */,
|
|
61039
|
+
node.translationsKeyword
|
|
61040
|
+
);
|
|
61041
|
+
controller.skipChildrenTraverse();
|
|
61042
|
+
} else if (this.sourceFile.package.kind === "translation") {
|
|
61043
|
+
if (this.resolvedTranslationPackage === void 0) {
|
|
61044
|
+
this.createAndAddDiagnostic(
|
|
61045
|
+
2052 /* UnknownTranslatingPackage0 */,
|
|
61046
|
+
node.translationsKeyword,
|
|
61047
|
+
[this.sourceFile.package.configuration.targetPackageName.toString()]
|
|
61048
|
+
);
|
|
61049
|
+
controller.skipChildrenTraverse();
|
|
61050
|
+
}
|
|
61051
|
+
} else if (this.sourceFile.package.kind === "text-translation") {
|
|
61052
|
+
const textTranslationPackage = this.textTranslationPackage;
|
|
61053
|
+
const targetPackage = textTranslationPackage?.getTargetPackage();
|
|
61054
|
+
if (targetPackage === void 0 || textTranslationPackage === void 0) {
|
|
61055
|
+
this.createAndAddDiagnostic(
|
|
61056
|
+
2052 /* UnknownTranslatingPackage0 */,
|
|
61057
|
+
node.translationsKeyword,
|
|
61058
|
+
[this.sourceFile.package.configuration.targetPackageName.toString()]
|
|
61059
|
+
);
|
|
61060
|
+
controller.skipChildrenTraverse();
|
|
61061
|
+
} else {
|
|
61062
|
+
if (textTranslationPackage.isPrimary()) {
|
|
61063
|
+
const packages = this.analyzer.getTextTranslationPackagesOfTargetPackage(targetPackage);
|
|
61064
|
+
if (packages !== void 0 && packages.some((p) => p.isPrimary() && p !== textTranslationPackage)) {
|
|
61065
|
+
this.createAndAddDiagnostic(
|
|
61066
|
+
2196 /* OnlyOneTextTranslationPackageShouldBeMarkedAsPrimary */,
|
|
61067
|
+
node.translationsKeyword,
|
|
61068
|
+
[]
|
|
61069
|
+
);
|
|
61070
|
+
}
|
|
61071
|
+
}
|
|
61072
|
+
if (this.sourceFile.package.sourceFiles[0] === this.sourceFile) {
|
|
61073
|
+
this.addNotTranslatedTextsDiagnostics(textTranslationPackage, node.translationsKeyword);
|
|
61074
|
+
}
|
|
61179
61075
|
}
|
|
61180
61076
|
}
|
|
61181
|
-
return void 0;
|
|
61182
61077
|
}
|
|
61183
|
-
|
|
61184
|
-
const
|
|
61185
|
-
|
|
61186
|
-
|
|
61187
|
-
|
|
61188
|
-
|
|
61189
|
-
|
|
61190
|
-
|
|
61191
|
-
|
|
61192
|
-
|
|
61193
|
-
|
|
61194
|
-
|
|
61195
|
-
|
|
61196
|
-
|
|
61197
|
-
|
|
61198
|
-
|
|
61199
|
-
|
|
61200
|
-
|
|
61201
|
-
|
|
61078
|
+
addNotTranslatedTextsDiagnostics(translationPackage, diagnosticLocation) {
|
|
61079
|
+
const notTranslatedEntities = this.collectNotTranslatedTexts(translationPackage);
|
|
61080
|
+
if (notTranslatedEntities.length > 0) {
|
|
61081
|
+
const diagnostic = this.createNotTranslatedTextsDiagnostic(notTranslatedEntities, diagnosticLocation);
|
|
61082
|
+
this.addDiagnostic(diagnostic);
|
|
61083
|
+
}
|
|
61084
|
+
}
|
|
61085
|
+
collectNotTranslatedTexts(translationPackage) {
|
|
61086
|
+
return [];
|
|
61087
|
+
}
|
|
61088
|
+
createNotTranslatedTextsDiagnostic(entities, diagnosticLocation) {
|
|
61089
|
+
const maxDisplayedEntitiesCount = 10;
|
|
61090
|
+
let result;
|
|
61091
|
+
if (entities.length <= maxDisplayedEntitiesCount) {
|
|
61092
|
+
const displayableEntities = entities.map((e) => this.diagnosticArgumentFactory.createDisplayableEntity(e));
|
|
61093
|
+
result = this.analyzer.createDiagnostic(
|
|
61094
|
+
2095 /* TheFollowingTextsAreNotTranslated0 */,
|
|
61095
|
+
diagnosticLocation,
|
|
61096
|
+
[new DisplayableArray(displayableEntities, "\n\n")],
|
|
61097
|
+
1 /* Warning */
|
|
61098
|
+
);
|
|
61099
|
+
} else {
|
|
61100
|
+
const displayableEntities = entities.slice(0, maxDisplayedEntitiesCount + 1).map((e) => this.diagnosticArgumentFactory.createDisplayableEntity(e));
|
|
61101
|
+
result = this.analyzer.createDiagnostic(
|
|
61102
|
+
2096 /* TheFollowingTextsAreNotTranslated0And1More */,
|
|
61103
|
+
diagnosticLocation,
|
|
61104
|
+
[new DisplayableArray(displayableEntities, "\n\n"), entities.length - maxDisplayedEntitiesCount],
|
|
61105
|
+
1 /* Warning */
|
|
61106
|
+
);
|
|
61107
|
+
}
|
|
61108
|
+
return result;
|
|
61109
|
+
}
|
|
61110
|
+
checkTextTranslationDeclaration(node) {
|
|
61111
|
+
const sourceText = node.sourceText;
|
|
61112
|
+
if (sourceText.kind === 141 /* TranslationTextTemplate */) {
|
|
61113
|
+
const semanticContext = this.analyzer.semanticContext.ofTextTranslationDeclarationParameters(sourceText);
|
|
61114
|
+
semanticContext.validateNameConflicts(this.diagnosticAcceptor);
|
|
61115
|
+
}
|
|
61116
|
+
const pkg2 = this.textTranslationPackage;
|
|
61117
|
+
if (pkg2 !== void 0 && !pkg2.isPrimary()) {
|
|
61118
|
+
const targetPackage = pkg2.getTargetPackage();
|
|
61119
|
+
if (targetPackage !== void 0) {
|
|
61120
|
+
const primaryPkg = this.analyzer.getPrimaryTextTranslationPackageOfTargetPackage(targetPackage);
|
|
61121
|
+
if (primaryPkg !== void 0) {
|
|
61122
|
+
const textKey = TextIdentity.keyFromTextTranslationSource(sourceText);
|
|
61123
|
+
const textTranslation = primaryPkg.getMembers().getTextTranslationsByTextKey(textKey);
|
|
61124
|
+
if (textTranslation.length === 0) {
|
|
61125
|
+
this.createAndAddDiagnostic(
|
|
61126
|
+
2190 /* TextIsMissingAmongPrimaryTextTranslationDefinitions */,
|
|
61127
|
+
sourceText,
|
|
61128
|
+
void 0,
|
|
61129
|
+
1 /* Warning */
|
|
61130
|
+
);
|
|
61131
|
+
}
|
|
61202
61132
|
}
|
|
61203
|
-
break;
|
|
61204
61133
|
}
|
|
61205
|
-
|
|
61206
|
-
|
|
61207
|
-
|
|
61208
|
-
|
|
61134
|
+
}
|
|
61135
|
+
if (node.kind === 139 /* TextTranslationFunctionDeclaration */) {
|
|
61136
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61137
|
+
node,
|
|
61138
|
+
node.sourceText,
|
|
61139
|
+
this.analyzer.returnType.ofTextTranslationFunctionDeclaration(node),
|
|
61140
|
+
this.analyzer.resultLocalVariableEntity.ofTextTranslationFunctionDeclaration(node)
|
|
61141
|
+
);
|
|
61209
61142
|
}
|
|
61210
61143
|
}
|
|
61211
61144
|
checkPackageVariantDeclaration(node) {
|
|
@@ -61213,6 +61146,9 @@ var SourceFileAnalyzer = class {
|
|
|
61213
61146
|
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61214
61147
|
}
|
|
61215
61148
|
const entity = this.analyzer.entity.ofPackageVariantDeclaration(node);
|
|
61149
|
+
if (node.extendsClause !== void 0) {
|
|
61150
|
+
this.checkAspectsHaveNotBeenExtendedWithDifferentTypeArguments(entity, node.extendsClause.baseTypeList, node.name);
|
|
61151
|
+
}
|
|
61216
61152
|
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61217
61153
|
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61218
61154
|
const semanticContext = this.analyzer.semanticContext.outermostSemanticContextOfTypeDeclaration(node);
|
|
@@ -61237,105 +61173,6 @@ var SourceFileAnalyzer = class {
|
|
|
61237
61173
|
}
|
|
61238
61174
|
}
|
|
61239
61175
|
}
|
|
61240
|
-
checkTypeMemberDeclarationBlock(node) {
|
|
61241
|
-
const parent = node.parent;
|
|
61242
|
-
if (isTypeDeclaration(parent)) {
|
|
61243
|
-
switch (parent.kind) {
|
|
61244
|
-
case 27 /* PackageClassDeclaration */: {
|
|
61245
|
-
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(parent);
|
|
61246
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61247
|
-
node.memberList,
|
|
61248
|
-
0 /* Class */,
|
|
61249
|
-
entity.isAbstract(),
|
|
61250
|
-
entity.markedBasic()
|
|
61251
|
-
);
|
|
61252
|
-
break;
|
|
61253
|
-
}
|
|
61254
|
-
case 28 /* PackageStructureDeclaration */: {
|
|
61255
|
-
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(parent);
|
|
61256
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61257
|
-
node.memberList,
|
|
61258
|
-
1 /* Structure */,
|
|
61259
|
-
entity.isAbstract(),
|
|
61260
|
-
entity.markedBasic()
|
|
61261
|
-
);
|
|
61262
|
-
break;
|
|
61263
|
-
}
|
|
61264
|
-
case 29 /* PackageAspectDeclaration */: {
|
|
61265
|
-
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(parent);
|
|
61266
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61267
|
-
node.memberList,
|
|
61268
|
-
2 /* Aspect */,
|
|
61269
|
-
entity.isAbstract(),
|
|
61270
|
-
entity.markedBasic()
|
|
61271
|
-
);
|
|
61272
|
-
break;
|
|
61273
|
-
}
|
|
61274
|
-
case 18 /* AnonymousClassDeclaration */: {
|
|
61275
|
-
const entity = this.analyzer.entity.ofAnonymousStructuredTypeDeclaration(parent);
|
|
61276
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61277
|
-
node.memberList,
|
|
61278
|
-
2 /* Aspect */,
|
|
61279
|
-
entity.isAbstract(),
|
|
61280
|
-
entity.markedBasic()
|
|
61281
|
-
);
|
|
61282
|
-
break;
|
|
61283
|
-
}
|
|
61284
|
-
case 30 /* PackageReducedTypeDeclaration */: {
|
|
61285
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61286
|
-
node.memberList,
|
|
61287
|
-
5 /* ReducedType */,
|
|
61288
|
-
false,
|
|
61289
|
-
false
|
|
61290
|
-
);
|
|
61291
|
-
break;
|
|
61292
|
-
}
|
|
61293
|
-
case 31 /* PackageVariantDeclaration */: {
|
|
61294
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61295
|
-
node.memberList,
|
|
61296
|
-
3 /* Variant */,
|
|
61297
|
-
false,
|
|
61298
|
-
false
|
|
61299
|
-
);
|
|
61300
|
-
break;
|
|
61301
|
-
}
|
|
61302
|
-
case 19 /* PackageAliasTypeDeclaration */: {
|
|
61303
|
-
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61304
|
-
node.memberList,
|
|
61305
|
-
4 /* AliasType */,
|
|
61306
|
-
false,
|
|
61307
|
-
false
|
|
61308
|
-
);
|
|
61309
|
-
break;
|
|
61310
|
-
}
|
|
61311
|
-
default:
|
|
61312
|
-
Debug.never(parent);
|
|
61313
|
-
}
|
|
61314
|
-
}
|
|
61315
|
-
}
|
|
61316
|
-
checkAssumptionExpression(node) {
|
|
61317
|
-
const parent = node.getParentSkippingParenthesizedExpressions();
|
|
61318
|
-
switch (parent.kind) {
|
|
61319
|
-
case 73 /* MemberAccessExpression */:
|
|
61320
|
-
case 65 /* CallExpression */:
|
|
61321
|
-
case 67 /* IndexedAccessExpression */:
|
|
61322
|
-
case 75 /* DereferenceExpression */:
|
|
61323
|
-
break;
|
|
61324
|
-
default:
|
|
61325
|
-
this.createAndAddDiagnostic(
|
|
61326
|
-
2225 /* QuestionOperatorCanBeUsedOnlyInSpecificExpressions */,
|
|
61327
|
-
node.questionToken
|
|
61328
|
-
);
|
|
61329
|
-
}
|
|
61330
|
-
}
|
|
61331
|
-
checkStatementBlock(node) {
|
|
61332
|
-
const semanticContext = this.analyzer.semanticContext.ofStatementBlock(node);
|
|
61333
|
-
semanticContext.validateNameConflicts(this.diagnosticAcceptor);
|
|
61334
|
-
}
|
|
61335
|
-
checkFunctionBlock(node) {
|
|
61336
|
-
const semanticContext = this.analyzer.semanticContext.ofFunctionBlock(node);
|
|
61337
|
-
semanticContext.validateNameConflicts(this.diagnosticAcceptor);
|
|
61338
|
-
}
|
|
61339
61176
|
checkPackageStructuredTypeDeclaration(node, controller) {
|
|
61340
61177
|
return __async(this, null, function* () {
|
|
61341
61178
|
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(node);
|
|
@@ -61346,6 +61183,9 @@ var SourceFileAnalyzer = class {
|
|
|
61346
61183
|
if (node.typeParameterClause !== void 0) {
|
|
61347
61184
|
this.analyzer.semanticContext.ofTypeDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61348
61185
|
}
|
|
61186
|
+
if (node.extendsClause !== void 0) {
|
|
61187
|
+
this.checkAspectsHaveNotBeenExtendedWithDifferentTypeArguments(entity, node.extendsClause.baseTypeList, node.name);
|
|
61188
|
+
}
|
|
61349
61189
|
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61350
61190
|
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61351
61191
|
const semanticContext = this.analyzer.semanticContext.outermostSemanticContextOfTypeDeclaration(node);
|
|
@@ -61585,6 +61425,805 @@ var SourceFileAnalyzer = class {
|
|
|
61585
61425
|
return result;
|
|
61586
61426
|
});
|
|
61587
61427
|
}
|
|
61428
|
+
checkAspectsHaveNotBeenExtendedWithDifferentTypeArguments(entity, baseTypeList, fallbackDiagnosticLocation) {
|
|
61429
|
+
const type = this.analyzer.instantiateTypeByIdentitySubstitution(entity);
|
|
61430
|
+
const baseAspectTypes = this.analyzer.typeUtils.getPossiblyAliasedBaseAspectTypes(type);
|
|
61431
|
+
if (baseAspectTypes !== void 0 && baseAspectTypes.length > 0) {
|
|
61432
|
+
let allBaseTypes;
|
|
61433
|
+
for (const baseAspectType of baseAspectTypes) {
|
|
61434
|
+
const unaliasedBaseAspectType = baseAspectType.unalias();
|
|
61435
|
+
if (unaliasedBaseAspectType.kind === "structured" && unaliasedBaseAspectType.getTypeParameters().length === 0) {
|
|
61436
|
+
continue;
|
|
61437
|
+
}
|
|
61438
|
+
allBaseTypes ??= this.analyzer.typeUtils.getBaseAndAliasedTypesRecursively(type);
|
|
61439
|
+
const extendedAspect = allBaseTypes.find((t) => t.kind === "structured" && t.getEntity().getOriginalEntity() === unaliasedBaseAspectType.getEntity()?.getOriginalEntity() && !t.getSubstitutions().equals(unaliasedBaseAspectType.getSubstitutions()));
|
|
61440
|
+
if (extendedAspect !== void 0) {
|
|
61441
|
+
const diagnosticLocation = baseTypeList.baseTypes.first((n) => this.analyzer.type.ofTypeSpecifier(n).equals(baseAspectType)) ?? fallbackDiagnosticLocation;
|
|
61442
|
+
this.createAndAddDiagnostic(
|
|
61443
|
+
2246 /* AspectHasAlreadyBeenExtendedWithDifferentTypeArguments0 */,
|
|
61444
|
+
diagnosticLocation,
|
|
61445
|
+
[this.diagnosticArgumentFactory.createDisplayableType(extendedAspect)]
|
|
61446
|
+
);
|
|
61447
|
+
}
|
|
61448
|
+
}
|
|
61449
|
+
}
|
|
61450
|
+
}
|
|
61451
|
+
checkPackageVariableDeclaration(node) {
|
|
61452
|
+
const entity = this.analyzer.entity.ofPackageVariableDeclaration(node);
|
|
61453
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61454
|
+
if (this.isInterfacePackageFile) {
|
|
61455
|
+
if (node.initializer !== void 0) {
|
|
61456
|
+
this.createAndAddDiagnostic(2061 /* InterfacePackageVariablesMustNotHaveInitializers */, node.name);
|
|
61457
|
+
}
|
|
61458
|
+
}
|
|
61459
|
+
if (node.typeAnnotation === void 0 && node.initializer === void 0) {
|
|
61460
|
+
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
61461
|
+
} else if (node.initializer !== void 0 && node.typeAnnotation !== void 0) {
|
|
61462
|
+
this.checkExpressionTypeIsAssignableToTargetType(
|
|
61463
|
+
node.initializer,
|
|
61464
|
+
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
61465
|
+
);
|
|
61466
|
+
}
|
|
61467
|
+
}
|
|
61468
|
+
checkPackageFunctionDeclaration(node) {
|
|
61469
|
+
const entity = this.analyzer.entity.ofPackageFunctionDeclaration(node);
|
|
61470
|
+
this.checkPackageMemberBodyPresence(entity, node.block, node.name);
|
|
61471
|
+
if (node.block !== void 0) {
|
|
61472
|
+
this.checkPossibleGeneratorFunctionReturnType(entity, node, node.name);
|
|
61473
|
+
}
|
|
61474
|
+
if (node.typeParameterClause !== void 0) {
|
|
61475
|
+
this.analyzer.semanticContext.ofFunctionDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61476
|
+
}
|
|
61477
|
+
this.analyzer.semanticContext.ofFunctionDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61478
|
+
if (!this.analyzer.isFunctionGenerator(node)) {
|
|
61479
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61480
|
+
node,
|
|
61481
|
+
node.name,
|
|
61482
|
+
this.analyzer.returnType.ofPackageFunctionDeclaration(node),
|
|
61483
|
+
this.analyzer.resultLocalVariableEntity.ofPackageFunctionDeclaration(node)
|
|
61484
|
+
);
|
|
61485
|
+
}
|
|
61486
|
+
}
|
|
61487
|
+
checkPackageVariableGetterDeclaration(node) {
|
|
61488
|
+
const entity = this.analyzer.entity.ofComputedPackageVariableDeclaration(node);
|
|
61489
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61490
|
+
this.checkPackageMemberBodyPresence(entity, node.block, node.name);
|
|
61491
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61492
|
+
node,
|
|
61493
|
+
node.name,
|
|
61494
|
+
this.analyzer.returnType.ofPackageVariableGetterDeclaration(node),
|
|
61495
|
+
this.analyzer.resultLocalVariableEntity.ofPackageVariableGetterDeclaration(node)
|
|
61496
|
+
);
|
|
61497
|
+
}
|
|
61498
|
+
checkPackageVariableSetterDeclaration(node) {
|
|
61499
|
+
const entity = this.analyzer.entity.ofComputedPackageVariableDeclaration(node);
|
|
61500
|
+
this.checkPackageMemberBodyPresence(entity, node.block, node.name);
|
|
61501
|
+
}
|
|
61502
|
+
checkPackageMemberBodyPresence(entity, body, diagnosticLocation) {
|
|
61503
|
+
if (this.isInterfacePackageFile) {
|
|
61504
|
+
if (body !== void 0) {
|
|
61505
|
+
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, diagnosticLocation);
|
|
61506
|
+
}
|
|
61507
|
+
} else if (findTag(this.analyzer.originalWellKnownDeclarations.builtIntoPlatform, entity.getTags()) !== void 0) {
|
|
61508
|
+
if (body !== void 0) {
|
|
61509
|
+
this.createAndAddDiagnostic(
|
|
61510
|
+
2066 /* DeclarationsMarkedWithBuiltIntoPlatformTagMustNotHaveBody */,
|
|
61511
|
+
diagnosticLocation
|
|
61512
|
+
);
|
|
61513
|
+
}
|
|
61514
|
+
} else {
|
|
61515
|
+
if (body === void 0) {
|
|
61516
|
+
this.createAndAddDiagnostic(2062 /* BodyIsMissing */, diagnosticLocation);
|
|
61517
|
+
}
|
|
61518
|
+
}
|
|
61519
|
+
}
|
|
61520
|
+
checkTypeExtensionDeclaration(node) {
|
|
61521
|
+
const entity = this.analyzer.entity.ofTypeExtensionDeclaration(node);
|
|
61522
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61523
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61524
|
+
node.memberBlock.memberList,
|
|
61525
|
+
6 /* TypeExtension */,
|
|
61526
|
+
false,
|
|
61527
|
+
false
|
|
61528
|
+
);
|
|
61529
|
+
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61530
|
+
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61531
|
+
}
|
|
61532
|
+
checkTypeMemberDeclarationBlock(node) {
|
|
61533
|
+
const parent = node.parent;
|
|
61534
|
+
if (isTypeDeclaration(parent)) {
|
|
61535
|
+
switch (parent.kind) {
|
|
61536
|
+
case 27 /* PackageClassDeclaration */: {
|
|
61537
|
+
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(parent);
|
|
61538
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61539
|
+
node.memberList,
|
|
61540
|
+
0 /* Class */,
|
|
61541
|
+
entity.isAbstract(),
|
|
61542
|
+
entity.markedBasic()
|
|
61543
|
+
);
|
|
61544
|
+
break;
|
|
61545
|
+
}
|
|
61546
|
+
case 28 /* PackageStructureDeclaration */: {
|
|
61547
|
+
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(parent);
|
|
61548
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61549
|
+
node.memberList,
|
|
61550
|
+
1 /* Structure */,
|
|
61551
|
+
entity.isAbstract(),
|
|
61552
|
+
entity.markedBasic()
|
|
61553
|
+
);
|
|
61554
|
+
break;
|
|
61555
|
+
}
|
|
61556
|
+
case 29 /* PackageAspectDeclaration */: {
|
|
61557
|
+
const entity = this.analyzer.entity.ofPackageStructuredTypeDeclaration(parent);
|
|
61558
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61559
|
+
node.memberList,
|
|
61560
|
+
2 /* Aspect */,
|
|
61561
|
+
entity.isAbstract(),
|
|
61562
|
+
entity.markedBasic()
|
|
61563
|
+
);
|
|
61564
|
+
break;
|
|
61565
|
+
}
|
|
61566
|
+
case 18 /* AnonymousClassDeclaration */: {
|
|
61567
|
+
const entity = this.analyzer.entity.ofAnonymousStructuredTypeDeclaration(parent);
|
|
61568
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61569
|
+
node.memberList,
|
|
61570
|
+
2 /* Aspect */,
|
|
61571
|
+
entity.isAbstract(),
|
|
61572
|
+
entity.markedBasic()
|
|
61573
|
+
);
|
|
61574
|
+
break;
|
|
61575
|
+
}
|
|
61576
|
+
case 30 /* PackageReducedTypeDeclaration */: {
|
|
61577
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61578
|
+
node.memberList,
|
|
61579
|
+
5 /* ReducedType */,
|
|
61580
|
+
false,
|
|
61581
|
+
false
|
|
61582
|
+
);
|
|
61583
|
+
break;
|
|
61584
|
+
}
|
|
61585
|
+
case 31 /* PackageVariantDeclaration */: {
|
|
61586
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61587
|
+
node.memberList,
|
|
61588
|
+
3 /* Variant */,
|
|
61589
|
+
false,
|
|
61590
|
+
false
|
|
61591
|
+
);
|
|
61592
|
+
break;
|
|
61593
|
+
}
|
|
61594
|
+
case 19 /* PackageAliasTypeDeclaration */: {
|
|
61595
|
+
this.modifierValidator.validateTopLevelTypeMembers(
|
|
61596
|
+
node.memberList,
|
|
61597
|
+
4 /* AliasType */,
|
|
61598
|
+
false,
|
|
61599
|
+
false
|
|
61600
|
+
);
|
|
61601
|
+
break;
|
|
61602
|
+
}
|
|
61603
|
+
default:
|
|
61604
|
+
Debug.never(parent);
|
|
61605
|
+
}
|
|
61606
|
+
}
|
|
61607
|
+
}
|
|
61608
|
+
checkConstructorDeclaration(node) {
|
|
61609
|
+
const entity = this.analyzer.entity.ofConstructorDeclaration(node);
|
|
61610
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61611
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.creationKeyword);
|
|
61612
|
+
this.analyzer.semanticContext.ofConstructorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61613
|
+
}
|
|
61614
|
+
checkDestructorDeclaration(node) {
|
|
61615
|
+
const entity = this.analyzer.entity.ofDestructorDeclaration(node);
|
|
61616
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61617
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.destructionKeyword);
|
|
61618
|
+
this.analyzer.semanticContext.ofDestructorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61619
|
+
}
|
|
61620
|
+
checkMethodDeclaration(node) {
|
|
61621
|
+
const entity = this.analyzer.entity.ofMethodDeclaration(node);
|
|
61622
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61623
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.name);
|
|
61624
|
+
if (node.block !== void 0) {
|
|
61625
|
+
this.checkPossibleGeneratorFunctionReturnType(entity, node, node.name);
|
|
61626
|
+
const containingEntity = entity.getContainingEntity();
|
|
61627
|
+
if (entity.markedBasic() && containingEntity.kind === 2 /* Type */ && containingEntity.typeEntityKind === 4 /* Alias */) {
|
|
61628
|
+
this.analyzer.checkBodyOfBasicAliasTypeMethod(node, this.diagnosticAcceptor);
|
|
61629
|
+
}
|
|
61630
|
+
}
|
|
61631
|
+
if (entity.methodKind === 3 /* Operator */) {
|
|
61632
|
+
if (node.typeParameterClause !== void 0) {
|
|
61633
|
+
this.createAndAddDiagnostic(
|
|
61634
|
+
2231 /* OperatorCannotContainTypeParameterDeclarations */,
|
|
61635
|
+
node.typeParameterClause
|
|
61636
|
+
);
|
|
61637
|
+
}
|
|
61638
|
+
const syntacticalOperatorKind = node.name.operatorKind;
|
|
61639
|
+
if (syntacticalOperatorKind !== void 0) {
|
|
61640
|
+
const requiredParameterCount = requiredParameterCountBySyntacticalOperatorKind[syntacticalOperatorKind];
|
|
61641
|
+
const actualParameterCount = node.parameterClause.parameterList.parameters.count();
|
|
61642
|
+
switch (requiredParameterCount) {
|
|
61643
|
+
case 0 /* Zero */: {
|
|
61644
|
+
if (actualParameterCount !== 0) {
|
|
61645
|
+
const operatorText = LocalizationHelperA.localizeSyntacticalOperatorKind(
|
|
61646
|
+
syntacticalOperatorKind,
|
|
61647
|
+
this.sourceFile.locale
|
|
61648
|
+
);
|
|
61649
|
+
this.createAndAddDiagnostic(
|
|
61650
|
+
2097 /* OperatorFunction0MustNotHaveParameters */,
|
|
61651
|
+
node.name,
|
|
61652
|
+
[operatorText]
|
|
61653
|
+
);
|
|
61654
|
+
}
|
|
61655
|
+
break;
|
|
61656
|
+
}
|
|
61657
|
+
case 1 /* ZeroOrOne */: {
|
|
61658
|
+
if (!(actualParameterCount === 0 || actualParameterCount === 1)) {
|
|
61659
|
+
const operatorText = LocalizationHelperA.localizeSyntacticalOperatorKind(
|
|
61660
|
+
syntacticalOperatorKind,
|
|
61661
|
+
this.sourceFile.locale
|
|
61662
|
+
);
|
|
61663
|
+
this.createAndAddDiagnostic(
|
|
61664
|
+
2099 /* OperatorFunction0MustHaveNoMoreThanOneParameter */,
|
|
61665
|
+
node.name,
|
|
61666
|
+
[operatorText]
|
|
61667
|
+
);
|
|
61668
|
+
}
|
|
61669
|
+
break;
|
|
61670
|
+
}
|
|
61671
|
+
case 2 /* One */: {
|
|
61672
|
+
if (actualParameterCount !== 1) {
|
|
61673
|
+
const operatorText = LocalizationHelperA.localizeSyntacticalOperatorKind(
|
|
61674
|
+
syntacticalOperatorKind,
|
|
61675
|
+
this.sourceFile.locale
|
|
61676
|
+
);
|
|
61677
|
+
this.createAndAddDiagnostic(
|
|
61678
|
+
2098 /* OperatorFunction0MustHaveOneParameter */,
|
|
61679
|
+
node.name,
|
|
61680
|
+
[operatorText]
|
|
61681
|
+
);
|
|
61682
|
+
}
|
|
61683
|
+
break;
|
|
61684
|
+
}
|
|
61685
|
+
default:
|
|
61686
|
+
Debug.never(requiredParameterCount);
|
|
61687
|
+
}
|
|
61688
|
+
}
|
|
61689
|
+
}
|
|
61690
|
+
if (node.typeParameterClause !== void 0) {
|
|
61691
|
+
this.analyzer.semanticContext.ofFunctionDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61692
|
+
}
|
|
61693
|
+
this.analyzer.semanticContext.ofFunctionDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61694
|
+
if (!this.analyzer.isFunctionGenerator(node)) {
|
|
61695
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61696
|
+
node,
|
|
61697
|
+
node.name,
|
|
61698
|
+
this.analyzer.returnType.ofMethodDeclaration(node),
|
|
61699
|
+
this.analyzer.resultLocalVariableEntity.ofMethodDeclaration(node)
|
|
61700
|
+
);
|
|
61701
|
+
}
|
|
61702
|
+
}
|
|
61703
|
+
checkFieldDeclaration(node) {
|
|
61704
|
+
const entity = this.analyzer.entity.ofFieldDeclaration(node);
|
|
61705
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61706
|
+
if (TypeMemberEntity.isAspectMember(entity) && !entity.isStatic() && !entity.markedAbstract()) {
|
|
61707
|
+
this.createAndAddDiagnostic(2065 /* AspectTypeFieldsMustBeAbstract */, node.name);
|
|
61708
|
+
}
|
|
61709
|
+
if (this.isInterfacePackageFile) {
|
|
61710
|
+
if (node.initializer !== void 0) {
|
|
61711
|
+
this.createAndAddDiagnostic(2061 /* InterfacePackageVariablesMustNotHaveInitializers */, node.name);
|
|
61712
|
+
}
|
|
61713
|
+
} else if (TypeMemberEntity.isReducedTypeMember(entity)) {
|
|
61714
|
+
if (node.initializer !== void 0) {
|
|
61715
|
+
this.createAndAddDiagnostic(2069 /* ReducedTypeFieldsMustNotHaveInitializers */, node.name);
|
|
61716
|
+
}
|
|
61717
|
+
} else if (entity.markedAbstract()) {
|
|
61718
|
+
if (node.initializer !== void 0) {
|
|
61719
|
+
this.createAndAddDiagnostic(2068 /* AbstractFieldsMustNotHaveInitializers */, node.name);
|
|
61720
|
+
}
|
|
61721
|
+
}
|
|
61722
|
+
if (node.typeAnnotation === void 0 && node.initializer === void 0) {
|
|
61723
|
+
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
61724
|
+
} else if (node.initializer !== void 0 && node.typeAnnotation !== void 0) {
|
|
61725
|
+
this.checkExpressionTypeIsAssignableToTargetType(
|
|
61726
|
+
node.initializer,
|
|
61727
|
+
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
61728
|
+
);
|
|
61729
|
+
}
|
|
61730
|
+
}
|
|
61731
|
+
checkFieldGetterDeclaration(node) {
|
|
61732
|
+
const entity = this.analyzer.entity.ofComputedFieldDeclaration(node);
|
|
61733
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61734
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.name);
|
|
61735
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61736
|
+
node,
|
|
61737
|
+
node.name,
|
|
61738
|
+
this.analyzer.returnType.ofFieldGetterDeclaration(node),
|
|
61739
|
+
this.analyzer.resultLocalVariableEntity.ofFieldGetterDeclaration(node)
|
|
61740
|
+
);
|
|
61741
|
+
}
|
|
61742
|
+
checkFieldSetterDeclaration(node) {
|
|
61743
|
+
const entity = this.analyzer.entity.ofComputedFieldDeclaration(node);
|
|
61744
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61745
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.name);
|
|
61746
|
+
}
|
|
61747
|
+
checkIndexedElementGetterDeclaration(node) {
|
|
61748
|
+
const entity = this.analyzer.entity.ofIndexerDeclaration(node);
|
|
61749
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61750
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.parameterClause);
|
|
61751
|
+
this.analyzer.semanticContext.ofIndexedElementAccessorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61752
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61753
|
+
node,
|
|
61754
|
+
node.parameterClause,
|
|
61755
|
+
this.analyzer.returnType.ofIndexedElementGetterDeclaration(node),
|
|
61756
|
+
this.analyzer.resultLocalVariableEntity.ofIndexedElementGetterDeclaration(node)
|
|
61757
|
+
);
|
|
61758
|
+
}
|
|
61759
|
+
checkIndexedElementSetterDeclaration(node) {
|
|
61760
|
+
const entity = this.analyzer.entity.ofIndexerDeclaration(node);
|
|
61761
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61762
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.parameterClause);
|
|
61763
|
+
this.analyzer.semanticContext.ofIndexedElementAccessorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61764
|
+
}
|
|
61765
|
+
checkDereferencedVariableGetterDeclaration(node) {
|
|
61766
|
+
const entity = this.analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
|
61767
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61768
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.caretToken);
|
|
61769
|
+
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61770
|
+
node,
|
|
61771
|
+
node.caretToken,
|
|
61772
|
+
this.analyzer.returnType.ofDereferencedVariableGetterDeclaration(node),
|
|
61773
|
+
this.analyzer.resultLocalVariableEntity.ofDereferencedVariableGetterDeclaration(node)
|
|
61774
|
+
);
|
|
61775
|
+
}
|
|
61776
|
+
checkDereferencedVariableSetterDeclaration(node) {
|
|
61777
|
+
const entity = this.analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
|
61778
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
61779
|
+
this.checkTypeMemberBodyPresence(entity, node.block, node.caretToken);
|
|
61780
|
+
}
|
|
61781
|
+
checkTypeMemberBodyPresence(entity, body, diagnosticLocation) {
|
|
61782
|
+
if (this.isInterfacePackageFile) {
|
|
61783
|
+
if (body !== void 0) {
|
|
61784
|
+
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, diagnosticLocation);
|
|
61785
|
+
}
|
|
61786
|
+
} else if (findTag(this.analyzer.originalWellKnownDeclarations.builtIntoPlatform, entity.getTags()) !== void 0) {
|
|
61787
|
+
if (body !== void 0) {
|
|
61788
|
+
this.createAndAddDiagnostic(
|
|
61789
|
+
2066 /* DeclarationsMarkedWithBuiltIntoPlatformTagMustNotHaveBody */,
|
|
61790
|
+
diagnosticLocation
|
|
61791
|
+
);
|
|
61792
|
+
}
|
|
61793
|
+
} else if (TypeMemberEntity.isReducedTypeMember(entity)) {
|
|
61794
|
+
if (body !== void 0) {
|
|
61795
|
+
this.createAndAddDiagnostic(
|
|
61796
|
+
2067 /* ReducedTypeMembersMustNotHaveBody */,
|
|
61797
|
+
diagnosticLocation
|
|
61798
|
+
);
|
|
61799
|
+
}
|
|
61800
|
+
} else if (entity.isStatic()) {
|
|
61801
|
+
if (body === void 0) {
|
|
61802
|
+
this.createAndAddDiagnostic(2062 /* BodyIsMissing */, diagnosticLocation);
|
|
61803
|
+
}
|
|
61804
|
+
} else if (entity.markedAbstract()) {
|
|
61805
|
+
if (body !== void 0) {
|
|
61806
|
+
this.createAndAddDiagnostic(
|
|
61807
|
+
2063 /* AbstractTypeMembersMustNotHaveBody */,
|
|
61808
|
+
diagnosticLocation
|
|
61809
|
+
);
|
|
61810
|
+
}
|
|
61811
|
+
} else {
|
|
61812
|
+
if (body === void 0) {
|
|
61813
|
+
this.createAndAddDiagnostic(2062 /* BodyIsMissing */, diagnosticLocation);
|
|
61814
|
+
}
|
|
61815
|
+
}
|
|
61816
|
+
}
|
|
61817
|
+
checkTypeParameterList(node) {
|
|
61818
|
+
const typeParameterDeclarations = node.typeParameters.toArray();
|
|
61819
|
+
if (typeParameterDeclarations.some((d) => d.defaultType !== void 0)) {
|
|
61820
|
+
const notYetDeclaredParameters = /* @__PURE__ */ new Set();
|
|
61821
|
+
for (const typeParameterDeclaration of typeParameterDeclarations) {
|
|
61822
|
+
notYetDeclaredParameters.add(this.analyzer.entity.ofTypeParameterDeclaration(typeParameterDeclaration));
|
|
61823
|
+
}
|
|
61824
|
+
const visitor = (node2) => {
|
|
61825
|
+
if (node2.kind === 26 /* TypeMemberDeclarationBlock */) {
|
|
61826
|
+
return;
|
|
61827
|
+
}
|
|
61828
|
+
if (node2.kind === 10 /* NamedTypeSpecifier */) {
|
|
61829
|
+
const type = this.analyzer.resolveNamedTypeSpecifier(node2).type;
|
|
61830
|
+
if (type?.kind === "parameter" && notYetDeclaredParameters.has(type.getEntity().getOriginalEntity())) {
|
|
61831
|
+
this.createAndAddDiagnostic(
|
|
61832
|
+
2186 /* TypeParameterDefaultCanReferenceOnlyPreviouslyDeclaredTypeParameters */,
|
|
61833
|
+
node2
|
|
61834
|
+
);
|
|
61835
|
+
}
|
|
61836
|
+
}
|
|
61837
|
+
forEachChild(node2, false, visitor);
|
|
61838
|
+
};
|
|
61839
|
+
for (const typeParameterDeclaration of typeParameterDeclarations) {
|
|
61840
|
+
if (typeParameterDeclaration.defaultType !== void 0) {
|
|
61841
|
+
visitor(typeParameterDeclaration.defaultType);
|
|
61842
|
+
}
|
|
61843
|
+
notYetDeclaredParameters.delete(this.analyzer.entity.ofTypeParameterDeclaration(typeParameterDeclaration));
|
|
61844
|
+
}
|
|
61845
|
+
}
|
|
61846
|
+
let seenOptionalTypeParameter = false;
|
|
61847
|
+
for (const typeParameterDeclaration of typeParameterDeclarations) {
|
|
61848
|
+
if (typeParameterDeclaration.defaultType !== void 0) {
|
|
61849
|
+
seenOptionalTypeParameter = true;
|
|
61850
|
+
} else if (seenOptionalTypeParameter) {
|
|
61851
|
+
this.createAndAddDiagnostic(
|
|
61852
|
+
2187 /* RequiredTypeParametersCannotFollowTypeParametersWithDefaults */,
|
|
61853
|
+
typeParameterDeclaration
|
|
61854
|
+
);
|
|
61855
|
+
break;
|
|
61856
|
+
}
|
|
61857
|
+
}
|
|
61858
|
+
}
|
|
61859
|
+
checkTypeParameterDeclaration(node) {
|
|
61860
|
+
const entity = this.analyzer.entity.ofTypeParameterDeclaration(node);
|
|
61861
|
+
const constraint = entity.getConstraint();
|
|
61862
|
+
if (constraint.causesCycle) {
|
|
61863
|
+
this.createAndAddDiagnostic(2082 /* TypeParameterHasCircularConstraint */, node.name);
|
|
61864
|
+
}
|
|
61865
|
+
if (constraint.cycleFree !== void 0) {
|
|
61866
|
+
const defaultType = entity.getDefaultType();
|
|
61867
|
+
if (defaultType !== void 0 && !this.analyzer.isTypeAssignableTo(defaultType, constraint.cycleFree)) {
|
|
61868
|
+
this.addTypeAssignabilityDiagnosticIfBothTypesResolved(
|
|
61869
|
+
defaultType,
|
|
61870
|
+
constraint.cycleFree,
|
|
61871
|
+
node.defaultType ?? node,
|
|
61872
|
+
2087 /* Type0IsNotAssignableToConstraint1 */
|
|
61873
|
+
);
|
|
61874
|
+
}
|
|
61875
|
+
}
|
|
61876
|
+
this.checkIfTypeParameterIsUnused(entity, node.name);
|
|
61877
|
+
}
|
|
61878
|
+
checkNamedTypeSpecifier(node) {
|
|
61879
|
+
const resolutionResult = this.analyzer.resolveNamedTypeSpecifier(node);
|
|
61880
|
+
if (resolutionResult.type !== void 0) {
|
|
61881
|
+
const entity = resolutionResult.type.getEntity();
|
|
61882
|
+
if (entity !== void 0) {
|
|
61883
|
+
const typeArgumentCount = node.typeArgumentClause?.typeArgumentList.typeArguments.count() ?? 0;
|
|
61884
|
+
this.analyzer.checkTypeArgumentCount(
|
|
61885
|
+
typeArgumentCount,
|
|
61886
|
+
entity.getTypeParameters(),
|
|
61887
|
+
this.diagnosticAcceptor,
|
|
61888
|
+
node.typeArgumentClause ?? node.qualifiedName
|
|
61889
|
+
);
|
|
61890
|
+
const substitutions = resolutionResult.type.getSubstitutions();
|
|
61891
|
+
this.checkTypeArgumentTypesAreAssignableToConstraints(
|
|
61892
|
+
entity.getTypeParameters(),
|
|
61893
|
+
substitutions,
|
|
61894
|
+
void 0,
|
|
61895
|
+
node.typeArgumentClause ?? node
|
|
61896
|
+
);
|
|
61897
|
+
}
|
|
61898
|
+
}
|
|
61899
|
+
}
|
|
61900
|
+
checkAnonymousClassDeclaration(node) {
|
|
61901
|
+
const entity = this.analyzer.entity.ofAnonymousStructuredTypeDeclaration(node);
|
|
61902
|
+
if (node.extendsClause !== void 0) {
|
|
61903
|
+
this.checkAspectsHaveNotBeenExtendedWithDifferentTypeArguments(
|
|
61904
|
+
entity,
|
|
61905
|
+
node.extendsClause.baseTypeList,
|
|
61906
|
+
node.classKeyword
|
|
61907
|
+
);
|
|
61908
|
+
}
|
|
61909
|
+
this.overrideChecker.checkMembers(entity.getMembers());
|
|
61910
|
+
new TypeMemberConflictsValidator(this.analyzer, entity.getMembers(), this.diagnosticAcceptor).validate();
|
|
61911
|
+
const semanticContext = this.analyzer.semanticContext.outermostSemanticContextOfTypeDeclaration(node);
|
|
61912
|
+
new BaseMemberConflictsValidator(
|
|
61913
|
+
this.analyzer,
|
|
61914
|
+
entity,
|
|
61915
|
+
semanticContext.getDiagnosticArgumentFactory(),
|
|
61916
|
+
this.diagnosticAcceptor,
|
|
61917
|
+
node.classKeyword
|
|
61918
|
+
).validate();
|
|
61919
|
+
const typeMemberImplementationCheckResult = this.analyzer.getTypeMemberImplementationCheckResult(entity);
|
|
61920
|
+
this.attachNodeLocationAndAddDiagnostics(
|
|
61921
|
+
typeMemberImplementationCheckResult.diagnosticsData,
|
|
61922
|
+
node.classKeyword
|
|
61923
|
+
);
|
|
61924
|
+
if (!this.isInterfacePackageFile) {
|
|
61925
|
+
this.addDiagnostics(this.analyzer.getOwnAndBaseConstructorCallsCheckResult(node).diagnostics);
|
|
61926
|
+
new InstanceFieldsInitializationValidator(
|
|
61927
|
+
this.analyzer,
|
|
61928
|
+
node,
|
|
61929
|
+
this.namedDeclarationsUsageMap,
|
|
61930
|
+
this.diagnosticAcceptor
|
|
61931
|
+
).validate();
|
|
61932
|
+
}
|
|
61933
|
+
}
|
|
61934
|
+
checkAnonymousFunctionTypeDeclaration(node) {
|
|
61935
|
+
this.analyzer.semanticContext.ofFunctionTypeDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61936
|
+
}
|
|
61937
|
+
checkParameterList(node) {
|
|
61938
|
+
const parameters = node.parameters.toArray();
|
|
61939
|
+
if (parameters.length > 0) {
|
|
61940
|
+
this.checkRequiredParametersDoNotFollowOptionalParameters(parameters);
|
|
61941
|
+
const firstParameter = parameters[0];
|
|
61942
|
+
const firstParameterEntity = this.analyzer.entity.ofParameterDeclaration(firstParameter);
|
|
61943
|
+
if (firstParameterEntity.isObjectParameter() && !this.parameterListCanDeclareObjectParameter(node)) {
|
|
61944
|
+
this.createAndAddDiagnostic(2228 /* ObjectParameterCannotBeDeclaredHere */, firstParameter.name);
|
|
61945
|
+
}
|
|
61946
|
+
this.checkObjectParameterIsTheFirstParameter(parameters);
|
|
61947
|
+
}
|
|
61948
|
+
}
|
|
61949
|
+
checkRequiredParametersDoNotFollowOptionalParameters(parameters) {
|
|
61950
|
+
let seenOptionalParameter = false;
|
|
61951
|
+
for (const parameter of parameters) {
|
|
61952
|
+
if (parameter.defaultValue !== void 0) {
|
|
61953
|
+
seenOptionalParameter = true;
|
|
61954
|
+
} else if (seenOptionalParameter) {
|
|
61955
|
+
this.createAndAddDiagnostic(2188 /* RequiredParametersCannotFollowOptionalParameters */, parameter.name);
|
|
61956
|
+
break;
|
|
61957
|
+
}
|
|
61958
|
+
}
|
|
61959
|
+
}
|
|
61960
|
+
parameterListCanDeclareObjectParameter(node) {
|
|
61961
|
+
const parent = node.parent.parent;
|
|
61962
|
+
switch (parent.kind) {
|
|
61963
|
+
case 17 /* AnonymousFunctionTypeDeclaration */:
|
|
61964
|
+
case 23 /* PackageFunctionDeclaration */:
|
|
61965
|
+
case 53 /* NestedFunctionDeclaration */:
|
|
61966
|
+
case 62 /* FunctionLiteral */:
|
|
61967
|
+
return true;
|
|
61968
|
+
case 47 /* MethodDeclaration */: {
|
|
61969
|
+
const containingDeclaration = TypeMemberQuery.getContainingDeclaration(parent);
|
|
61970
|
+
switch (containingDeclaration.kind) {
|
|
61971
|
+
case 18 /* AnonymousClassDeclaration */:
|
|
61972
|
+
case 27 /* PackageClassDeclaration */:
|
|
61973
|
+
case 28 /* PackageStructureDeclaration */:
|
|
61974
|
+
case 29 /* PackageAspectDeclaration */:
|
|
61975
|
+
case 30 /* PackageReducedTypeDeclaration */:
|
|
61976
|
+
case 31 /* PackageVariantDeclaration */:
|
|
61977
|
+
return true;
|
|
61978
|
+
case 19 /* PackageAliasTypeDeclaration */:
|
|
61979
|
+
case 35 /* TypeExtensionDeclaration */:
|
|
61980
|
+
return false;
|
|
61981
|
+
default:
|
|
61982
|
+
Debug.never(containingDeclaration);
|
|
61983
|
+
}
|
|
61984
|
+
}
|
|
61985
|
+
case 40 /* ConstructorDeclaration */:
|
|
61986
|
+
case 41 /* DestructorDeclaration */:
|
|
61987
|
+
case 42 /* IndexedElementGetterDeclaration */:
|
|
61988
|
+
case 43 /* IndexedElementSetterDeclaration */:
|
|
61989
|
+
return false;
|
|
61990
|
+
default:
|
|
61991
|
+
Debug.never(parent);
|
|
61992
|
+
}
|
|
61993
|
+
}
|
|
61994
|
+
checkObjectParameterIsTheFirstParameter(parameters) {
|
|
61995
|
+
for (let i = 1; i < parameters.length; i++) {
|
|
61996
|
+
const parameterDeclaration2 = parameters[i];
|
|
61997
|
+
if ((parameterDeclaration2.name.flags & 512 /* ObjectParameterName */) !== 0) {
|
|
61998
|
+
this.createAndAddDiagnostic(2227 /* ObjectParameterMustBeTheFirstParameter */, parameterDeclaration2.name);
|
|
61999
|
+
break;
|
|
62000
|
+
}
|
|
62001
|
+
}
|
|
62002
|
+
}
|
|
62003
|
+
checkParameterDeclaration(node) {
|
|
62004
|
+
const entity = this.analyzer.entity.ofParameterDeclaration(node);
|
|
62005
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
62006
|
+
const isFunctionLiteralParameter = node.parent.parent.parent.kind === 62 /* FunctionLiteral */;
|
|
62007
|
+
if (!isFunctionLiteralParameter && node.typeAnnotation === void 0 && node.defaultValue === void 0) {
|
|
62008
|
+
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
62009
|
+
} else if (node.defaultValue !== void 0 && node.typeAnnotation !== void 0) {
|
|
62010
|
+
this.checkExpressionTypeIsAssignableToTargetType(
|
|
62011
|
+
node.defaultValue,
|
|
62012
|
+
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
62013
|
+
);
|
|
62014
|
+
} else if (isFunctionLiteralParameter && node.defaultValue !== void 0) {
|
|
62015
|
+
this.checkExpressionTypeIsAssignableToTargetType(node.defaultValue, entity.getType());
|
|
62016
|
+
}
|
|
62017
|
+
let parentHasBody;
|
|
62018
|
+
const parent = node.parent.parent.parent;
|
|
62019
|
+
switch (parent.kind) {
|
|
62020
|
+
case 23 /* PackageFunctionDeclaration */:
|
|
62021
|
+
case 40 /* ConstructorDeclaration */:
|
|
62022
|
+
case 41 /* DestructorDeclaration */:
|
|
62023
|
+
case 42 /* IndexedElementGetterDeclaration */:
|
|
62024
|
+
case 43 /* IndexedElementSetterDeclaration */:
|
|
62025
|
+
case 47 /* MethodDeclaration */:
|
|
62026
|
+
case 53 /* NestedFunctionDeclaration */:
|
|
62027
|
+
case 62 /* FunctionLiteral */:
|
|
62028
|
+
parentHasBody = parent.block !== void 0;
|
|
62029
|
+
break;
|
|
62030
|
+
case 17 /* AnonymousFunctionTypeDeclaration */:
|
|
62031
|
+
parentHasBody = false;
|
|
62032
|
+
break;
|
|
62033
|
+
default:
|
|
62034
|
+
Debug.never(parent);
|
|
62035
|
+
}
|
|
62036
|
+
if (parentHasBody) {
|
|
62037
|
+
this.checkIfVariableIsUnused(entity, node.name);
|
|
62038
|
+
}
|
|
62039
|
+
}
|
|
62040
|
+
checkOwnConstructorCallExpression(node) {
|
|
62041
|
+
this.analyzer.resolveOwnConstructorCallExpression(node);
|
|
62042
|
+
}
|
|
62043
|
+
checkReferenceExpression(node) {
|
|
62044
|
+
if (!this.analyzer.expressionCanBeReferenced(node.expression)) {
|
|
62045
|
+
this.createAndAddDiagnostic(2189 /* ExpressionCannotBeReferenced */, node.expression);
|
|
62046
|
+
}
|
|
62047
|
+
}
|
|
62048
|
+
checkMatchExpressionList(node) {
|
|
62049
|
+
const matchedExpressionType = this.analyzer.type.ofExpression(node.parent.parent.parent.expression);
|
|
62050
|
+
for (const expression of node.matchExpressions) {
|
|
62051
|
+
this.checkExpressionTypeIsAssignableToTargetType(expression, matchedExpressionType);
|
|
62052
|
+
}
|
|
62053
|
+
}
|
|
62054
|
+
checkWhileStatement(node) {
|
|
62055
|
+
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
62056
|
+
}
|
|
62057
|
+
checkLoopStatement(node) {
|
|
62058
|
+
if (node.condition !== void 0) {
|
|
62059
|
+
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
62060
|
+
}
|
|
62061
|
+
}
|
|
62062
|
+
checkElseIfClause(node) {
|
|
62063
|
+
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
62064
|
+
}
|
|
62065
|
+
checkIfStatement(node) {
|
|
62066
|
+
this.checkExpressionTypeIsAssignableToTargetType(node.condition, this.standardTypes.yesNo);
|
|
62067
|
+
}
|
|
62068
|
+
checkArgument(node) {
|
|
62069
|
+
this.checkExpressionTypeIsAssignableToTargetType(
|
|
62070
|
+
node.value,
|
|
62071
|
+
this.analyzer.getTargetTypeOfExpression(node.value)
|
|
62072
|
+
);
|
|
62073
|
+
}
|
|
62074
|
+
checkErrorVariableDeclaration(node) {
|
|
62075
|
+
const entity = this.analyzer.entity.ofErrorVariableDeclaration(node);
|
|
62076
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
62077
|
+
this.checkIfVariableIsUnused(entity, node.name);
|
|
62078
|
+
}
|
|
62079
|
+
checkForStatementVariableDeclaration(node) {
|
|
62080
|
+
const entity = this.analyzer.entity.ofForStatementVariableDeclaration(node);
|
|
62081
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
62082
|
+
this.checkIfVariableIsUnused(entity, node.name);
|
|
62083
|
+
}
|
|
62084
|
+
checkLocalVariableDeclaration(node) {
|
|
62085
|
+
const entity = this.analyzer.entity.ofLocalVariableDeclaration(node);
|
|
62086
|
+
entity.ensureAllDiagnosticsReported?.();
|
|
62087
|
+
if (node.typeAnnotation === void 0 && node.initializer === void 0) {
|
|
62088
|
+
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
62089
|
+
} else if (node.initializer !== void 0 && node.typeAnnotation !== void 0) {
|
|
62090
|
+
this.checkExpressionTypeIsAssignableToTargetType(
|
|
62091
|
+
node.initializer,
|
|
62092
|
+
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
62093
|
+
);
|
|
62094
|
+
}
|
|
62095
|
+
this.checkIfVariableIsUnused(entity, node.name);
|
|
62096
|
+
}
|
|
62097
|
+
checkBaseExpression(node) {
|
|
62098
|
+
const meaning = this.analyzer.resolveBaseExpression(node);
|
|
62099
|
+
if (meaning.kind === "base-object-access") {
|
|
62100
|
+
let parent = node.getParentSkippingParenthesizedExpressions();
|
|
62101
|
+
if (parent.kind === 60 /* AsExpression */) {
|
|
62102
|
+
parent = parent.getParentSkippingParenthesizedExpressions();
|
|
62103
|
+
}
|
|
62104
|
+
if (!(parent.kind === 73 /* MemberAccessExpression */ || parent.kind === 67 /* IndexedAccessExpression */ || parent.kind === 75 /* DereferenceExpression */)) {
|
|
62105
|
+
this.createAndAddDiagnostic(2059 /* BaseCannotBeUsedAsAnExpressionInItself */, node);
|
|
62106
|
+
}
|
|
62107
|
+
} else if (meaning.kind === "overridden-method-access" && meaning.method.kind === "substituted-function") {
|
|
62108
|
+
const typeArgumentClause = getParentGenericSpecializationExpression(node)?.typeArgumentClause;
|
|
62109
|
+
this.checkTypeArgumentTypesAreAssignableToConstraints(
|
|
62110
|
+
meaning.method.getTypeParameters(),
|
|
62111
|
+
meaning.method.value.getSubstitutions(),
|
|
62112
|
+
meaning.method.value.getOuterSubstitutions(),
|
|
62113
|
+
typeArgumentClause ?? node
|
|
62114
|
+
);
|
|
62115
|
+
}
|
|
62116
|
+
}
|
|
62117
|
+
checkObjectExpression(node) {
|
|
62118
|
+
this.analyzer.resolveObjectExpression(node);
|
|
62119
|
+
}
|
|
62120
|
+
checkAssignmentStatement(node) {
|
|
62121
|
+
if (this.checkAssignmentIsValid(node)) {
|
|
62122
|
+
if (node.operator.tokenKind === 64 /* Equals */) {
|
|
62123
|
+
this.checkExpressionTypeIsAssignableToTargetType(node.right, this.analyzer.type.ofExpression(node.left));
|
|
62124
|
+
}
|
|
62125
|
+
}
|
|
62126
|
+
const operatorKind = this.analyzer.getBinaryOperatorKindIfCompoundAssignmentOperator(node.operator);
|
|
62127
|
+
if (operatorKind !== void 0) {
|
|
62128
|
+
const operator = this.analyzer.resolveCompoundAssignmentStatementOperator(node, operatorKind);
|
|
62129
|
+
if (operator !== void 0) {
|
|
62130
|
+
const returnType = operator.getReturnType();
|
|
62131
|
+
const leftType = this.analyzer.type.ofExpression(node.left);
|
|
62132
|
+
if (!this.analyzer.isTypeAssignableTo(returnType, leftType)) {
|
|
62133
|
+
this.addTypeAssignabilityDiagnosticIfBothTypesResolved(
|
|
62134
|
+
returnType,
|
|
62135
|
+
leftType,
|
|
62136
|
+
node.right,
|
|
62137
|
+
2032 /* Type0IsNotAssignableToType1 */
|
|
62138
|
+
);
|
|
62139
|
+
}
|
|
62140
|
+
}
|
|
62141
|
+
}
|
|
62142
|
+
}
|
|
62143
|
+
checkPrefixUnaryExpression(node) {
|
|
62144
|
+
this.analyzer.resolvePrefixUnaryExpressionUserDefinableOperator(node);
|
|
62145
|
+
}
|
|
62146
|
+
checkCatchClause(node) {
|
|
62147
|
+
this.analyzer.semanticContext.ofCatchClause(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
62148
|
+
}
|
|
62149
|
+
checkForStatement(node) {
|
|
62150
|
+
const checkResult = this.analyzer.checkExpressionCanBeUsedInForLoop(node.enumeratedExpression);
|
|
62151
|
+
if (checkResult.kind === "error") {
|
|
62152
|
+
this.addDiagnostics(checkResult.value);
|
|
62153
|
+
}
|
|
62154
|
+
this.analyzer.semanticContext.ofForStatement(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
62155
|
+
}
|
|
62156
|
+
checkLocalizableTextTemplateLiteral(node) {
|
|
62157
|
+
const resolved = this.analyzer.resolveLocalizableTextOrTextTemplate(node);
|
|
62158
|
+
if (resolved !== void 0) {
|
|
62159
|
+
const spans = node.spanList.spans;
|
|
62160
|
+
const parameters = resolved.getParameters();
|
|
62161
|
+
if (spans.length === parameters.length) {
|
|
62162
|
+
for (let i = 0; i < spans.length; i++) {
|
|
62163
|
+
const argument2 = spans[i].expression;
|
|
62164
|
+
const parameter = parameters[i];
|
|
62165
|
+
this.checkExpressionTypeIsAssignableToTargetType(argument2, parameter.getType());
|
|
62166
|
+
}
|
|
62167
|
+
}
|
|
62168
|
+
}
|
|
62169
|
+
}
|
|
62170
|
+
checkLocalizableTextLiteral(node) {
|
|
62171
|
+
this.analyzer.resolveLocalizableTextOrTextTemplate(node);
|
|
62172
|
+
}
|
|
62173
|
+
checkAutotypeCallExpression(node) {
|
|
62174
|
+
this.analyzer.resolveAutotypeCallExpression(node);
|
|
62175
|
+
}
|
|
62176
|
+
checkBinaryExpression(node) {
|
|
62177
|
+
const classificationResult = this.analyzer.classifyBinaryExpressionOperator(node.operator);
|
|
62178
|
+
switch (classificationResult.kind) {
|
|
62179
|
+
case "user-definable":
|
|
62180
|
+
this.analyzer.resolveBinaryExpressionUserDefinableOperator(node, classificationResult.operatorKind);
|
|
62181
|
+
break;
|
|
62182
|
+
case "equals":
|
|
62183
|
+
case "not-equals": {
|
|
62184
|
+
const leftType = this.analyzer.type.ofExpression(node.left);
|
|
62185
|
+
const rightType = this.analyzer.type.ofExpression(node.right);
|
|
62186
|
+
if (!this.analyzer.expressionsOfTypesCanBeCompared(leftType, rightType)) {
|
|
62187
|
+
this.createAndAddDiagnostic(
|
|
62188
|
+
2233 /* ExpressionsWithTypes0And1CannotBeCompared */,
|
|
62189
|
+
node.operator,
|
|
62190
|
+
[
|
|
62191
|
+
this.diagnosticArgumentFactory.createDisplayableType(leftType),
|
|
62192
|
+
this.diagnosticArgumentFactory.createDisplayableType(rightType)
|
|
62193
|
+
]
|
|
62194
|
+
);
|
|
62195
|
+
}
|
|
62196
|
+
break;
|
|
62197
|
+
}
|
|
62198
|
+
case "question-question":
|
|
62199
|
+
break;
|
|
62200
|
+
default:
|
|
62201
|
+
Debug.never(classificationResult);
|
|
62202
|
+
}
|
|
62203
|
+
}
|
|
62204
|
+
checkAssumptionExpression(node) {
|
|
62205
|
+
const parent = node.getParentSkippingParenthesizedExpressions();
|
|
62206
|
+
switch (parent.kind) {
|
|
62207
|
+
case 73 /* MemberAccessExpression */:
|
|
62208
|
+
case 65 /* CallExpression */:
|
|
62209
|
+
case 67 /* IndexedAccessExpression */:
|
|
62210
|
+
case 75 /* DereferenceExpression */:
|
|
62211
|
+
break;
|
|
62212
|
+
default:
|
|
62213
|
+
this.createAndAddDiagnostic(
|
|
62214
|
+
2225 /* QuestionOperatorCanBeUsedOnlyInSpecificExpressions */,
|
|
62215
|
+
node.questionToken
|
|
62216
|
+
);
|
|
62217
|
+
}
|
|
62218
|
+
}
|
|
62219
|
+
checkStatementBlock(node) {
|
|
62220
|
+
const semanticContext = this.analyzer.semanticContext.ofStatementBlock(node);
|
|
62221
|
+
semanticContext.validateNameConflicts(this.diagnosticAcceptor);
|
|
62222
|
+
}
|
|
62223
|
+
checkFunctionBlock(node) {
|
|
62224
|
+
const semanticContext = this.analyzer.semanticContext.ofFunctionBlock(node);
|
|
62225
|
+
semanticContext.validateNameConflicts(this.diagnosticAcceptor);
|
|
62226
|
+
}
|
|
61588
62227
|
checkErrorStatement(node) {
|
|
61589
62228
|
this.checkExpressionTypeIsAssignableToTargetType(
|
|
61590
62229
|
node.expression,
|
|
@@ -61670,67 +62309,6 @@ var SourceFileAnalyzer = class {
|
|
|
61670
62309
|
}
|
|
61671
62310
|
return { isUsedInsideLoop, isUsedInsideFinallyBlock };
|
|
61672
62311
|
}
|
|
61673
|
-
checkTypeParameterList(node) {
|
|
61674
|
-
const typeParameterDeclarations = node.typeParameters.toArray();
|
|
61675
|
-
if (typeParameterDeclarations.some((d) => d.defaultType !== void 0)) {
|
|
61676
|
-
const notYetDeclaredParameters = /* @__PURE__ */ new Set();
|
|
61677
|
-
for (const typeParameterDeclaration of typeParameterDeclarations) {
|
|
61678
|
-
notYetDeclaredParameters.add(this.analyzer.entity.ofTypeParameterDeclaration(typeParameterDeclaration));
|
|
61679
|
-
}
|
|
61680
|
-
const visitor = (node2) => {
|
|
61681
|
-
if (node2.kind === 26 /* TypeMemberDeclarationBlock */) {
|
|
61682
|
-
return;
|
|
61683
|
-
}
|
|
61684
|
-
if (node2.kind === 10 /* NamedTypeSpecifier */) {
|
|
61685
|
-
const type = this.analyzer.resolveNamedTypeSpecifier(node2).type;
|
|
61686
|
-
if (type?.kind === "parameter" && notYetDeclaredParameters.has(type.getEntity().getOriginalEntity())) {
|
|
61687
|
-
this.createAndAddDiagnostic(
|
|
61688
|
-
2186 /* TypeParameterDefaultCanReferenceOnlyPreviouslyDeclaredTypeParameters */,
|
|
61689
|
-
node2
|
|
61690
|
-
);
|
|
61691
|
-
}
|
|
61692
|
-
}
|
|
61693
|
-
forEachChild(node2, false, visitor);
|
|
61694
|
-
};
|
|
61695
|
-
for (const typeParameterDeclaration of typeParameterDeclarations) {
|
|
61696
|
-
if (typeParameterDeclaration.defaultType !== void 0) {
|
|
61697
|
-
visitor(typeParameterDeclaration.defaultType);
|
|
61698
|
-
}
|
|
61699
|
-
notYetDeclaredParameters.delete(this.analyzer.entity.ofTypeParameterDeclaration(typeParameterDeclaration));
|
|
61700
|
-
}
|
|
61701
|
-
}
|
|
61702
|
-
let seenOptionalTypeParameter = false;
|
|
61703
|
-
for (const typeParameterDeclaration of typeParameterDeclarations) {
|
|
61704
|
-
if (typeParameterDeclaration.defaultType !== void 0) {
|
|
61705
|
-
seenOptionalTypeParameter = true;
|
|
61706
|
-
} else if (seenOptionalTypeParameter) {
|
|
61707
|
-
this.createAndAddDiagnostic(
|
|
61708
|
-
2187 /* RequiredTypeParametersCannotFollowTypeParametersWithDefaults */,
|
|
61709
|
-
typeParameterDeclaration
|
|
61710
|
-
);
|
|
61711
|
-
break;
|
|
61712
|
-
}
|
|
61713
|
-
}
|
|
61714
|
-
}
|
|
61715
|
-
checkTypeParameterDeclaration(node) {
|
|
61716
|
-
const entity = this.analyzer.entity.ofTypeParameterDeclaration(node);
|
|
61717
|
-
const constraint = entity.getConstraint();
|
|
61718
|
-
if (constraint.causesCycle) {
|
|
61719
|
-
this.createAndAddDiagnostic(2082 /* TypeParameterHasCircularConstraint */, node.name);
|
|
61720
|
-
}
|
|
61721
|
-
if (constraint.cycleFree !== void 0) {
|
|
61722
|
-
const defaultType = entity.getDefaultType();
|
|
61723
|
-
if (defaultType !== void 0 && !this.analyzer.isTypeAssignableTo(defaultType, constraint.cycleFree)) {
|
|
61724
|
-
this.addTypeAssignabilityDiagnosticIfBothTypesResolved(
|
|
61725
|
-
defaultType,
|
|
61726
|
-
constraint.cycleFree,
|
|
61727
|
-
node.defaultType ?? node,
|
|
61728
|
-
2087 /* Type0IsNotAssignableToConstraint1 */
|
|
61729
|
-
);
|
|
61730
|
-
}
|
|
61731
|
-
}
|
|
61732
|
-
this.checkIfTypeParameterIsUnused(entity, node.name);
|
|
61733
|
-
}
|
|
61734
62312
|
checkFunctionLiteral(node) {
|
|
61735
62313
|
this.analyzer.semanticContext.ofRegularOrBlockFunctionLiteralParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61736
62314
|
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
@@ -61806,38 +62384,6 @@ var SourceFileAnalyzer = class {
|
|
|
61806
62384
|
}
|
|
61807
62385
|
}
|
|
61808
62386
|
}
|
|
61809
|
-
addNotTranslatedTextsDiagnostics(translationPackage, diagnosticLocation) {
|
|
61810
|
-
const notTranslatedEntities = this.collectNotTranslatedTexts(translationPackage);
|
|
61811
|
-
if (notTranslatedEntities.length > 0) {
|
|
61812
|
-
const diagnostic = this.createNotTranslatedTextsDiagnostic(notTranslatedEntities, diagnosticLocation);
|
|
61813
|
-
this.addDiagnostic(diagnostic);
|
|
61814
|
-
}
|
|
61815
|
-
}
|
|
61816
|
-
collectNotTranslatedTexts(translationPackage) {
|
|
61817
|
-
return [];
|
|
61818
|
-
}
|
|
61819
|
-
createNotTranslatedTextsDiagnostic(entities, diagnosticLocation) {
|
|
61820
|
-
const maxDisplayedEntitiesCount = 10;
|
|
61821
|
-
let result;
|
|
61822
|
-
if (entities.length <= maxDisplayedEntitiesCount) {
|
|
61823
|
-
const displayableEntities = entities.map((e) => this.diagnosticArgumentFactory.createDisplayableEntity(e));
|
|
61824
|
-
result = this.analyzer.createDiagnostic(
|
|
61825
|
-
2095 /* TheFollowingTextsAreNotTranslated0 */,
|
|
61826
|
-
diagnosticLocation,
|
|
61827
|
-
[new DisplayableArray(displayableEntities, "\n\n")],
|
|
61828
|
-
1 /* Warning */
|
|
61829
|
-
);
|
|
61830
|
-
} else {
|
|
61831
|
-
const displayableEntities = entities.slice(0, maxDisplayedEntitiesCount + 1).map((e) => this.diagnosticArgumentFactory.createDisplayableEntity(e));
|
|
61832
|
-
result = this.analyzer.createDiagnostic(
|
|
61833
|
-
2096 /* TheFollowingTextsAreNotTranslated0And1More */,
|
|
61834
|
-
diagnosticLocation,
|
|
61835
|
-
[new DisplayableArray(displayableEntities, "\n\n"), entities.length - maxDisplayedEntitiesCount],
|
|
61836
|
-
1 /* Warning */
|
|
61837
|
-
);
|
|
61838
|
-
}
|
|
61839
|
-
return result;
|
|
61840
|
-
}
|
|
61841
62387
|
checkAllDefaultConstructorArgumentsAreNamed(node) {
|
|
61842
62388
|
for (const argument2 of node.argumentList.arguments) {
|
|
61843
62389
|
if (argument2.name === void 0) {
|
|
@@ -61846,224 +62392,6 @@ var SourceFileAnalyzer = class {
|
|
|
61846
62392
|
}
|
|
61847
62393
|
}
|
|
61848
62394
|
}
|
|
61849
|
-
checkPackageVariableDeclaration(node) {
|
|
61850
|
-
const entity = this.analyzer.entity.ofPackageVariableDeclaration(node);
|
|
61851
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61852
|
-
if (this.isInterfacePackageFile) {
|
|
61853
|
-
if (node.initializer !== void 0) {
|
|
61854
|
-
this.createAndAddDiagnostic(2061 /* InterfacePackageVariablesMustNotHaveInitializers */, node.name);
|
|
61855
|
-
}
|
|
61856
|
-
}
|
|
61857
|
-
if (node.typeAnnotation === void 0 && node.initializer === void 0) {
|
|
61858
|
-
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
61859
|
-
} else if (node.initializer !== void 0 && node.typeAnnotation !== void 0) {
|
|
61860
|
-
this.checkExpressionTypeIsAssignableToTargetType(
|
|
61861
|
-
node.initializer,
|
|
61862
|
-
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
61863
|
-
);
|
|
61864
|
-
}
|
|
61865
|
-
}
|
|
61866
|
-
checkPackageFunctionDeclaration(node) {
|
|
61867
|
-
const entity = this.analyzer.entity.ofPackageFunctionDeclaration(node);
|
|
61868
|
-
this.checkPackageMemberBodyPresence(entity, node.block, node.name);
|
|
61869
|
-
if (node.block !== void 0) {
|
|
61870
|
-
this.checkPossibleGeneratorFunctionReturnType(entity, node, node.name);
|
|
61871
|
-
}
|
|
61872
|
-
if (node.typeParameterClause !== void 0) {
|
|
61873
|
-
this.analyzer.semanticContext.ofFunctionDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61874
|
-
}
|
|
61875
|
-
this.analyzer.semanticContext.ofFunctionDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61876
|
-
if (!this.analyzer.isFunctionGenerator(node)) {
|
|
61877
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61878
|
-
node,
|
|
61879
|
-
node.name,
|
|
61880
|
-
this.analyzer.returnType.ofPackageFunctionDeclaration(node),
|
|
61881
|
-
this.analyzer.resultLocalVariableEntity.ofPackageFunctionDeclaration(node)
|
|
61882
|
-
);
|
|
61883
|
-
}
|
|
61884
|
-
}
|
|
61885
|
-
checkPackageVariableGetterDeclaration(node) {
|
|
61886
|
-
const entity = this.analyzer.entity.ofComputedPackageVariableDeclaration(node);
|
|
61887
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61888
|
-
this.checkPackageMemberBodyPresence(entity, node.block, node.name);
|
|
61889
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61890
|
-
node,
|
|
61891
|
-
node.name,
|
|
61892
|
-
this.analyzer.returnType.ofPackageVariableGetterDeclaration(node),
|
|
61893
|
-
this.analyzer.resultLocalVariableEntity.ofPackageVariableGetterDeclaration(node)
|
|
61894
|
-
);
|
|
61895
|
-
}
|
|
61896
|
-
checkPackageVariableSetterDeclaration(node) {
|
|
61897
|
-
const entity = this.analyzer.entity.ofComputedPackageVariableDeclaration(node);
|
|
61898
|
-
this.checkPackageMemberBodyPresence(entity, node.block, node.name);
|
|
61899
|
-
}
|
|
61900
|
-
checkConstructorDeclaration(node) {
|
|
61901
|
-
const entity = this.analyzer.entity.ofConstructorDeclaration(node);
|
|
61902
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61903
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.creationKeyword);
|
|
61904
|
-
this.analyzer.semanticContext.ofConstructorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61905
|
-
}
|
|
61906
|
-
checkMethodDeclaration(node) {
|
|
61907
|
-
const entity = this.analyzer.entity.ofMethodDeclaration(node);
|
|
61908
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61909
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.name);
|
|
61910
|
-
if (node.block !== void 0) {
|
|
61911
|
-
this.checkPossibleGeneratorFunctionReturnType(entity, node, node.name);
|
|
61912
|
-
const containingEntity = entity.getContainingEntity();
|
|
61913
|
-
if (entity.markedBasic() && containingEntity.kind === 2 /* Type */ && containingEntity.typeEntityKind === 4 /* Alias */) {
|
|
61914
|
-
this.analyzer.checkBodyOfBasicAliasTypeMethod(node, this.diagnosticAcceptor);
|
|
61915
|
-
}
|
|
61916
|
-
}
|
|
61917
|
-
if (entity.methodKind === 3 /* Operator */) {
|
|
61918
|
-
if (node.typeParameterClause !== void 0) {
|
|
61919
|
-
this.createAndAddDiagnostic(
|
|
61920
|
-
2231 /* OperatorCannotContainTypeParameterDeclarations */,
|
|
61921
|
-
node.typeParameterClause
|
|
61922
|
-
);
|
|
61923
|
-
}
|
|
61924
|
-
const syntacticalOperatorKind = node.name.operatorKind;
|
|
61925
|
-
if (syntacticalOperatorKind !== void 0) {
|
|
61926
|
-
const requiredParameterCount = requiredParameterCountBySyntacticalOperatorKind[syntacticalOperatorKind];
|
|
61927
|
-
const actualParameterCount = node.parameterClause.parameterList.parameters.count();
|
|
61928
|
-
switch (requiredParameterCount) {
|
|
61929
|
-
case 0 /* Zero */: {
|
|
61930
|
-
if (actualParameterCount !== 0) {
|
|
61931
|
-
const operatorText = LocalizationHelperA.localizeSyntacticalOperatorKind(
|
|
61932
|
-
syntacticalOperatorKind,
|
|
61933
|
-
this.sourceFile.locale
|
|
61934
|
-
);
|
|
61935
|
-
this.createAndAddDiagnostic(
|
|
61936
|
-
2097 /* OperatorFunction0MustNotHaveParameters */,
|
|
61937
|
-
node.name,
|
|
61938
|
-
[operatorText]
|
|
61939
|
-
);
|
|
61940
|
-
}
|
|
61941
|
-
break;
|
|
61942
|
-
}
|
|
61943
|
-
case 1 /* ZeroOrOne */: {
|
|
61944
|
-
if (!(actualParameterCount === 0 || actualParameterCount === 1)) {
|
|
61945
|
-
const operatorText = LocalizationHelperA.localizeSyntacticalOperatorKind(
|
|
61946
|
-
syntacticalOperatorKind,
|
|
61947
|
-
this.sourceFile.locale
|
|
61948
|
-
);
|
|
61949
|
-
this.createAndAddDiagnostic(
|
|
61950
|
-
2099 /* OperatorFunction0MustHaveNoMoreThanOneParameter */,
|
|
61951
|
-
node.name,
|
|
61952
|
-
[operatorText]
|
|
61953
|
-
);
|
|
61954
|
-
}
|
|
61955
|
-
break;
|
|
61956
|
-
}
|
|
61957
|
-
case 2 /* One */: {
|
|
61958
|
-
if (actualParameterCount !== 1) {
|
|
61959
|
-
const operatorText = LocalizationHelperA.localizeSyntacticalOperatorKind(
|
|
61960
|
-
syntacticalOperatorKind,
|
|
61961
|
-
this.sourceFile.locale
|
|
61962
|
-
);
|
|
61963
|
-
this.createAndAddDiagnostic(
|
|
61964
|
-
2098 /* OperatorFunction0MustHaveOneParameter */,
|
|
61965
|
-
node.name,
|
|
61966
|
-
[operatorText]
|
|
61967
|
-
);
|
|
61968
|
-
}
|
|
61969
|
-
break;
|
|
61970
|
-
}
|
|
61971
|
-
default:
|
|
61972
|
-
Debug.never(requiredParameterCount);
|
|
61973
|
-
}
|
|
61974
|
-
}
|
|
61975
|
-
}
|
|
61976
|
-
if (node.typeParameterClause !== void 0) {
|
|
61977
|
-
this.analyzer.semanticContext.ofFunctionDeclarationTypeParameters(node, node.typeParameterClause).validateNameConflicts(this.diagnosticAcceptor);
|
|
61978
|
-
}
|
|
61979
|
-
this.analyzer.semanticContext.ofFunctionDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
61980
|
-
if (!this.analyzer.isFunctionGenerator(node)) {
|
|
61981
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
61982
|
-
node,
|
|
61983
|
-
node.name,
|
|
61984
|
-
this.analyzer.returnType.ofMethodDeclaration(node),
|
|
61985
|
-
this.analyzer.resultLocalVariableEntity.ofMethodDeclaration(node)
|
|
61986
|
-
);
|
|
61987
|
-
}
|
|
61988
|
-
}
|
|
61989
|
-
checkFieldDeclaration(node) {
|
|
61990
|
-
const entity = this.analyzer.entity.ofFieldDeclaration(node);
|
|
61991
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
61992
|
-
if (TypeMemberEntity.isAspectMember(entity) && !entity.isStatic() && !entity.markedAbstract()) {
|
|
61993
|
-
this.createAndAddDiagnostic(2065 /* AspectTypeFieldsMustBeAbstract */, node.name);
|
|
61994
|
-
}
|
|
61995
|
-
if (this.isInterfacePackageFile) {
|
|
61996
|
-
if (node.initializer !== void 0) {
|
|
61997
|
-
this.createAndAddDiagnostic(2061 /* InterfacePackageVariablesMustNotHaveInitializers */, node.name);
|
|
61998
|
-
}
|
|
61999
|
-
} else if (TypeMemberEntity.isReducedTypeMember(entity)) {
|
|
62000
|
-
if (node.initializer !== void 0) {
|
|
62001
|
-
this.createAndAddDiagnostic(2069 /* ReducedTypeFieldsMustNotHaveInitializers */, node.name);
|
|
62002
|
-
}
|
|
62003
|
-
} else if (entity.markedAbstract()) {
|
|
62004
|
-
if (node.initializer !== void 0) {
|
|
62005
|
-
this.createAndAddDiagnostic(2068 /* AbstractFieldsMustNotHaveInitializers */, node.name);
|
|
62006
|
-
}
|
|
62007
|
-
}
|
|
62008
|
-
if (node.typeAnnotation === void 0 && node.initializer === void 0) {
|
|
62009
|
-
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
62010
|
-
} else if (node.initializer !== void 0 && node.typeAnnotation !== void 0) {
|
|
62011
|
-
this.checkExpressionTypeIsAssignableToTargetType(
|
|
62012
|
-
node.initializer,
|
|
62013
|
-
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
62014
|
-
);
|
|
62015
|
-
}
|
|
62016
|
-
}
|
|
62017
|
-
checkFieldGetterDeclaration(node) {
|
|
62018
|
-
const entity = this.analyzer.entity.ofComputedFieldDeclaration(node);
|
|
62019
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62020
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.name);
|
|
62021
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
62022
|
-
node,
|
|
62023
|
-
node.name,
|
|
62024
|
-
this.analyzer.returnType.ofFieldGetterDeclaration(node),
|
|
62025
|
-
this.analyzer.resultLocalVariableEntity.ofFieldGetterDeclaration(node)
|
|
62026
|
-
);
|
|
62027
|
-
}
|
|
62028
|
-
checkFieldSetterDeclaration(node) {
|
|
62029
|
-
const entity = this.analyzer.entity.ofComputedFieldDeclaration(node);
|
|
62030
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62031
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.name);
|
|
62032
|
-
}
|
|
62033
|
-
checkIndexedElementGetterDeclaration(node) {
|
|
62034
|
-
const entity = this.analyzer.entity.ofIndexerDeclaration(node);
|
|
62035
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62036
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.parameterClause);
|
|
62037
|
-
this.analyzer.semanticContext.ofIndexedElementAccessorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
62038
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
62039
|
-
node,
|
|
62040
|
-
node.parameterClause,
|
|
62041
|
-
this.analyzer.returnType.ofIndexedElementGetterDeclaration(node),
|
|
62042
|
-
this.analyzer.resultLocalVariableEntity.ofIndexedElementGetterDeclaration(node)
|
|
62043
|
-
);
|
|
62044
|
-
}
|
|
62045
|
-
checkIndexedElementSetterDeclaration(node) {
|
|
62046
|
-
const entity = this.analyzer.entity.ofIndexerDeclaration(node);
|
|
62047
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62048
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.parameterClause);
|
|
62049
|
-
this.analyzer.semanticContext.ofIndexedElementAccessorDeclarationParameters(node).validateNameConflicts(this.diagnosticAcceptor);
|
|
62050
|
-
}
|
|
62051
|
-
checkDereferencedVariableGetterDeclaration(node) {
|
|
62052
|
-
const entity = this.analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
|
62053
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62054
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.caretToken);
|
|
62055
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
62056
|
-
node,
|
|
62057
|
-
node.caretToken,
|
|
62058
|
-
this.analyzer.returnType.ofDereferencedVariableGetterDeclaration(node),
|
|
62059
|
-
this.analyzer.resultLocalVariableEntity.ofDereferencedVariableGetterDeclaration(node)
|
|
62060
|
-
);
|
|
62061
|
-
}
|
|
62062
|
-
checkDereferencedVariableSetterDeclaration(node) {
|
|
62063
|
-
const entity = this.analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
|
62064
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62065
|
-
this.checkTypeMemberBodyPresence(entity, node.block, node.caretToken);
|
|
62066
|
-
}
|
|
62067
62395
|
checkNestedFunctionDeclaration(node) {
|
|
62068
62396
|
const entity = this.analyzer.entity.ofNestedFunctionDeclaration(node);
|
|
62069
62397
|
if (node.block !== void 0) {
|
|
@@ -62135,60 +62463,6 @@ var SourceFileAnalyzer = class {
|
|
|
62135
62463
|
}
|
|
62136
62464
|
}
|
|
62137
62465
|
}
|
|
62138
|
-
checkPackageMemberBodyPresence(entity, body, diagnosticLocation) {
|
|
62139
|
-
if (this.isInterfacePackageFile) {
|
|
62140
|
-
if (body !== void 0) {
|
|
62141
|
-
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, diagnosticLocation);
|
|
62142
|
-
}
|
|
62143
|
-
} else if (findTag(this.analyzer.originalWellKnownDeclarations.builtIntoPlatform, entity.getTags()) !== void 0) {
|
|
62144
|
-
if (body !== void 0) {
|
|
62145
|
-
this.createAndAddDiagnostic(
|
|
62146
|
-
2066 /* DeclarationsMarkedWithBuiltIntoPlatformTagMustNotHaveBody */,
|
|
62147
|
-
diagnosticLocation
|
|
62148
|
-
);
|
|
62149
|
-
}
|
|
62150
|
-
} else {
|
|
62151
|
-
if (body === void 0) {
|
|
62152
|
-
this.createAndAddDiagnostic(2062 /* BodyIsMissing */, diagnosticLocation);
|
|
62153
|
-
}
|
|
62154
|
-
}
|
|
62155
|
-
}
|
|
62156
|
-
checkTypeMemberBodyPresence(entity, body, diagnosticLocation) {
|
|
62157
|
-
if (this.isInterfacePackageFile) {
|
|
62158
|
-
if (body !== void 0) {
|
|
62159
|
-
this.createAndAddDiagnostic(2060 /* InterfacePackageMustNotContainImplementation */, diagnosticLocation);
|
|
62160
|
-
}
|
|
62161
|
-
} else if (findTag(this.analyzer.originalWellKnownDeclarations.builtIntoPlatform, entity.getTags()) !== void 0) {
|
|
62162
|
-
if (body !== void 0) {
|
|
62163
|
-
this.createAndAddDiagnostic(
|
|
62164
|
-
2066 /* DeclarationsMarkedWithBuiltIntoPlatformTagMustNotHaveBody */,
|
|
62165
|
-
diagnosticLocation
|
|
62166
|
-
);
|
|
62167
|
-
}
|
|
62168
|
-
} else if (TypeMemberEntity.isReducedTypeMember(entity)) {
|
|
62169
|
-
if (body !== void 0) {
|
|
62170
|
-
this.createAndAddDiagnostic(
|
|
62171
|
-
2067 /* ReducedTypeMembersMustNotHaveBody */,
|
|
62172
|
-
diagnosticLocation
|
|
62173
|
-
);
|
|
62174
|
-
}
|
|
62175
|
-
} else if (entity.isStatic()) {
|
|
62176
|
-
if (body === void 0) {
|
|
62177
|
-
this.createAndAddDiagnostic(2062 /* BodyIsMissing */, diagnosticLocation);
|
|
62178
|
-
}
|
|
62179
|
-
} else if (entity.markedAbstract()) {
|
|
62180
|
-
if (body !== void 0) {
|
|
62181
|
-
this.createAndAddDiagnostic(
|
|
62182
|
-
2063 /* AbstractTypeMembersMustNotHaveBody */,
|
|
62183
|
-
diagnosticLocation
|
|
62184
|
-
);
|
|
62185
|
-
}
|
|
62186
|
-
} else {
|
|
62187
|
-
if (body === void 0) {
|
|
62188
|
-
this.createAndAddDiagnostic(2062 /* BodyIsMissing */, diagnosticLocation);
|
|
62189
|
-
}
|
|
62190
|
-
}
|
|
62191
|
-
}
|
|
62192
62466
|
// TODO: учесть константы времени компиляции.
|
|
62193
62467
|
// private validateVariantInitializer(expression: tree.Expression): void {
|
|
62194
62468
|
// if (expression.kind === tree.NodeKind.TokenExpression) {
|
|
@@ -62686,109 +62960,6 @@ var SourceFileAnalyzer = class {
|
|
|
62686
62960
|
}
|
|
62687
62961
|
}
|
|
62688
62962
|
}
|
|
62689
|
-
checkParameterList(node) {
|
|
62690
|
-
const parameters = node.parameters.toArray();
|
|
62691
|
-
if (parameters.length > 0) {
|
|
62692
|
-
this.checkRequiredParametersDoNotFollowOptionalParameters(parameters);
|
|
62693
|
-
const firstParameter = parameters[0];
|
|
62694
|
-
const firstParameterEntity = this.analyzer.entity.ofParameterDeclaration(firstParameter);
|
|
62695
|
-
if (firstParameterEntity.isObjectParameter() && !this.parameterListCanDeclareObjectParameter(node)) {
|
|
62696
|
-
this.createAndAddDiagnostic(2228 /* ObjectParameterCannotBeDeclaredHere */, firstParameter.name);
|
|
62697
|
-
}
|
|
62698
|
-
this.checkObjectParameterIsTheFirstParameter(parameters);
|
|
62699
|
-
}
|
|
62700
|
-
}
|
|
62701
|
-
checkRequiredParametersDoNotFollowOptionalParameters(parameters) {
|
|
62702
|
-
let seenOptionalParameter = false;
|
|
62703
|
-
for (const parameter of parameters) {
|
|
62704
|
-
if (parameter.defaultValue !== void 0) {
|
|
62705
|
-
seenOptionalParameter = true;
|
|
62706
|
-
} else if (seenOptionalParameter) {
|
|
62707
|
-
this.createAndAddDiagnostic(2188 /* RequiredParametersCannotFollowOptionalParameters */, parameter.name);
|
|
62708
|
-
break;
|
|
62709
|
-
}
|
|
62710
|
-
}
|
|
62711
|
-
}
|
|
62712
|
-
parameterListCanDeclareObjectParameter(node) {
|
|
62713
|
-
const parent = node.parent.parent;
|
|
62714
|
-
switch (parent.kind) {
|
|
62715
|
-
case 17 /* AnonymousFunctionTypeDeclaration */:
|
|
62716
|
-
case 23 /* PackageFunctionDeclaration */:
|
|
62717
|
-
case 53 /* NestedFunctionDeclaration */:
|
|
62718
|
-
case 62 /* FunctionLiteral */:
|
|
62719
|
-
return true;
|
|
62720
|
-
case 47 /* MethodDeclaration */: {
|
|
62721
|
-
const containingDeclaration = TypeMemberQuery.getContainingDeclaration(parent);
|
|
62722
|
-
switch (containingDeclaration.kind) {
|
|
62723
|
-
case 18 /* AnonymousClassDeclaration */:
|
|
62724
|
-
case 27 /* PackageClassDeclaration */:
|
|
62725
|
-
case 28 /* PackageStructureDeclaration */:
|
|
62726
|
-
case 29 /* PackageAspectDeclaration */:
|
|
62727
|
-
case 30 /* PackageReducedTypeDeclaration */:
|
|
62728
|
-
case 31 /* PackageVariantDeclaration */:
|
|
62729
|
-
return true;
|
|
62730
|
-
case 19 /* PackageAliasTypeDeclaration */:
|
|
62731
|
-
case 35 /* TypeExtensionDeclaration */:
|
|
62732
|
-
return false;
|
|
62733
|
-
default:
|
|
62734
|
-
Debug.never(containingDeclaration);
|
|
62735
|
-
}
|
|
62736
|
-
}
|
|
62737
|
-
case 40 /* ConstructorDeclaration */:
|
|
62738
|
-
case 41 /* DestructorDeclaration */:
|
|
62739
|
-
case 42 /* IndexedElementGetterDeclaration */:
|
|
62740
|
-
case 43 /* IndexedElementSetterDeclaration */:
|
|
62741
|
-
return false;
|
|
62742
|
-
default:
|
|
62743
|
-
Debug.never(parent);
|
|
62744
|
-
}
|
|
62745
|
-
}
|
|
62746
|
-
checkObjectParameterIsTheFirstParameter(parameters) {
|
|
62747
|
-
for (let i = 1; i < parameters.length; i++) {
|
|
62748
|
-
const parameterDeclaration2 = parameters[i];
|
|
62749
|
-
if ((parameterDeclaration2.name.flags & 512 /* ObjectParameterName */) !== 0) {
|
|
62750
|
-
this.createAndAddDiagnostic(2227 /* ObjectParameterMustBeTheFirstParameter */, parameterDeclaration2.name);
|
|
62751
|
-
break;
|
|
62752
|
-
}
|
|
62753
|
-
}
|
|
62754
|
-
}
|
|
62755
|
-
checkParameterDeclaration(node) {
|
|
62756
|
-
const entity = this.analyzer.entity.ofParameterDeclaration(node);
|
|
62757
|
-
entity.ensureAllDiagnosticsReported?.();
|
|
62758
|
-
const isFunctionLiteralParameter = node.parent.parent.parent.kind === 62 /* FunctionLiteral */;
|
|
62759
|
-
if (!isFunctionLiteralParameter && node.typeAnnotation === void 0 && node.defaultValue === void 0) {
|
|
62760
|
-
this.createAndAddDiagnostic(2184 /* VariableTypeIsNotSpecified */, node.name);
|
|
62761
|
-
} else if (node.defaultValue !== void 0 && node.typeAnnotation !== void 0) {
|
|
62762
|
-
this.checkExpressionTypeIsAssignableToTargetType(
|
|
62763
|
-
node.defaultValue,
|
|
62764
|
-
this.analyzer.type.ofTypeSpecifier(node.typeAnnotation.typeSpecifier)
|
|
62765
|
-
);
|
|
62766
|
-
} else if (isFunctionLiteralParameter && node.defaultValue !== void 0) {
|
|
62767
|
-
this.checkExpressionTypeIsAssignableToTargetType(node.defaultValue, entity.getType());
|
|
62768
|
-
}
|
|
62769
|
-
let parentHasBody;
|
|
62770
|
-
const parent = node.parent.parent.parent;
|
|
62771
|
-
switch (parent.kind) {
|
|
62772
|
-
case 23 /* PackageFunctionDeclaration */:
|
|
62773
|
-
case 40 /* ConstructorDeclaration */:
|
|
62774
|
-
case 41 /* DestructorDeclaration */:
|
|
62775
|
-
case 42 /* IndexedElementGetterDeclaration */:
|
|
62776
|
-
case 43 /* IndexedElementSetterDeclaration */:
|
|
62777
|
-
case 47 /* MethodDeclaration */:
|
|
62778
|
-
case 53 /* NestedFunctionDeclaration */:
|
|
62779
|
-
case 62 /* FunctionLiteral */:
|
|
62780
|
-
parentHasBody = parent.block !== void 0;
|
|
62781
|
-
break;
|
|
62782
|
-
case 17 /* AnonymousFunctionTypeDeclaration */:
|
|
62783
|
-
parentHasBody = false;
|
|
62784
|
-
break;
|
|
62785
|
-
default:
|
|
62786
|
-
Debug.never(parent);
|
|
62787
|
-
}
|
|
62788
|
-
if (parentHasBody) {
|
|
62789
|
-
this.checkIfVariableIsUnused(entity, node.name);
|
|
62790
|
-
}
|
|
62791
|
-
}
|
|
62792
62963
|
checkIfVariableIsUnused(entity, diagnosticLocation) {
|
|
62793
62964
|
const usageInfo = this.namedDeclarationsUsageMap.getUsageInfo(entity);
|
|
62794
62965
|
if (usageInfo.usageCount === 0 || !usageInfo.hasGetAccess) {
|
|
@@ -62858,43 +63029,6 @@ var SourceFileAnalyzer = class {
|
|
|
62858
63029
|
}
|
|
62859
63030
|
return receiver.kind === 85 /* BaseExpression */;
|
|
62860
63031
|
}
|
|
62861
|
-
overridingMemberHasCorrectHiding(overridingMemberHiding, overriddenMemberHiding) {
|
|
62862
|
-
return overriddenMemberHiding === void 0 ? overridingMemberHiding === void 0 : overriddenMemberHiding.kind === overridingMemberHiding?.kind;
|
|
62863
|
-
}
|
|
62864
|
-
checkTextTranslationDeclaration(node) {
|
|
62865
|
-
const sourceText = node.sourceText;
|
|
62866
|
-
if (sourceText.kind === 141 /* TranslationTextTemplate */) {
|
|
62867
|
-
const semanticContext = this.analyzer.semanticContext.ofTextTranslationDeclarationParameters(sourceText);
|
|
62868
|
-
semanticContext.validateNameConflicts(this.diagnosticAcceptor);
|
|
62869
|
-
}
|
|
62870
|
-
const pkg2 = this.textTranslationPackage;
|
|
62871
|
-
if (pkg2 !== void 0 && !pkg2.isPrimary()) {
|
|
62872
|
-
const targetPackage = pkg2.getTargetPackage();
|
|
62873
|
-
if (targetPackage !== void 0) {
|
|
62874
|
-
const primaryPkg = this.analyzer.getPrimaryTextTranslationPackageOfTargetPackage(targetPackage);
|
|
62875
|
-
if (primaryPkg !== void 0) {
|
|
62876
|
-
const textKey = TextIdentity.keyFromTextTranslationSource(sourceText);
|
|
62877
|
-
const textTranslation = primaryPkg.getMembers().getTextTranslationsByTextKey(textKey);
|
|
62878
|
-
if (textTranslation.length === 0) {
|
|
62879
|
-
this.createAndAddDiagnostic(
|
|
62880
|
-
2190 /* TextIsMissingAmongPrimaryTextTranslationDefinitions */,
|
|
62881
|
-
sourceText,
|
|
62882
|
-
void 0,
|
|
62883
|
-
1 /* Warning */
|
|
62884
|
-
);
|
|
62885
|
-
}
|
|
62886
|
-
}
|
|
62887
|
-
}
|
|
62888
|
-
}
|
|
62889
|
-
if (node.kind === 139 /* TextTranslationFunctionDeclaration */) {
|
|
62890
|
-
this.checkAllCodePathsReturnOrResultVariableIsAssigned(
|
|
62891
|
-
node,
|
|
62892
|
-
node.sourceText,
|
|
62893
|
-
this.analyzer.returnType.ofTextTranslationFunctionDeclaration(node),
|
|
62894
|
-
this.analyzer.resultLocalVariableEntity.ofTextTranslationFunctionDeclaration(node)
|
|
62895
|
-
);
|
|
62896
|
-
}
|
|
62897
|
-
}
|
|
62898
63032
|
attachNodeLocationAndAddDiagnostics(diagnosticsData, node) {
|
|
62899
63033
|
for (const diagnosticData of diagnosticsData) {
|
|
62900
63034
|
const location = this.analyzer.getNodeDiagnosticLocation(node);
|