@artel/artc 0.6.25222 → 0.6.25223
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 +8 -2
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +14 -40
- package/build/{chunk-MBMOAUK7.js → chunk-AX3LQ2CF.js} +2 -2
- package/build/{chunk-ODWG5ZXF.js → chunk-DZNNWICP.js} +1258 -659
- package/build/{chunk-UZK7JCND.js → chunk-LG4Z4SWO.js} +1 -1
- package/build/types/analysis/Analyzer.d.ts +6 -6
- package/build/types/analysis/ControlFlowGraphBuilder.d.ts +12 -4
- package/build/types/analysis/LocalizationContext.d.ts +2 -2
- package/build/types/analysis/Lookup.d.ts +4 -4
- package/build/types/analysis/PropertyAccessExpressionMeaning.d.ts +1 -1
- package/build/types/analysis/Scope.d.ts +21 -44
- package/build/types/analysis/SemanticContext.d.ts +14 -1
- package/build/types/analysis/SemanticContextBuilder.d.ts +1 -0
- package/build/types/analysis/StatementBlockScopeBuilder.d.ts +1 -0
- package/build/types/analysis/TypeMemberLookup.d.ts +39 -11
- package/build/types/analysis/TypeNarrower.d.ts +41 -6
- package/build/types/entities/index.d.ts +3 -0
- package/build/types/parser/Scanner.d.ts +1 -2
- package/build/types/tree/green/Nodes.d.ts +4 -5
- package/build/types/tree/red/Nodes.d.ts +3 -3
- package/build/types/types/TypeMembers.d.ts +5 -0
- package/package.json +1 -1
@@ -577,7 +577,7 @@ var UniqueWithComparatorQuery = class extends Query {
|
|
577
577
|
};
|
578
578
|
|
579
579
|
// source/common/Constants.ts
|
580
|
-
var ArtelVersion = true ? "0.6.
|
580
|
+
var ArtelVersion = true ? "0.6.25223" : "";
|
581
581
|
var ArtelSourceFileExtensions = [".\u0430\u0440\u0442", ".\u0430\u0440\u0442\u0435\u043B\u044C", ".art", ".artel"];
|
582
582
|
var ArtelSourceFileExtensionSet = new Set(ArtelSourceFileExtensions);
|
583
583
|
var ArtelSourceAndConfigurationFileExtensionSet = new Set(ArtelSourceFileExtensionSet).add(".json");
|
@@ -1159,68 +1159,68 @@ __export(green_exports, {
|
|
1159
1159
|
});
|
1160
1160
|
|
1161
1161
|
// source/tree/KeywordKind.ts
|
1162
|
-
var KeywordKind = /* @__PURE__ */ ((
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
return
|
1162
|
+
var KeywordKind = /* @__PURE__ */ ((KeywordKind5) => {
|
1163
|
+
KeywordKind5[KeywordKind5["Unknown"] = 0] = "Unknown";
|
1164
|
+
KeywordKind5[KeywordKind5["Let"] = 1] = "Let";
|
1165
|
+
KeywordKind5[KeywordKind5["Autotype"] = 2] = "Autotype";
|
1166
|
+
KeywordKind5[KeywordKind5["Aspect"] = 3] = "Aspect";
|
1167
|
+
KeywordKind5[KeywordKind5["Object"] = 4] = "Object";
|
1168
|
+
KeywordKind5[KeywordKind5["PlainObject"] = 5] = "PlainObject";
|
1169
|
+
KeywordKind5[KeywordKind5["Variant"] = 6] = "Variant";
|
1170
|
+
KeywordKind5[KeywordKind5["Run"] = 7] = "Run";
|
1171
|
+
KeywordKind5[KeywordKind5["Try"] = 8] = "Try";
|
1172
|
+
KeywordKind5[KeywordKind5["From"] = 9] = "From";
|
1173
|
+
KeywordKind5[KeywordKind5["Else"] = 10] = "Else";
|
1174
|
+
KeywordKind5[KeywordKind5["ElseIf"] = 11] = "ElseIf";
|
1175
|
+
KeywordKind5[KeywordKind5["Function"] = 12] = "Function";
|
1176
|
+
KeywordKind5[KeywordKind5["If"] = 13] = "If";
|
1177
|
+
KeywordKind5[KeywordKind5["Is"] = 14] = "Is";
|
1178
|
+
KeywordKind5[KeywordKind5["Return"] = 15] = "Return";
|
1179
|
+
KeywordKind5[KeywordKind5["Type"] = 16] = "Type";
|
1180
|
+
KeywordKind5[KeywordKind5["Basic"] = 17] = "Basic";
|
1181
|
+
KeywordKind5[KeywordKind5["Import"] = 18] = "Import";
|
1182
|
+
KeywordKind5[KeywordKind5["Important"] = 19] = "Important";
|
1183
|
+
KeywordKind5[KeywordKind5["Error"] = 20] = "Error";
|
1184
|
+
KeywordKind5[KeywordKind5["Finally"] = 21] = "Finally";
|
1185
|
+
KeywordKind5[KeywordKind5["And"] = 22] = "And";
|
1186
|
+
KeywordKind5[KeywordKind5["Or"] = 23] = "Or";
|
1187
|
+
KeywordKind5[KeywordKind5["Xor"] = 24] = "Xor";
|
1188
|
+
KeywordKind5[KeywordKind5["While"] = 25] = "While";
|
1189
|
+
KeywordKind5[KeywordKind5["Loop"] = 26] = "Loop";
|
1190
|
+
KeywordKind5[KeywordKind5["RepeatWhile"] = 27] = "RepeatWhile";
|
1191
|
+
KeywordKind5[KeywordKind5["Yield"] = 28] = "Yield";
|
1192
|
+
KeywordKind5[KeywordKind5["When"] = 29] = "When";
|
1193
|
+
KeywordKind5[KeywordKind5["Creation"] = 30] = "Creation";
|
1194
|
+
KeywordKind5[KeywordKind5["Catch"] = 31] = "Catch";
|
1195
|
+
KeywordKind5[KeywordKind5["BreakLoop"] = 32] = "BreakLoop";
|
1196
|
+
KeywordKind5[KeywordKind5["ContinueLoop"] = 33] = "ContinueLoop";
|
1197
|
+
KeywordKind5[KeywordKind5["For"] = 34] = "For";
|
1198
|
+
KeywordKind5[KeywordKind5["Const"] = 35] = "Const";
|
1199
|
+
KeywordKind5[KeywordKind5["Hidden"] = 36] = "Hidden";
|
1200
|
+
KeywordKind5[KeywordKind5["Abstract"] = 37] = "Abstract";
|
1201
|
+
KeywordKind5[KeywordKind5["Redefinable"] = 38] = "Redefinable";
|
1202
|
+
KeywordKind5[KeywordKind5["Redefined"] = 39] = "Redefined";
|
1203
|
+
KeywordKind5[KeywordKind5["Async"] = 40] = "Async";
|
1204
|
+
KeywordKind5[KeywordKind5["Static"] = 41] = "Static";
|
1205
|
+
KeywordKind5[KeywordKind5["As"] = 42] = "As";
|
1206
|
+
KeywordKind5[KeywordKind5["Not"] = 43] = "Not";
|
1207
|
+
KeywordKind5[KeywordKind5["Switch"] = 44] = "Switch";
|
1208
|
+
KeywordKind5[KeywordKind5["Case"] = 45] = "Case";
|
1209
|
+
KeywordKind5[KeywordKind5["Dispose"] = 46] = "Dispose";
|
1210
|
+
KeywordKind5[KeywordKind5["Destruction"] = 47] = "Destruction";
|
1211
|
+
KeywordKind5[KeywordKind5["InHierarchy"] = 48] = "InHierarchy";
|
1212
|
+
KeywordKind5[KeywordKind5["InFile"] = 49] = "InFile";
|
1213
|
+
KeywordKind5[KeywordKind5["InPackage"] = 50] = "InPackage";
|
1214
|
+
KeywordKind5[KeywordKind5["InType"] = 51] = "InType";
|
1215
|
+
KeywordKind5[KeywordKind5["Yes"] = 52] = "Yes";
|
1216
|
+
KeywordKind5[KeywordKind5["No"] = 53] = "No";
|
1217
|
+
KeywordKind5[KeywordKind5["Reference"] = 54] = "Reference";
|
1218
|
+
KeywordKind5[KeywordKind5["Translations"] = 55] = "Translations";
|
1219
|
+
KeywordKind5[KeywordKind5["Base"] = 56] = "Base";
|
1220
|
+
KeywordKind5[KeywordKind5["None"] = 57] = "None";
|
1221
|
+
KeywordKind5[KeywordKind5["Get"] = 58] = "Get";
|
1222
|
+
KeywordKind5[KeywordKind5["Set"] = 59] = "Set";
|
1223
|
+
return KeywordKind5;
|
1224
1224
|
})(KeywordKind || {});
|
1225
1225
|
|
1226
1226
|
// source/tree/NodeKind.ts
|
@@ -2530,18 +2530,44 @@ var Scanner = class _Scanner {
|
|
2530
2530
|
return this.token;
|
2531
2531
|
}
|
2532
2532
|
lookAhead(callback) {
|
2533
|
-
|
2534
|
-
|
2535
|
-
|
2536
|
-
|
2537
|
-
)
|
2533
|
+
const savedToken = this.token;
|
2534
|
+
const savedCurrentPosition = this.currentPosition;
|
2535
|
+
const savedBraceBalance = this.braceBalance;
|
2536
|
+
let savedTextTemplateBraceBalanceStack = void 0;
|
2537
|
+
if (this.textTemplateBraceBalanceStack.length > 0) {
|
2538
|
+
savedTextTemplateBraceBalanceStack = this.textTemplateBraceBalanceStack.slice();
|
2539
|
+
}
|
2540
|
+
const result = callback();
|
2541
|
+
this.token = savedToken;
|
2542
|
+
this.currentPosition = savedCurrentPosition;
|
2543
|
+
this.braceBalance = savedBraceBalance;
|
2544
|
+
if (savedTextTemplateBraceBalanceStack !== void 0) {
|
2545
|
+
this.textTemplateBraceBalanceStack = savedTextTemplateBraceBalanceStack;
|
2546
|
+
} else {
|
2547
|
+
this.textTemplateBraceBalanceStack.length = 0;
|
2548
|
+
}
|
2549
|
+
return result;
|
2538
2550
|
}
|
2539
2551
|
tryScan(callback) {
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
)
|
2552
|
+
const savedToken = this.token;
|
2553
|
+
const savedCurrentPosition = this.currentPosition;
|
2554
|
+
const savedBraceBalance = this.braceBalance;
|
2555
|
+
let savedTextTemplateBraceBalanceStack = void 0;
|
2556
|
+
if (this.textTemplateBraceBalanceStack.length > 0) {
|
2557
|
+
savedTextTemplateBraceBalanceStack = this.textTemplateBraceBalanceStack.slice();
|
2558
|
+
}
|
2559
|
+
const result = callback();
|
2560
|
+
if (result === void 0) {
|
2561
|
+
this.token = savedToken;
|
2562
|
+
this.currentPosition = savedCurrentPosition;
|
2563
|
+
this.braceBalance = savedBraceBalance;
|
2564
|
+
if (savedTextTemplateBraceBalanceStack !== void 0) {
|
2565
|
+
this.textTemplateBraceBalanceStack = savedTextTemplateBraceBalanceStack;
|
2566
|
+
} else {
|
2567
|
+
this.textTemplateBraceBalanceStack.length = 0;
|
2568
|
+
}
|
2569
|
+
}
|
2570
|
+
return result;
|
2545
2571
|
}
|
2546
2572
|
nextToken() {
|
2547
2573
|
if (this.skipWhitespace) {
|
@@ -2866,27 +2892,6 @@ var Scanner = class _Scanner {
|
|
2866
2892
|
this.token = new Token(kind, value, startPosition, unterminated);
|
2867
2893
|
return this.token;
|
2868
2894
|
}
|
2869
|
-
tryScanOrLookAhead(callback, alwaysRestoreState) {
|
2870
|
-
const savedToken = this.token;
|
2871
|
-
const savedCurrentPosition = this.currentPosition;
|
2872
|
-
const savedBraceBalance = this.braceBalance;
|
2873
|
-
let savedTextTemplateBraceBalanceStack = void 0;
|
2874
|
-
if (this.textTemplateBraceBalanceStack.length > 0) {
|
2875
|
-
savedTextTemplateBraceBalanceStack = this.textTemplateBraceBalanceStack.slice();
|
2876
|
-
}
|
2877
|
-
const result = callback();
|
2878
|
-
if (alwaysRestoreState || !result) {
|
2879
|
-
this.token = savedToken;
|
2880
|
-
this.currentPosition = savedCurrentPosition;
|
2881
|
-
this.braceBalance = savedBraceBalance;
|
2882
|
-
if (savedTextTemplateBraceBalanceStack !== void 0) {
|
2883
|
-
this.textTemplateBraceBalanceStack = savedTextTemplateBraceBalanceStack;
|
2884
|
-
} else {
|
2885
|
-
this.textTemplateBraceBalanceStack.length = 0;
|
2886
|
-
}
|
2887
|
-
}
|
2888
|
-
return result;
|
2889
|
-
}
|
2890
2895
|
isCloseBraceEndingTextTemplate() {
|
2891
2896
|
return this.textTemplateBraceBalanceStack.length > 0 && this.braceBalance === 1;
|
2892
2897
|
}
|
@@ -7179,14 +7184,11 @@ var FunctionBlock = class extends BaseNode {
|
|
7179
7184
|
get openBraceToken() {
|
7180
7185
|
return this.children[0];
|
7181
7186
|
}
|
7182
|
-
get
|
7187
|
+
get expressionOrStatementList() {
|
7183
7188
|
return this.children[1];
|
7184
7189
|
}
|
7185
|
-
get statementList() {
|
7186
|
-
return this.children[2];
|
7187
|
-
}
|
7188
7190
|
get closeBraceToken() {
|
7189
|
-
return this.children[
|
7191
|
+
return this.children[2];
|
7190
7192
|
}
|
7191
7193
|
get thisAsNode() {
|
7192
7194
|
return this;
|
@@ -7194,9 +7196,9 @@ var FunctionBlock = class extends BaseNode {
|
|
7194
7196
|
createChildren() {
|
7195
7197
|
return [
|
7196
7198
|
this.green.openBraceToken.toRed(childRangeStart(this, 0), this),
|
7197
|
-
|
7198
|
-
this.green.
|
7199
|
-
this.green.closeBraceToken.toRed(childRangeStart(this,
|
7199
|
+
// @ts-ignore: Expression produces a union type that is too complex to represent.
|
7200
|
+
this.green.expressionOrStatementList.toRed(childRangeStart(this, 1), this),
|
7201
|
+
this.green.closeBraceToken.toRed(childRangeStart(this, 2), this)
|
7200
7202
|
];
|
7201
7203
|
}
|
7202
7204
|
};
|
@@ -11065,22 +11067,19 @@ var StatementBlock2 = class extends BaseNode2 {
|
|
11065
11067
|
}
|
11066
11068
|
};
|
11067
11069
|
var FunctionBlock2 = class extends BaseNode2 {
|
11068
|
-
constructor(openBraceToken,
|
11070
|
+
constructor(openBraceToken, expressionOrStatementList, closeBraceToken) {
|
11069
11071
|
super();
|
11070
11072
|
this.kind = 94 /* FunctionBlock */;
|
11071
|
-
this.children = [openBraceToken,
|
11073
|
+
this.children = [openBraceToken, expressionOrStatementList, closeBraceToken];
|
11072
11074
|
}
|
11073
11075
|
get openBraceToken() {
|
11074
11076
|
return this.children[0];
|
11075
11077
|
}
|
11076
|
-
get
|
11078
|
+
get expressionOrStatementList() {
|
11077
11079
|
return this.children[1];
|
11078
11080
|
}
|
11079
|
-
get statementList() {
|
11080
|
-
return this.children[2];
|
11081
|
-
}
|
11082
11081
|
get closeBraceToken() {
|
11083
|
-
return this.children[
|
11082
|
+
return this.children[2];
|
11084
11083
|
}
|
11085
11084
|
get thisAsNode() {
|
11086
11085
|
return this;
|
@@ -14233,15 +14232,15 @@ var LocalizationContext = class {
|
|
14233
14232
|
getTranslationLocale(packageEntity) {
|
14234
14233
|
return this._translationPackageByTranslated.get(packageEntity)?.getTranslationLocale() ?? packageEntity.getLocale();
|
14235
14234
|
}
|
14236
|
-
|
14237
|
-
if (!isPackageTypeEntity(
|
14235
|
+
getTranslatedTypeOrExtensionEntityMembers(entity) {
|
14236
|
+
if (entity.kind === 11 /* TypeExtension */ || !isPackageTypeEntity(entity)) {
|
14238
14237
|
return void 0;
|
14239
14238
|
}
|
14240
|
-
const translationPackage = this._translationPackageByTranslated.get(
|
14239
|
+
const translationPackage = this._translationPackageByTranslated.get(entity.getContainingPackage());
|
14241
14240
|
if (translationPackage === void 0) {
|
14242
14241
|
return void 0;
|
14243
14242
|
}
|
14244
|
-
return translationPackage.getTypeEntityMembers(
|
14243
|
+
return translationPackage.getTypeEntityMembers(entity);
|
14245
14244
|
}
|
14246
14245
|
getEntityName(entity) {
|
14247
14246
|
const containingPackage = getPackageContainingEntity(entity);
|
@@ -18847,7 +18846,7 @@ var TextParser = class {
|
|
18847
18846
|
this._diagnosticStartPositions = new Set(this._diagnosticStartPositions);
|
18848
18847
|
this._skippedTokenOrKeywords = savedSkippedTokenOrKeywords.slice();
|
18849
18848
|
const result = this._scanner.tryScan(callback);
|
18850
|
-
if (
|
18849
|
+
if (result === void 0) {
|
18851
18850
|
this._nextTokenStartPosition = savedCurrentTokenStartPosition;
|
18852
18851
|
this._nextToken = savedNextToken;
|
18853
18852
|
this._currentTokenOrKeyword = savedTokenOrKeyword;
|
@@ -18964,11 +18963,9 @@ var TextParser = class {
|
|
18964
18963
|
if (keywordPart !== void 0) {
|
18965
18964
|
const keywordStart = this._nextTokenStartPosition;
|
18966
18965
|
if (keywordPart.subsequentParts !== void 0) {
|
18967
|
-
|
18968
|
-
this.tryParse(() => {
|
18966
|
+
const parts = this.tryParse(() => {
|
18969
18967
|
this.nextToken();
|
18970
|
-
|
18971
|
-
return parts !== void 0;
|
18968
|
+
return this.tryParseKeywordParts(keywordPart.subsequentParts);
|
18972
18969
|
});
|
18973
18970
|
if (parts !== void 0) {
|
18974
18971
|
result = { tokens: [identifier2, ...parts.tokens], kind: parts.kind, startPosition: keywordStart };
|
@@ -19351,27 +19348,28 @@ var StatementParser = class {
|
|
19351
19348
|
let result;
|
19352
19349
|
const blockStart = this.parser.tokenOrKeywordStartPosition();
|
19353
19350
|
const openBraceToken = this.parser.parseExpectedToken(43 /* OpenBrace */);
|
19354
|
-
let expression = void 0;
|
19355
|
-
let statementList = void 0;
|
19356
19351
|
if (!openBraceToken.isMissing) {
|
19357
|
-
|
19358
|
-
|
19359
|
-
|
19360
|
-
|
19352
|
+
let expressionOrStatementList;
|
19353
|
+
if (allowSingleExpression) {
|
19354
|
+
expressionOrStatementList = this.tryParseFunctionBlockExpression();
|
19355
|
+
}
|
19356
|
+
if (expressionOrStatementList === void 0) {
|
19357
|
+
expressionOrStatementList = this.parseStatementList();
|
19361
19358
|
}
|
19362
19359
|
const closeBraceToken = this.parser.parseExpectedToken(20 /* CloseBrace */);
|
19363
19360
|
result = this.parser.intern(
|
19364
|
-
new FunctionBlock2(openBraceToken,
|
19361
|
+
new FunctionBlock2(openBraceToken, expressionOrStatementList, closeBraceToken),
|
19365
19362
|
blockStart
|
19366
19363
|
);
|
19367
19364
|
} else {
|
19365
|
+
const expressionOrStatementList = this.parser.intern(new StatementList2([]), blockStart);
|
19368
19366
|
const flags = 1 /* Missing */;
|
19369
19367
|
const closeBraceToken = this.parser.intern(
|
19370
19368
|
new Token5(20 /* CloseBrace */, "", [], flags, void 0),
|
19371
19369
|
blockStart
|
19372
19370
|
);
|
19373
19371
|
result = this.parser.intern(
|
19374
|
-
new FunctionBlock2(openBraceToken,
|
19372
|
+
new FunctionBlock2(openBraceToken, expressionOrStatementList, closeBraceToken),
|
19375
19373
|
blockStart
|
19376
19374
|
);
|
19377
19375
|
result = this.parser.intern(result, blockStart);
|
@@ -19497,14 +19495,17 @@ var StatementParser = class {
|
|
19497
19495
|
const result = new EnumerationVariableDeclaration2(name);
|
19498
19496
|
return this.parser.intern(result, declarationStart);
|
19499
19497
|
}
|
19500
|
-
|
19498
|
+
tryParseFunctionBlockExpression() {
|
19499
|
+
let result;
|
19501
19500
|
if (!this.parser.expressionParser.isStartOfExpression(false)) {
|
19502
|
-
|
19501
|
+
result = void 0;
|
19502
|
+
} else {
|
19503
|
+
result = this.parser.tryParse(() => {
|
19504
|
+
const expression = this.parser.expressionParser.parseExpression(false);
|
19505
|
+
return this.parser.currentTokenOrKeyword.isToken(20 /* CloseBrace */) ? expression : void 0;
|
19506
|
+
});
|
19503
19507
|
}
|
19504
|
-
return
|
19505
|
-
this.parser.expressionParser.parseExpression(false);
|
19506
|
-
return this.parser.currentTokenOrKeyword.isToken(20 /* CloseBrace */);
|
19507
|
-
});
|
19508
|
+
return result;
|
19508
19509
|
}
|
19509
19510
|
canParseOptionalExpression(isFollowedByStatementBlock) {
|
19510
19511
|
if (!this.parser.expressionParser.isStartOfExpression(isFollowedByStatementBlock)) {
|
@@ -20864,7 +20865,7 @@ var TagParser = class {
|
|
20864
20865
|
const hashSignToken = this.parser.parseExpectedToken(35 /* HashSign */);
|
20865
20866
|
const name = this.parser.parseQualifiedName(36 /* TagNameExpected */);
|
20866
20867
|
let typeArgumentClause;
|
20867
|
-
if (this.parser.typeArgumentParser.
|
20868
|
+
if (this.parser.typeArgumentParser.isStartOfTypeArgumentClause()) {
|
20868
20869
|
typeArgumentClause = this.parser.typeArgumentParser.parseTypeArgumentClause();
|
20869
20870
|
}
|
20870
20871
|
let openParenthesisToken;
|
@@ -21008,6 +21009,9 @@ var TypeArgumentParser = class {
|
|
21008
21009
|
const result = new TypeArgumentList2(elements);
|
21009
21010
|
return this.parser.intern(result, listStart);
|
21010
21011
|
}
|
21012
|
+
isStartOfTypeArgumentClause() {
|
21013
|
+
return this.parser.currentTokenOrKeyword.isToken(36 /* LessThan */);
|
21014
|
+
}
|
21011
21015
|
canParseTypeArgumentClause() {
|
21012
21016
|
return this.parser.lookAhead(() => {
|
21013
21017
|
const typeArgumentClause = this.parseTypeArgumentClause();
|
@@ -23684,6 +23688,9 @@ var Constructor = class {
|
|
23684
23688
|
isHidden() {
|
23685
23689
|
return this._entity.isHidden();
|
23686
23690
|
}
|
23691
|
+
isStatic() {
|
23692
|
+
return false;
|
23693
|
+
}
|
23687
23694
|
equals(other) {
|
23688
23695
|
if (this === other) {
|
23689
23696
|
return true;
|
@@ -23712,6 +23719,9 @@ var Destructor = class _Destructor {
|
|
23712
23719
|
isHidden() {
|
23713
23720
|
return this._entity.isHidden();
|
23714
23721
|
}
|
23722
|
+
isStatic() {
|
23723
|
+
return false;
|
23724
|
+
}
|
23715
23725
|
applySubstitutions(substitutions) {
|
23716
23726
|
return new _Destructor(this._entity, this._substitutions.substituteTypes(substitutions.map));
|
23717
23727
|
}
|
@@ -23746,6 +23756,9 @@ var Indexer = class _Indexer {
|
|
23746
23756
|
isHidden() {
|
23747
23757
|
return this._entity.isHidden();
|
23748
23758
|
}
|
23759
|
+
isStatic() {
|
23760
|
+
return this._entity.isStatic();
|
23761
|
+
}
|
23749
23762
|
applySubstitutions(substitutions) {
|
23750
23763
|
return new _Indexer(this._entity, this._substitutions.substituteTypes(substitutions.map));
|
23751
23764
|
}
|
@@ -23774,6 +23787,9 @@ var DereferenceOperator = class _DereferenceOperator {
|
|
23774
23787
|
isHidden() {
|
23775
23788
|
return this._entity.isHidden();
|
23776
23789
|
}
|
23790
|
+
isStatic() {
|
23791
|
+
return false;
|
23792
|
+
}
|
23777
23793
|
applySubstitutions(substitutions) {
|
23778
23794
|
return new _DereferenceOperator(this._entity, this._substitutions.substituteTypes(substitutions.map));
|
23779
23795
|
}
|
@@ -23950,9 +23966,9 @@ var FoundAnonymousDeclaration = class _FoundAnonymousDeclaration {
|
|
23950
23966
|
|
23951
23967
|
// source/analysis/TypeMemberLookup.ts
|
23952
23968
|
var TypeMemberLookup = class _TypeMemberLookup {
|
23953
|
-
constructor(_analyzer,
|
23969
|
+
constructor(_analyzer, _typeOrExtension, _localizationContext) {
|
23954
23970
|
this._analyzer = _analyzer;
|
23955
|
-
this.
|
23971
|
+
this._typeOrExtension = _typeOrExtension;
|
23956
23972
|
this._localizationContext = _localizationContext;
|
23957
23973
|
this._searchLocale = new Cached();
|
23958
23974
|
}
|
@@ -23962,12 +23978,12 @@ var TypeMemberLookup = class _TypeMemberLookup {
|
|
23962
23978
|
get searchLocale() {
|
23963
23979
|
return this._searchLocale.getOrInsertWith(() => {
|
23964
23980
|
let result;
|
23965
|
-
const
|
23966
|
-
if (
|
23967
|
-
if (isNamedTypeEntity(
|
23968
|
-
result = this.getLocaleOfTypeEntity(
|
23981
|
+
const typeOrExtensionEntity = this._typeOrExtension.getEntity();
|
23982
|
+
if (typeOrExtensionEntity !== void 0) {
|
23983
|
+
if (typeOrExtensionEntity.kind === 2 /* Type */ && isNamedTypeEntity(typeOrExtensionEntity)) {
|
23984
|
+
result = this.getLocaleOfTypeEntity(typeOrExtensionEntity);
|
23969
23985
|
} else {
|
23970
|
-
result = getPackageContainingEntity(
|
23986
|
+
result = getPackageContainingEntity(typeOrExtensionEntity).getLocale();
|
23971
23987
|
}
|
23972
23988
|
} else {
|
23973
23989
|
result = this._localizationContext?.originalLocale ?? DefaultLocale;
|
@@ -23975,37 +23991,54 @@ var TypeMemberLookup = class _TypeMemberLookup {
|
|
23975
23991
|
return result;
|
23976
23992
|
});
|
23977
23993
|
}
|
23994
|
+
static ofType(analyzer, type, localizationContext) {
|
23995
|
+
const typeOrExtension = new TypeOrExtension_type(type);
|
23996
|
+
return new _TypeMemberLookup(analyzer, typeOrExtension, localizationContext);
|
23997
|
+
}
|
23978
23998
|
static ofTypeEntity(analyzer, entity, localizationContext) {
|
23979
23999
|
const type = analyzer.instantiateTypeByIdentitySubstitution(entity);
|
23980
|
-
return
|
24000
|
+
return _TypeMemberLookup.ofType(analyzer, type, localizationContext);
|
23981
24001
|
}
|
23982
|
-
|
24002
|
+
static ofTypeExtension(analyzer, typeExtension, localizationContext) {
|
24003
|
+
const typeOrExtension = new TypeOrExtension_extension(typeExtension);
|
24004
|
+
return new _TypeMemberLookup(analyzer, typeOrExtension, localizationContext);
|
24005
|
+
}
|
24006
|
+
static ofTypeOrExtension(analyzer, typeOrExtension, localizationContext) {
|
24007
|
+
return new _TypeMemberLookup(analyzer, typeOrExtension, localizationContext);
|
24008
|
+
}
|
24009
|
+
getNamedMembers(options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
23983
24010
|
const lookup = new NamedTypeMemberLookup(this._analyzer, this.searchLocale, this._localizationContext);
|
23984
|
-
return lookup.getMembers(this.
|
24011
|
+
return lookup.getMembers(this._typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
23985
24012
|
}
|
23986
|
-
getNamedMembersByName(name, hidingMatcher, typeExtensionsLookup) {
|
24013
|
+
getNamedMembersByName(name, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
23987
24014
|
const lookup = new NamedTypeMemberLookup(this._analyzer, this.searchLocale, this._localizationContext);
|
23988
|
-
return lookup.getMembersByName(name, this.
|
24015
|
+
return lookup.getMembersByName(name, this._typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
23989
24016
|
}
|
23990
|
-
getOperators(hidingMatcher, typeExtensionsLookup) {
|
24017
|
+
getOperators(options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
23991
24018
|
const lookup = new OperatorLookup(this._analyzer, this._localizationContext);
|
23992
|
-
return lookup.getOperators(this.
|
24019
|
+
return lookup.getOperators(this._typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
23993
24020
|
}
|
23994
|
-
getOperatorsByKind(kind, hidingMatcher, typeExtensionsLookup) {
|
24021
|
+
getOperatorsByKind(kind, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
23995
24022
|
const lookup = new OperatorLookup(this._analyzer, this._localizationContext);
|
23996
|
-
return lookup.getOperatorsByKind(
|
24023
|
+
return lookup.getOperatorsByKind(
|
24024
|
+
kind,
|
24025
|
+
this._typeOrExtension,
|
24026
|
+
options,
|
24027
|
+
hidingMatcher,
|
24028
|
+
typeExtensionsLookup
|
24029
|
+
);
|
23997
24030
|
}
|
23998
24031
|
getConstructors(hidingMatcher, typeExtensionsLookup) {
|
23999
|
-
const lookup = new ConstructorLookup(this._localizationContext);
|
24000
|
-
return lookup.getConstructors(this.
|
24032
|
+
const lookup = new ConstructorLookup(this._analyzer, this._localizationContext);
|
24033
|
+
return lookup.getConstructors(this._typeOrExtension, hidingMatcher, typeExtensionsLookup);
|
24001
24034
|
}
|
24002
|
-
getIndexers(hidingMatcher, typeExtensionsLookup) {
|
24035
|
+
getIndexers(options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24003
24036
|
const lookup = new IndexerLookup(this._analyzer, this._localizationContext);
|
24004
|
-
return lookup.getIndexers(this.
|
24037
|
+
return lookup.getIndexers(this._typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24005
24038
|
}
|
24006
|
-
getDereferenceOperators(hidingMatcher, typeExtensionsLookup) {
|
24039
|
+
getDereferenceOperators(options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24007
24040
|
const lookup = new DereferenceOperatorLookup(this._analyzer, this._localizationContext);
|
24008
|
-
return lookup.getDereferenceOperators(this.
|
24041
|
+
return lookup.getDereferenceOperators(this._typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24009
24042
|
}
|
24010
24043
|
getLocaleOfTypeEntity(typeEntity) {
|
24011
24044
|
const containingPackage = getPackageContainingEntity(typeEntity);
|
@@ -24017,63 +24050,108 @@ var TypeMemberLookup = class _TypeMemberLookup {
|
|
24017
24050
|
}
|
24018
24051
|
};
|
24019
24052
|
var BoundTypeMemberLookup = class _BoundTypeMemberLookup {
|
24020
|
-
constructor(analyzer,
|
24021
|
-
this._lookup =
|
24053
|
+
constructor(analyzer, typeOrExtension, localizationContext, options = 0 /* None */, hidingMatcher, typeExtensionLookup) {
|
24054
|
+
this._lookup = TypeMemberLookup.ofTypeOrExtension(analyzer, typeOrExtension, localizationContext);
|
24055
|
+
this._options = options;
|
24022
24056
|
this._hidingMatcher = hidingMatcher;
|
24023
24057
|
this._typeExtensionLookup = typeExtensionLookup;
|
24024
24058
|
}
|
24025
|
-
static
|
24059
|
+
static ofType(analyzer, type, localizationContext, options = 0 /* None */, hidingMatcher, typeExtensionLookup) {
|
24060
|
+
const typeOrExtension = new TypeOrExtension_type(type);
|
24061
|
+
return new _BoundTypeMemberLookup(
|
24062
|
+
analyzer,
|
24063
|
+
typeOrExtension,
|
24064
|
+
localizationContext,
|
24065
|
+
options,
|
24066
|
+
hidingMatcher,
|
24067
|
+
typeExtensionLookup
|
24068
|
+
);
|
24069
|
+
}
|
24070
|
+
static ofTypeEntity(analyzer, entity, localizationContext, options = 0 /* None */, hidingMatcher, typeExtensionLookup) {
|
24026
24071
|
const type = analyzer.instantiateTypeByIdentitySubstitution(entity);
|
24027
|
-
return
|
24072
|
+
return this.ofType(analyzer, type, localizationContext, options, hidingMatcher, typeExtensionLookup);
|
24073
|
+
}
|
24074
|
+
static ofTypeExtension(analyzer, typeExtension, localizationContext, options = 0 /* None */, hidingMatcher, typeExtensionLookup) {
|
24075
|
+
const typeOrExtension = new TypeOrExtension_extension(typeExtension);
|
24076
|
+
return new _BoundTypeMemberLookup(
|
24077
|
+
analyzer,
|
24078
|
+
typeOrExtension,
|
24079
|
+
localizationContext,
|
24080
|
+
options,
|
24081
|
+
hidingMatcher,
|
24082
|
+
typeExtensionLookup
|
24083
|
+
);
|
24028
24084
|
}
|
24029
24085
|
getNamedMembers() {
|
24030
|
-
return this._lookup.getNamedMembers(this._hidingMatcher, this._typeExtensionLookup);
|
24086
|
+
return this._lookup.getNamedMembers(this._options, this._hidingMatcher, this._typeExtensionLookup);
|
24031
24087
|
}
|
24032
24088
|
getNamedMembersByName(name) {
|
24033
|
-
return this._lookup.getNamedMembersByName(
|
24089
|
+
return this._lookup.getNamedMembersByName(
|
24090
|
+
name,
|
24091
|
+
this._options,
|
24092
|
+
this._hidingMatcher,
|
24093
|
+
this._typeExtensionLookup
|
24094
|
+
);
|
24034
24095
|
}
|
24035
24096
|
getOperators() {
|
24036
|
-
return this._lookup.getOperators(this._hidingMatcher, this._typeExtensionLookup);
|
24097
|
+
return this._lookup.getOperators(this._options, this._hidingMatcher, this._typeExtensionLookup);
|
24037
24098
|
}
|
24038
24099
|
getOperatorsByKind(kind) {
|
24039
|
-
return this._lookup.getOperatorsByKind(
|
24100
|
+
return this._lookup.getOperatorsByKind(
|
24101
|
+
kind,
|
24102
|
+
this._options,
|
24103
|
+
this._hidingMatcher,
|
24104
|
+
this._typeExtensionLookup
|
24105
|
+
);
|
24040
24106
|
}
|
24041
24107
|
getConstructors() {
|
24042
24108
|
return this._lookup.getConstructors(this._hidingMatcher, this._typeExtensionLookup);
|
24043
24109
|
}
|
24044
24110
|
getIndexers() {
|
24045
|
-
return this._lookup.getIndexers(this._hidingMatcher, this._typeExtensionLookup);
|
24111
|
+
return this._lookup.getIndexers(this._options, this._hidingMatcher, this._typeExtensionLookup);
|
24046
24112
|
}
|
24047
24113
|
getDereferenceOperators() {
|
24048
|
-
return this._lookup.getDereferenceOperators(this._hidingMatcher, this._typeExtensionLookup);
|
24114
|
+
return this._lookup.getDereferenceOperators(this._options, this._hidingMatcher, this._typeExtensionLookup);
|
24049
24115
|
}
|
24050
24116
|
};
|
24117
|
+
var TypeMemberLookupOptions = /* @__PURE__ */ ((TypeMemberLookupOptions2) => {
|
24118
|
+
TypeMemberLookupOptions2[TypeMemberLookupOptions2["None"] = 0] = "None";
|
24119
|
+
TypeMemberLookupOptions2[TypeMemberLookupOptions2["OnlyInstanceMembers"] = 1] = "OnlyInstanceMembers";
|
24120
|
+
TypeMemberLookupOptions2[TypeMemberLookupOptions2["OnlyStaticMembers"] = 2] = "OnlyStaticMembers";
|
24121
|
+
return TypeMemberLookupOptions2;
|
24122
|
+
})(TypeMemberLookupOptions || {});
|
24051
24123
|
var TypeMemberLookupBase = class {
|
24052
24124
|
constructor(analyzer) {
|
24053
24125
|
this._analyzer = analyzer;
|
24054
24126
|
}
|
24055
|
-
|
24056
|
-
|
24057
|
-
|
24058
|
-
|
24059
|
-
|
24060
|
-
|
24061
|
-
|
24062
|
-
|
24063
|
-
|
24064
|
-
|
24065
|
-
|
24066
|
-
|
24067
|
-
|
24068
|
-
|
24069
|
-
|
24070
|
-
|
24071
|
-
|
24072
|
-
|
24127
|
+
getAllMembers(typeOrExtension, options, hidingMatcher, typeExtensionsLookup) {
|
24128
|
+
let result;
|
24129
|
+
if ((options & (1 /* OnlyInstanceMembers */ | 2 /* OnlyStaticMembers */)) !== 0) {
|
24130
|
+
result = this.getAllMembersOfTypeOrExtension(
|
24131
|
+
typeOrExtension,
|
24132
|
+
options,
|
24133
|
+
hidingMatcher,
|
24134
|
+
typeExtensionsLookup
|
24135
|
+
);
|
24136
|
+
} else {
|
24137
|
+
result = this.getAllMembersOfTypeOrExtension(
|
24138
|
+
typeOrExtension,
|
24139
|
+
1 /* OnlyInstanceMembers */,
|
24140
|
+
hidingMatcher,
|
24141
|
+
typeExtensionsLookup
|
24142
|
+
);
|
24143
|
+
const staticMembers = this.getAllMembersOfTypeOrExtension(
|
24144
|
+
typeOrExtension,
|
24145
|
+
2 /* OnlyStaticMembers */,
|
24146
|
+
hidingMatcher,
|
24147
|
+
typeExtensionsLookup
|
24148
|
+
);
|
24149
|
+
result = this.mergeMembers(result, [staticMembers], false);
|
24073
24150
|
}
|
24151
|
+
return result;
|
24074
24152
|
}
|
24075
|
-
|
24076
|
-
return getPackageContainingEntity(
|
24153
|
+
getOriginalLocaleOfTypeOrExtensionEntity(entity) {
|
24154
|
+
return getPackageContainingEntity(entity).getLocale();
|
24077
24155
|
}
|
24078
24156
|
mergeMembers(shadowingMembers, shadowedMembersFromMultipleTypes, mergeNonAspectShadowedMembersFirst) {
|
24079
24157
|
const result = Array.from(shadowingMembers);
|
@@ -24113,94 +24191,167 @@ var TypeMemberLookupBase = class {
|
|
24113
24191
|
}
|
24114
24192
|
return result;
|
24115
24193
|
}
|
24116
|
-
|
24117
|
-
|
24194
|
+
getAllMembersOfTypeOrExtension(typeOrExtension, options, hidingMatcher, typeExtensionsLookup) {
|
24195
|
+
switch (typeOrExtension.kind) {
|
24196
|
+
case "type":
|
24197
|
+
return this.getAllMembersOfType(typeOrExtension.value, options, hidingMatcher, typeExtensionsLookup);
|
24198
|
+
case "extension": {
|
24199
|
+
let extendedType;
|
24200
|
+
let substitutions;
|
24201
|
+
const extendedTypeEntity = typeOrExtension.value.getExtendedTypeEntity();
|
24202
|
+
if (extendedTypeEntity !== void 0) {
|
24203
|
+
extendedType = this._analyzer.instantiateTypeByIdentitySubstitution(extendedTypeEntity);
|
24204
|
+
substitutions = extendedType.getSubstitutions();
|
24205
|
+
} else {
|
24206
|
+
extendedType = void 0;
|
24207
|
+
substitutions = Substitutions2.empty(this._analyzer);
|
24208
|
+
}
|
24209
|
+
return this.getAllMembersOfRegularTypeOrExtension(
|
24210
|
+
typeOrExtension.value,
|
24211
|
+
substitutions,
|
24212
|
+
void 0,
|
24213
|
+
void 0,
|
24214
|
+
extendedType,
|
24215
|
+
options,
|
24216
|
+
hidingMatcher,
|
24217
|
+
typeExtensionsLookup
|
24218
|
+
);
|
24219
|
+
}
|
24220
|
+
default:
|
24221
|
+
Debug.never(typeOrExtension);
|
24222
|
+
}
|
24223
|
+
}
|
24224
|
+
getAllMembersOfType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24225
|
+
switch (type.kind) {
|
24226
|
+
case "structured":
|
24227
|
+
return this.getAllMembersOfStructuredType(type, options, hidingMatcher, typeExtensionsLookup);
|
24228
|
+
case "variant":
|
24229
|
+
return this.getAllMembersOfVariantType(type, options, hidingMatcher, typeExtensionsLookup);
|
24230
|
+
case "method":
|
24231
|
+
return this.getAllMembersOfMethodType(type, options, hidingMatcher, typeExtensionsLookup);
|
24232
|
+
case "alias":
|
24233
|
+
return this.getAllMembersOfAliasType(type, options, hidingMatcher, typeExtensionsLookup);
|
24234
|
+
case "parameter":
|
24235
|
+
return this.getAllMembersOfParameterType(type, options, hidingMatcher, typeExtensionsLookup);
|
24236
|
+
case "union":
|
24237
|
+
return this.getAllMembersOfUnionType(type, options, hidingMatcher, typeExtensionsLookup);
|
24238
|
+
case "unresolved":
|
24239
|
+
return [];
|
24240
|
+
default:
|
24241
|
+
Debug.never(type);
|
24242
|
+
}
|
24243
|
+
}
|
24244
|
+
getAllMembersOfStructuredType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24245
|
+
return this.getAllMembersOfRegularTypeOrExtension(
|
24118
24246
|
type.getEntity(),
|
24119
24247
|
type.getSubstitutions(),
|
24120
24248
|
type.getBaseObjectType(),
|
24121
24249
|
type.getBaseAspectTypes(),
|
24250
|
+
void 0,
|
24251
|
+
options,
|
24122
24252
|
hidingMatcher,
|
24123
24253
|
typeExtensionsLookup
|
24124
24254
|
);
|
24125
24255
|
}
|
24126
|
-
getAllMembersOfVariantType(type, hidingMatcher, typeExtensionsLookup) {
|
24127
|
-
return this.
|
24256
|
+
getAllMembersOfVariantType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24257
|
+
return this.getAllMembersOfRegularTypeOrExtension(
|
24128
24258
|
type.getEntity(),
|
24129
24259
|
type.getSubstitutions(),
|
24130
24260
|
type.getBaseType(),
|
24131
24261
|
void 0,
|
24262
|
+
void 0,
|
24263
|
+
options,
|
24132
24264
|
hidingMatcher,
|
24133
24265
|
typeExtensionsLookup
|
24134
24266
|
);
|
24135
24267
|
}
|
24136
|
-
getAllMembersOfMethodType(type, hidingMatcher, typeExtensionsLookup) {
|
24137
|
-
return this.
|
24268
|
+
getAllMembersOfMethodType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24269
|
+
return this.getAllMembersOfRegularTypeOrExtension(
|
24138
24270
|
type.getEntity(),
|
24139
24271
|
type.getSubstitutions(),
|
24140
24272
|
type.getBaseType(),
|
24141
24273
|
void 0,
|
24274
|
+
void 0,
|
24275
|
+
options,
|
24142
24276
|
hidingMatcher,
|
24143
24277
|
typeExtensionsLookup
|
24144
24278
|
);
|
24145
24279
|
}
|
24146
|
-
getAllMembersOfAliasType(type, hidingMatcher, typeExtensionsLookup) {
|
24147
|
-
const ownMembers = this.getOwnMembersMatchingHiding(
|
24280
|
+
getAllMembersOfAliasType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24281
|
+
const ownMembers = this.getOwnMembersMatchingHiding(
|
24282
|
+
type.getEntity(),
|
24283
|
+
type.getSubstitutions(),
|
24284
|
+
options,
|
24285
|
+
hidingMatcher
|
24286
|
+
);
|
24148
24287
|
const baseAndExtensionMembers = new Array();
|
24149
24288
|
const aliasedType = type.getAliasedType();
|
24150
|
-
const aliasedTypeMembers = this.getAllMembersOfType(
|
24289
|
+
const aliasedTypeMembers = this.getAllMembersOfType(
|
24290
|
+
aliasedType,
|
24291
|
+
options,
|
24292
|
+
hidingMatcher,
|
24293
|
+
typeExtensionsLookup
|
24294
|
+
);
|
24151
24295
|
baseAndExtensionMembers.push(aliasedTypeMembers);
|
24152
24296
|
if (typeExtensionsLookup !== void 0) {
|
24153
24297
|
const extensionMembers = this.getMembersOfExtensionsMatchingHiding(
|
24154
24298
|
type.getEntity(),
|
24155
24299
|
type.getSubstitutions(),
|
24300
|
+
options,
|
24156
24301
|
typeExtensionsLookup,
|
24157
24302
|
hidingMatcher
|
24158
24303
|
);
|
24159
|
-
baseAndExtensionMembers.push(
|
24304
|
+
baseAndExtensionMembers.push(extensionMembers);
|
24160
24305
|
}
|
24161
24306
|
const result = this.mergeMembers(ownMembers, baseAndExtensionMembers, false);
|
24162
24307
|
return result;
|
24163
24308
|
}
|
24164
|
-
getAllMembersOfParameterType(type, hidingMatcher, typeExtensionsLookup) {
|
24309
|
+
getAllMembersOfParameterType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24165
24310
|
let result = [];
|
24166
24311
|
if (type.constraint !== void 0) {
|
24167
|
-
result = this.getAllMembersOfType(type.constraint, hidingMatcher, typeExtensionsLookup);
|
24312
|
+
result = this.getAllMembersOfType(type.constraint, options, hidingMatcher, typeExtensionsLookup);
|
24168
24313
|
}
|
24169
24314
|
return result;
|
24170
24315
|
}
|
24171
|
-
getAllMembersOfUnionType(type, hidingMatcher, typeExtensionsLookup) {
|
24316
|
+
getAllMembersOfUnionType(type, options, hidingMatcher, typeExtensionsLookup) {
|
24172
24317
|
const commonBaseTypes = this._analyzer.getCommonObjectAndAspectTypesOfUnion(type);
|
24173
|
-
const result = commonBaseTypes.flatMap((t) => this.getAllMembersOfStructuredType(t, hidingMatcher, typeExtensionsLookup));
|
24318
|
+
const result = commonBaseTypes.flatMap((t) => this.getAllMembersOfStructuredType(t, options, hidingMatcher, typeExtensionsLookup));
|
24174
24319
|
return result;
|
24175
24320
|
}
|
24176
|
-
|
24177
|
-
const ownMembers = this.getOwnMembersMatchingHiding(
|
24321
|
+
getAllMembersOfRegularTypeOrExtension(entity, substitutions, baseObjectType, baseAspectTypes, extendedType, options, hidingMatcher, typeExtensionsLookup) {
|
24322
|
+
const ownMembers = this.getOwnMembersMatchingHiding(entity, substitutions, options, hidingMatcher);
|
24178
24323
|
const baseAndExtensionMembers = new Array();
|
24179
24324
|
if (baseObjectType !== void 0) {
|
24180
|
-
const members = this.getAllMembersOfType(baseObjectType, hidingMatcher, typeExtensionsLookup);
|
24325
|
+
const members = this.getAllMembersOfType(baseObjectType, options, hidingMatcher, typeExtensionsLookup);
|
24181
24326
|
baseAndExtensionMembers.push(members);
|
24182
24327
|
}
|
24183
24328
|
if (baseAspectTypes !== void 0 && baseAspectTypes.length > 0) {
|
24184
|
-
const aspectsMembers = baseAspectTypes.map((a) => this.getAllMembersOfType(a, hidingMatcher, typeExtensionsLookup));
|
24329
|
+
const aspectsMembers = baseAspectTypes.map((a) => this.getAllMembersOfType(a, options, hidingMatcher, typeExtensionsLookup));
|
24185
24330
|
baseAndExtensionMembers.push(...aspectsMembers);
|
24186
24331
|
}
|
24187
|
-
if (
|
24332
|
+
if (extendedType !== void 0) {
|
24333
|
+
const members = this.getAllMembersOfType(extendedType, options, hidingMatcher, typeExtensionsLookup);
|
24334
|
+
baseAndExtensionMembers.push(members);
|
24335
|
+
}
|
24336
|
+
if (typeExtensionsLookup !== void 0 && entity.kind === 2 /* Type */) {
|
24188
24337
|
const membersOfExtensions = this.getMembersOfExtensionsMatchingHiding(
|
24189
|
-
|
24338
|
+
entity,
|
24190
24339
|
substitutions,
|
24340
|
+
options,
|
24191
24341
|
typeExtensionsLookup,
|
24192
24342
|
hidingMatcher
|
24193
24343
|
);
|
24194
|
-
baseAndExtensionMembers.push(
|
24344
|
+
baseAndExtensionMembers.push(membersOfExtensions);
|
24195
24345
|
}
|
24196
24346
|
const result = this.mergeMembers(ownMembers, baseAndExtensionMembers, true);
|
24197
24347
|
return result;
|
24198
24348
|
}
|
24199
|
-
getOwnMembersMatchingHiding(
|
24200
|
-
|
24201
|
-
|
24349
|
+
getOwnMembersMatchingHiding(entity, substitutions, options, hidingMatcher) {
|
24350
|
+
let members = this.getOwnMembers(entity, substitutions);
|
24351
|
+
if ((options & (1 /* OnlyInstanceMembers */ | 2 /* OnlyStaticMembers */)) !== 0) {
|
24352
|
+
const isStatic = (options & 2 /* OnlyStaticMembers */) !== 0;
|
24353
|
+
members = members.filter((m) => m.value.isStatic() === isStatic);
|
24202
24354
|
}
|
24203
|
-
let members = this.getOwnMembers(typeEntity, substitutions);
|
24204
24355
|
if (hidingMatcher !== void 0) {
|
24205
24356
|
members = members.filter((m) => {
|
24206
24357
|
const hiding = m.value.isHidden();
|
@@ -24209,142 +24360,243 @@ var TypeMemberLookupBase = class {
|
|
24209
24360
|
}
|
24210
24361
|
return members;
|
24211
24362
|
}
|
24212
|
-
getMembersOfExtensionsMatchingHiding(typeEntity, substitutions, typeExtensionsLookup, hidingMatcher) {
|
24363
|
+
getMembersOfExtensionsMatchingHiding(typeEntity, substitutions, options, typeExtensionsLookup, hidingMatcher) {
|
24213
24364
|
const extensions = typeExtensionsLookup.getTypeExtensionsByType(typeEntity);
|
24214
|
-
let
|
24365
|
+
let members = this.getMembersOfExtensions(extensions, substitutions);
|
24366
|
+
if ((options & (1 /* OnlyInstanceMembers */ | 2 /* OnlyStaticMembers */)) !== 0) {
|
24367
|
+
const isStatic = (options & 2 /* OnlyStaticMembers */) !== 0;
|
24368
|
+
members = members.filter((m) => m.value.isStatic() === isStatic);
|
24369
|
+
}
|
24215
24370
|
if (hidingMatcher !== void 0) {
|
24216
|
-
|
24217
|
-
|
24218
|
-
|
24219
|
-
|
24220
|
-
})
|
24221
|
-
);
|
24371
|
+
members = members.filter((m) => {
|
24372
|
+
const hiding = m.value.isHidden();
|
24373
|
+
return hiding === void 0 || hidingMatcher.matches(hiding);
|
24374
|
+
});
|
24222
24375
|
}
|
24223
|
-
return
|
24376
|
+
return members;
|
24224
24377
|
}
|
24225
24378
|
};
|
24226
24379
|
var TypeMemberLookupByKeyBase = class extends TypeMemberLookupBase {
|
24227
24380
|
constructor(analyzer) {
|
24228
24381
|
super(analyzer);
|
24229
24382
|
}
|
24230
|
-
|
24383
|
+
getMembersByKey(key, typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24384
|
+
let result;
|
24385
|
+
if ((options & (1 /* OnlyInstanceMembers */ | 2 /* OnlyStaticMembers */)) !== 0) {
|
24386
|
+
result = this.getMembersOfTypeOrExtension(key, typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24387
|
+
} else {
|
24388
|
+
result = this.getMembersOfTypeOrExtension(
|
24389
|
+
key,
|
24390
|
+
typeOrExtension,
|
24391
|
+
1 /* OnlyInstanceMembers */,
|
24392
|
+
hidingMatcher,
|
24393
|
+
typeExtensionsLookup
|
24394
|
+
);
|
24395
|
+
if (result.length === 0) {
|
24396
|
+
result = this.getMembersOfTypeOrExtension(
|
24397
|
+
key,
|
24398
|
+
typeOrExtension,
|
24399
|
+
0 /* None */,
|
24400
|
+
hidingMatcher,
|
24401
|
+
typeExtensionsLookup
|
24402
|
+
);
|
24403
|
+
}
|
24404
|
+
}
|
24405
|
+
return result;
|
24406
|
+
}
|
24407
|
+
getMembersOfTypeOrExtension(key, typeOrExtension, options, hidingMatcher, typeExtensionsLookup) {
|
24408
|
+
switch (typeOrExtension.kind) {
|
24409
|
+
case "type":
|
24410
|
+
return this.getMembersOfTypeByKey(key, typeOrExtension.value, options, hidingMatcher, typeExtensionsLookup);
|
24411
|
+
case "extension": {
|
24412
|
+
let extendedType;
|
24413
|
+
let substitutions;
|
24414
|
+
const extendedTypeEntity = typeOrExtension.value.getExtendedTypeEntity();
|
24415
|
+
if (extendedTypeEntity !== void 0) {
|
24416
|
+
extendedType = this._analyzer.instantiateTypeByIdentitySubstitution(extendedTypeEntity);
|
24417
|
+
substitutions = extendedType.getSubstitutions();
|
24418
|
+
} else {
|
24419
|
+
extendedType = void 0;
|
24420
|
+
substitutions = Substitutions2.empty(this._analyzer);
|
24421
|
+
}
|
24422
|
+
return this.getMembersOfRegularTypeOrExtensionByKey(
|
24423
|
+
key,
|
24424
|
+
typeOrExtension.value,
|
24425
|
+
substitutions,
|
24426
|
+
void 0,
|
24427
|
+
void 0,
|
24428
|
+
extendedType,
|
24429
|
+
options,
|
24430
|
+
hidingMatcher,
|
24431
|
+
typeExtensionsLookup
|
24432
|
+
);
|
24433
|
+
}
|
24434
|
+
default:
|
24435
|
+
Debug.never(typeOrExtension);
|
24436
|
+
}
|
24437
|
+
}
|
24438
|
+
getMembersOfTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24231
24439
|
switch (type.kind) {
|
24232
24440
|
case "structured":
|
24233
|
-
return this.getMembersOfStructuredTypeByKey(key, type, hidingMatcher, typeExtensionsLookup);
|
24441
|
+
return this.getMembersOfStructuredTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup);
|
24234
24442
|
case "variant":
|
24235
|
-
return this.getMembersOfVariantTypeByKey(key, type, hidingMatcher, typeExtensionsLookup);
|
24443
|
+
return this.getMembersOfVariantTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup);
|
24236
24444
|
case "method":
|
24237
|
-
return this.getMembersOfMethodTypeByKey(key, type, hidingMatcher, typeExtensionsLookup);
|
24445
|
+
return this.getMembersOfMethodTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup);
|
24238
24446
|
case "alias":
|
24239
|
-
return this.getMembersOfAliasTypeByKey(key, type, hidingMatcher, typeExtensionsLookup);
|
24447
|
+
return this.getMembersOfAliasTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup);
|
24240
24448
|
case "parameter":
|
24241
|
-
return this.getMembersOfParameterTypeByKey(key, type, hidingMatcher, typeExtensionsLookup);
|
24449
|
+
return this.getMembersOfParameterTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup);
|
24242
24450
|
case "union":
|
24243
|
-
return this.getMembersOfUnionTypeByKey(key, type, hidingMatcher, typeExtensionsLookup);
|
24451
|
+
return this.getMembersOfUnionTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup);
|
24244
24452
|
case "unresolved":
|
24245
24453
|
return [];
|
24246
24454
|
default:
|
24247
24455
|
Debug.never(type);
|
24248
24456
|
}
|
24249
24457
|
}
|
24250
|
-
getMembersOfStructuredTypeByKey(key, type, hidingMatcher, typeExtensionsLookup) {
|
24251
|
-
return this.
|
24458
|
+
getMembersOfStructuredTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24459
|
+
return this.getMembersOfRegularTypeOrExtensionByKey(
|
24252
24460
|
key,
|
24253
24461
|
type.getEntity(),
|
24254
24462
|
type.getSubstitutions(),
|
24255
24463
|
type.getBaseObjectType(),
|
24256
24464
|
type.getBaseAspectTypes(),
|
24465
|
+
void 0,
|
24466
|
+
options,
|
24257
24467
|
hidingMatcher,
|
24258
24468
|
typeExtensionsLookup
|
24259
24469
|
);
|
24260
24470
|
}
|
24261
|
-
getMembersOfVariantTypeByKey(key, type, hidingMatcher, typeExtensionsLookup) {
|
24262
|
-
return this.
|
24471
|
+
getMembersOfVariantTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24472
|
+
return this.getMembersOfRegularTypeOrExtensionByKey(
|
24263
24473
|
key,
|
24264
24474
|
type.getEntity(),
|
24265
24475
|
type.getSubstitutions(),
|
24266
24476
|
type.getBaseType(),
|
24267
24477
|
void 0,
|
24478
|
+
void 0,
|
24479
|
+
options,
|
24268
24480
|
hidingMatcher,
|
24269
24481
|
typeExtensionsLookup
|
24270
24482
|
);
|
24271
24483
|
}
|
24272
|
-
getMembersOfMethodTypeByKey(key, type, hidingMatcher, typeExtensionsLookup) {
|
24273
|
-
return this.
|
24484
|
+
getMembersOfMethodTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24485
|
+
return this.getMembersOfRegularTypeOrExtensionByKey(
|
24274
24486
|
key,
|
24275
24487
|
type.getEntity(),
|
24276
24488
|
type.getSubstitutions(),
|
24277
24489
|
type.getBaseType(),
|
24278
24490
|
void 0,
|
24491
|
+
void 0,
|
24492
|
+
options,
|
24279
24493
|
hidingMatcher,
|
24280
24494
|
typeExtensionsLookup
|
24281
24495
|
);
|
24282
24496
|
}
|
24283
|
-
getMembersOfAliasTypeByKey(key, type, hidingMatcher, typeExtensionsLookup) {
|
24497
|
+
getMembersOfAliasTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24284
24498
|
const ownMembers = this.getOwnMembersByKeyMatchingHiding(
|
24285
24499
|
key,
|
24286
24500
|
type.getEntity(),
|
24287
24501
|
type.getSubstitutions(),
|
24502
|
+
options,
|
24288
24503
|
hidingMatcher
|
24289
24504
|
);
|
24290
24505
|
const baseAndExtensionMembers = new Array();
|
24291
24506
|
const aliasedType = type.getAliasedType();
|
24292
|
-
const aliasedTypeMembers = this.getMembersOfTypeByKey(
|
24507
|
+
const aliasedTypeMembers = this.getMembersOfTypeByKey(
|
24508
|
+
key,
|
24509
|
+
aliasedType,
|
24510
|
+
options,
|
24511
|
+
hidingMatcher,
|
24512
|
+
typeExtensionsLookup
|
24513
|
+
);
|
24293
24514
|
baseAndExtensionMembers.push(aliasedTypeMembers);
|
24294
24515
|
if (typeExtensionsLookup !== void 0) {
|
24295
24516
|
const extensionMembers = this.getMembersOfExtensionsByKeyMatchingHiding(
|
24296
24517
|
key,
|
24297
24518
|
type.getEntity(),
|
24298
24519
|
type.getSubstitutions(),
|
24520
|
+
options,
|
24299
24521
|
typeExtensionsLookup,
|
24300
24522
|
hidingMatcher
|
24301
24523
|
);
|
24302
|
-
baseAndExtensionMembers.push(
|
24524
|
+
baseAndExtensionMembers.push(extensionMembers);
|
24303
24525
|
}
|
24304
24526
|
const result = this.mergeMembers(ownMembers, baseAndExtensionMembers, false);
|
24305
24527
|
return result;
|
24306
24528
|
}
|
24307
|
-
getMembersOfParameterTypeByKey(key, type, hidingMatcher, typeExtensionsLookup) {
|
24529
|
+
getMembersOfParameterTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24308
24530
|
let result = new Array();
|
24309
24531
|
if (type.constraint !== void 0) {
|
24310
|
-
result = this.getMembersOfTypeByKey(key, type.constraint, hidingMatcher, typeExtensionsLookup);
|
24532
|
+
result = this.getMembersOfTypeByKey(key, type.constraint, options, hidingMatcher, typeExtensionsLookup);
|
24311
24533
|
}
|
24312
24534
|
return result;
|
24313
24535
|
}
|
24314
|
-
getMembersOfUnionTypeByKey(key, type, hidingMatcher, typeExtensionsLookup) {
|
24536
|
+
getMembersOfUnionTypeByKey(key, type, options, hidingMatcher, typeExtensionsLookup) {
|
24315
24537
|
const commonBaseTypes = this._analyzer.getCommonObjectAndAspectTypesOfUnion(type);
|
24316
|
-
const result = commonBaseTypes.flatMap((t) => this.getMembersOfStructuredTypeByKey(
|
24538
|
+
const result = commonBaseTypes.flatMap((t) => this.getMembersOfStructuredTypeByKey(
|
24539
|
+
key,
|
24540
|
+
t,
|
24541
|
+
options,
|
24542
|
+
hidingMatcher,
|
24543
|
+
typeExtensionsLookup
|
24544
|
+
));
|
24317
24545
|
return result;
|
24318
24546
|
}
|
24319
|
-
|
24320
|
-
const ownMembers = this.getOwnMembersByKeyMatchingHiding(
|
24547
|
+
getMembersOfRegularTypeOrExtensionByKey(key, entity, substitutions, baseObjectType, baseAspectTypes, extendedType, options, hidingMatcher, typeExtensionsLookup) {
|
24548
|
+
const ownMembers = this.getOwnMembersByKeyMatchingHiding(
|
24549
|
+
key,
|
24550
|
+
entity,
|
24551
|
+
substitutions,
|
24552
|
+
options,
|
24553
|
+
hidingMatcher
|
24554
|
+
);
|
24321
24555
|
const baseAndExtensionMembers = new Array();
|
24322
24556
|
if (baseObjectType !== void 0) {
|
24323
|
-
const members = this.getMembersOfTypeByKey(
|
24557
|
+
const members = this.getMembersOfTypeByKey(
|
24558
|
+
key,
|
24559
|
+
baseObjectType,
|
24560
|
+
options,
|
24561
|
+
hidingMatcher,
|
24562
|
+
typeExtensionsLookup
|
24563
|
+
);
|
24324
24564
|
baseAndExtensionMembers.push(members);
|
24325
24565
|
}
|
24326
24566
|
if (baseAspectTypes !== void 0 && baseAspectTypes.length > 0) {
|
24327
|
-
const aspectsMembers = baseAspectTypes.map((a) => this.getMembersOfTypeByKey(key, a, hidingMatcher, typeExtensionsLookup));
|
24567
|
+
const aspectsMembers = baseAspectTypes.map((a) => this.getMembersOfTypeByKey(key, a, options, hidingMatcher, typeExtensionsLookup));
|
24328
24568
|
baseAndExtensionMembers.push(...aspectsMembers);
|
24329
24569
|
}
|
24330
|
-
if (
|
24570
|
+
if (extendedType !== void 0) {
|
24571
|
+
const members = this.getMembersOfTypeByKey(
|
24572
|
+
key,
|
24573
|
+
extendedType,
|
24574
|
+
options,
|
24575
|
+
hidingMatcher,
|
24576
|
+
typeExtensionsLookup
|
24577
|
+
);
|
24578
|
+
baseAndExtensionMembers.push(members);
|
24579
|
+
}
|
24580
|
+
if (typeExtensionsLookup !== void 0 && entity.kind === 2 /* Type */) {
|
24331
24581
|
const membersOfExtensions = this.getMembersOfExtensionsByKeyMatchingHiding(
|
24332
24582
|
key,
|
24333
|
-
|
24583
|
+
entity,
|
24334
24584
|
substitutions,
|
24585
|
+
options,
|
24335
24586
|
typeExtensionsLookup,
|
24336
24587
|
hidingMatcher
|
24337
24588
|
);
|
24338
|
-
baseAndExtensionMembers.push(
|
24589
|
+
baseAndExtensionMembers.push(membersOfExtensions);
|
24339
24590
|
}
|
24340
24591
|
const result = this.mergeMembers(ownMembers, baseAndExtensionMembers, true);
|
24341
24592
|
return result;
|
24342
24593
|
}
|
24343
|
-
getOwnMembersByKeyMatchingHiding(key,
|
24344
|
-
|
24345
|
-
|
24594
|
+
getOwnMembersByKeyMatchingHiding(key, entity, substitutions, options, hidingMatcher) {
|
24595
|
+
let members = this.getOwnMembersByKey(key, entity, substitutions);
|
24596
|
+
if ((options & (1 /* OnlyInstanceMembers */ | 2 /* OnlyStaticMembers */)) !== 0) {
|
24597
|
+
const isStatic = (options & 2 /* OnlyStaticMembers */) !== 0;
|
24598
|
+
members = members.filter((m) => m.value.isStatic() === isStatic);
|
24346
24599
|
}
|
24347
|
-
let members = this.getOwnMembersByKey(key, typeEntity, substitutions);
|
24348
24600
|
if (hidingMatcher !== void 0) {
|
24349
24601
|
members = members.filter((m) => {
|
24350
24602
|
const hiding = m.value.isHidden();
|
@@ -24353,18 +24605,20 @@ var TypeMemberLookupByKeyBase = class extends TypeMemberLookupBase {
|
|
24353
24605
|
}
|
24354
24606
|
return members;
|
24355
24607
|
}
|
24356
|
-
getMembersOfExtensionsByKeyMatchingHiding(key, typeEntity, substitutions, typeExtensionsLookup, hidingMatcher) {
|
24608
|
+
getMembersOfExtensionsByKeyMatchingHiding(key, typeEntity, substitutions, options, typeExtensionsLookup, hidingMatcher) {
|
24357
24609
|
const extensions = typeExtensionsLookup.getTypeExtensionsByType(typeEntity);
|
24358
|
-
let
|
24610
|
+
let members = this.getMembersOfExtensionsByKey(key, extensions, substitutions);
|
24611
|
+
if ((options & (1 /* OnlyInstanceMembers */ | 2 /* OnlyStaticMembers */)) !== 0) {
|
24612
|
+
const isStatic = (options & 2 /* OnlyStaticMembers */) !== 0;
|
24613
|
+
members = members.filter((m) => m.value.isStatic() === isStatic);
|
24614
|
+
}
|
24359
24615
|
if (hidingMatcher !== void 0) {
|
24360
|
-
|
24361
|
-
|
24362
|
-
|
24363
|
-
|
24364
|
-
})
|
24365
|
-
);
|
24616
|
+
members = members.filter((m) => {
|
24617
|
+
const hiding = m.value.isHidden();
|
24618
|
+
return hiding === void 0 || hidingMatcher.matches(hiding);
|
24619
|
+
});
|
24366
24620
|
}
|
24367
|
-
return
|
24621
|
+
return members;
|
24368
24622
|
}
|
24369
24623
|
};
|
24370
24624
|
var NamedTypeMemberLookup = class extends TypeMemberLookupByKeyBase {
|
@@ -24373,17 +24627,17 @@ var NamedTypeMemberLookup = class extends TypeMemberLookupByKeyBase {
|
|
24373
24627
|
this._searchLocale = searchLocale;
|
24374
24628
|
this._localizationContext = localizationContext;
|
24375
24629
|
}
|
24376
|
-
getMembersByName(name,
|
24377
|
-
return super.
|
24630
|
+
getMembersByName(name, typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24631
|
+
return super.getMembersByKey(name, typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24378
24632
|
}
|
24379
|
-
getMembers(
|
24380
|
-
return this.
|
24633
|
+
getMembers(typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24634
|
+
return this.getAllMembers(typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24381
24635
|
}
|
24382
|
-
getOwnMembers(
|
24636
|
+
getOwnMembers(entity, substitutions) {
|
24383
24637
|
let result;
|
24384
24638
|
const translatedMemberEntities = /* @__PURE__ */ new Set();
|
24385
|
-
const translatedMembers = this._localizationContext?.
|
24386
|
-
const originalLocale = this.
|
24639
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24640
|
+
const originalLocale = this.getOriginalLocaleOfTypeOrExtensionEntity(entity);
|
24387
24641
|
if (translatedMembers !== void 0 && translatedMembers.translationPackage.getTranslationLocale() === this._searchLocale) {
|
24388
24642
|
const members = translatedMembers.getNamedMembers();
|
24389
24643
|
result = members.map((m) => FoundNamedDeclaration.translated(this.convertNamedMember(m.value, substitutions), m.name));
|
@@ -24393,7 +24647,7 @@ var NamedTypeMemberLookup = class extends TypeMemberLookupByKeyBase {
|
|
24393
24647
|
}
|
24394
24648
|
const isExplicitOriginalNameRequired = originalLocale !== this._searchLocale;
|
24395
24649
|
result = result.concat(
|
24396
|
-
|
24650
|
+
entity.getMembers().getNamedMembers().filter((m) => !translatedMemberEntities.has(m)).map((m) => FoundNamedDeclaration.original(
|
24397
24651
|
this.convertNamedMember(m, substitutions),
|
24398
24652
|
m.getName(),
|
24399
24653
|
originalLocale,
|
@@ -24403,7 +24657,7 @@ var NamedTypeMemberLookup = class extends TypeMemberLookupByKeyBase {
|
|
24403
24657
|
return result;
|
24404
24658
|
}
|
24405
24659
|
getMembersOfExtensions(extensions, substitutions) {
|
24406
|
-
const result = extensions.
|
24660
|
+
const result = extensions.flatMap((e) => {
|
24407
24661
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24408
24662
|
return e.getMembers().getNamedMembers().map((m) => FoundNamedDeclaration.original(
|
24409
24663
|
this.convertNamedMember(m, substitutions),
|
@@ -24414,13 +24668,13 @@ var NamedTypeMemberLookup = class extends TypeMemberLookupByKeyBase {
|
|
24414
24668
|
});
|
24415
24669
|
return result;
|
24416
24670
|
}
|
24417
|
-
getOwnMembersByKey(name,
|
24671
|
+
getOwnMembersByKey(name, entity, substitutions) {
|
24418
24672
|
let result;
|
24419
|
-
const translatedMembers = this._localizationContext?.
|
24420
|
-
const originalLocale = this.
|
24673
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24674
|
+
const originalLocale = this.getOriginalLocaleOfTypeOrExtensionEntity(entity);
|
24421
24675
|
if (name.isStrictlyOriginal || originalLocale === this._searchLocale) {
|
24422
24676
|
const isExplicitOriginalNameRequired = originalLocale !== this._searchLocale;
|
24423
|
-
result =
|
24677
|
+
result = entity.getMembers().getNamedMembersByName(name.value).map(
|
24424
24678
|
(m) => FoundNamedDeclaration.original(
|
24425
24679
|
this.convertNamedMember(m, substitutions),
|
24426
24680
|
m.getName(),
|
@@ -24436,7 +24690,7 @@ var NamedTypeMemberLookup = class extends TypeMemberLookupByKeyBase {
|
|
24436
24690
|
return result;
|
24437
24691
|
}
|
24438
24692
|
getMembersOfExtensionsByKey(name, extensions, substitutions) {
|
24439
|
-
const result = extensions.
|
24693
|
+
const result = extensions.flatMap((e) => {
|
24440
24694
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24441
24695
|
return e.getMembers().getNamedMembersByName(name.value).map(
|
24442
24696
|
(m) => FoundNamedDeclaration.original(
|
@@ -24490,16 +24744,16 @@ var OperatorLookup = class extends TypeMemberLookupByKeyBase {
|
|
24490
24744
|
super(analyzer);
|
24491
24745
|
this._localizationContext = localizationContext;
|
24492
24746
|
}
|
24493
|
-
getOperatorsByKind(kind,
|
24494
|
-
return this.
|
24747
|
+
getOperatorsByKind(kind, typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24748
|
+
return this.getMembersByKey(kind, typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24495
24749
|
}
|
24496
|
-
getOperators(
|
24497
|
-
return this.
|
24750
|
+
getOperators(typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24751
|
+
return this.getAllMembers(typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24498
24752
|
}
|
24499
|
-
getOwnMembers(
|
24500
|
-
const translatedMembers = this._localizationContext?.
|
24501
|
-
const originalLocale = this.
|
24502
|
-
const result =
|
24753
|
+
getOwnMembers(entity, substitutions) {
|
24754
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24755
|
+
const originalLocale = this.getOriginalLocaleOfTypeOrExtensionEntity(entity);
|
24756
|
+
const result = entity.getMembers().getOperators().map((o) => {
|
24503
24757
|
const member = new Operator(this._analyzer, o, substitutions);
|
24504
24758
|
if (translatedMembers !== void 0) {
|
24505
24759
|
const translation = new Translation(translatedMembers.translationPackage);
|
@@ -24511,7 +24765,7 @@ var OperatorLookup = class extends TypeMemberLookupByKeyBase {
|
|
24511
24765
|
return result;
|
24512
24766
|
}
|
24513
24767
|
getMembersOfExtensions(extensions, substitutions) {
|
24514
|
-
const result = extensions.
|
24768
|
+
const result = extensions.flatMap((e) => {
|
24515
24769
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24516
24770
|
return e.getMembers().getOperators().map((o) => FoundAnonymousDeclaration.original(
|
24517
24771
|
new Operator(this._analyzer, o, substitutions),
|
@@ -24520,10 +24774,10 @@ var OperatorLookup = class extends TypeMemberLookupByKeyBase {
|
|
24520
24774
|
});
|
24521
24775
|
return result;
|
24522
24776
|
}
|
24523
|
-
getOwnMembersByKey(kind,
|
24524
|
-
const translatedMembers = this._localizationContext?.
|
24525
|
-
const originalLocale = this.
|
24526
|
-
const result =
|
24777
|
+
getOwnMembersByKey(kind, entity, substitutions) {
|
24778
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24779
|
+
const originalLocale = this.getOriginalLocaleOfTypeOrExtensionEntity(entity);
|
24780
|
+
const result = entity.getMembers().getOperatorsByKind(kind).map((o) => {
|
24527
24781
|
const member = new Operator(this._analyzer, o, substitutions);
|
24528
24782
|
if (translatedMembers !== void 0) {
|
24529
24783
|
const translation = new Translation(translatedMembers.translationPackage);
|
@@ -24535,7 +24789,7 @@ var OperatorLookup = class extends TypeMemberLookupByKeyBase {
|
|
24535
24789
|
return result;
|
24536
24790
|
}
|
24537
24791
|
getMembersOfExtensionsByKey(kind, extensions, substitutions) {
|
24538
|
-
const result = extensions.
|
24792
|
+
const result = extensions.flatMap((e) => {
|
24539
24793
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24540
24794
|
return e.getMembers().getOperatorsByKind(kind).map((o) => FoundAnonymousDeclaration.original(
|
24541
24795
|
new Operator(this._analyzer, o, substitutions),
|
@@ -24559,13 +24813,13 @@ var IndexerLookup = class extends TypeMemberLookupBase {
|
|
24559
24813
|
super(analyzer);
|
24560
24814
|
this._localizationContext = localizationContext;
|
24561
24815
|
}
|
24562
|
-
getIndexers(
|
24563
|
-
return this.
|
24816
|
+
getIndexers(typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24817
|
+
return this.getAllMembers(typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24564
24818
|
}
|
24565
|
-
getOwnMembers(
|
24566
|
-
const translatedMembers = this._localizationContext?.
|
24567
|
-
const originalLocale = this.
|
24568
|
-
const result =
|
24819
|
+
getOwnMembers(entity, substitutions) {
|
24820
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24821
|
+
const originalLocale = this.getOriginalLocaleOfTypeOrExtensionEntity(entity);
|
24822
|
+
const result = entity.getMembers().getIndexers().map((i) => {
|
24569
24823
|
const member = new Indexer(i, substitutions);
|
24570
24824
|
if (translatedMembers !== void 0) {
|
24571
24825
|
const translation = new Translation(translatedMembers.translationPackage);
|
@@ -24577,7 +24831,7 @@ var IndexerLookup = class extends TypeMemberLookupBase {
|
|
24577
24831
|
return result;
|
24578
24832
|
}
|
24579
24833
|
getMembersOfExtensions(extensions, substitutions) {
|
24580
|
-
const result = extensions.
|
24834
|
+
const result = extensions.flatMap((e) => {
|
24581
24835
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24582
24836
|
return e.getMembers().getIndexers().map((i) => FoundAnonymousDeclaration.original(new Indexer(i, substitutions), originalLocale));
|
24583
24837
|
});
|
@@ -24598,13 +24852,13 @@ var DereferenceOperatorLookup = class extends TypeMemberLookupBase {
|
|
24598
24852
|
super(analyzer);
|
24599
24853
|
this._localizationContext = localizationContext;
|
24600
24854
|
}
|
24601
|
-
getDereferenceOperators(
|
24602
|
-
return this.
|
24855
|
+
getDereferenceOperators(typeOrExtension, options = 0 /* None */, hidingMatcher, typeExtensionsLookup) {
|
24856
|
+
return this.getAllMembers(typeOrExtension, options, hidingMatcher, typeExtensionsLookup);
|
24603
24857
|
}
|
24604
|
-
getOwnMembers(
|
24605
|
-
const translatedMembers = this._localizationContext?.
|
24606
|
-
const originalLocale = this.
|
24607
|
-
const result =
|
24858
|
+
getOwnMembers(entity, substitutions) {
|
24859
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24860
|
+
const originalLocale = this.getOriginalLocaleOfTypeOrExtensionEntity(entity);
|
24861
|
+
const result = entity.getMembers().getDereferenceOperators().map((i) => {
|
24608
24862
|
const member = new DereferenceOperator(i, substitutions);
|
24609
24863
|
if (translatedMembers !== void 0) {
|
24610
24864
|
const translation = new Translation(translatedMembers.translationPackage);
|
@@ -24616,7 +24870,7 @@ var DereferenceOperatorLookup = class extends TypeMemberLookupBase {
|
|
24616
24870
|
return result;
|
24617
24871
|
}
|
24618
24872
|
getMembersOfExtensions(extensions, substitutions) {
|
24619
|
-
const result = extensions.
|
24873
|
+
const result = extensions.flatMap((e) => {
|
24620
24874
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24621
24875
|
return e.getMembers().getDereferenceOperators().map((i) => FoundAnonymousDeclaration.original(new DereferenceOperator(i, substitutions), originalLocale));
|
24622
24876
|
});
|
@@ -24631,10 +24885,32 @@ var DereferenceOperatorLookup = class extends TypeMemberLookupBase {
|
|
24631
24885
|
}
|
24632
24886
|
};
|
24633
24887
|
var ConstructorLookup = class {
|
24634
|
-
constructor(localizationContext) {
|
24888
|
+
constructor(analyzer, localizationContext) {
|
24889
|
+
this._analyzer = analyzer;
|
24635
24890
|
this._localizationContext = localizationContext;
|
24636
24891
|
}
|
24637
|
-
getConstructors(
|
24892
|
+
getConstructors(typeOrExtension, hidingMatcher, typeExtensionsLookup) {
|
24893
|
+
switch (typeOrExtension.kind) {
|
24894
|
+
case "type":
|
24895
|
+
return this.getConstructorsOfType(typeOrExtension.value, hidingMatcher, typeExtensionsLookup);
|
24896
|
+
case "extension": {
|
24897
|
+
const extendedTypeEntity = typeOrExtension.value.getExtendedTypeEntity();
|
24898
|
+
if (extendedTypeEntity === void 0) {
|
24899
|
+
return [];
|
24900
|
+
}
|
24901
|
+
const extendedType = this._analyzer.instantiateTypeByIdentitySubstitution(extendedTypeEntity);
|
24902
|
+
return this.getConstructorsOfTypeWithOwnMembersOrExtension(
|
24903
|
+
typeOrExtension.value,
|
24904
|
+
extendedType,
|
24905
|
+
hidingMatcher,
|
24906
|
+
typeExtensionsLookup
|
24907
|
+
);
|
24908
|
+
}
|
24909
|
+
default:
|
24910
|
+
Debug.never(typeOrExtension);
|
24911
|
+
}
|
24912
|
+
}
|
24913
|
+
getConstructorsOfType(type, hidingMatcher, typeExtensionsLookup) {
|
24638
24914
|
switch (type.kind) {
|
24639
24915
|
case "structured":
|
24640
24916
|
return this.getConstructorsOfStructuredType(type, hidingMatcher, typeExtensionsLookup);
|
@@ -24653,13 +24929,28 @@ var ConstructorLookup = class {
|
|
24653
24929
|
}
|
24654
24930
|
}
|
24655
24931
|
getConstructorsOfStructuredType(type, hidingMatcher, typeExtensionsLookup) {
|
24656
|
-
return this.
|
24932
|
+
return this.getConstructorsOfTypeWithOwnMembersOrExtension(
|
24933
|
+
type.getEntity(),
|
24934
|
+
type,
|
24935
|
+
hidingMatcher,
|
24936
|
+
typeExtensionsLookup
|
24937
|
+
);
|
24657
24938
|
}
|
24658
24939
|
getConstructorsOfVariantType(type, hidingMatcher, typeExtensionsLookup) {
|
24659
|
-
return this.
|
24940
|
+
return this.getConstructorsOfTypeWithOwnMembersOrExtension(
|
24941
|
+
type.getEntity(),
|
24942
|
+
type,
|
24943
|
+
hidingMatcher,
|
24944
|
+
typeExtensionsLookup
|
24945
|
+
);
|
24660
24946
|
}
|
24661
24947
|
getConstructorsOfMethodType(type, hidingMatcher, typeExtensionsLookup) {
|
24662
|
-
return this.
|
24948
|
+
return this.getConstructorsOfTypeWithOwnMembersOrExtension(
|
24949
|
+
type.getEntity(),
|
24950
|
+
type,
|
24951
|
+
hidingMatcher,
|
24952
|
+
typeExtensionsLookup
|
24953
|
+
);
|
24663
24954
|
}
|
24664
24955
|
getConstructorsOfAliasType(type, hidingMatcher, typeExtensionsLookup) {
|
24665
24956
|
let result = this.getOwnConstructors(type.getEntity(), type, hidingMatcher);
|
@@ -24687,22 +24978,22 @@ var ConstructorLookup = class {
|
|
24687
24978
|
}
|
24688
24979
|
aliasedType = aliasedType.getAliasedType();
|
24689
24980
|
}
|
24690
|
-
const constructors = this.
|
24981
|
+
const constructors = this.getConstructorsOfType(aliasedType, hidingMatcher, typeExtensionsLookup);
|
24691
24982
|
result = this.mergeConstructors(result, constructors);
|
24692
24983
|
return result;
|
24693
24984
|
}
|
24694
|
-
|
24695
|
-
let result = this.getOwnConstructors(
|
24696
|
-
if (typeExtensionsLookup !== void 0) {
|
24697
|
-
const extensionConstructors = this.getExtensionConstructors(
|
24985
|
+
getConstructorsOfTypeWithOwnMembersOrExtension(entity, type, hidingMatcher, typeExtensionsLookup) {
|
24986
|
+
let result = this.getOwnConstructors(entity, type, hidingMatcher);
|
24987
|
+
if (typeExtensionsLookup !== void 0 && entity.kind === 2 /* Type */) {
|
24988
|
+
const extensionConstructors = this.getExtensionConstructors(entity, type, hidingMatcher, typeExtensionsLookup);
|
24698
24989
|
result = this.mergeConstructors(result, extensionConstructors);
|
24699
24990
|
}
|
24700
24991
|
return result;
|
24701
24992
|
}
|
24702
|
-
getOwnConstructors(
|
24703
|
-
const translatedMembers = this._localizationContext?.
|
24704
|
-
const originalLocale = getPackageContainingEntity(
|
24705
|
-
let result =
|
24993
|
+
getOwnConstructors(entity, type, hidingMatcher) {
|
24994
|
+
const translatedMembers = this._localizationContext?.getTranslatedTypeOrExtensionEntityMembers(entity);
|
24995
|
+
const originalLocale = getPackageContainingEntity(entity).getLocale();
|
24996
|
+
let result = entity.getMembers().getConstructors().map((c) => {
|
24706
24997
|
const member = new Constructor(c, type.getSubstitutions(), type);
|
24707
24998
|
if (translatedMembers !== void 0) {
|
24708
24999
|
const translation = new Translation(translatedMembers.translationPackage);
|
@@ -24719,8 +25010,8 @@ var ConstructorLookup = class {
|
|
24719
25010
|
}
|
24720
25011
|
return result;
|
24721
25012
|
}
|
24722
|
-
getExtensionConstructors(
|
24723
|
-
let result = typeExtensionsLookup.getTypeExtensionsByType(
|
25013
|
+
getExtensionConstructors(entity, type, hidingMatcher, typeExtensionsLookup) {
|
25014
|
+
let result = typeExtensionsLookup.getTypeExtensionsByType(entity).flatMap((e) => {
|
24724
25015
|
const originalLocale = getPackageContainingEntity(e).getLocale();
|
24725
25016
|
return e.getMembers().getConstructors().map(
|
24726
25017
|
(c) => FoundAnonymousDeclaration.original(
|
@@ -24756,6 +25047,24 @@ var ConstructorLookup = class {
|
|
24756
25047
|
return shadowingParameters.length === shadowedParameters.length && Query.from(shadowingParameters).zip(shadowedParameters, (l, r) => l.getType().equals(r.getType())).all((v) => v);
|
24757
25048
|
}
|
24758
25049
|
};
|
25050
|
+
var TypeOrExtension_type = class {
|
25051
|
+
constructor(value) {
|
25052
|
+
this.value = value;
|
25053
|
+
this.kind = "type";
|
25054
|
+
}
|
25055
|
+
getEntity() {
|
25056
|
+
return this.value.getEntity();
|
25057
|
+
}
|
25058
|
+
};
|
25059
|
+
var TypeOrExtension_extension = class {
|
25060
|
+
constructor(value) {
|
25061
|
+
this.value = value;
|
25062
|
+
this.kind = "extension";
|
25063
|
+
}
|
25064
|
+
getEntity() {
|
25065
|
+
return this.value;
|
25066
|
+
}
|
25067
|
+
};
|
24759
25068
|
|
24760
25069
|
// source/ts-interop/Entities.ts
|
24761
25070
|
import ts2 from "typescript";
|
@@ -25834,7 +26143,10 @@ var TsPropertyEntity = class {
|
|
25834
26143
|
if (!this.isStatic() && this._containingType.typeEntityKind === 1 /* Structured */) {
|
25835
26144
|
const baseType = this._containingType.getBaseObjectType().cycleFree;
|
25836
26145
|
if (baseType !== void 0) {
|
25837
|
-
result =
|
26146
|
+
result = TypeMemberLookup.ofType(this._tsctx.analyzer, baseType, void 0).getNamedMembersByName(
|
26147
|
+
new SearchName(this.getName(), true),
|
26148
|
+
1 /* OnlyInstanceMembers */
|
26149
|
+
).find((m) => m.value.kind === "variable")?.value;
|
25838
26150
|
}
|
25839
26151
|
}
|
25840
26152
|
return result !== void 0 ? [result] : [];
|
@@ -25952,7 +26264,10 @@ var TsAccessorEntity = class {
|
|
25952
26264
|
if (!this.isStatic() && this._containingType.typeEntityKind === 1 /* Structured */) {
|
25953
26265
|
const baseType = this._containingType.getBaseObjectType().cycleFree;
|
25954
26266
|
if (baseType !== void 0) {
|
25955
|
-
result =
|
26267
|
+
result = TypeMemberLookup.ofType(this._tsctx.analyzer, baseType, void 0).getNamedMembersByName(
|
26268
|
+
new SearchName(this.getName(), true),
|
26269
|
+
1 /* OnlyInstanceMembers */
|
26270
|
+
).find((m) => m.value.kind === "variable")?.value;
|
25956
26271
|
}
|
25957
26272
|
}
|
25958
26273
|
return result !== void 0 ? [result] : [];
|
@@ -26128,7 +26443,10 @@ var TsMethodEntity = class {
|
|
26128
26443
|
if (!this.isStatic() && this._containingType.typeEntityKind === 1 /* Structured */) {
|
26129
26444
|
const baseType = this._containingType.getBaseObjectType().cycleFree;
|
26130
26445
|
if (baseType !== void 0) {
|
26131
|
-
result =
|
26446
|
+
result = TypeMemberLookup.ofType(this._tsctx.analyzer, baseType, void 0).getNamedMembersByName(
|
26447
|
+
new SearchName(this.getName(), true),
|
26448
|
+
1 /* OnlyInstanceMembers */
|
26449
|
+
).find((m) => m.value.kind === "method")?.value;
|
26132
26450
|
}
|
26133
26451
|
}
|
26134
26452
|
return result !== void 0 ? [result] : [];
|
@@ -26427,7 +26745,7 @@ var TsIndexSignatureEntity = class {
|
|
26427
26745
|
if (!this.isStatic() && this._containingType.typeEntityKind === 1 /* Structured */) {
|
26428
26746
|
const baseType = this._containingType.getBaseObjectType().cycleFree;
|
26429
26747
|
if (baseType !== void 0) {
|
26430
|
-
result =
|
26748
|
+
result = TypeMemberLookup.ofType(this._tsctx.analyzer, baseType, void 0).getIndexers(1 /* OnlyInstanceMembers */).at(0)?.value;
|
26431
26749
|
}
|
26432
26750
|
}
|
26433
26751
|
return result !== void 0 ? [result] : [];
|
@@ -28736,7 +29054,7 @@ var TsInteropContext3 = class {
|
|
28736
29054
|
this.analyzer.wellKnownDeclarations.defaultImport
|
28737
29055
|
);
|
28738
29056
|
Debug.assert(type.kind === "structured");
|
28739
|
-
const constructor =
|
29057
|
+
const constructor = TypeMemberLookup.ofType(this.analyzer, type, void 0).getConstructors().at(0);
|
28740
29058
|
Debug.assertNotNull(constructor, `\u0422\u0438\u043F ${type.getEntity().getNaming()} \u0434\u043E\u043B\u0436\u0435\u043D \u0438\u043C\u0435\u0442\u044C \u043A\u043E\u043D\u0441\u0442\u0440\u0443\u043A\u0442\u043E\u0440.`);
|
28741
29059
|
return new TagType(type, constructor.value, /* @__PURE__ */ new Map());
|
28742
29060
|
});
|
@@ -30429,7 +30747,11 @@ var Resolver2 = class {
|
|
30429
30747
|
]);
|
30430
30748
|
}
|
30431
30749
|
const semanticContext = this._analyzer.semanticContext.containing(this._node);
|
30432
|
-
const typeMemberLookup =
|
30750
|
+
const typeMemberLookup = TypeMemberLookup.ofType(
|
30751
|
+
this._analyzer,
|
30752
|
+
targetType,
|
30753
|
+
semanticContext.getLocalizationContext()
|
30754
|
+
);
|
30433
30755
|
const constructors = typeMemberLookup.getConstructors(semanticContext.getHidingMatcher(), semanticContext.getScopeLookup());
|
30434
30756
|
if (constructors.length === 0) {
|
30435
30757
|
return new Meaning_unresolved([this._analyzer.createNodeDiagnostic(
|
@@ -30505,7 +30827,7 @@ var Resolver3 = class {
|
|
30505
30827
|
}
|
30506
30828
|
const semanticContext = this._analyzer.semanticContext.containing(this._node);
|
30507
30829
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
30508
|
-
const typeMemberLookup =
|
30830
|
+
const typeMemberLookup = TypeMemberLookup.ofType(this._analyzer, baseType, semanticContext.getLocalizationContext());
|
30509
30831
|
const constructors = typeMemberLookup.getConstructors(hidingMatcher);
|
30510
30832
|
if (constructors.length === 0) {
|
30511
30833
|
return new Meaning_unresolved2(
|
@@ -30712,7 +31034,7 @@ var Resolver4 = class {
|
|
30712
31034
|
]);
|
30713
31035
|
}
|
30714
31036
|
const semanticContext = this._analyzer.semanticContext.containing(this._node);
|
30715
|
-
const typeMemberLookup =
|
31037
|
+
const typeMemberLookup = TypeMemberLookup.ofType(this._analyzer, type, semanticContext.getLocalizationContext());
|
30716
31038
|
const constructors = typeMemberLookup.getConstructors(semanticContext.getHidingMatcher(), semanticContext.getScopeLookup());
|
30717
31039
|
if (constructors.length === 0) {
|
30718
31040
|
return new Meaning_unresolved3([this._analyzer.createNodeDiagnostic(
|
@@ -30802,6 +31124,11 @@ var ControlFlowGraphVisualizer = class {
|
|
30802
31124
|
nodeStack.push(node.predecessor);
|
30803
31125
|
break;
|
30804
31126
|
}
|
31127
|
+
case "local-variable-declaration": {
|
31128
|
+
addEdge(id, node.predecessor);
|
31129
|
+
nodeStack.push(node.predecessor);
|
31130
|
+
break;
|
31131
|
+
}
|
30805
31132
|
case "condition": {
|
30806
31133
|
addEdge(id, node.predecessor);
|
30807
31134
|
nodeStack.push(node.predecessor);
|
@@ -30862,6 +31189,11 @@ var ControlFlowGraphVisualizer = class {
|
|
30862
31189
|
label = `{${nodeText}|\u041F\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043D\u0438\u0435}`;
|
30863
31190
|
break;
|
30864
31191
|
}
|
31192
|
+
case "local-variable-declaration": {
|
31193
|
+
const nodeText = toSourceCode(node.syntaxNode, void 0, true);
|
31194
|
+
label = `{${nodeText}|\u041E\u0431\u044A\u044F\u0432\u043B\u0435\u043D\u0438\u0435}`;
|
31195
|
+
break;
|
31196
|
+
}
|
30865
31197
|
case "split": {
|
30866
31198
|
label = "\u0420\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u0435";
|
30867
31199
|
break;
|
@@ -31210,7 +31542,7 @@ var ControlFlowGraphBuilder = class {
|
|
31210
31542
|
visitLocalVariableDeclaration(node) {
|
31211
31543
|
this.visitChildren(node);
|
31212
31544
|
if (node.initializer !== void 0) {
|
31213
|
-
this.
|
31545
|
+
this._currentPredecessor = new ControlFlowNode.LocalVariableDeclaration(this._currentPredecessor, node);
|
31214
31546
|
}
|
31215
31547
|
}
|
31216
31548
|
visitWhenTernaryExpression(node) {
|
@@ -31237,6 +31569,17 @@ var ControlFlowGraphBuilder = class {
|
|
31237
31569
|
case 75 /* ParenthesizedExpression */:
|
31238
31570
|
this.visitCondition(node.expression, conditionTargets);
|
31239
31571
|
break;
|
31572
|
+
case 85 /* KeywordExpression */: {
|
31573
|
+
if (node.keyword.keywordKind === 52 /* Yes */) {
|
31574
|
+
conditionTargets.trueTarget.addPredecessor(this._currentPredecessor);
|
31575
|
+
} else if (node.keyword.keywordKind === 53 /* No */) {
|
31576
|
+
conditionTargets.falseTarget.addPredecessor(this._currentPredecessor);
|
31577
|
+
} else {
|
31578
|
+
this.visitNode(node);
|
31579
|
+
conditionTargets.addCommonPredecessor(this._currentPredecessor);
|
31580
|
+
}
|
31581
|
+
break;
|
31582
|
+
}
|
31240
31583
|
default:
|
31241
31584
|
this.visitNode(node);
|
31242
31585
|
conditionTargets.addCommonPredecessor(this._currentPredecessor);
|
@@ -31319,10 +31662,12 @@ var ConditionFlowTargets = class _ConditionFlowTargets {
|
|
31319
31662
|
return new _ConditionFlowTargets(this.falseTarget, this.trueTarget);
|
31320
31663
|
}
|
31321
31664
|
createAndAddConditionPredecessor(condition, predecessor) {
|
31322
|
-
|
31323
|
-
|
31324
|
-
|
31325
|
-
|
31665
|
+
if (predecessor.kind !== "unreachable") {
|
31666
|
+
const trueCondition = new ControlFlowNode.Condition(predecessor, condition, true);
|
31667
|
+
this.trueTarget.addPredecessor(trueCondition);
|
31668
|
+
const falseCondition = new ControlFlowNode.Condition(predecessor, condition, false);
|
31669
|
+
this.falseTarget.addPredecessor(falseCondition);
|
31670
|
+
}
|
31326
31671
|
}
|
31327
31672
|
addCommonPredecessor(predecessor) {
|
31328
31673
|
this.trueTarget.addPredecessor(predecessor);
|
@@ -31387,6 +31732,13 @@ function isNarrowableReferenceExpression(node) {
|
|
31387
31732
|
return false;
|
31388
31733
|
}
|
31389
31734
|
}
|
31735
|
+
function unwrapExpressionForNarrowableReferenceCheck(node) {
|
31736
|
+
let result = node;
|
31737
|
+
while (result.kind === 75 /* ParenthesizedExpression */ || result.kind === 63 /* AssertionExpression */ || result.kind === 64 /* AssumptionExpression */) {
|
31738
|
+
result = result.expression;
|
31739
|
+
}
|
31740
|
+
return result;
|
31741
|
+
}
|
31390
31742
|
var ControlFlowNode;
|
31391
31743
|
((ControlFlowNode3) => {
|
31392
31744
|
class ControlFlowNodeBase {
|
@@ -31441,6 +31793,21 @@ var ControlFlowNode;
|
|
31441
31793
|
}
|
31442
31794
|
}
|
31443
31795
|
ControlFlowNode3.Assignment = Assignment;
|
31796
|
+
class LocalVariableDeclaration5 extends ControlFlowNodeBase {
|
31797
|
+
constructor(predecessor, syntaxNode) {
|
31798
|
+
super();
|
31799
|
+
this.predecessor = predecessor;
|
31800
|
+
this.syntaxNode = syntaxNode;
|
31801
|
+
this.kind = "local-variable-declaration";
|
31802
|
+
}
|
31803
|
+
get debuggerDisplay() {
|
31804
|
+
return `Declaration: ${toSourceCode(this.syntaxNode, void 0, true)}`;
|
31805
|
+
}
|
31806
|
+
get thisAsNode() {
|
31807
|
+
return this;
|
31808
|
+
}
|
31809
|
+
}
|
31810
|
+
ControlFlowNode3.LocalVariableDeclaration = LocalVariableDeclaration5;
|
31444
31811
|
class Split extends ControlFlowNodeBase {
|
31445
31812
|
constructor(predecessors) {
|
31446
31813
|
super();
|
@@ -31646,12 +32013,18 @@ var Resolver5 = class {
|
|
31646
32013
|
if (receiverType.kind === "unresolved") {
|
31647
32014
|
return new Meaning_unresolved4(void 0);
|
31648
32015
|
}
|
31649
|
-
const
|
32016
|
+
const isStaticAccess = this._analyzer.checkExpressionDenotesType(this._node.expression) !== void 0;
|
32017
|
+
const lookupOptions = isStaticAccess ? 2 /* OnlyStaticMembers */ : 0 /* None */;
|
32018
|
+
const typeMemberLookup = TypeMemberLookup.ofType(
|
31650
32019
|
this._analyzer,
|
31651
32020
|
receiverType,
|
31652
32021
|
this.semanticContext.getLocalizationContext()
|
31653
32022
|
);
|
31654
|
-
const operator = typeMemberLookup.getDereferenceOperators(
|
32023
|
+
const operator = typeMemberLookup.getDereferenceOperators(
|
32024
|
+
lookupOptions,
|
32025
|
+
this.semanticContext.getHidingMatcher(),
|
32026
|
+
this.semanticContext.getScopeLookup()
|
32027
|
+
).at(0);
|
31655
32028
|
if (operator !== void 0) {
|
31656
32029
|
const accessKind = this.convertSyntacticAccessKind(
|
31657
32030
|
this._analyzer.getSyntacticAccessKind(this._node),
|
@@ -31787,7 +32160,8 @@ var Resolver6 = class {
|
|
31787
32160
|
}
|
31788
32161
|
}
|
31789
32162
|
const searchName = this._analyzer.createSearchNameFromIdentifier(this._node.identifier);
|
31790
|
-
const
|
32163
|
+
const noInstanceMembers = this.semanticContext.isStatic();
|
32164
|
+
const namedDeclarations = this.semanticContext.getScopeLookup().getNamedDeclarationsByName(searchName, noInstanceMembers);
|
31791
32165
|
if (namedDeclarations.length === 1) {
|
31792
32166
|
const namedDeclaration = namedDeclarations[0];
|
31793
32167
|
if (namedDeclaration.value.kind === "package-alias") {
|
@@ -32244,12 +32618,18 @@ var Resolver7 = class {
|
|
32244
32618
|
if (receiverType.kind === "unresolved") {
|
32245
32619
|
return new ResolutionResult2(new Meaning_unresolved6());
|
32246
32620
|
}
|
32247
|
-
const
|
32621
|
+
const isStaticAccess = this._analyzer.checkExpressionDenotesType(this._node.expression) !== void 0;
|
32622
|
+
const lookupOptions = isStaticAccess ? 2 /* OnlyStaticMembers */ : 0 /* None */;
|
32623
|
+
const typeMemberLookup = TypeMemberLookup.ofType(
|
32248
32624
|
this._analyzer,
|
32249
32625
|
receiverType,
|
32250
32626
|
this.semanticContext.getLocalizationContext()
|
32251
32627
|
);
|
32252
|
-
const indexers = typeMemberLookup.getIndexers(
|
32628
|
+
const indexers = typeMemberLookup.getIndexers(
|
32629
|
+
lookupOptions,
|
32630
|
+
this.semanticContext.getHidingMatcher(),
|
32631
|
+
this.semanticContext.getScopeLookup()
|
32632
|
+
);
|
32253
32633
|
if (indexers.length === 1) {
|
32254
32634
|
const accessKind = this.convertSyntacticAccessKind(
|
32255
32635
|
this._analyzer.getSyntacticAccessKind(this._node),
|
@@ -32706,7 +33086,7 @@ var Resolver8 = class {
|
|
32706
33086
|
const type = this._analyzer.instantiateTypeByIdentitySubstitution(typeEntity);
|
32707
33087
|
const semanticContext = this._analyzer.semanticContext.containing(this._node);
|
32708
33088
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
32709
|
-
const typeMemberLookup =
|
33089
|
+
const typeMemberLookup = TypeMemberLookup.ofType(this._analyzer, type, semanticContext.getLocalizationContext());
|
32710
33090
|
const constructors = typeMemberLookup.getConstructors(hidingMatcher);
|
32711
33091
|
if (constructors.length === 0) {
|
32712
33092
|
return new Meaning_unresolved7(this._analyzer.createNodeDiagnostic(
|
@@ -32988,8 +33368,16 @@ var Resolver10 = class {
|
|
32988
33368
|
)
|
32989
33369
|
);
|
32990
33370
|
}
|
32991
|
-
const typeMemberLookup =
|
32992
|
-
|
33371
|
+
const typeMemberLookup = TypeMemberLookup.ofType(
|
33372
|
+
this._analyzer,
|
33373
|
+
type,
|
33374
|
+
this.semanticContext.getLocalizationContext()
|
33375
|
+
);
|
33376
|
+
const namedMembers = typeMemberLookup.getNamedMembersByName(
|
33377
|
+
this.propertySearchName,
|
33378
|
+
2 /* OnlyStaticMembers */,
|
33379
|
+
this.semanticContext.getHidingMatcher()
|
33380
|
+
);
|
32993
33381
|
if (namedMembers.length === 0) {
|
32994
33382
|
return new ResolutionResult3(
|
32995
33383
|
new Meaning_unresolved8(),
|
@@ -33056,14 +33444,22 @@ var Resolver10 = class {
|
|
33056
33444
|
return new ResolutionResult3(new Meaning_unresolved8());
|
33057
33445
|
}
|
33058
33446
|
if (this._node.propertyName.ifOperatorNameThenKind !== void 0) {
|
33059
|
-
const resolved = this.
|
33447
|
+
const resolved = this.tryResolveInstanceOperatorAccessMeaning(
|
33448
|
+
type,
|
33449
|
+
this._node.propertyName.ifOperatorNameThenKind
|
33450
|
+
);
|
33060
33451
|
if (resolved !== void 0) {
|
33061
33452
|
return resolved;
|
33062
33453
|
}
|
33063
33454
|
}
|
33064
|
-
const typeMemberLookup =
|
33455
|
+
const typeMemberLookup = TypeMemberLookup.ofType(
|
33456
|
+
this._analyzer,
|
33457
|
+
type,
|
33458
|
+
this.semanticContext.getLocalizationContext()
|
33459
|
+
);
|
33065
33460
|
const namedMembers = typeMemberLookup.getNamedMembersByName(
|
33066
33461
|
this.propertySearchName,
|
33462
|
+
0 /* None */,
|
33067
33463
|
this.semanticContext.getHidingMatcher(),
|
33068
33464
|
this.semanticContext.getScopeLookup()
|
33069
33465
|
);
|
@@ -33112,10 +33508,19 @@ var Resolver10 = class {
|
|
33112
33508
|
this._analyzer.createNodeDiagnostic(66 /* AmbiguousAccess */, this._node.propertyName)
|
33113
33509
|
);
|
33114
33510
|
}
|
33115
|
-
|
33511
|
+
tryResolveInstanceOperatorAccessMeaning(type, syntacticOperatorKind) {
|
33116
33512
|
const operatorKinds2 = operatorKindsBySyntacticalOperatorKind[syntacticOperatorKind];
|
33117
|
-
const typeMemberLookup =
|
33118
|
-
|
33513
|
+
const typeMemberLookup = TypeMemberLookup.ofType(
|
33514
|
+
this._analyzer,
|
33515
|
+
type,
|
33516
|
+
this.semanticContext.getLocalizationContext()
|
33517
|
+
);
|
33518
|
+
const operators = operatorKinds2.flatMap((k) => typeMemberLookup.getOperatorsByKind(
|
33519
|
+
k,
|
33520
|
+
0 /* None */,
|
33521
|
+
this.semanticContext.getHidingMatcher(),
|
33522
|
+
this.semanticContext.getScopeLookup()
|
33523
|
+
));
|
33119
33524
|
if (operators.length === 0) {
|
33120
33525
|
return void 0;
|
33121
33526
|
}
|
@@ -33575,7 +33980,7 @@ var SourceFileScope = class {
|
|
33575
33980
|
const result = Query.from(groups).map((g) => g.toArray()).skipWhile((d) => d.length === 0).first() ?? [];
|
33576
33981
|
return result;
|
33577
33982
|
}
|
33578
|
-
getNamedDeclarations(hidingMatcher) {
|
33983
|
+
getNamedDeclarations(_noInstanceMembers, hidingMatcher) {
|
33579
33984
|
const groups = new Array();
|
33580
33985
|
{
|
33581
33986
|
const group = Query.from(this._sourceFileMembers.getPackageAliases()).map((d) => this.convertPackageAliasToNamedDeclaration(d)).chain(
|
@@ -33597,7 +34002,7 @@ var SourceFileScope = class {
|
|
33597
34002
|
return result;
|
33598
34003
|
}).flatMap((d) => d).toArray();
|
33599
34004
|
}
|
33600
|
-
getNamedDeclarationsByName(name, hidingMatcher) {
|
34005
|
+
getNamedDeclarationsByName(name, _noInstanceMembers, hidingMatcher) {
|
33601
34006
|
const groups = new Array();
|
33602
34007
|
{
|
33603
34008
|
const group = Query.from(this._sourceFileMembers.getPackageAliasesByName(name)).map((d) => this.convertPackageAliasToNamedDeclaration(d)).chain(Query.fromNullable(this.packageNameSegmentsByKey.get(name.value.key)).map((s) => FoundNamedDeclaration.original(
|
@@ -33617,10 +34022,10 @@ var SourceFileScope = class {
|
|
33617
34022
|
const result = Query.from(groups).map((g) => g.toArray()).skipWhile((d) => d.length === 0).first() ?? [];
|
33618
34023
|
return result;
|
33619
34024
|
}
|
33620
|
-
getOperators(_hidingMatcher) {
|
34025
|
+
getOperators(_noInstanceMembers, _hidingMatcher) {
|
33621
34026
|
return [];
|
33622
34027
|
}
|
33623
|
-
getOperatorsByKind(_kind, _hidingMatcher) {
|
34028
|
+
getOperatorsByKind(_kind, _noInstanceMembers, _hidingMatcher) {
|
33624
34029
|
return [];
|
33625
34030
|
}
|
33626
34031
|
getTypeExtensionsByType(type, hidingMatcher) {
|
@@ -33709,10 +34114,10 @@ var GenericScope = class {
|
|
33709
34114
|
}).toArray();
|
33710
34115
|
return result;
|
33711
34116
|
}
|
33712
|
-
getNamedDeclarations(hidingMatcher) {
|
34117
|
+
getNamedDeclarations(_noInstanceMembers, hidingMatcher) {
|
33713
34118
|
return Query.from(this._namedDeclarations).filter((d) => this.checkHiding(d.isHidden(), hidingMatcher)).map((d) => FoundNamedDeclaration.original(d, d.getName(), this._locale, false)).toArray();
|
33714
34119
|
}
|
33715
|
-
getNamedDeclarationsByName(name, hidingMatcher) {
|
34120
|
+
getNamedDeclarationsByName(name, _noInstanceMembers, hidingMatcher) {
|
33716
34121
|
const declarations = this.namedDeclarationsByName.get(name.value.key);
|
33717
34122
|
if (declarations === void 0) {
|
33718
34123
|
return [];
|
@@ -33725,10 +34130,10 @@ var GenericScope = class {
|
|
33725
34130
|
}).toArray();
|
33726
34131
|
return result;
|
33727
34132
|
}
|
33728
|
-
getOperators(_hidingMatcher) {
|
34133
|
+
getOperators(_noInstanceMembers, _hidingMatcher) {
|
33729
34134
|
return [];
|
33730
34135
|
}
|
33731
|
-
getOperatorsByKind(_kind, _hidingMatcher) {
|
34136
|
+
getOperatorsByKind(_kind, _noInstanceMembers, _hidingMatcher) {
|
33732
34137
|
return [];
|
33733
34138
|
}
|
33734
34139
|
getTypeExtensionsByType(typeEntity, hidingMatcher) {
|
@@ -33767,10 +34172,10 @@ var ParameterDeclarationsScope = class {
|
|
33767
34172
|
getTypesOrContainersWithTypesByName(name, hidingMatcher) {
|
33768
34173
|
return [];
|
33769
34174
|
}
|
33770
|
-
getNamedDeclarations(hidingMatcher) {
|
34175
|
+
getNamedDeclarations(_noInstanceMembers, hidingMatcher) {
|
33771
34176
|
return Query.from(this.namedDeclarations).filter((d) => this.checkHiding(d.isHidden(), hidingMatcher)).map((d) => FoundNamedDeclaration.original(d, d.getName(), this.locale, false)).toArray();
|
33772
34177
|
}
|
33773
|
-
getNamedDeclarationsByName(name, hidingMatcher) {
|
34178
|
+
getNamedDeclarationsByName(name, noInstanceMembers, hidingMatcher) {
|
33774
34179
|
const declarations = this.namedDeclarationsByName.get(name.value.key);
|
33775
34180
|
if (declarations === void 0) {
|
33776
34181
|
return [];
|
@@ -33783,10 +34188,10 @@ var ParameterDeclarationsScope = class {
|
|
33783
34188
|
}).toArray();
|
33784
34189
|
return result;
|
33785
34190
|
}
|
33786
|
-
getOperators(_hidingMatcher) {
|
34191
|
+
getOperators(_noInstanceMembers, _hidingMatcher) {
|
33787
34192
|
return [];
|
33788
34193
|
}
|
33789
|
-
getOperatorsByKind(_kind, _hidingMatcher) {
|
34194
|
+
getOperatorsByKind(_kind, _noInstanceMembers, _hidingMatcher) {
|
33790
34195
|
return [];
|
33791
34196
|
}
|
33792
34197
|
getTypeExtensionsByType(typeEntity, hidingMatcher) {
|
@@ -33796,7 +34201,7 @@ var ParameterDeclarationsScope = class {
|
|
33796
34201
|
return hiding === void 0 || hidingMatcher === void 0 || hidingMatcher.matches(hiding);
|
33797
34202
|
}
|
33798
34203
|
};
|
33799
|
-
var
|
34204
|
+
var TypeWithMembersOrExtensionBodyScope = class {
|
33800
34205
|
constructor(_memberLookup, _typeExtensionsLookup) {
|
33801
34206
|
this._memberLookup = _memberLookup;
|
33802
34207
|
this._typeExtensionsLookup = _typeExtensionsLookup;
|
@@ -33807,17 +34212,21 @@ var TypeWithMembersBodyScope = class {
|
|
33807
34212
|
getTypesOrContainersWithTypesByName(_name, _hidingMatcher) {
|
33808
34213
|
return [];
|
33809
34214
|
}
|
33810
|
-
getNamedDeclarations(hidingMatcher) {
|
33811
|
-
|
34215
|
+
getNamedDeclarations(noInstanceMembers = false, hidingMatcher) {
|
34216
|
+
const options = noInstanceMembers ? 2 /* OnlyStaticMembers */ : 0 /* None */;
|
34217
|
+
return this._memberLookup.getNamedMembers(options, hidingMatcher, this._typeExtensionsLookup).map((m) => this.convertNamedMember(m));
|
33812
34218
|
}
|
33813
|
-
getNamedDeclarationsByName(name, hidingMatcher) {
|
33814
|
-
|
34219
|
+
getNamedDeclarationsByName(name, noInstanceMembers = false, hidingMatcher) {
|
34220
|
+
const options = noInstanceMembers ? 2 /* OnlyStaticMembers */ : 0 /* None */;
|
34221
|
+
return this._memberLookup.getNamedMembersByName(name, options, hidingMatcher, this._typeExtensionsLookup).map((m) => this.convertNamedMember(m));
|
33815
34222
|
}
|
33816
|
-
getOperators(hidingMatcher) {
|
33817
|
-
|
34223
|
+
getOperators(noInstanceMembers = false, hidingMatcher) {
|
34224
|
+
const options = noInstanceMembers ? 2 /* OnlyStaticMembers */ : 0 /* None */;
|
34225
|
+
return this._memberLookup.getOperators(options, hidingMatcher, this._typeExtensionsLookup);
|
33818
34226
|
}
|
33819
|
-
getOperatorsByKind(kind, hidingMatcher) {
|
33820
|
-
|
34227
|
+
getOperatorsByKind(kind, noInstanceMembers = false, hidingMatcher) {
|
34228
|
+
const options = noInstanceMembers ? 2 /* OnlyStaticMembers */ : 0 /* None */;
|
34229
|
+
return this._memberLookup.getOperatorsByKind(kind, options, hidingMatcher, this._typeExtensionsLookup);
|
33821
34230
|
}
|
33822
34231
|
getTypeExtensionsByType(_typeEntity, _hidingMatcher) {
|
33823
34232
|
return [];
|
@@ -33833,141 +34242,6 @@ var TypeWithMembersBodyScope = class {
|
|
33833
34242
|
}
|
33834
34243
|
}
|
33835
34244
|
};
|
33836
|
-
var TypeExtensionBodyScope = class {
|
33837
|
-
constructor(_analyzer, _extendedTypeMemberLookup, _extendedType, _typeExtensionEntity, _typeExtensionsLookup, _locale) {
|
33838
|
-
this._analyzer = _analyzer;
|
33839
|
-
this._extendedTypeMemberLookup = _extendedTypeMemberLookup;
|
33840
|
-
this._extendedType = _extendedType;
|
33841
|
-
this._typeExtensionEntity = _typeExtensionEntity;
|
33842
|
-
this._typeExtensionsLookup = _typeExtensionsLookup;
|
33843
|
-
this._locale = _locale;
|
33844
|
-
this._substitutions = new Cached();
|
33845
|
-
}
|
33846
|
-
get substitutions() {
|
33847
|
-
return this._substitutions.getOrInsertWith(() => {
|
33848
|
-
if (this._extendedType !== void 0) {
|
33849
|
-
return Substitutions2.identity(this._analyzer, this._extendedType.getTypeParameters());
|
33850
|
-
}
|
33851
|
-
return Substitutions2.empty(this._analyzer);
|
33852
|
-
});
|
33853
|
-
}
|
33854
|
-
getTypesOrContainersWithTypes(_hidingMatcher) {
|
33855
|
-
return [];
|
33856
|
-
}
|
33857
|
-
getTypesOrContainersWithTypesByName(_name, _hidingMatcher) {
|
33858
|
-
return [];
|
33859
|
-
}
|
33860
|
-
getNamedDeclarations(hidingMatcher) {
|
33861
|
-
const groups = new Array();
|
33862
|
-
{
|
33863
|
-
const group = Query.from(this._typeExtensionEntity.getMembers().getNamedMembers()).mapAndFilter((m) => this.convertNamedTypeExtensionMember(m));
|
33864
|
-
groups.push(group);
|
33865
|
-
}
|
33866
|
-
if (this._extendedTypeMemberLookup !== void 0) {
|
33867
|
-
const group = Query.from(this._extendedTypeMemberLookup.getNamedMembers(hidingMatcher, this._typeExtensionsLookup)).map((m) => this.convertExtendedTypeMember(m));
|
33868
|
-
groups.push(group);
|
33869
|
-
}
|
33870
|
-
return Query.from(groups).scan(new Array(), (seen, group) => {
|
33871
|
-
const result = group.filter((d) => seen.every((sd) => !this.checkNamedDeclarationShadowing(sd, d))).toArray();
|
33872
|
-
seen.push(...result);
|
33873
|
-
return result;
|
33874
|
-
}).flatMap((d) => d).toArray();
|
33875
|
-
}
|
33876
|
-
getNamedDeclarationsByName(name, hidingMatcher) {
|
33877
|
-
let result;
|
33878
|
-
result = Query.from(this._typeExtensionEntity.getMembers().getNamedMembersByName(name.value)).mapAndFilter((m) => this.convertNamedTypeExtensionMember(m)).toArray();
|
33879
|
-
if (result.length === 0 && this._extendedTypeMemberLookup !== void 0) {
|
33880
|
-
result = this._extendedTypeMemberLookup.getNamedMembersByName(name, hidingMatcher, this._typeExtensionsLookup).map((m) => this.convertExtendedTypeMember(m));
|
33881
|
-
}
|
33882
|
-
return result;
|
33883
|
-
}
|
33884
|
-
getOperators(hidingMatcher) {
|
33885
|
-
const groups = new Array();
|
33886
|
-
{
|
33887
|
-
const group = Query.from(this._typeExtensionEntity.getMembers().getOperators()).mapAndFilter((o) => this.convertTypeExtensionOperator(o));
|
33888
|
-
groups.push(group);
|
33889
|
-
}
|
33890
|
-
if (this._extendedTypeMemberLookup !== void 0) {
|
33891
|
-
const group = Query.from(this._extendedTypeMemberLookup.getOperators(hidingMatcher, this._typeExtensionsLookup));
|
33892
|
-
groups.push(group);
|
33893
|
-
}
|
33894
|
-
return Query.from(groups).scan(new Array(), (seen, group) => {
|
33895
|
-
const result = group.filter((d) => seen.every((sd) => !this.checkOperatorShadowing(sd, d))).toArray();
|
33896
|
-
seen.push(...result);
|
33897
|
-
return result;
|
33898
|
-
}).flatMap((d) => d).toArray();
|
33899
|
-
}
|
33900
|
-
getOperatorsByKind(kind, hidingMatcher) {
|
33901
|
-
let result;
|
33902
|
-
result = this._typeExtensionEntity.getMembers().getOperatorsByKind(kind).map((o) => this.convertTypeExtensionOperator(o));
|
33903
|
-
if (result.length === 0 && this._extendedTypeMemberLookup !== void 0) {
|
33904
|
-
result = this._extendedTypeMemberLookup.getOperatorsByKind(kind, hidingMatcher, this._typeExtensionsLookup);
|
33905
|
-
}
|
33906
|
-
return result;
|
33907
|
-
}
|
33908
|
-
getTypeExtensionsByType(_typeEntity, _hidingMatcher) {
|
33909
|
-
return [];
|
33910
|
-
}
|
33911
|
-
convertNamedTypeExtensionMember(member) {
|
33912
|
-
switch (member.kind) {
|
33913
|
-
case 0 /* Variable */: {
|
33914
|
-
const variable = new Variable(member, this.substitutions);
|
33915
|
-
return FoundNamedDeclaration.original(
|
33916
|
-
new NamedDeclaration_variable(new NamedDeclarationVariable_typeMember(variable)),
|
33917
|
-
variable.getName(),
|
33918
|
-
this._locale,
|
33919
|
-
false
|
33920
|
-
);
|
33921
|
-
}
|
33922
|
-
case 1 /* Method */: {
|
33923
|
-
const method = new Method(this._analyzer, member, this.substitutions);
|
33924
|
-
return FoundNamedDeclaration.original(
|
33925
|
-
new NamedDeclaration_method(new NamedDeclarationMethod_typeMember(method)),
|
33926
|
-
method.getName(),
|
33927
|
-
this._locale,
|
33928
|
-
false
|
33929
|
-
);
|
33930
|
-
}
|
33931
|
-
default:
|
33932
|
-
Debug.never(member);
|
33933
|
-
}
|
33934
|
-
}
|
33935
|
-
convertTypeExtensionOperator(entity) {
|
33936
|
-
return FoundAnonymousDeclaration.original(
|
33937
|
-
new Operator(this._analyzer, entity, this.substitutions),
|
33938
|
-
this._locale
|
33939
|
-
);
|
33940
|
-
}
|
33941
|
-
convertExtendedTypeMember(member) {
|
33942
|
-
switch (member.value.kind) {
|
33943
|
-
case "variable":
|
33944
|
-
return member.withValue(new NamedDeclaration_variable(new NamedDeclarationVariable_typeMember(member.value)));
|
33945
|
-
case "method":
|
33946
|
-
return member.withValue(new NamedDeclaration_method(new NamedDeclarationMethod_typeMember(member.value)));
|
33947
|
-
default:
|
33948
|
-
Debug.never(member.value);
|
33949
|
-
}
|
33950
|
-
}
|
33951
|
-
checkOperatorShadowing(source, target) {
|
33952
|
-
if (source.value.getOperatorKind() !== target.value.getOperatorKind()) {
|
33953
|
-
return false;
|
33954
|
-
}
|
33955
|
-
const sourceValueParameters = source.value.getValueParameters();
|
33956
|
-
const targetValueParameters = target.value.getValueParameters();
|
33957
|
-
return sourceValueParameters.length === targetValueParameters.length && Query.from(sourceValueParameters).zip(targetValueParameters, (l, r) => l.getType().equals(r.getType())).all((v) => v);
|
33958
|
-
}
|
33959
|
-
checkNamedDeclarationShadowing(source, target) {
|
33960
|
-
if (source.value.kind === "method" && target.value.kind === "method") {
|
33961
|
-
if (!source.name.value.considerEqual(target.name.value)) {
|
33962
|
-
return false;
|
33963
|
-
}
|
33964
|
-
const sourceValueParameters = source.value.value.getValueParameters();
|
33965
|
-
const targetValueParameters = target.value.value.getValueParameters();
|
33966
|
-
return sourceValueParameters.length === targetValueParameters.length && Query.from(sourceValueParameters).zip(targetValueParameters, (l, r) => l.getType().equals(r.getType())).all((v) => v);
|
33967
|
-
}
|
33968
|
-
return source.name.value.considerEqual(target.name.value);
|
33969
|
-
}
|
33970
|
-
};
|
33971
34245
|
|
33972
34246
|
// source/analysis/Lookup.ts
|
33973
34247
|
var Lookup = class {
|
@@ -33991,32 +34265,32 @@ var Lookup = class {
|
|
33991
34265
|
}
|
33992
34266
|
return [];
|
33993
34267
|
}
|
33994
|
-
getNamedDeclarations() {
|
33995
|
-
return this._scopeChain.toQuery().map((s) => s.getNamedDeclarations(this._hidingMatcher)).scan(new Array(), (seen, declarations) => {
|
34268
|
+
getNamedDeclarations(noInstanceMembers = false) {
|
34269
|
+
return this._scopeChain.toQuery().map((s) => s.getNamedDeclarations(noInstanceMembers, this._hidingMatcher)).scan(new Array(), (seen, declarations) => {
|
33996
34270
|
const result = Query.from(declarations).filter((d) => seen.every((sd) => !this.checkNamedDeclarationShadowing(sd, d))).toArray();
|
33997
34271
|
seen.push(...result);
|
33998
34272
|
return result;
|
33999
34273
|
}).flatMap((d) => d).toArray();
|
34000
34274
|
}
|
34001
|
-
getNamedDeclarationsByName(name) {
|
34275
|
+
getNamedDeclarationsByName(name, noInstanceMembers) {
|
34002
34276
|
for (const scope of this._scopeChain.enumerateScopes()) {
|
34003
|
-
const result = scope.getNamedDeclarationsByName(name, this._hidingMatcher);
|
34277
|
+
const result = scope.getNamedDeclarationsByName(name, noInstanceMembers, this._hidingMatcher);
|
34004
34278
|
if (result.length > 0) {
|
34005
34279
|
return result;
|
34006
34280
|
}
|
34007
34281
|
}
|
34008
34282
|
return [];
|
34009
34283
|
}
|
34010
|
-
getOperators() {
|
34011
|
-
return this._scopeChain.toQuery().map((s) => s.getOperators(this._hidingMatcher)).scan(new Array(), (seen, declarations) => {
|
34284
|
+
getOperators(noInstanceMembers) {
|
34285
|
+
return this._scopeChain.toQuery().map((s) => s.getOperators(noInstanceMembers, this._hidingMatcher)).scan(new Array(), (seen, declarations) => {
|
34012
34286
|
const result = Query.from(declarations).filter((d) => seen.every((sd) => !this.checkOperatorShadowing(sd, d))).toArray();
|
34013
34287
|
seen.push(...result);
|
34014
34288
|
return result;
|
34015
34289
|
}).flatMap((d) => d).toArray();
|
34016
34290
|
}
|
34017
|
-
getOperatorsByKind(kind) {
|
34291
|
+
getOperatorsByKind(kind, noInstanceMembers) {
|
34018
34292
|
for (const scope of this._scopeChain.enumerateScopes()) {
|
34019
|
-
const result = scope.getOperatorsByKind(kind, this._hidingMatcher);
|
34293
|
+
const result = scope.getOperatorsByKind(kind, noInstanceMembers, this._hidingMatcher);
|
34020
34294
|
if (result.length > 0) {
|
34021
34295
|
return result;
|
34022
34296
|
}
|
@@ -34338,6 +34612,9 @@ var SemanticContextWithParent = class {
|
|
34338
34612
|
getHidingMatcher() {
|
34339
34613
|
return new SemanticContextBasedEntityHidingMatcher(this);
|
34340
34614
|
}
|
34615
|
+
isStatic() {
|
34616
|
+
return this._parentContext.isStatic();
|
34617
|
+
}
|
34341
34618
|
};
|
34342
34619
|
var SourceFileSemanticContext = class {
|
34343
34620
|
constructor(analyzer, node) {
|
@@ -34378,6 +34655,9 @@ var SourceFileSemanticContext = class {
|
|
34378
34655
|
getLocalizationContext() {
|
34379
34656
|
return this._analyzer.createLocalizationContext(this._sourceFile);
|
34380
34657
|
}
|
34658
|
+
isStatic() {
|
34659
|
+
return false;
|
34660
|
+
}
|
34381
34661
|
};
|
34382
34662
|
var LastSemanticContextOfType = class extends SemanticContextWithParent {
|
34383
34663
|
constructor(analyzer, node, parentContext) {
|
@@ -34397,6 +34677,9 @@ var LastSemanticContextOfType = class extends SemanticContextWithParent {
|
|
34397
34677
|
isInFinallyClause() {
|
34398
34678
|
return false;
|
34399
34679
|
}
|
34680
|
+
isStatic() {
|
34681
|
+
return false;
|
34682
|
+
}
|
34400
34683
|
getContainingType() {
|
34401
34684
|
switch (this._node.kind) {
|
34402
34685
|
case 22 /* PackageAliasTypeDeclaration */:
|
@@ -34515,6 +34798,18 @@ var LastSemanticContextOfMethod = class extends SemanticContextWithParent {
|
|
34515
34798
|
isInFinallyClause() {
|
34516
34799
|
return false;
|
34517
34800
|
}
|
34801
|
+
isStatic() {
|
34802
|
+
switch (this._node.kind) {
|
34803
|
+
case 52 /* TypeMethodDeclaration */:
|
34804
|
+
return this._analyzer.entity.ofTypeMethodDeclaration(this._node).isStatic();
|
34805
|
+
case 58 /* NestedMethodDeclaration */:
|
34806
|
+
return this._parentContext.isStatic();
|
34807
|
+
case 27 /* PackageMethodDeclaration */:
|
34808
|
+
return false;
|
34809
|
+
default:
|
34810
|
+
Debug.never(this._node);
|
34811
|
+
}
|
34812
|
+
}
|
34518
34813
|
};
|
34519
34814
|
var MethodTypeParameterSemanticContext = class extends SemanticContextWithParent {
|
34520
34815
|
constructor(analyzer, node, parentContext) {
|
@@ -34611,6 +34906,9 @@ var OperatorSemanticContext = class extends SemanticContextWithParent {
|
|
34611
34906
|
getContainingSubprogram() {
|
34612
34907
|
return this._subprogramInfo.getOrInsertWith(() => new SubprogramInfo.Operator(this._analyzer, this._node));
|
34613
34908
|
}
|
34909
|
+
isStatic() {
|
34910
|
+
return this._analyzer.entity.ofOperatorDeclaration(this._node).isStatic();
|
34911
|
+
}
|
34614
34912
|
};
|
34615
34913
|
var ConstructorSemanticContext = class extends SemanticContextWithParent {
|
34616
34914
|
constructor(analyzer, node, parentContext) {
|
@@ -34666,7 +34964,6 @@ var IndexerSemanticContext = class extends SemanticContextWithParent {
|
|
34666
34964
|
var GetterSemanticContext = class extends SemanticContextWithParent {
|
34667
34965
|
constructor(analyzer, node, parentContext) {
|
34668
34966
|
super(parentContext);
|
34669
|
-
this._scopeChain = new Cached();
|
34670
34967
|
this._subprogramInfo = new Cached();
|
34671
34968
|
this._analyzer = analyzer;
|
34672
34969
|
this._node = node;
|
@@ -34677,6 +34974,20 @@ var GetterSemanticContext = class extends SemanticContextWithParent {
|
|
34677
34974
|
getContainingSubprogram() {
|
34678
34975
|
return this._subprogramInfo.getOrInsertWith(() => new SubprogramInfo.Getter(this._analyzer, this._node));
|
34679
34976
|
}
|
34977
|
+
isStatic() {
|
34978
|
+
switch (this._node.kind) {
|
34979
|
+
case 55 /* TypeVariableGetterDeclaration */:
|
34980
|
+
return this._analyzer.entity.ofComputedTypeVariableDeclaration(this._node).isStatic();
|
34981
|
+
case 47 /* TypeIndexedGetterDeclaration */:
|
34982
|
+
return this._analyzer.entity.ofTypeIndexerDeclaration(this._node).isStatic();
|
34983
|
+
case 50 /* TypeDereferencedVariableGetterDeclaration */:
|
34984
|
+
return this._analyzer.entity.ofTypeDereferenceOperatorDeclaration(this._node).isStatic();
|
34985
|
+
case 36 /* PackageVariableGetterDeclaration */:
|
34986
|
+
return false;
|
34987
|
+
default:
|
34988
|
+
Debug.never(this._node);
|
34989
|
+
}
|
34990
|
+
}
|
34680
34991
|
};
|
34681
34992
|
var SetterSemanticContext = class extends SemanticContextWithParent {
|
34682
34993
|
constructor(analyzer, node, parentContext) {
|
@@ -34688,6 +34999,20 @@ var SetterSemanticContext = class extends SemanticContextWithParent {
|
|
34688
34999
|
getContainingSubprogram() {
|
34689
35000
|
return this._subprogramInfo.getOrInsertWith(() => new SubprogramInfo.Setter(this._analyzer, this._node));
|
34690
35001
|
}
|
35002
|
+
isStatic() {
|
35003
|
+
switch (this._node.kind) {
|
35004
|
+
case 56 /* TypeVariableSetterDeclaration */:
|
35005
|
+
return this._analyzer.entity.ofComputedTypeVariableDeclaration(this._node).isStatic();
|
35006
|
+
case 48 /* TypeIndexedSetterDeclaration */:
|
35007
|
+
return this._analyzer.entity.ofTypeIndexerDeclaration(this._node).isStatic();
|
35008
|
+
case 51 /* TypeDereferencedVariableSetterDeclaration */:
|
35009
|
+
return this._analyzer.entity.ofTypeDereferenceOperatorDeclaration(this._node).isStatic();
|
35010
|
+
case 37 /* PackageVariableSetterDeclaration */:
|
35011
|
+
return false;
|
35012
|
+
default:
|
35013
|
+
Debug.never(this._node);
|
35014
|
+
}
|
35015
|
+
}
|
34691
35016
|
};
|
34692
35017
|
var StatementBlockSemanticContext = class extends SemanticContextWithParent {
|
34693
35018
|
constructor(analyzer, node, parentContext) {
|
@@ -34789,6 +35114,16 @@ var CatchClauseSemanticContext = class extends SemanticContextWithParent {
|
|
34789
35114
|
});
|
34790
35115
|
}
|
34791
35116
|
};
|
35117
|
+
var TypeVariableWithInitializerSemanticContext = class extends SemanticContextWithParent {
|
35118
|
+
constructor(analyzer, node, parentContext) {
|
35119
|
+
super(parentContext);
|
35120
|
+
this._analyzer = analyzer;
|
35121
|
+
this._node = node;
|
35122
|
+
}
|
35123
|
+
isStatic() {
|
35124
|
+
return this._analyzer.entity.ofTypeVariableDeclaration(this._node).isStatic();
|
35125
|
+
}
|
35126
|
+
};
|
34792
35127
|
var SemanticContextBasedEntityHidingMatcher = class {
|
34793
35128
|
constructor(semanticContext) {
|
34794
35129
|
this._sourceFile = new Cached();
|
@@ -35134,6 +35469,15 @@ var SemanticContextBuilder = class {
|
|
35134
35469
|
}
|
35135
35470
|
return result;
|
35136
35471
|
}
|
35472
|
+
ofTypeVariableDeclarationWithInitializer(node) {
|
35473
|
+
let result = this._semanticContexts.get(node);
|
35474
|
+
if (result === void 0) {
|
35475
|
+
const parent = this.containingInternal(node, void 0);
|
35476
|
+
result = new TypeVariableWithInitializerSemanticContext(this._analyzer, node, parent);
|
35477
|
+
this._semanticContexts.set(node, result);
|
35478
|
+
}
|
35479
|
+
return result;
|
35480
|
+
}
|
35137
35481
|
containingInternal(node, offset) {
|
35138
35482
|
if (node.kind === 1 /* SourceFile */) {
|
35139
35483
|
return this.ofSourceFile(node);
|
@@ -35240,6 +35584,15 @@ var SemanticContextBuilder = class {
|
|
35240
35584
|
return this.ofPackageConstructorDeclaration(cursor);
|
35241
35585
|
}
|
35242
35586
|
break;
|
35587
|
+
case 54 /* TypeVariableDeclaration */:
|
35588
|
+
if (cursor.initializer !== void 0) {
|
35589
|
+
if (offset === void 0) {
|
35590
|
+
return this.ofTypeVariableDeclarationWithInitializer(cursor);
|
35591
|
+
} else if (cursor.equalsToken !== void 0 && offset >= cursor.equalsToken.rangeWithTrivia.end) {
|
35592
|
+
return this.ofTypeVariableDeclarationWithInitializer(cursor);
|
35593
|
+
}
|
35594
|
+
}
|
35595
|
+
break;
|
35243
35596
|
}
|
35244
35597
|
cursor = cursor.parent;
|
35245
35598
|
}
|
@@ -35478,7 +35831,7 @@ var StatementBlockScopeBuilder = class {
|
|
35478
35831
|
}
|
35479
35832
|
}
|
35480
35833
|
static buildGenericScopeForFunctionBlock(analyzer, node) {
|
35481
|
-
const namedDeclarations = this.
|
35834
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35482
35835
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35483
35836
|
return new GenericScope(namedDeclarations, [], locale);
|
35484
35837
|
}
|
@@ -35488,108 +35841,117 @@ var StatementBlockScopeBuilder = class {
|
|
35488
35841
|
return new GenericScope(namedDeclarations, [], locale);
|
35489
35842
|
}
|
35490
35843
|
static buildScopeForMethodBlockLiteral(analyzer, node, parent) {
|
35491
|
-
const namedDeclarations = this.
|
35844
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35492
35845
|
const resultVariable = analyzer.resultLocalVariableEntity.ofMethodBlockLiteral(parent);
|
35493
35846
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35494
35847
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35495
35848
|
return new GenericScope(namedDeclarations, [], locale);
|
35496
35849
|
}
|
35497
35850
|
static buildScopeForPackageMethodDeclaration(analyzer, node, parent) {
|
35498
|
-
const namedDeclarations = this.
|
35851
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35499
35852
|
const resultVariable = analyzer.resultLocalVariableEntity.ofPackageMethodDeclaration(parent);
|
35500
35853
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35501
35854
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35502
35855
|
return new GenericScope(namedDeclarations, [], locale);
|
35503
35856
|
}
|
35504
35857
|
static buildScopeForTypeVariableGetterDeclaration(analyzer, node, parent) {
|
35505
|
-
const namedDeclarations = this.
|
35858
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35506
35859
|
const resultVariable = analyzer.resultLocalVariableEntity.ofTypeVariableGetterDeclaration(parent);
|
35507
35860
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35508
35861
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35509
35862
|
return new GenericScope(namedDeclarations, [], locale);
|
35510
35863
|
}
|
35511
35864
|
static buildScopeForTypeVariableSetterDeclaration(analyzer, node, parent) {
|
35512
|
-
const namedDeclarations = this.
|
35865
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35513
35866
|
const valueVariable = analyzer.valueLocalVariableEntity.ofTypeVariableSetterDeclaration(parent);
|
35514
35867
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(valueVariable)));
|
35515
35868
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35516
35869
|
return new GenericScope(namedDeclarations, [], locale);
|
35517
35870
|
}
|
35518
35871
|
static buildScopeForPackageVariableGetterDeclaration(analyzer, node, parent) {
|
35519
|
-
const namedDeclarations = this.
|
35872
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35520
35873
|
const resultVariable = analyzer.resultLocalVariableEntity.ofPackageVariableGetterDeclaration(parent);
|
35521
35874
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35522
35875
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35523
35876
|
return new GenericScope(namedDeclarations, [], locale);
|
35524
35877
|
}
|
35525
35878
|
static buildScopeForPackageVariableSetterDeclaration(analyzer, node, parent) {
|
35526
|
-
const namedDeclarations = this.
|
35879
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35527
35880
|
const valueVariable = analyzer.valueLocalVariableEntity.ofPackageVariableSetterDeclaration(parent);
|
35528
35881
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(valueVariable)));
|
35529
35882
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35530
35883
|
return new GenericScope(namedDeclarations, [], locale);
|
35531
35884
|
}
|
35532
35885
|
static buildScopeForTypeIndexedGetterDeclaration(analyzer, node, parent) {
|
35533
|
-
const namedDeclarations = this.
|
35886
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35534
35887
|
const resultVariable = analyzer.resultLocalVariableEntity.ofTypeIndexedGetterDeclaration(parent);
|
35535
35888
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35536
35889
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35537
35890
|
return new GenericScope(namedDeclarations, [], locale);
|
35538
35891
|
}
|
35539
35892
|
static buildScopeForTypeIndexedSetterDeclaration(analyzer, node, parent) {
|
35540
|
-
const namedDeclarations = this.
|
35893
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35541
35894
|
const valueVariable = analyzer.valueLocalVariableEntity.ofTypeIndexedSetterDeclaration(parent);
|
35542
35895
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(valueVariable)));
|
35543
35896
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35544
35897
|
return new GenericScope(namedDeclarations, [], locale);
|
35545
35898
|
}
|
35546
35899
|
static buildScopeForTypeDereferencedVariableGetterDeclaration(analyzer, node, parent) {
|
35547
|
-
const namedDeclarations = this.
|
35900
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35548
35901
|
const resultVariable = analyzer.resultLocalVariableEntity.ofTypeDereferencedVariableGetterDeclaration(parent);
|
35549
35902
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35550
35903
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35551
35904
|
return new GenericScope(namedDeclarations, [], locale);
|
35552
35905
|
}
|
35553
35906
|
static buildScopeForTypeDereferencedVariableSetterDeclaration(analyzer, node, parent) {
|
35554
|
-
const namedDeclarations = this.
|
35907
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35555
35908
|
const valueVariable = analyzer.valueLocalVariableEntity.ofTypeDereferencedVariableSetterDeclaration(parent);
|
35556
35909
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(valueVariable)));
|
35557
35910
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35558
35911
|
return new GenericScope(namedDeclarations, [], locale);
|
35559
35912
|
}
|
35560
35913
|
static buildScopeForNestedMethodDeclaration(analyzer, node, parent) {
|
35561
|
-
const namedDeclarations = this.
|
35914
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35562
35915
|
const resultVariable = analyzer.resultLocalVariableEntity.ofNestedMethodDeclaration(parent);
|
35563
35916
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35564
35917
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35565
35918
|
return new GenericScope(namedDeclarations, [], locale);
|
35566
35919
|
}
|
35567
35920
|
static buildScopeForMethodLiteral(analyzer, node, parent) {
|
35568
|
-
const namedDeclarations = this.
|
35921
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35569
35922
|
const resultVariable = analyzer.resultLocalVariableEntity.ofMethodLiteral(parent);
|
35570
35923
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35571
35924
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35572
35925
|
return new GenericScope(namedDeclarations, [], locale);
|
35573
35926
|
}
|
35574
35927
|
static buildScopeForTypeConstructorDeclaration(analyzer, node, parent) {
|
35575
|
-
const namedDeclarations = this.
|
35928
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35576
35929
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35577
35930
|
return new GenericScope(namedDeclarations, [], locale);
|
35578
35931
|
}
|
35579
35932
|
static buildScopeForTypeMethodDeclaration(analyzer, node, parent) {
|
35580
|
-
const namedDeclarations = this.
|
35933
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35581
35934
|
const resultVariable = analyzer.resultLocalVariableEntity.ofTypeMethodDeclaration(parent);
|
35582
35935
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35583
35936
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35584
35937
|
return new GenericScope(namedDeclarations, [], locale);
|
35585
35938
|
}
|
35586
35939
|
static buildScopeForOperatorDeclaration(analyzer, node, parent) {
|
35587
|
-
const namedDeclarations = this.
|
35940
|
+
const namedDeclarations = this.getLocalNamedDeclarationsOfFunctionBlock(analyzer, node);
|
35588
35941
|
const resultVariable = analyzer.resultLocalVariableEntity.ofOperatorDeclaration(parent);
|
35589
35942
|
namedDeclarations.push(new NamedDeclaration_variable(new NamedDeclarationVariable_entity(resultVariable)));
|
35590
35943
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
35591
35944
|
return new GenericScope(namedDeclarations, [], locale);
|
35592
35945
|
}
|
35946
|
+
static getLocalNamedDeclarationsOfFunctionBlock(analyzer, node) {
|
35947
|
+
let result;
|
35948
|
+
if (node.expressionOrStatementList.kind === 92 /* StatementList */) {
|
35949
|
+
result = this.getLocalNamedDeclarations(analyzer, node.expressionOrStatementList);
|
35950
|
+
} else {
|
35951
|
+
result = [];
|
35952
|
+
}
|
35953
|
+
return result;
|
35954
|
+
}
|
35593
35955
|
static getLocalNamedDeclarations(analyzer, statements) {
|
35594
35956
|
const result = new Array();
|
35595
35957
|
if (statements !== void 0) {
|
@@ -35793,7 +36155,7 @@ var Resolver11 = class {
|
|
35793
36155
|
const typeArguments = Query.fromNullable(this._node.typeArgumentClause?.typeArgumentList.typeArguments).map((t) => this._analyzer.type.ofTypeSpecifier(t)).toArray();
|
35794
36156
|
const type = this._analyzer.instantiateType(suitableTypes[0].value, typeArguments);
|
35795
36157
|
const semanticContext = this.semanticContext;
|
35796
|
-
const typeMemberLookup =
|
36158
|
+
const typeMemberLookup = TypeMemberLookup.ofType(this._analyzer, type, semanticContext.getLocalizationContext());
|
35797
36159
|
const constructors = typeMemberLookup.getConstructors(semanticContext.getHidingMatcher(), semanticContext.getScopeLookup());
|
35798
36160
|
if (constructors.length === 0) {
|
35799
36161
|
return new ResolutionResult4(
|
@@ -35973,6 +36335,7 @@ var TypeNarrower = class {
|
|
35973
36335
|
constructor(analyzer, referenceExpression, initialType, controlFlowNode) {
|
35974
36336
|
// Инициализируется в методе `getType`.
|
35975
36337
|
this._typeByNode = /* @__PURE__ */ new Map();
|
36338
|
+
this._isVariableAssignedInLoopCheckResults = /* @__PURE__ */ new Map();
|
35976
36339
|
this._analyzer = analyzer;
|
35977
36340
|
this._referenceExpression = referenceExpression;
|
35978
36341
|
this._initialType = initialType;
|
@@ -36000,6 +36363,9 @@ var TypeNarrower = class {
|
|
36000
36363
|
case "assignment":
|
36001
36364
|
result = this.getTypeAtAssignment(node);
|
36002
36365
|
break;
|
36366
|
+
case "local-variable-declaration":
|
36367
|
+
result = this.getTypeAtLocalVariableDeclaration(node);
|
36368
|
+
break;
|
36003
36369
|
case "split":
|
36004
36370
|
result = this.getTypeAtSplit(node);
|
36005
36371
|
break;
|
@@ -36035,41 +36401,33 @@ var TypeNarrower = class {
|
|
36035
36401
|
}
|
36036
36402
|
}
|
36037
36403
|
getTypeAtAssignment(node) {
|
36038
|
-
|
36039
|
-
|
36040
|
-
switch (node.syntaxNode.kind) {
|
36041
|
-
case 91 /* AssignmentStatement */: {
|
36042
|
-
if (node.syntaxNode.operator.tokenKind === 57 /* Equals */) {
|
36043
|
-
reference = this.getReferenceAtNodeIfNarrowable(node.syntaxNode.left);
|
36044
|
-
}
|
36045
|
-
right = node.syntaxNode.right;
|
36046
|
-
break;
|
36047
|
-
}
|
36048
|
-
case 59 /* LocalVariableDeclaration */: {
|
36049
|
-
reference = this.getReferenceAtLocalVariableDeclaration(node.syntaxNode);
|
36050
|
-
right = node.syntaxNode.initializer;
|
36051
|
-
break;
|
36052
|
-
}
|
36053
|
-
default:
|
36054
|
-
Debug.never(node.syntaxNode);
|
36404
|
+
if (node.syntaxNode.operator.tokenKind !== 57 /* Equals */) {
|
36405
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
36055
36406
|
}
|
36056
|
-
|
36407
|
+
const reference = this.getReferenceAtNodeIfNarrowable(node.syntaxNode.left);
|
36408
|
+
if (reference !== void 0) {
|
36057
36409
|
if (reference.equals(this._reference)) {
|
36058
|
-
const rightType = this._analyzer.type.ofExpression(right);
|
36059
|
-
|
36060
|
-
if ((typeAssignabilityFlags & (1 /* NotAssignable */ | 16 /* ImplicitConversion */)) !== 0) {
|
36061
|
-
return this.getTypeAtControlFlowNode(node.predecessor);
|
36062
|
-
}
|
36063
|
-
if (NodeTypeUtils.isNoneLiteral(unwrapParenthesizedExpressions(right))) {
|
36064
|
-
return this._analyzer.makeNoneAssignableToType(this.getTypeAtControlFlowNode(node.predecessor));
|
36065
|
-
}
|
36066
|
-
return rightType;
|
36410
|
+
const rightType = this._analyzer.type.ofExpression(node.syntaxNode.right);
|
36411
|
+
return this.getTypeAtAssignmentOrDeclaration(rightType, node.predecessor, false);
|
36067
36412
|
} else if (this._reference.contains(reference)) {
|
36068
36413
|
return this._initialType;
|
36069
36414
|
}
|
36070
36415
|
}
|
36071
36416
|
return this.getTypeAtControlFlowNode(node.predecessor);
|
36072
36417
|
}
|
36418
|
+
getTypeAtLocalVariableDeclaration(node) {
|
36419
|
+
const reference = this.getReferenceAtLocalVariableDeclaration(node.syntaxNode);
|
36420
|
+
if (reference.equals(this._reference)) {
|
36421
|
+
if (node.syntaxNode.initializer !== void 0) {
|
36422
|
+
const initializerType = this._analyzer.type.ofExpression(node.syntaxNode.initializer);
|
36423
|
+
return this.getTypeAtAssignmentOrDeclaration(initializerType, node.predecessor, true);
|
36424
|
+
} else {
|
36425
|
+
return this._initialType;
|
36426
|
+
}
|
36427
|
+
} else {
|
36428
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
36429
|
+
}
|
36430
|
+
}
|
36073
36431
|
getTypeAtSplit(node) {
|
36074
36432
|
const types = new Array();
|
36075
36433
|
for (const predecessor of node.predecessors) {
|
@@ -36079,7 +36437,23 @@ var TypeNarrower = class {
|
|
36079
36437
|
return this._analyzer.typeFactory.getUnionType(types);
|
36080
36438
|
}
|
36081
36439
|
getTypeAtLoop(node) {
|
36082
|
-
|
36440
|
+
if (this.checkIfVariableIsAssignedInLoop(node)) {
|
36441
|
+
return this._initialType;
|
36442
|
+
} else {
|
36443
|
+
return this.getTypeAtControlFlowNode(node.predecessor);
|
36444
|
+
}
|
36445
|
+
}
|
36446
|
+
getTypeAtAssignmentWithImplicitConversion(rightType) {
|
36447
|
+
let result;
|
36448
|
+
if (this._initialType.kind === "union" && rightType.kind !== "union") {
|
36449
|
+
const constituentTypes = this._initialType.originalTypes.filter((t) => this._analyzer.isTypeAssignableTo(rightType, t));
|
36450
|
+
result = this._analyzer.typeFactory.getUnionType(constituentTypes);
|
36451
|
+
} else if (!this._analyzer.isNoneAssignableToType(rightType)) {
|
36452
|
+
result = this._analyzer.excludeNoneFromType(this._initialType);
|
36453
|
+
} else {
|
36454
|
+
result = this._initialType;
|
36455
|
+
}
|
36456
|
+
return result;
|
36083
36457
|
}
|
36084
36458
|
getTypeAtComparisonWithNone(type, isEqual) {
|
36085
36459
|
if (isEqual) {
|
@@ -36096,6 +36470,19 @@ var TypeNarrower = class {
|
|
36096
36470
|
return this._analyzer.excludeTypeFromUnion(typeAtPredecessor, checkedType);
|
36097
36471
|
}
|
36098
36472
|
}
|
36473
|
+
getTypeAtAssignmentOrDeclaration(rightType, predecessor, isDeclaration) {
|
36474
|
+
const typeAssignabilityFlags = this._analyzer.getTypeAssignabilityFlags(rightType, this._initialType);
|
36475
|
+
if (typeAssignabilityFlags === 0 /* NotAssignable */) {
|
36476
|
+
return this._initialType;
|
36477
|
+
}
|
36478
|
+
if ((typeAssignabilityFlags & 8 /* ImplicitConversion */) !== 0) {
|
36479
|
+
return this.getTypeAtAssignmentWithImplicitConversion(rightType);
|
36480
|
+
}
|
36481
|
+
if (rightType.equals(this._analyzer.standardTypes.none)) {
|
36482
|
+
return isDeclaration ? this._initialType : this._analyzer.makeNoneAssignableToType(this.getTypeAtControlFlowNode(predecessor));
|
36483
|
+
}
|
36484
|
+
return rightType;
|
36485
|
+
}
|
36099
36486
|
addTypeIfUnique(types, type) {
|
36100
36487
|
if (type.kind === "union") {
|
36101
36488
|
for (const constituentType of type.originalTypes) {
|
@@ -36107,19 +36494,64 @@ var TypeNarrower = class {
|
|
36107
36494
|
}
|
36108
36495
|
}
|
36109
36496
|
}
|
36110
|
-
|
36111
|
-
|
36112
|
-
|
36497
|
+
checkIfVariableIsAssignedInLoop(node) {
|
36498
|
+
let result = this._isVariableAssignedInLoopCheckResults.get(node);
|
36499
|
+
if (result === void 0) {
|
36500
|
+
result = node.loopingPredecessors.some((p) => this.checkIfVariableIsAssignedAtNode(p, node));
|
36501
|
+
this._isVariableAssignedInLoopCheckResults.set(node, result);
|
36502
|
+
}
|
36503
|
+
return result;
|
36113
36504
|
}
|
36114
|
-
|
36115
|
-
|
36116
|
-
|
36117
|
-
|
36505
|
+
checkIfVariableIsAssignedAtNode(node, loopNode) {
|
36506
|
+
if (node === loopNode) {
|
36507
|
+
return false;
|
36508
|
+
}
|
36509
|
+
if (node.kind === "loop") {
|
36510
|
+
return this.checkIfVariableIsAssignedInLoop(node);
|
36511
|
+
}
|
36512
|
+
let result = this._isVariableAssignedInLoopCheckResults.get(node);
|
36513
|
+
if (result === void 0) {
|
36514
|
+
switch (node.kind) {
|
36515
|
+
case "start":
|
36516
|
+
case "unreachable":
|
36517
|
+
result = false;
|
36518
|
+
break;
|
36519
|
+
case "condition":
|
36520
|
+
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
36521
|
+
break;
|
36522
|
+
case "split":
|
36523
|
+
result = node.predecessors.some((p) => this.checkIfVariableIsAssignedAtNode(p, loopNode));
|
36524
|
+
break;
|
36525
|
+
case "assignment": {
|
36526
|
+
const left = unwrapExpressionForNarrowableReferenceCheck(node.syntaxNode.left);
|
36527
|
+
if (isNarrowableReferenceExpression(left) && (this._reference.equalsExpression(left) || this._reference.containsExpression(left))) {
|
36528
|
+
result = true;
|
36529
|
+
} else {
|
36530
|
+
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
36531
|
+
}
|
36532
|
+
break;
|
36533
|
+
}
|
36534
|
+
case "local-variable-declaration": {
|
36535
|
+
if (this._reference.kind === "local-variable" && this.getReferenceAtLocalVariableDeclaration(node.syntaxNode).equals(this._reference)) {
|
36536
|
+
result = true;
|
36537
|
+
} else {
|
36538
|
+
result = this.checkIfVariableIsAssignedAtNode(node.predecessor, loopNode);
|
36539
|
+
}
|
36540
|
+
break;
|
36541
|
+
}
|
36542
|
+
default:
|
36543
|
+
Debug.never(node);
|
36544
|
+
}
|
36545
|
+
this._isVariableAssignedInLoopCheckResults.set(node, result);
|
36118
36546
|
}
|
36119
36547
|
return result;
|
36120
36548
|
}
|
36549
|
+
isSameReferenceAsNarrowedExpression(referenceExpression) {
|
36550
|
+
const reference = this.getReferenceAtNodeIfNarrowable(referenceExpression);
|
36551
|
+
return reference !== void 0 && reference.equals(this._reference);
|
36552
|
+
}
|
36121
36553
|
getReferenceAtNodeIfNarrowable(node) {
|
36122
|
-
node =
|
36554
|
+
node = unwrapExpressionForNarrowableReferenceCheck(node);
|
36123
36555
|
let result;
|
36124
36556
|
if (isNarrowableReferenceExpression(node)) {
|
36125
36557
|
result = this.getReferenceAtNode(node);
|
@@ -36139,8 +36571,9 @@ var TypeNarrower = class {
|
|
36139
36571
|
switch (entity.subkind) {
|
36140
36572
|
case "local":
|
36141
36573
|
case "parameter":
|
36142
|
-
return new NarrowableReference.LocalVariable(entity);
|
36574
|
+
return new NarrowableReference.LocalVariable(this._analyzer, entity);
|
36143
36575
|
case "package":
|
36576
|
+
return new NarrowableReference.PackageVariable(this._analyzer, entity);
|
36144
36577
|
case "type":
|
36145
36578
|
return void 0;
|
36146
36579
|
default:
|
@@ -36148,9 +36581,13 @@ var TypeNarrower = class {
|
|
36148
36581
|
}
|
36149
36582
|
} else if (variable.kind === "type-member") {
|
36150
36583
|
if (variable.value.isStatic()) {
|
36151
|
-
return new NarrowableReference.StaticTypeVariable(variable.value);
|
36584
|
+
return new NarrowableReference.StaticTypeVariable(this._analyzer, variable.value);
|
36152
36585
|
} else {
|
36153
|
-
return new NarrowableReference.InstanceTypeVariable(
|
36586
|
+
return new NarrowableReference.InstanceTypeVariable(
|
36587
|
+
this._analyzer,
|
36588
|
+
variable.value,
|
36589
|
+
new NarrowableReference.Object()
|
36590
|
+
);
|
36154
36591
|
}
|
36155
36592
|
} else {
|
36156
36593
|
Debug.never(variable);
|
@@ -36161,16 +36598,18 @@ var TypeNarrower = class {
|
|
36161
36598
|
case 78 /* PropertyAccessExpression */: {
|
36162
36599
|
const meaning = this._analyzer.resolvePropertyAccessExpression(node).meaning;
|
36163
36600
|
if (meaning.kind === "instance-variable-access") {
|
36164
|
-
const receiverExpression =
|
36601
|
+
const receiverExpression = unwrapExpressionForNarrowableReferenceCheck(node.expression);
|
36165
36602
|
if (isNarrowableReferenceExpression(receiverExpression)) {
|
36166
36603
|
const receiver = this.getReferenceAtNode(receiverExpression);
|
36167
36604
|
if (receiver !== void 0) {
|
36168
|
-
return new NarrowableReference.InstanceTypeVariable(meaning.variable.value, receiver);
|
36605
|
+
return new NarrowableReference.InstanceTypeVariable(this._analyzer, meaning.variable.value, receiver);
|
36169
36606
|
}
|
36170
36607
|
}
|
36171
36608
|
return void 0;
|
36172
36609
|
} else if (meaning.kind === "static-variable-access") {
|
36173
|
-
return new NarrowableReference.StaticTypeVariable(meaning.variable.value);
|
36610
|
+
return new NarrowableReference.StaticTypeVariable(this._analyzer, meaning.variable.value);
|
36611
|
+
} else if (meaning.kind === "package-variable-access") {
|
36612
|
+
return new NarrowableReference.PackageVariable(this._analyzer, meaning.variable.value);
|
36174
36613
|
}
|
36175
36614
|
return void 0;
|
36176
36615
|
}
|
@@ -36180,13 +36619,14 @@ var TypeNarrower = class {
|
|
36180
36619
|
}
|
36181
36620
|
getReferenceAtLocalVariableDeclaration(node) {
|
36182
36621
|
const entity = this._analyzer.entity.ofLocalVariableDeclaration(node);
|
36183
|
-
return new NarrowableReference.LocalVariable(entity);
|
36622
|
+
return new NarrowableReference.LocalVariable(this._analyzer, entity);
|
36184
36623
|
}
|
36185
36624
|
};
|
36186
36625
|
var NarrowableReference;
|
36187
36626
|
((NarrowableReference2) => {
|
36188
36627
|
class LocalVariable {
|
36189
|
-
constructor(entity) {
|
36628
|
+
constructor(_analyzer, entity) {
|
36629
|
+
this._analyzer = _analyzer;
|
36190
36630
|
this.entity = entity;
|
36191
36631
|
this.kind = "local-variable";
|
36192
36632
|
}
|
@@ -36196,10 +36636,56 @@ var NarrowableReference;
|
|
36196
36636
|
contains(_other) {
|
36197
36637
|
return false;
|
36198
36638
|
}
|
36639
|
+
equalsExpression(expression) {
|
36640
|
+
if (expression.kind !== 88 /* IdentifierExpression */) {
|
36641
|
+
return false;
|
36642
|
+
}
|
36643
|
+
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
36644
|
+
return meaning.kind === "variable-access" && meaning.variable.value.getEntity() === this.entity;
|
36645
|
+
}
|
36646
|
+
containsExpression(_expression) {
|
36647
|
+
return false;
|
36648
|
+
}
|
36199
36649
|
}
|
36200
36650
|
NarrowableReference2.LocalVariable = LocalVariable;
|
36651
|
+
class PackageVariable {
|
36652
|
+
constructor(_analyzer, entity) {
|
36653
|
+
this._analyzer = _analyzer;
|
36654
|
+
this.entity = entity;
|
36655
|
+
this.kind = "package-variable";
|
36656
|
+
}
|
36657
|
+
equals(other) {
|
36658
|
+
return other.kind === "package-variable" && this.entity === other.entity;
|
36659
|
+
}
|
36660
|
+
contains(_other) {
|
36661
|
+
return false;
|
36662
|
+
}
|
36663
|
+
equalsExpression(expression) {
|
36664
|
+
if (expression.kind === 88 /* IdentifierExpression */) {
|
36665
|
+
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
36666
|
+
return meaning.kind === "variable-access" && meaning.variable.value.getEntity() === this.entity;
|
36667
|
+
} else if (expression.kind === 78 /* PropertyAccessExpression */) {
|
36668
|
+
let result = NarrowableReferenceComparisonUtils.checkExpressionDenotesPackage(
|
36669
|
+
this._analyzer,
|
36670
|
+
expression.expression
|
36671
|
+
);
|
36672
|
+
if (result) {
|
36673
|
+
const meaning = this._analyzer.resolvePropertyAccessExpression(expression).meaning;
|
36674
|
+
result = meaning.kind === "package-variable-access" && meaning.variable.value === this.entity;
|
36675
|
+
}
|
36676
|
+
return result;
|
36677
|
+
} else {
|
36678
|
+
return false;
|
36679
|
+
}
|
36680
|
+
}
|
36681
|
+
containsExpression(_expression) {
|
36682
|
+
return false;
|
36683
|
+
}
|
36684
|
+
}
|
36685
|
+
NarrowableReference2.PackageVariable = PackageVariable;
|
36201
36686
|
class InstanceTypeVariable {
|
36202
|
-
constructor(variable, receiver) {
|
36687
|
+
constructor(_analyzer, variable, receiver) {
|
36688
|
+
this._analyzer = _analyzer;
|
36203
36689
|
this.variable = variable;
|
36204
36690
|
this.receiver = receiver;
|
36205
36691
|
this.kind = "instance-type-variable";
|
@@ -36213,10 +36699,41 @@ var NarrowableReference;
|
|
36213
36699
|
}
|
36214
36700
|
return this.receiver.contains(other);
|
36215
36701
|
}
|
36702
|
+
equalsExpression(expression) {
|
36703
|
+
if (expression.kind === 88 /* IdentifierExpression */) {
|
36704
|
+
if (this.receiver.kind !== "object") {
|
36705
|
+
return false;
|
36706
|
+
}
|
36707
|
+
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
36708
|
+
return meaning.kind === "variable-access" && meaning.variable.value.kind === "type-member" && meaning.variable.value.value.equals(this.variable);
|
36709
|
+
} else if (expression.kind === 78 /* PropertyAccessExpression */) {
|
36710
|
+
const receiverExpression = unwrapExpressionForNarrowableReferenceCheck(expression.expression);
|
36711
|
+
if (!isNarrowableReferenceExpression(receiverExpression)) {
|
36712
|
+
return false;
|
36713
|
+
}
|
36714
|
+
if (!this.receiver.equalsExpression(receiverExpression)) {
|
36715
|
+
return false;
|
36716
|
+
}
|
36717
|
+
const meaning = this._analyzer.resolvePropertyAccessExpression(expression).meaning;
|
36718
|
+
return meaning.kind === "instance-variable-access" && meaning.variable.value.equals(this.variable);
|
36719
|
+
} else {
|
36720
|
+
return false;
|
36721
|
+
}
|
36722
|
+
}
|
36723
|
+
containsExpression(expression) {
|
36724
|
+
let result = false;
|
36725
|
+
let reference = this;
|
36726
|
+
while (!result && reference.kind === "instance-type-variable") {
|
36727
|
+
reference = reference.receiver;
|
36728
|
+
result = reference.equalsExpression(expression);
|
36729
|
+
}
|
36730
|
+
return result;
|
36731
|
+
}
|
36216
36732
|
}
|
36217
36733
|
NarrowableReference2.InstanceTypeVariable = InstanceTypeVariable;
|
36218
36734
|
class StaticTypeVariable {
|
36219
|
-
constructor(variable) {
|
36735
|
+
constructor(_analyzer, variable) {
|
36736
|
+
this._analyzer = _analyzer;
|
36220
36737
|
this.variable = variable;
|
36221
36738
|
this.kind = "static-type-variable";
|
36222
36739
|
}
|
@@ -36226,6 +36743,27 @@ var NarrowableReference;
|
|
36226
36743
|
contains(_other) {
|
36227
36744
|
return false;
|
36228
36745
|
}
|
36746
|
+
equalsExpression(expression) {
|
36747
|
+
if (expression.kind === 88 /* IdentifierExpression */) {
|
36748
|
+
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
36749
|
+
return meaning.kind === "variable-access" && meaning.variable.value.kind === "type-member" && meaning.variable.value.value.equals(this.variable);
|
36750
|
+
} else if (expression.kind === 78 /* PropertyAccessExpression */) {
|
36751
|
+
let result = NarrowableReferenceComparisonUtils.checkExpressionDenotesType(
|
36752
|
+
this._analyzer,
|
36753
|
+
expression.expression
|
36754
|
+
);
|
36755
|
+
if (result) {
|
36756
|
+
const meaning = this._analyzer.resolvePropertyAccessExpression(expression).meaning;
|
36757
|
+
result = meaning.kind === "static-variable-access" && meaning.variable.value.equals(this.variable);
|
36758
|
+
}
|
36759
|
+
return result;
|
36760
|
+
} else {
|
36761
|
+
return false;
|
36762
|
+
}
|
36763
|
+
}
|
36764
|
+
containsExpression(_expression) {
|
36765
|
+
return false;
|
36766
|
+
}
|
36229
36767
|
}
|
36230
36768
|
NarrowableReference2.StaticTypeVariable = StaticTypeVariable;
|
36231
36769
|
class Object2 {
|
@@ -36238,9 +36776,49 @@ var NarrowableReference;
|
|
36238
36776
|
contains(_other) {
|
36239
36777
|
return false;
|
36240
36778
|
}
|
36779
|
+
equalsExpression(expression) {
|
36780
|
+
return expression.kind === 86 /* ObjectExpression */;
|
36781
|
+
}
|
36782
|
+
containsExpression(_expression) {
|
36783
|
+
return false;
|
36784
|
+
}
|
36241
36785
|
}
|
36242
36786
|
NarrowableReference2.Object = Object2;
|
36243
36787
|
})(NarrowableReference || (NarrowableReference = {}));
|
36788
|
+
var NarrowableReferenceComparisonUtils = class {
|
36789
|
+
static checkExpressionDenotesType(analyzer, expression) {
|
36790
|
+
expression = unwrapParenthesizedExpressions(expression);
|
36791
|
+
if (expression.kind === 88 /* IdentifierExpression */) {
|
36792
|
+
const meaning = analyzer.resolveIdentifierExpression(expression).meaning;
|
36793
|
+
return meaning.kind === "type-access";
|
36794
|
+
} else if (expression.kind === 78 /* PropertyAccessExpression */) {
|
36795
|
+
let result = this.checkExpressionDenotesPackage(analyzer, expression.expression);
|
36796
|
+
if (result) {
|
36797
|
+
const meaning = analyzer.resolvePropertyAccessExpression(expression).meaning;
|
36798
|
+
result = meaning.kind === "package-type-access";
|
36799
|
+
}
|
36800
|
+
return result;
|
36801
|
+
} else {
|
36802
|
+
return false;
|
36803
|
+
}
|
36804
|
+
}
|
36805
|
+
static checkExpressionDenotesPackage(analyzer, expression) {
|
36806
|
+
expression = unwrapParenthesizedExpressions(expression);
|
36807
|
+
if (expression.kind === 88 /* IdentifierExpression */) {
|
36808
|
+
const meaning = analyzer.resolveIdentifierExpression(expression).meaning;
|
36809
|
+
return meaning.kind === "package-name-segment-access" || meaning.kind === "package-alias-access";
|
36810
|
+
} else if (expression.kind === 78 /* PropertyAccessExpression */) {
|
36811
|
+
let result = this.checkExpressionDenotesPackage(analyzer, expression.expression);
|
36812
|
+
if (result) {
|
36813
|
+
const meaning = analyzer.resolvePropertyAccessExpression(expression).meaning;
|
36814
|
+
result = meaning.kind === "package-name-segment-access";
|
36815
|
+
}
|
36816
|
+
return result;
|
36817
|
+
} else {
|
36818
|
+
return false;
|
36819
|
+
}
|
36820
|
+
}
|
36821
|
+
};
|
36244
36822
|
|
36245
36823
|
// source/analysis/TypeOverloadResolver.ts
|
36246
36824
|
var Resolver12 = class {
|
@@ -36276,8 +36854,13 @@ var UserDefinableBinaryOperatorResolver = class {
|
|
36276
36854
|
const typeExtensionLookup = semanticContext.getScopeLookup();
|
36277
36855
|
const lctx = semanticContext.getLocalizationContext();
|
36278
36856
|
const nonNullableLeftType = this._analyzer.excludeNoneFromType(this.leftType);
|
36279
|
-
const leftTypeMemberLookup =
|
36280
|
-
const operators = leftTypeMemberLookup.getOperatorsByKind(
|
36857
|
+
const leftTypeMemberLookup = TypeMemberLookup.ofType(this._analyzer, nonNullableLeftType, lctx);
|
36858
|
+
const operators = leftTypeMemberLookup.getOperatorsByKind(
|
36859
|
+
this._operatorKind,
|
36860
|
+
1 /* OnlyInstanceMembers */,
|
36861
|
+
hidingMatcher,
|
36862
|
+
typeExtensionLookup
|
36863
|
+
).filter((o) => o.value.getValueParameters().length === 1);
|
36281
36864
|
if (operators.length > 0) {
|
36282
36865
|
const suitableOperators = this.chooseSuitableOperators(operators);
|
36283
36866
|
if (suitableOperators.length === 1) {
|
@@ -36394,8 +36977,13 @@ var UserDefinableUnaryOperatorResolver = class {
|
|
36394
36977
|
const typeExtensionLookup = semanticContext.getScopeLookup();
|
36395
36978
|
const nonNullableOperandType = this._analyzer.excludeNoneFromType(operandType);
|
36396
36979
|
const lctx = semanticContext.getLocalizationContext();
|
36397
|
-
const typeMemberLookup =
|
36398
|
-
const operators = typeMemberLookup.getOperatorsByKind(
|
36980
|
+
const typeMemberLookup = TypeMemberLookup.ofType(this._analyzer, nonNullableOperandType, lctx);
|
36981
|
+
const operators = typeMemberLookup.getOperatorsByKind(
|
36982
|
+
this.operatorKind,
|
36983
|
+
1 /* OnlyInstanceMembers */,
|
36984
|
+
hidingMatcher,
|
36985
|
+
typeExtensionLookup
|
36986
|
+
).filter((o) => o.value.getValueParameters().length === 0);
|
36399
36987
|
if (operators.length === 1) {
|
36400
36988
|
return new WithDiagnostics_ok(operators[0]);
|
36401
36989
|
}
|
@@ -36501,7 +37089,7 @@ var Analyzer = class _Analyzer {
|
|
36501
37089
|
Debug.assertNotNull(parameter, "There must be type parameter.");
|
36502
37090
|
result = implementedEnumerableAspect.getSubstitutions().map.get(parameter) ?? this.standardTypes.unresolved;
|
36503
37091
|
} else {
|
36504
|
-
const memberLookup =
|
37092
|
+
const memberLookup = TypeMemberLookup.ofType(this, type, void 0);
|
36505
37093
|
const member = memberLookup.getNamedMembersByName(new SearchName(new Name(_Analyzer.enumeratorMethodName), true)).at(0);
|
36506
37094
|
if (member?.value.kind === "method") {
|
36507
37095
|
const returnType = member.value.getReturnType();
|
@@ -37814,9 +38402,9 @@ var Analyzer = class _Analyzer {
|
|
37814
38402
|
return void 0;
|
37815
38403
|
}
|
37816
38404
|
const block = node.block;
|
37817
|
-
let expression
|
37818
|
-
if (
|
37819
|
-
const firstStatement = block.
|
38405
|
+
let expression;
|
38406
|
+
if (block.expressionOrStatementList.kind === 92 /* StatementList */) {
|
38407
|
+
const firstStatement = block.expressionOrStatementList?.statements.first();
|
37820
38408
|
if (firstStatement?.kind !== 106 /* ExpressionStatement */) {
|
37821
38409
|
diagnostics?.addDiagnostic(this.createNodeDiagnostic(
|
37822
38410
|
108 /* IncorrectBodyOfRedefinableAliasTypeMethod */,
|
@@ -37825,6 +38413,8 @@ var Analyzer = class _Analyzer {
|
|
37825
38413
|
return void 0;
|
37826
38414
|
}
|
37827
38415
|
expression = firstStatement.expression;
|
38416
|
+
} else {
|
38417
|
+
expression = block.expressionOrStatementList;
|
37828
38418
|
}
|
37829
38419
|
if (expression.kind !== 69 /* CallExpression */) {
|
37830
38420
|
diagnostics?.addDiagnostic(this.createNodeDiagnostic(
|
@@ -39022,7 +39612,7 @@ var TargetType = class {
|
|
39022
39612
|
return void 0;
|
39023
39613
|
}
|
39024
39614
|
getTargetTypeOfChildOfFunctionBlock(parent, child) {
|
39025
|
-
Debug.assert(child === parent.
|
39615
|
+
Debug.assert(child === parent.expressionOrStatementList);
|
39026
39616
|
const semanticContext = this._analyzer.semanticContext.ofFunctionBlock(parent);
|
39027
39617
|
let returnType = semanticContext.getContainingSubprogram()?.getReturnType();
|
39028
39618
|
if (returnType !== void 0 && returnType.equals(this._analyzer.standardTypes.none)) {
|
@@ -40014,8 +40604,8 @@ var Scope = class {
|
|
40014
40604
|
Substitutions2.identity(this._analyzer, entity.getTypeParameters())
|
40015
40605
|
);
|
40016
40606
|
const semanticContext = this._analyzer.semanticContext.containing(node);
|
40017
|
-
result = new
|
40018
|
-
|
40607
|
+
result = new TypeWithMembersOrExtensionBodyScope(
|
40608
|
+
TypeMemberLookup.ofType(this._analyzer, type, semanticContext.getLocalizationContext()),
|
40019
40609
|
semanticContext.getScopeLookup()
|
40020
40610
|
);
|
40021
40611
|
this._structuredTypeDeclarationBodyScopes.set(node, result);
|
@@ -40077,8 +40667,8 @@ var Scope = class {
|
|
40077
40667
|
Substitutions2.identity(this._analyzer, entity.getTypeParameters())
|
40078
40668
|
);
|
40079
40669
|
const semanticContext = this._analyzer.semanticContext.containing(node);
|
40080
|
-
result = new
|
40081
|
-
|
40670
|
+
result = new TypeWithMembersOrExtensionBodyScope(
|
40671
|
+
TypeMemberLookup.ofType(this._analyzer, type, semanticContext.getLocalizationContext()),
|
40082
40672
|
semanticContext.getScopeLookup()
|
40083
40673
|
);
|
40084
40674
|
this._variantTypeDeclarationBodyScopes.set(node, result);
|
@@ -40094,8 +40684,8 @@ var Scope = class {
|
|
40094
40684
|
Substitutions2.identity(this._analyzer, entity.getTypeParameters())
|
40095
40685
|
);
|
40096
40686
|
const semanticContext = this._analyzer.semanticContext.containing(node);
|
40097
|
-
result = new
|
40098
|
-
|
40687
|
+
result = new TypeWithMembersOrExtensionBodyScope(
|
40688
|
+
TypeMemberLookup.ofType(this._analyzer, type, semanticContext.getLocalizationContext()),
|
40099
40689
|
semanticContext.getScopeLookup()
|
40100
40690
|
);
|
40101
40691
|
this._aliasTypeDeclarationBodyScopes.set(node, result);
|
@@ -40150,22 +40740,13 @@ var Scope = class {
|
|
40150
40740
|
let result = this._typeExtensionDeclarationScopes.get(node);
|
40151
40741
|
if (result === void 0) {
|
40152
40742
|
const entity = this._analyzer.entity.ofTypeExtensionDeclaration(node);
|
40153
|
-
const extendedTypeEntity = entity.getExtendedTypeEntity();
|
40154
|
-
let extendedTypeMemberLookup;
|
40155
40743
|
const semanticContext = this._analyzer.semanticContext.containing(node);
|
40156
|
-
|
40157
|
-
const type = this._analyzer.instantiateTypeByIdentitySubstitution(extendedTypeEntity);
|
40158
|
-
extendedTypeMemberLookup = new TypeMemberLookup(this._analyzer, type, semanticContext.getLocalizationContext());
|
40159
|
-
}
|
40160
|
-
const locale = TreeQuery.fromNode(node).packageEntity(this._analyzer).getLocale();
|
40161
|
-
result = new TypeExtensionBodyScope(
|
40744
|
+
const memberLookup = TypeMemberLookup.ofTypeExtension(
|
40162
40745
|
this._analyzer,
|
40163
|
-
extendedTypeMemberLookup,
|
40164
|
-
extendedTypeEntity,
|
40165
40746
|
entity,
|
40166
|
-
semanticContext.
|
40167
|
-
locale
|
40747
|
+
semanticContext.getLocalizationContext()
|
40168
40748
|
);
|
40749
|
+
result = new TypeWithMembersOrExtensionBodyScope(memberLookup, semanticContext.getScopeLookup());
|
40169
40750
|
this._typeExtensionDeclarationScopes.set(node, result);
|
40170
40751
|
}
|
40171
40752
|
return result;
|
@@ -40277,7 +40858,7 @@ var DefaultConstructors = class {
|
|
40277
40858
|
if (baseType !== void 0) {
|
40278
40859
|
const semanticContext = this._analyzer.semanticContext.containing(node);
|
40279
40860
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
40280
|
-
const lookup =
|
40861
|
+
const lookup = TypeMemberLookup.ofType(this._analyzer, baseType, void 0);
|
40281
40862
|
result = lookup.getConstructors(hidingMatcher).map((c) => new DefaultConstructorEntity(this._analyzer, typeEntity, variablesToInitialize, c));
|
40282
40863
|
} else {
|
40283
40864
|
result = [new DefaultConstructorEntity(this._analyzer, typeEntity, variablesToInitialize, void 0)];
|
@@ -40418,7 +40999,14 @@ var OverriddenMember = class {
|
|
40418
40999
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
40419
41000
|
const typeExtensionLookup = semanticContext.getScopeLookup();
|
40420
41001
|
for (const type of this.enumerateTypesForOverriddenMemberLookup(container.typeEntity)) {
|
40421
|
-
yield
|
41002
|
+
yield BoundTypeMemberLookup.ofType(
|
41003
|
+
this._analyzer,
|
41004
|
+
type,
|
41005
|
+
localizationContext,
|
41006
|
+
1 /* OnlyInstanceMembers */,
|
41007
|
+
hidingMatcher,
|
41008
|
+
typeExtensionLookup
|
41009
|
+
);
|
40422
41010
|
}
|
40423
41011
|
}
|
40424
41012
|
*enumerateTypesForOverriddenMemberLookup(entity) {
|
@@ -41111,22 +41699,22 @@ var TypeAssignabilityCheck = class {
|
|
41111
41699
|
}
|
41112
41700
|
isTypeAssignableTo(source, target) {
|
41113
41701
|
const assignabilityFlags = this.getAssignabilityFlags(source, target);
|
41114
|
-
return assignabilityFlags !==
|
41702
|
+
return assignabilityFlags !== 0 /* NotAssignable */;
|
41115
41703
|
}
|
41116
41704
|
getAssignabilityFlags(source, target) {
|
41117
41705
|
source = unaliasType(source);
|
41118
41706
|
target = unaliasType(target);
|
41119
41707
|
if (source.kind === "unresolved" || target.kind === "unresolved") {
|
41120
|
-
return
|
41708
|
+
return 0 /* NotAssignable */;
|
41121
41709
|
}
|
41122
41710
|
if (source.equals(target)) {
|
41123
|
-
return
|
41711
|
+
return 1 /* Identity */;
|
41124
41712
|
}
|
41125
41713
|
if (target.kind === "parameter") {
|
41126
41714
|
if (source.kind === "parameter" && source.getEntity() === target.getEntity() && (this._analyzer.canTypeParameterBeNone(target) || !this._analyzer.canTypeParameterBeNone(source))) {
|
41127
|
-
return
|
41715
|
+
return 1 /* Identity */;
|
41128
41716
|
} else {
|
41129
|
-
return
|
41717
|
+
return 0 /* NotAssignable */;
|
41130
41718
|
}
|
41131
41719
|
}
|
41132
41720
|
if (source.kind === "parameter" && source.constraint !== void 0) {
|
@@ -41135,16 +41723,16 @@ var TypeAssignabilityCheck = class {
|
|
41135
41723
|
constraint = this._analyzer.excludeNoneFromType(constraint);
|
41136
41724
|
}
|
41137
41725
|
const result = this.getAssignabilityFlags(constraint, target);
|
41138
|
-
if (result !==
|
41726
|
+
if (result !== 0 /* NotAssignable */) {
|
41139
41727
|
return result;
|
41140
41728
|
}
|
41141
41729
|
}
|
41142
41730
|
if (source.kind === "union") {
|
41143
|
-
let result =
|
41731
|
+
let result = 0 /* NotAssignable */;
|
41144
41732
|
for (const type of source.unaliasedFlattenedTypes) {
|
41145
41733
|
const constituentTypeResult = this.getAssignabilityFlags(type, target);
|
41146
|
-
if (constituentTypeResult ===
|
41147
|
-
result =
|
41734
|
+
if (constituentTypeResult === 0 /* NotAssignable */) {
|
41735
|
+
result = 0 /* NotAssignable */;
|
41148
41736
|
break;
|
41149
41737
|
}
|
41150
41738
|
result |= constituentTypeResult;
|
@@ -41152,7 +41740,7 @@ var TypeAssignabilityCheck = class {
|
|
41152
41740
|
return result;
|
41153
41741
|
}
|
41154
41742
|
if (target.kind === "union") {
|
41155
|
-
let result =
|
41743
|
+
let result = 0 /* NotAssignable */;
|
41156
41744
|
for (const type of target.unaliasedFlattenedTypes) {
|
41157
41745
|
const constituentTypeResult = this.getAssignabilityFlags(source, type);
|
41158
41746
|
if (this.areNewFlagsBetter(result, constituentTypeResult)) {
|
@@ -41162,24 +41750,24 @@ var TypeAssignabilityCheck = class {
|
|
41162
41750
|
return result;
|
41163
41751
|
}
|
41164
41752
|
if (source.equals(this._analyzer.standardTypes.none) || target.equals(this._analyzer.standardTypes.none)) {
|
41165
|
-
return source.equals(target) ?
|
41753
|
+
return source.equals(target) ? 1 /* Identity */ : 0 /* NotAssignable */;
|
41166
41754
|
}
|
41167
41755
|
if (!this._analyzer.canTypeBeNone(source) && target.equals(this._analyzer.standardTypes.refObject)) {
|
41168
|
-
return
|
41756
|
+
return 2 /* DerivedToBase */;
|
41169
41757
|
}
|
41170
41758
|
if (source.equals(this._analyzer.standardTypes.integer) && target.equals(this._analyzer.standardTypes.number)) {
|
41171
|
-
return
|
41759
|
+
return 8 /* ImplicitConversion */;
|
41172
41760
|
}
|
41173
41761
|
if (source.equals(this._analyzer.standardTypes.char) && target.equals(this._analyzer.standardTypes.text)) {
|
41174
|
-
return
|
41762
|
+
return 8 /* ImplicitConversion */;
|
41175
41763
|
}
|
41176
41764
|
if (source.equals(this._analyzer.standardTypes.textTemplate) && target.equals(this._analyzer.standardTypes.text)) {
|
41177
|
-
return
|
41765
|
+
return 8 /* ImplicitConversion */;
|
41178
41766
|
}
|
41179
41767
|
if (source.kind === "variant") {
|
41180
41768
|
let result = this.getAssignabilityFlags(source.getUnderlyingType(), target);
|
41181
|
-
if (result !==
|
41182
|
-
result |=
|
41769
|
+
if (result !== 0 /* NotAssignable */) {
|
41770
|
+
result |= 8 /* ImplicitConversion */;
|
41183
41771
|
}
|
41184
41772
|
return result;
|
41185
41773
|
}
|
@@ -41189,7 +41777,7 @@ var TypeAssignabilityCheck = class {
|
|
41189
41777
|
if (source.kind === "structured" && target.kind === "structured") {
|
41190
41778
|
return this.getAssignabilityFlagsForStructuredTypes(source, target);
|
41191
41779
|
}
|
41192
|
-
return
|
41780
|
+
return 0 /* NotAssignable */;
|
41193
41781
|
}
|
41194
41782
|
getAssignabilityFlagsForStructuredTypes(source, target) {
|
41195
41783
|
const queue = [source];
|
@@ -41207,7 +41795,7 @@ var TypeAssignabilityCheck = class {
|
|
41207
41795
|
queue.unshift(...currentType.getBaseAspectTypes().map((t) => unaliasType(t)).filter((t) => t.kind === "structured"));
|
41208
41796
|
}
|
41209
41797
|
}
|
41210
|
-
return isAssignable ?
|
41798
|
+
return isAssignable ? 2 /* DerivedToBase */ : 0 /* NotAssignable */;
|
41211
41799
|
}
|
41212
41800
|
/**
|
41213
41801
|
* @example
|
@@ -41221,30 +41809,30 @@ var TypeAssignabilityCheck = class {
|
|
41221
41809
|
*/
|
41222
41810
|
getAssignabilityFlagsForMethodTypes(source, target) {
|
41223
41811
|
if (source.isAsync() !== target.isAsync()) {
|
41224
|
-
return
|
41812
|
+
return 0 /* NotAssignable */;
|
41225
41813
|
}
|
41226
41814
|
const sourceValueParameters = source.getValueParameters();
|
41227
41815
|
const targetValueParameters = target.getValueParameters();
|
41228
41816
|
if (sourceValueParameters.length !== targetValueParameters.length) {
|
41229
|
-
return
|
41817
|
+
return 0 /* NotAssignable */;
|
41230
41818
|
}
|
41231
41819
|
for (let i = 0; i < sourceValueParameters.length; i++) {
|
41232
41820
|
const sourceParameterType = sourceValueParameters[i].getType();
|
41233
41821
|
const targetParameterType = targetValueParameters[i].getType();
|
41234
41822
|
if (!this.isTypeAssignableTo(targetParameterType, sourceParameterType)) {
|
41235
|
-
return
|
41823
|
+
return 0 /* NotAssignable */;
|
41236
41824
|
}
|
41237
41825
|
}
|
41238
41826
|
if (!this.isTypeAssignableTo(source.getReturnType(), target.getReturnType())) {
|
41239
|
-
return
|
41827
|
+
return 0 /* NotAssignable */;
|
41240
41828
|
}
|
41241
|
-
return
|
41829
|
+
return 4 /* MethodTypes */;
|
41242
41830
|
}
|
41243
41831
|
areNewFlagsBetter(currentFlags, newFlags) {
|
41244
41832
|
if (newFlags === currentFlags) {
|
41245
41833
|
return false;
|
41246
41834
|
}
|
41247
|
-
if (currentFlags ===
|
41835
|
+
if (currentFlags === 0 /* NotAssignable */) {
|
41248
41836
|
return true;
|
41249
41837
|
}
|
41250
41838
|
const currentLowestScore = this.getLowestFlagsScore(currentFlags);
|
@@ -41258,9 +41846,12 @@ var TypeAssignabilityCheck = class {
|
|
41258
41846
|
}
|
41259
41847
|
}
|
41260
41848
|
getLowestFlagsScore(flags) {
|
41849
|
+
if (flags === 0 /* NotAssignable */) {
|
41850
|
+
return -1;
|
41851
|
+
}
|
41261
41852
|
let lowestScore = Number.MAX_SAFE_INTEGER;
|
41262
41853
|
let current = 1 /* First */;
|
41263
|
-
while (current <=
|
41854
|
+
while (current <= 8 /* Last */) {
|
41264
41855
|
if ((flags & current) !== 0) {
|
41265
41856
|
const score = this.getSingleFlagScore(current);
|
41266
41857
|
if (score < lowestScore) {
|
@@ -41274,7 +41865,7 @@ var TypeAssignabilityCheck = class {
|
|
41274
41865
|
getFlagCount(flags) {
|
41275
41866
|
let result = 0;
|
41276
41867
|
let current = 1 /* First */;
|
41277
|
-
while (current <=
|
41868
|
+
while (current <= 8 /* Last */) {
|
41278
41869
|
if ((flags & current) !== 0) {
|
41279
41870
|
result++;
|
41280
41871
|
}
|
@@ -41288,15 +41879,15 @@ var TypeAssignabilityCheck = class {
|
|
41288
41879
|
*/
|
41289
41880
|
getSingleFlagScore(flag) {
|
41290
41881
|
switch (flag) {
|
41291
|
-
case
|
41882
|
+
case 0 /* NotAssignable */:
|
41292
41883
|
return 0;
|
41293
|
-
case
|
41884
|
+
case 1 /* Identity */:
|
41294
41885
|
return 10;
|
41295
|
-
case
|
41886
|
+
case 2 /* DerivedToBase */:
|
41296
41887
|
return 9;
|
41297
|
-
case
|
41888
|
+
case 4 /* MethodTypes */:
|
41298
41889
|
return 8;
|
41299
|
-
case
|
41890
|
+
case 8 /* ImplicitConversion */:
|
41300
41891
|
return 7;
|
41301
41892
|
default:
|
41302
41893
|
Debug.typeIsAssignableTo();
|
@@ -41305,13 +41896,13 @@ var TypeAssignabilityCheck = class {
|
|
41305
41896
|
}
|
41306
41897
|
};
|
41307
41898
|
var TypeAssignabilityFlags = /* @__PURE__ */ ((TypeAssignabilityFlags2) => {
|
41308
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["NotAssignable"] =
|
41309
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["Identity"] =
|
41310
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["DerivedToBase"] =
|
41311
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["MethodTypes"] =
|
41312
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["ImplicitConversion"] =
|
41313
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["First"] = 1 /*
|
41314
|
-
TypeAssignabilityFlags2[TypeAssignabilityFlags2["Last"] =
|
41899
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["NotAssignable"] = 0] = "NotAssignable";
|
41900
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["Identity"] = 1] = "Identity";
|
41901
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["DerivedToBase"] = 2] = "DerivedToBase";
|
41902
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["MethodTypes"] = 4] = "MethodTypes";
|
41903
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["ImplicitConversion"] = 8] = "ImplicitConversion";
|
41904
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["First"] = 1 /* Identity */] = "First";
|
41905
|
+
TypeAssignabilityFlags2[TypeAssignabilityFlags2["Last"] = 8 /* ImplicitConversion */] = "Last";
|
41315
41906
|
return TypeAssignabilityFlags2;
|
41316
41907
|
})(TypeAssignabilityFlags || {});
|
41317
41908
|
var PackageImports = class {
|
@@ -46533,6 +47124,15 @@ function isTypeEntityWithMembers(entity) {
|
|
46533
47124
|
Debug.never(entity);
|
46534
47125
|
}
|
46535
47126
|
}
|
47127
|
+
function isTypeWithMembersOrExtensionEntity(entity) {
|
47128
|
+
if (entity.kind === 2 /* Type */) {
|
47129
|
+
return isTypeEntityWithMembers(entity);
|
47130
|
+
} else if (entity.kind === 11 /* TypeExtension */) {
|
47131
|
+
return true;
|
47132
|
+
} else {
|
47133
|
+
return false;
|
47134
|
+
}
|
47135
|
+
}
|
46536
47136
|
function isTypeEntity(entity) {
|
46537
47137
|
return entity.kind === 2 /* Type */;
|
46538
47138
|
}
|
@@ -54857,22 +55457,14 @@ var IrBuilder = class {
|
|
54857
55457
|
return new PackageMethodDeclaration3(modifiers, [], body, entity, false, this.getSourceLocation(declaration));
|
54858
55458
|
}
|
54859
55459
|
buildFunctionBlockOfFunction(node, resultLocalVariable) {
|
54860
|
-
const isResultNone = this._analyzer.isFunctionResultNone(node);
|
54861
55460
|
let statements = void 0;
|
54862
|
-
if (node.
|
54863
|
-
const expression = this.buildExpression(node.expression);
|
54864
|
-
if (isResultNone) {
|
54865
|
-
statements = [new ExpressionStatement3(expression, this.getSourceLocation(node.expression))];
|
54866
|
-
} else {
|
54867
|
-
statements = [new ReturnStatement3(expression, void 0)];
|
54868
|
-
}
|
54869
|
-
} else if (node.statementList !== void 0) {
|
55461
|
+
if (node.expressionOrStatementList.kind === 92 /* StatementList */) {
|
54870
55462
|
const usageCount = this._declarationsUsageCountResult.getUsageCount(resultLocalVariable);
|
54871
55463
|
if (usageCount === 0) {
|
54872
|
-
statements = node.
|
55464
|
+
statements = node.expressionOrStatementList.statements.map((s) => this.buildStatement(s)).toArray();
|
54873
55465
|
} else {
|
54874
55466
|
if (usageCount === 1) {
|
54875
|
-
const statement = node.
|
55467
|
+
const statement = node.expressionOrStatementList.statements.single((s) => s.kind !== 103 /* EmptyStatement */);
|
54876
55468
|
if (statement?.kind === 91 /* AssignmentStatement */ && statement.left.kind === 88 /* IdentifierExpression */) {
|
54877
55469
|
const meaning = this._analyzer.resolveIdentifierExpression(statement.left).meaning;
|
54878
55470
|
if (meaning.kind === "variable-access" && meaning.variable.value.getEntity() === resultLocalVariable) {
|
@@ -54894,26 +55486,30 @@ var IrBuilder = class {
|
|
54894
55486
|
);
|
54895
55487
|
statements = [
|
54896
55488
|
resultVariableDeclarationStatement,
|
54897
|
-
...node.
|
55489
|
+
...node.expressionOrStatementList.statements.map((s) => this.buildStatement(s)),
|
54898
55490
|
returnStatement2
|
54899
55491
|
];
|
54900
55492
|
}
|
54901
55493
|
}
|
54902
55494
|
} else {
|
54903
|
-
|
55495
|
+
const isResultNone = this._analyzer.isFunctionResultNone(node);
|
55496
|
+
const expression = this.buildExpression(node.expressionOrStatementList);
|
55497
|
+
if (isResultNone) {
|
55498
|
+
statements = [new ExpressionStatement3(expression, this.getSourceLocation(node.expressionOrStatementList))];
|
55499
|
+
} else {
|
55500
|
+
statements = [new ReturnStatement3(expression, void 0)];
|
55501
|
+
}
|
54904
55502
|
}
|
54905
55503
|
return new BlockStatement(statements, this.getSourceLocation(node));
|
54906
55504
|
}
|
54907
55505
|
buildFunctionBlockOfFunctionWithoutResult(node) {
|
54908
55506
|
let statements;
|
54909
|
-
if (node.
|
54910
|
-
|
54911
|
-
const statement = new ExpressionStatement3(expression, this.getSourceLocation(node.expression));
|
54912
|
-
statements = [statement];
|
54913
|
-
} else if (node.statementList !== void 0) {
|
54914
|
-
statements = node.statementList.statements.map((s) => this.buildStatement(s)).toArray();
|
55507
|
+
if (node.expressionOrStatementList.kind === 92 /* StatementList */) {
|
55508
|
+
statements = node.expressionOrStatementList.statements.map((s) => this.buildStatement(s)).toArray();
|
54915
55509
|
} else {
|
54916
|
-
|
55510
|
+
const expression = this.buildExpression(node.expressionOrStatementList);
|
55511
|
+
const statement = new ExpressionStatement3(expression, this.getSourceLocation(node.expressionOrStatementList));
|
55512
|
+
statements = [statement];
|
54917
55513
|
}
|
54918
55514
|
return new BlockStatement(statements, this.getSourceLocation(node));
|
54919
55515
|
}
|
@@ -59669,6 +60265,7 @@ export {
|
|
59669
60265
|
EntityKind,
|
59670
60266
|
isPackageTypeEntity,
|
59671
60267
|
isTypeEntityWithMembers,
|
60268
|
+
isTypeWithMembersOrExtensionEntity,
|
59672
60269
|
isTypeEntity,
|
59673
60270
|
isNamedTypeEntity,
|
59674
60271
|
isPackageMemberEntity,
|
@@ -59686,6 +60283,7 @@ export {
|
|
59686
60283
|
FoundAnonymousDeclaration,
|
59687
60284
|
TypeMemberLookup,
|
59688
60285
|
BoundTypeMemberLookup,
|
60286
|
+
TypeMemberLookupOptions,
|
59689
60287
|
TsProgramState,
|
59690
60288
|
TsProgramLoader,
|
59691
60289
|
createTsInteropInputsForCompilation,
|
@@ -59733,6 +60331,7 @@ export {
|
|
59733
60331
|
MethodLiteralSemanticContext,
|
59734
60332
|
ForStatementSemanticContext,
|
59735
60333
|
CatchClauseSemanticContext,
|
60334
|
+
TypeVariableWithInitializerSemanticContext,
|
59736
60335
|
SourceFileMembers,
|
59737
60336
|
TargetTypeHint,
|
59738
60337
|
Analyzer,
|