@artel/artc 0.6.25249 → 0.6.25251
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 +10 -4
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +295 -254
- package/build/{chunk-6OPBY3SK.js → chunk-IZHH3TQT.js} +8 -6
- package/build/{chunk-CBYKP5SE.js → chunk-KGZLMBKA.js} +2 -2
- package/build/{chunk-G4UMALLG.js → chunk-XARNKP3Q.js} +2333 -1724
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +4 -4
- package/build/types/analysis/Analyzer.d.ts +23 -14
- package/build/types/analysis/DeclarationsUsageCounter.d.ts +3 -4
- package/build/types/analysis/DiagnosticCollector.d.ts +3 -5
- package/build/types/analysis/InstanceFieldsInitializationValidator.d.ts +2 -2
- package/build/types/analysis/Localization.d.ts +1 -1
- package/build/types/analysis/NodeTypeUtils.d.ts +1 -1
- package/build/types/analysis/PackageAndStaticVariablesInitializationValidator.d.ts +3 -3
- package/build/types/analysis/TypeNarrower.d.ts +1 -1
- package/build/types/analysis/WellKnownDeclarations.d.ts +3 -3
- package/build/types/diagnostic/DiagnosticCode.d.ts +11 -13
- package/build/types/emitter/Emitter.d.ts +4 -8
- package/build/types/emitter/EmitterContext.d.ts +2 -2
- package/build/types/emitter/Entities.d.ts +1 -0
- package/build/types/emitter/EntityMap.d.ts +1 -0
- package/build/types/emitter/IrBuilder.d.ts +18 -10
- package/build/types/emitter/IrToJs.d.ts +1 -1
- package/build/types/emitter/Transformer.d.ts +7 -2
- package/build/types/emitter/ir/EmitOptions.d.ts +5 -5
- package/build/types/emitter/ir/Nodes.d.ts +185 -147
- package/build/types/emitter/ir/types.d.ts +3 -3
- package/build/types/entities/LocalizableTextEntity.d.ts +75 -0
- package/build/types/entities/VariableEntity.d.ts +3 -3
- package/build/types/entities/index.d.ts +5 -2
- package/build/types/services/DisplayService.d.ts +4 -3
- package/build/types/tree/KeywordKind.d.ts +1 -1
- package/build/types/tree/NodeKind.d.ts +88 -84
- package/build/types/tree/green/Nodes.d.ts +96 -55
- package/build/types/tree/green/SyntaxFactory.d.ts +6 -6
- package/build/types/tree/red/Nodes.d.ts +137 -92
- package/build/types/ts-interop/Entities.d.ts +0 -1
- package/build/types/ts-interop/TsInteropContext.d.ts +1 -1
- package/build/types/types/ParameterType.d.ts +3 -3
- package/build/types/types/StandardTypes.d.ts +2 -2
- package/package.json +2 -2
package/build/api/ApiServices.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
FunctionDeclaration_substitutedFunction,
|
|
39
39
|
FunctionDeclaration_typeMember,
|
|
40
40
|
FunctionTypeDeclarationBody,
|
|
41
|
-
|
|
41
|
+
FunctionTypeTranslationDeclaration,
|
|
42
42
|
GeneratedSourceFileScheme,
|
|
43
43
|
GenericCancellationToken,
|
|
44
44
|
InMemoryPackageScheme,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
OperatorDeclaration_typeMember,
|
|
76
76
|
PackageAliasTypeDeclaration,
|
|
77
77
|
PackageFunctionDeclaration,
|
|
78
|
-
|
|
78
|
+
PackageFunctionTranslationDeclaration,
|
|
79
79
|
PackageFunctionTypeDeclaration,
|
|
80
80
|
PackageImport,
|
|
81
81
|
PackageImportDirectiveList,
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
PackageVariableDeclaration,
|
|
88
88
|
PackageVariableGetterDeclaration,
|
|
89
89
|
PackageVariableSetterDeclaration,
|
|
90
|
-
|
|
90
|
+
PackageVariableTranslationDeclaration,
|
|
91
91
|
PackageVariantTypeDeclaration,
|
|
92
92
|
ParameterClause,
|
|
93
93
|
ParameterDeclaration,
|
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
TypeParameterClause,
|
|
141
141
|
TypeParameterDeclaration,
|
|
142
142
|
TypeParameterList,
|
|
143
|
-
|
|
143
|
+
TypeTranslationDeclaration,
|
|
144
144
|
UnionTypeSpecifier,
|
|
145
145
|
Uri,
|
|
146
146
|
ValueParameterDeclaration_matchResultValueParameter,
|
|
@@ -178,7 +178,7 @@ import {
|
|
|
178
178
|
unwrapParenthesizedExpressions,
|
|
179
179
|
visitChildren,
|
|
180
180
|
yieldExecution
|
|
181
|
-
} from "../chunk-
|
|
181
|
+
} from "../chunk-XARNKP3Q.js";
|
|
182
182
|
|
|
183
183
|
// source/services/CustomCommand.ts
|
|
184
184
|
import * as ls from "vscode-languageserver";
|
|
@@ -315,7 +315,7 @@ var AddPropertyAssignmentService = class {
|
|
|
315
315
|
const reassignmentText = `${leftValueText} = ${value}`;
|
|
316
316
|
const subprogramBody = this.ifShouldBeAssignedAtTheEndOfSubprogramThenBody(assignmentNode);
|
|
317
317
|
if (subprogramBody !== void 0) {
|
|
318
|
-
const lastStatement = subprogramBody.expressionOrStatementList.kind ===
|
|
318
|
+
const lastStatement = subprogramBody.expressionOrStatementList.kind === 93 /* StatementList */ ? subprogramBody.expressionOrStatementList?.statements.last() : subprogramBody.expressionOrStatementList;
|
|
319
319
|
let editRangeStart;
|
|
320
320
|
let indentationText;
|
|
321
321
|
if (lastStatement !== void 0) {
|
|
@@ -347,9 +347,9 @@ var AddPropertyAssignmentService = class {
|
|
|
347
347
|
ifShouldBeAssignedAtTheEndOfSubprogramThenBody(node) {
|
|
348
348
|
const parent = node.parent.parent;
|
|
349
349
|
switch (parent.kind) {
|
|
350
|
-
case
|
|
350
|
+
case 94 /* StatementBlock */:
|
|
351
351
|
return this.getContainingSubprogram(parent)?.block;
|
|
352
|
-
case
|
|
352
|
+
case 95 /* FunctionBlock */:
|
|
353
353
|
return void 0;
|
|
354
354
|
default:
|
|
355
355
|
Debug.never(parent);
|
|
@@ -840,8 +840,8 @@ var SyntaxFactory = class {
|
|
|
840
840
|
const closeBraceToken = this.token(21 /* CloseBrace */);
|
|
841
841
|
return new FunctionBlock(openBraceToken, statementList, closeBraceToken);
|
|
842
842
|
}
|
|
843
|
-
static
|
|
844
|
-
return new KeywordExpression(this.keyword(57 /*
|
|
843
|
+
static nullLiteral() {
|
|
844
|
+
return new KeywordExpression(this.keyword(57 /* Null */));
|
|
845
845
|
}
|
|
846
846
|
static integerLiteral(value) {
|
|
847
847
|
return new TokenExpression(this.token(2 /* IntegerLiteral */, value.toString()));
|
|
@@ -866,7 +866,7 @@ var SyntaxFactory = class {
|
|
|
866
866
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
|
867
867
|
const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
|
|
868
868
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
|
869
|
-
return new
|
|
869
|
+
return new PackageVariableTranslationDeclaration(sourceNameIdentifier, minusGreaterThanToken, translatedNameIdentifier);
|
|
870
870
|
}
|
|
871
871
|
static packageFunctionTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
|
872
872
|
const functionKeyword = this.keyword(12 /* Function */);
|
|
@@ -877,7 +877,7 @@ var SyntaxFactory = class {
|
|
|
877
877
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
|
878
878
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
|
879
879
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
|
880
|
-
return new
|
|
880
|
+
return new PackageFunctionTranslationDeclaration(
|
|
881
881
|
functionKeyword,
|
|
882
882
|
sourceNameIdentifier,
|
|
883
883
|
sourceTypeParameterClause,
|
|
@@ -903,7 +903,7 @@ var SyntaxFactory = class {
|
|
|
903
903
|
memberList = new TypeMemberTranslationList(members);
|
|
904
904
|
closeBraceToken = this.token(21 /* CloseBrace */);
|
|
905
905
|
}
|
|
906
|
-
return new
|
|
906
|
+
return new TypeTranslationDeclaration(
|
|
907
907
|
typeKeyword,
|
|
908
908
|
sourceNameIdentifier,
|
|
909
909
|
sourceTypeParameterClause,
|
|
@@ -924,7 +924,7 @@ var SyntaxFactory = class {
|
|
|
924
924
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
|
925
925
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
|
926
926
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
|
927
|
-
return new
|
|
927
|
+
return new FunctionTypeTranslationDeclaration(
|
|
928
928
|
typeKeyword,
|
|
929
929
|
sourceNameIdentifier,
|
|
930
930
|
sourceTypeParameterClause,
|
|
@@ -1627,7 +1627,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
1627
1627
|
case 10 /* NamedTypeSpecifier */:
|
|
1628
1628
|
case 13 /* ParenthesizedTypeSpecifier */:
|
|
1629
1629
|
case 14 /* NullableTypeSpecifier */:
|
|
1630
|
-
case 16 /*
|
|
1630
|
+
case 16 /* MissingTypeSpecifier */:
|
|
1631
1631
|
case 12 /* IntersectionTypeSpecifier */:
|
|
1632
1632
|
return false;
|
|
1633
1633
|
default:
|
|
@@ -1653,7 +1653,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
1653
1653
|
case 10 /* NamedTypeSpecifier */:
|
|
1654
1654
|
case 13 /* ParenthesizedTypeSpecifier */:
|
|
1655
1655
|
case 14 /* NullableTypeSpecifier */:
|
|
1656
|
-
case 16 /*
|
|
1656
|
+
case 16 /* MissingTypeSpecifier */:
|
|
1657
1657
|
return false;
|
|
1658
1658
|
default:
|
|
1659
1659
|
Debug.never(node);
|
|
@@ -1668,7 +1668,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
1668
1668
|
case 10 /* NamedTypeSpecifier */:
|
|
1669
1669
|
case 13 /* ParenthesizedTypeSpecifier */:
|
|
1670
1670
|
case 14 /* NullableTypeSpecifier */:
|
|
1671
|
-
case 16 /*
|
|
1671
|
+
case 16 /* MissingTypeSpecifier */:
|
|
1672
1672
|
return false;
|
|
1673
1673
|
default:
|
|
1674
1674
|
Debug.never(node);
|
|
@@ -1693,7 +1693,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
1693
1693
|
this.writeNodeDefault(node);
|
|
1694
1694
|
}
|
|
1695
1695
|
writeDeclarationBody(node, addLeadingNewLineOrWhitespace = true) {
|
|
1696
|
-
if (node.expressionOrStatementList.kind !==
|
|
1696
|
+
if (node.expressionOrStatementList.kind !== 93 /* StatementList */ || node.expressionOrStatementList.elements.length === 0) {
|
|
1697
1697
|
this.writeWhitespace();
|
|
1698
1698
|
this.writeFunctionBlock(node, false);
|
|
1699
1699
|
} else {
|
|
@@ -2034,35 +2034,35 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
2034
2034
|
[52 /* FieldDeclaration */]: this.prototype.writeFieldDeclaration,
|
|
2035
2035
|
[53 /* FieldGetterDeclaration */]: this.prototype.writeFieldGetterDeclaration,
|
|
2036
2036
|
[54 /* FieldSetterDeclaration */]: this.prototype.writeFieldSetterDeclaration,
|
|
2037
|
-
[
|
|
2038
|
-
[
|
|
2039
|
-
[
|
|
2040
|
-
[
|
|
2041
|
-
[
|
|
2042
|
-
[
|
|
2043
|
-
[
|
|
2044
|
-
[
|
|
2045
|
-
[
|
|
2046
|
-
[
|
|
2047
|
-
[
|
|
2048
|
-
[
|
|
2049
|
-
[
|
|
2037
|
+
[94 /* StatementBlock */]: this.prototype.writeStatementBlock,
|
|
2038
|
+
[95 /* FunctionBlock */]: this.prototype.writeFunctionBlock,
|
|
2039
|
+
[138 /* QualifiedName */]: this.prototype.writeQualifiedName,
|
|
2040
|
+
[149 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
|
|
2041
|
+
[150 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
|
|
2042
|
+
[151 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
|
|
2043
|
+
[152 /* Argument */]: this.prototype.writeArgument,
|
|
2044
|
+
[154 /* Tag */]: this.prototype.writeTag,
|
|
2045
|
+
[156 /* Modifier */]: this.prototype.writeModifier,
|
|
2046
|
+
[157 /* ParameterClause */]: this.prototype.writeParameterClause,
|
|
2047
|
+
[158 /* ParameterList */]: this.prototype.writeParameterList,
|
|
2048
|
+
[159 /* TypeArgumentClause */]: this.prototype.writeTypeArgumentClause,
|
|
2049
|
+
[161 /* TypeParameterClause */]: this.prototype.writeTypeParameterClause,
|
|
2050
2050
|
[17 /* AnonymousFunctionTypeDeclaration */]: this.prototype.writeAnonymousFunctionTypeDeclaration,
|
|
2051
2051
|
[18 /* AnonymousStructuredTypeDeclaration */]: this.prototype.writeAnonymousStructuredTypeDeclaration,
|
|
2052
2052
|
[19 /* AnonymousVariantTypeDeclaration */]: this.prototype.writeAnonymousVariantTypeDeclaration,
|
|
2053
2053
|
[6 /* PackageGroupImportDirective */]: this.prototype.writeNodeDefault,
|
|
2054
2054
|
[7 /* PackageImportList */]: this.prototype.writeNodeDefault,
|
|
2055
|
-
[16 /*
|
|
2056
|
-
[
|
|
2057
|
-
[
|
|
2055
|
+
[16 /* MissingTypeSpecifier */]: this.prototype.writeNodeDefault,
|
|
2056
|
+
[126 /* TopLevelTranslationList */]: this.prototype.writeNodeDefault,
|
|
2057
|
+
[125 /* TranslationsDeclaration */]: this.prototype.writeTranslationsDeclaration,
|
|
2058
2058
|
[21 /* AliasTypeDeclarationBody */]: this.prototype.writeNodeDefault,
|
|
2059
2059
|
[29 /* TypeMemberDeclarationList */]: this.prototype.writeNodeDefault,
|
|
2060
2060
|
[38 /* TypeExtensionDeclaration */]: this.prototype.writeNodeDefault,
|
|
2061
2061
|
[39 /* ExtendedTypeClauseCommaList */]: this.prototype.writeNodeDefault,
|
|
2062
2062
|
[40 /* ExtendedTypeClause */]: this.prototype.writeNodeDefault,
|
|
2063
|
-
[41 /*
|
|
2063
|
+
[41 /* MissingPackageMemberDeclaration */]: this.prototype.writeNodeDefault,
|
|
2064
2064
|
[47 /* IndexParameterClause */]: this.prototype.writeNodeDefault,
|
|
2065
|
-
[55 /*
|
|
2065
|
+
[55 /* MissingTypeMemberDeclaration */]: this.prototype.writeNodeDefault,
|
|
2066
2066
|
[56 /* NestedFunctionDeclaration */]: this.prototype.writeNodeDefault,
|
|
2067
2067
|
[57 /* LocalVariableDeclaration */]: this.prototype.writeNodeDefault,
|
|
2068
2068
|
[58 /* EnumerationVariableDeclaration */]: this.prototype.writeNodeDefault,
|
|
@@ -2077,7 +2077,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
2077
2077
|
[68 /* CallExpression */]: this.prototype.writeNodeDefault,
|
|
2078
2078
|
[69 /* AutotypeCallExpression */]: this.prototype.writeNodeDefault,
|
|
2079
2079
|
[70 /* IndexedAccessExpression */]: this.prototype.writeNodeDefault,
|
|
2080
|
-
[71 /*
|
|
2080
|
+
[71 /* MissingExpression */]: this.prototype.writeNodeDefault,
|
|
2081
2081
|
[72 /* IsExpression */]: this.prototype.writeNodeDefault,
|
|
2082
2082
|
[65 /* FunctionLiteral */]: this.prototype.writeNodeDefault,
|
|
2083
2083
|
[73 /* ParenthesizedExpression */]: this.prototype.writeNodeDefault,
|
|
@@ -2086,72 +2086,76 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
|
2086
2086
|
[76 /* MemberAccessExpression */]: this.prototype.writeNodeDefault,
|
|
2087
2087
|
[77 /* ReferenceExpression */]: this.prototype.writeNodeDefault,
|
|
2088
2088
|
[78 /* DereferenceExpression */]: this.prototype.writeNodeDefault,
|
|
2089
|
+
[84 /* TextLiteral */]: this.prototype.writeNodeDefault,
|
|
2090
|
+
[85 /* LocalizableTextLiteral */]: this.prototype.writeNodeDefault,
|
|
2089
2091
|
[79 /* TextTemplateLiteral */]: this.prototype.writeNodeDefault,
|
|
2090
|
-
[80 /*
|
|
2091
|
-
[81 /*
|
|
2092
|
-
[82 /*
|
|
2093
|
-
[83 /*
|
|
2094
|
-
[
|
|
2095
|
-
[
|
|
2096
|
-
[
|
|
2097
|
-
[
|
|
2098
|
-
[
|
|
2099
|
-
[
|
|
2100
|
-
[
|
|
2101
|
-
[93 /*
|
|
2102
|
-
[
|
|
2103
|
-
[
|
|
2104
|
-
[
|
|
2105
|
-
[
|
|
2106
|
-
[
|
|
2107
|
-
[
|
|
2108
|
-
[
|
|
2109
|
-
[
|
|
2110
|
-
[
|
|
2111
|
-
[
|
|
2112
|
-
[
|
|
2113
|
-
[
|
|
2114
|
-
[
|
|
2115
|
-
[
|
|
2116
|
-
[
|
|
2117
|
-
[
|
|
2118
|
-
[
|
|
2119
|
-
[
|
|
2120
|
-
[
|
|
2121
|
-
[
|
|
2122
|
-
[
|
|
2123
|
-
[
|
|
2124
|
-
[
|
|
2125
|
-
[
|
|
2126
|
-
[
|
|
2127
|
-
[
|
|
2128
|
-
[
|
|
2129
|
-
[
|
|
2130
|
-
[124 /*
|
|
2131
|
-
[
|
|
2132
|
-
[
|
|
2133
|
-
[
|
|
2134
|
-
[
|
|
2135
|
-
[
|
|
2136
|
-
[
|
|
2137
|
-
[
|
|
2138
|
-
[
|
|
2139
|
-
[
|
|
2140
|
-
[
|
|
2141
|
-
[
|
|
2142
|
-
[
|
|
2143
|
-
[
|
|
2144
|
-
[
|
|
2145
|
-
[
|
|
2146
|
-
[
|
|
2147
|
-
[
|
|
2148
|
-
[
|
|
2149
|
-
[
|
|
2150
|
-
[
|
|
2151
|
-
[
|
|
2152
|
-
[
|
|
2153
|
-
[
|
|
2154
|
-
[
|
|
2092
|
+
[80 /* LocalizableTextTemplateLiteral */]: this.prototype.writeNodeDefault,
|
|
2093
|
+
[81 /* TextTemplateSpanList */]: this.prototype.writeNodeDefault,
|
|
2094
|
+
[82 /* TextTemplateSpan */]: this.prototype.writeNodeDefault,
|
|
2095
|
+
[83 /* TokenExpression */]: this.prototype.writeNodeDefault,
|
|
2096
|
+
[86 /* KeywordExpression */]: this.prototype.writeNodeDefault,
|
|
2097
|
+
[87 /* ObjectExpression */]: this.prototype.writeNodeDefault,
|
|
2098
|
+
[88 /* BaseExpression */]: this.prototype.writeNodeDefault,
|
|
2099
|
+
[89 /* IdentifierExpression */]: this.prototype.writeNodeDefault,
|
|
2100
|
+
[90 /* GenericSpecializationExpression */]: this.prototype.writeNodeDefault,
|
|
2101
|
+
[91 /* DefaultMatchExpression */]: this.prototype.writeNodeDefault,
|
|
2102
|
+
[92 /* AssignmentStatement */]: this.prototype.writeNodeDefault,
|
|
2103
|
+
[93 /* StatementList */]: this.prototype.writeNodeDefault,
|
|
2104
|
+
[96 /* BreakLoopStatement */]: this.prototype.writeNodeDefault,
|
|
2105
|
+
[97 /* ContinueLoopStatement */]: this.prototype.writeNodeDefault,
|
|
2106
|
+
[98 /* DisposeStatement */]: this.prototype.writeNodeDefault,
|
|
2107
|
+
[99 /* RunStatement */]: this.prototype.writeNodeDefault,
|
|
2108
|
+
[100 /* TryStatement */]: this.prototype.writeNodeDefault,
|
|
2109
|
+
[101 /* CatchClause */]: this.prototype.writeNodeDefault,
|
|
2110
|
+
[102 /* ErrorVariableDeclaration */]: this.prototype.writeNodeDefault,
|
|
2111
|
+
[103 /* FinallyClause */]: this.prototype.writeNodeDefault,
|
|
2112
|
+
[104 /* EmptyStatement */]: this.prototype.writeNodeDefault,
|
|
2113
|
+
[105 /* ErrorStatement */]: this.prototype.writeNodeDefault,
|
|
2114
|
+
[106 /* ImportantStatement */]: this.prototype.writeNodeDefault,
|
|
2115
|
+
[107 /* ExpressionStatement */]: this.prototype.writeNodeDefault,
|
|
2116
|
+
[108 /* EnumerationVariableList */]: this.prototype.writeNodeDefault,
|
|
2117
|
+
[109 /* ForStatement */]: this.prototype.writeNodeDefault,
|
|
2118
|
+
[110 /* IfStatement */]: this.prototype.writeNodeDefault,
|
|
2119
|
+
[111 /* ElseIfClauseList */]: this.prototype.writeNodeDefault,
|
|
2120
|
+
[112 /* ElseIfClause */]: this.prototype.writeNodeDefault,
|
|
2121
|
+
[113 /* ElseClause */]: this.prototype.writeNodeDefault,
|
|
2122
|
+
[114 /* MissingStatement */]: this.prototype.writeNodeDefault,
|
|
2123
|
+
[115 /* NestedFunctionDeclarationStatement */]: this.prototype.writeNodeDefault,
|
|
2124
|
+
[116 /* LocalVariableDeclarationStatement */]: this.prototype.writeNodeDefault,
|
|
2125
|
+
[117 /* LoopStatement */]: this.prototype.writeNodeDefault,
|
|
2126
|
+
[118 /* ReturnStatement */]: this.prototype.writeNodeDefault,
|
|
2127
|
+
[119 /* CaseClauseList */]: this.prototype.writeNodeDefault,
|
|
2128
|
+
[120 /* SwitchStatement */]: this.prototype.writeNodeDefault,
|
|
2129
|
+
[121 /* MatchExpressionList */]: this.prototype.writeNodeDefault,
|
|
2130
|
+
[122 /* CaseClause */]: this.prototype.writeNodeDefault,
|
|
2131
|
+
[123 /* WhileStatement */]: this.prototype.writeNodeDefault,
|
|
2132
|
+
[124 /* YieldStatement */]: this.prototype.writeNodeDefault,
|
|
2133
|
+
[127 /* TranslationParameterList */]: this.prototype.writeNodeDefault,
|
|
2134
|
+
[128 /* TranslationParameterClause */]: this.prototype.writeTranslationParameterClause,
|
|
2135
|
+
[129 /* ConstructorTranslation */]: this.prototype.writeConstructorTranslation,
|
|
2136
|
+
[130 /* IndexParameterTranslationClause */]: this.prototype.writeIndexParameterTranslationClause,
|
|
2137
|
+
[131 /* IndexerTranslation */]: this.prototype.writeIndexerTranslation,
|
|
2138
|
+
[132 /* TranslationTypeParameterList */]: this.prototype.writeNodeDefault,
|
|
2139
|
+
[133 /* TranslationTypeParameterClause */]: this.prototype.writeTranslationTypeParameterClause,
|
|
2140
|
+
[134 /* PackageFunctionTranslationDeclaration */]: this.prototype.writePackageFunctionTranslation,
|
|
2141
|
+
[135 /* MethodTranslation */]: this.prototype.writeMethodTranslation,
|
|
2142
|
+
[136 /* FunctionTypeTranslationDeclaration */]: this.prototype.writeFunctionTypeTranslation,
|
|
2143
|
+
[137 /* PackageImportTranslationDeclaration */]: this.prototype.writePackageImportTranslation,
|
|
2144
|
+
[139 /* PackageVariableTranslationDeclaration */]: this.prototype.writePackageVariableTranslation,
|
|
2145
|
+
[140 /* FieldOrVariantTranslation */]: this.prototype.writeFieldOrVariantTranslation,
|
|
2146
|
+
[141 /* TypeMemberTranslationList */]: this.prototype.writeNodeDefault,
|
|
2147
|
+
[142 /* TypeTranslationDeclaration */]: this.prototype.writeTypeTranslation,
|
|
2148
|
+
[143 /* TextTranslationDeclaration */]: this.prototype.writeNodeDefault,
|
|
2149
|
+
[153 /* TagList */]: this.prototype.writeNodeDefault,
|
|
2150
|
+
[155 /* ModifierList */]: this.prototype.writeNodeDefault,
|
|
2151
|
+
[160 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
|
|
2152
|
+
[162 /* TypeParameterList */]: this.prototype.writeNodeDefault,
|
|
2153
|
+
[163 /* TypeAnnotation */]: this.prototype.writeNodeDefault,
|
|
2154
|
+
[144 /* TranslationTextLiteral */]: this.prototype.writeNodeDefault,
|
|
2155
|
+
[145 /* TranslationTextTemplate */]: this.prototype.writeNodeDefault,
|
|
2156
|
+
[146 /* TranslationTextTemplateSpanList */]: this.prototype.writeNodeDefault,
|
|
2157
|
+
[147 /* TranslationTextTemplateSpan */]: this.prototype.writeNodeDefault,
|
|
2158
|
+
[148 /* TranslationTextTemplateParameter */]: this.prototype.writeNodeDefault
|
|
2155
2159
|
};
|
|
2156
2160
|
return writeFunctions;
|
|
2157
2161
|
}
|
|
@@ -2335,7 +2339,7 @@ var TranslationsGenerationService = class {
|
|
|
2335
2339
|
return void 0;
|
|
2336
2340
|
}
|
|
2337
2341
|
let result;
|
|
2338
|
-
if (tokenOrKeyword.isToken(10 /* Identifier */) && tokenOrKeyword.parent.kind ===
|
|
2342
|
+
if (tokenOrKeyword.isToken(10 /* Identifier */) && tokenOrKeyword.parent.kind === 142 /* TypeTranslationDeclaration */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
|
|
2339
2343
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
|
2340
2344
|
if (translationPackage !== void 0) {
|
|
2341
2345
|
const generator = new TranslationsGenerator(
|
|
@@ -2347,7 +2351,7 @@ var TranslationsGenerationService = class {
|
|
|
2347
2351
|
result = generator.generateMissingTypeMemberTranslations(tokenOrKeyword.parent);
|
|
2348
2352
|
}
|
|
2349
2353
|
}
|
|
2350
|
-
if (result === void 0 && tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind ===
|
|
2354
|
+
if (result === void 0 && tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind === 125 /* TranslationsDeclaration */) {
|
|
2351
2355
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
|
2352
2356
|
if (translationPackage !== void 0) {
|
|
2353
2357
|
const generator = new TranslationsGenerator(
|
|
@@ -2373,7 +2377,7 @@ var TranslationsGenerationService = class {
|
|
|
2373
2377
|
if (tokenOrKeyword === void 0) {
|
|
2374
2378
|
return false;
|
|
2375
2379
|
}
|
|
2376
|
-
if (!(tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind ===
|
|
2380
|
+
if (!(tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind === 125 /* TranslationsDeclaration */)) {
|
|
2377
2381
|
return false;
|
|
2378
2382
|
}
|
|
2379
2383
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
|
@@ -2381,7 +2385,7 @@ var TranslationsGenerationService = class {
|
|
|
2381
2385
|
return false;
|
|
2382
2386
|
}
|
|
2383
2387
|
const generator = new TranslationsGenerator(analyzer, sourceFile, translationPackage, sourceFile.package.dialect);
|
|
2384
|
-
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind ===
|
|
2388
|
+
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 142 /* TypeTranslationDeclaration */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
|
|
2385
2389
|
}
|
|
2386
2390
|
};
|
|
2387
2391
|
var TranslationsGenerator = class _TranslationsGenerator {
|
|
@@ -2408,7 +2412,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2408
2412
|
};
|
|
2409
2413
|
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createPackageMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) => {
|
|
2410
2414
|
const code = new SyntaxToCode(n, syntaxToCodeOptions).convert();
|
|
2411
|
-
if (n.kind ===
|
|
2415
|
+
if (n.kind === 142 /* TypeTranslationDeclaration */) {
|
|
2412
2416
|
const startOffset = Math.max(code.indexOf(newLine), 0);
|
|
2413
2417
|
return this.addNewLineBeforeArrowsInTranslation(
|
|
2414
2418
|
code,
|
|
@@ -2440,7 +2444,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2440
2444
|
generateMissingTranslationsForPartiallyTranslatedTypes(translationsDeclaration) {
|
|
2441
2445
|
const result = new Array();
|
|
2442
2446
|
for (const translation of translationsDeclaration.translationList.translationDeclarations) {
|
|
2443
|
-
if (translation.kind ===
|
|
2447
|
+
if (translation.kind === 142 /* TypeTranslationDeclaration */) {
|
|
2444
2448
|
const edits = this.generateMissingTypeMemberTranslations(translation);
|
|
2445
2449
|
if (edits !== void 0) {
|
|
2446
2450
|
result.push(...edits);
|
|
@@ -2536,13 +2540,13 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2536
2540
|
}
|
|
2537
2541
|
detectIndentationStepForTypeMemberTranslations(node) {
|
|
2538
2542
|
let indentationStepSize;
|
|
2539
|
-
if (node.kind ===
|
|
2543
|
+
if (node.kind === 142 /* TypeTranslationDeclaration */) {
|
|
2540
2544
|
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(node, this._sourceFile);
|
|
2541
2545
|
}
|
|
2542
2546
|
if (indentationStepSize === void 0) {
|
|
2543
|
-
const translationsDeclarations = node.kind ===
|
|
2547
|
+
const translationsDeclarations = node.kind === 125 /* TranslationsDeclaration */ ? node : node.parent.parent;
|
|
2544
2548
|
for (const member of translationsDeclarations.translationList.translationDeclarations) {
|
|
2545
|
-
if (member.kind ===
|
|
2549
|
+
if (member.kind === 142 /* TypeTranslationDeclaration */) {
|
|
2546
2550
|
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(member, this._sourceFile);
|
|
2547
2551
|
if (indentationStepSize !== void 0) {
|
|
2548
2552
|
break;
|
|
@@ -2822,7 +2826,7 @@ var SignatureForNode = class _SignatureForNode {
|
|
|
2822
2826
|
return _SignatureForNode.getSignaturesForAutotypeCallExpression(analyzer, node);
|
|
2823
2827
|
case 70 /* IndexedAccessExpression */:
|
|
2824
2828
|
return _SignatureForNode.getSignaturesForIndexedAccessExpression(analyzer, node);
|
|
2825
|
-
case
|
|
2829
|
+
case 154 /* Tag */:
|
|
2826
2830
|
return _SignatureForNode.getSignaturesForTag(analyzer, node);
|
|
2827
2831
|
default:
|
|
2828
2832
|
Debug.never(node);
|
|
@@ -2960,7 +2964,7 @@ var SimplifiedOverloadResolver = class _SimplifiedOverloadResolver {
|
|
|
2960
2964
|
result = false;
|
|
2961
2965
|
break;
|
|
2962
2966
|
}
|
|
2963
|
-
if (argument.expression === void 0 || argument.expression.kind === 71 /*
|
|
2967
|
+
if (argument.expression === void 0 || argument.expression.kind === 71 /* MissingExpression */) {
|
|
2964
2968
|
continue;
|
|
2965
2969
|
}
|
|
2966
2970
|
const targetParameterType = targetParameter.getType();
|
|
@@ -3204,7 +3208,7 @@ var CompletionService = class {
|
|
|
3204
3208
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
|
3205
3209
|
return new TypeMemberCompletionContext(type, isStaticAccess, hidingMatcher, semanticContext);
|
|
3206
3210
|
}
|
|
3207
|
-
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind ===
|
|
3211
|
+
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 138 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
|
|
3208
3212
|
const namedTypeSpecifier = tokenOrKeyword.parent.parent;
|
|
3209
3213
|
const resolutionResult = this._analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
|
|
3210
3214
|
const segmentIndex = Math.floor(
|
|
@@ -3243,7 +3247,7 @@ var CompletionService = class {
|
|
|
3243
3247
|
}
|
|
3244
3248
|
return { kind: "none" };
|
|
3245
3249
|
}
|
|
3246
|
-
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind ===
|
|
3250
|
+
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 138 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 154 /* Tag */) {
|
|
3247
3251
|
const tag = tokenOrKeyword.parent.parent;
|
|
3248
3252
|
const resolutionResult = this._analyzer.resolveTag(tag);
|
|
3249
3253
|
const segmentIndex = Math.floor(
|
|
@@ -3329,17 +3333,17 @@ var CompletionService = class {
|
|
|
3329
3333
|
translationKind = 0 /* Any */;
|
|
3330
3334
|
hasPrecedingKeyword = false;
|
|
3331
3335
|
}
|
|
3332
|
-
if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind ===
|
|
3336
|
+
if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind === 137 /* PackageImportTranslationDeclaration */) {
|
|
3333
3337
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
|
3334
3338
|
translationKind = 1 /* PackageImport */;
|
|
3335
3339
|
hasPrecedingKeyword = true;
|
|
3336
3340
|
}
|
|
3337
|
-
if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind ===
|
|
3341
|
+
if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind === 142 /* TypeTranslationDeclaration */ || tokenOrKeyword.parent.kind === 136 /* FunctionTypeTranslationDeclaration */)) {
|
|
3338
3342
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
|
3339
3343
|
translationKind = 3 /* Type */;
|
|
3340
3344
|
hasPrecedingKeyword = true;
|
|
3341
3345
|
}
|
|
3342
|
-
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind ===
|
|
3346
|
+
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 134 /* PackageFunctionTranslationDeclaration */) {
|
|
3343
3347
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
|
3344
3348
|
translationKind = 2 /* Method */;
|
|
3345
3349
|
hasPrecedingKeyword = true;
|
|
@@ -3356,9 +3360,9 @@ var CompletionService = class {
|
|
|
3356
3360
|
hasPrecedingKeyword
|
|
3357
3361
|
);
|
|
3358
3362
|
}
|
|
3359
|
-
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind ===
|
|
3363
|
+
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 138 /* QualifiedName */) {
|
|
3360
3364
|
const qualifiedName = tokenOrKeyword.parent;
|
|
3361
|
-
if (qualifiedName.parent.kind ===
|
|
3365
|
+
if (qualifiedName.parent.kind === 137 /* PackageImportTranslationDeclaration */ && qualifiedName === qualifiedName.parent.sourceName) {
|
|
3362
3366
|
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
|
3363
3367
|
const sourceLocale = translationPackage.getTargetPackage().getLocale();
|
|
3364
3368
|
return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
|
|
@@ -3383,12 +3387,12 @@ var CompletionService = class {
|
|
|
3383
3387
|
translationKind = 0 /* Any */;
|
|
3384
3388
|
hasPrecedingKeyword = false;
|
|
3385
3389
|
}
|
|
3386
|
-
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind ===
|
|
3390
|
+
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 135 /* MethodTranslation */) {
|
|
3387
3391
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
|
3388
3392
|
translationKind = 1 /* Method */;
|
|
3389
3393
|
hasPrecedingKeyword = true;
|
|
3390
3394
|
}
|
|
3391
|
-
if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind ===
|
|
3395
|
+
if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 129 /* ConstructorTranslation */) {
|
|
3392
3396
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
|
3393
3397
|
translationKind = 3 /* Constructor */;
|
|
3394
3398
|
hasPrecedingKeyword = true;
|
|
@@ -3428,7 +3432,7 @@ var CompletionService = class {
|
|
|
3428
3432
|
role.argumentList.parent
|
|
3429
3433
|
);
|
|
3430
3434
|
break;
|
|
3431
|
-
case
|
|
3435
|
+
case 154 /* Tag */:
|
|
3432
3436
|
signatures = SignatureForNode.getSignaturesForTag(this._analyzer, role.argumentList.parent);
|
|
3433
3437
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(role.argumentList.parent);
|
|
3434
3438
|
break;
|
|
@@ -3454,7 +3458,7 @@ var CompletionService = class {
|
|
|
3454
3458
|
}
|
|
3455
3459
|
if (role.kind === "array-element") {
|
|
3456
3460
|
let type = this._analyzer.type.ofExpression(role.array);
|
|
3457
|
-
type = this._analyzer.
|
|
3461
|
+
type = this._analyzer.excludeNullFromType(type);
|
|
3458
3462
|
const isArrayCheck = this._analyzer.isTypeArrayOrReadonlyArray(type);
|
|
3459
3463
|
if (isArrayCheck !== void 0) {
|
|
3460
3464
|
return { targetTypes: [isArrayCheck.elementType], targetSignaturesParameters: void 0 };
|
|
@@ -3480,7 +3484,7 @@ var CompletionService = class {
|
|
|
3480
3484
|
}
|
|
3481
3485
|
if (role.kind === "function-block-expression") {
|
|
3482
3486
|
const targetType = semanticContext.getContainingSubprogram()?.getReturnType();
|
|
3483
|
-
if (targetType !== void 0 && !targetType.equals(this._analyzer.originalStandardTypes.
|
|
3487
|
+
if (targetType !== void 0 && !targetType.equals(this._analyzer.originalStandardTypes.nullType)) {
|
|
3484
3488
|
return { targetTypes: [targetType], targetSignaturesParameters: void 0 };
|
|
3485
3489
|
}
|
|
3486
3490
|
return { targetTypes: void 0, targetSignaturesParameters: void 0 };
|
|
@@ -3589,7 +3593,7 @@ var CompletionService = class {
|
|
|
3589
3593
|
kinds.add(9 /* From */);
|
|
3590
3594
|
}
|
|
3591
3595
|
if (syntaxContext.isExpressionContext !== void 0) {
|
|
3592
|
-
kinds.add(43 /* Not */).add(52 /* Yes */).add(53 /* No */).add(57 /*
|
|
3596
|
+
kinds.add(43 /* Not */).add(52 /* Yes */).add(53 /* No */).add(57 /* Null */).add(40 /* Async */).add(12 /* Function */).add(54 /* Reference */).add(2 /* Autotype */).add(30 /* Cond */);
|
|
3593
3597
|
if (positionDescription.kind === "after-token-or-keyword") {
|
|
3594
3598
|
const container = semanticContext.getContainingTypeOrTypeExtension();
|
|
3595
3599
|
if (container !== void 0) {
|
|
@@ -3642,35 +3646,35 @@ var CompletionService = class {
|
|
|
3642
3646
|
return false;
|
|
3643
3647
|
}
|
|
3644
3648
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
|
3645
|
-
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
|
3649
|
+
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 117 /* LoopStatement */;
|
|
3646
3650
|
}
|
|
3647
3651
|
isModifierLevelContext(positionDescription) {
|
|
3648
3652
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
|
3649
3653
|
return false;
|
|
3650
3654
|
}
|
|
3651
3655
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
|
3652
|
-
return tokenOrKeyword.isToken(45 /* OpenParenthesis */) && tokenOrKeyword.parent.kind ===
|
|
3656
|
+
return tokenOrKeyword.isToken(45 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 156 /* Modifier */;
|
|
3653
3657
|
}
|
|
3654
3658
|
isElseOrElseIfKeywordContext(positionDescription) {
|
|
3655
3659
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
|
3656
3660
|
return false;
|
|
3657
3661
|
}
|
|
3658
3662
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
|
3659
|
-
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
|
3663
|
+
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 110 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.block || tokenOrKeyword.parent.parent.kind === 112 /* ElseIfClause */);
|
|
3660
3664
|
}
|
|
3661
3665
|
isCatchKeywordContext(positionDescription) {
|
|
3662
3666
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
|
3663
3667
|
return false;
|
|
3664
3668
|
}
|
|
3665
3669
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
|
3666
|
-
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
|
3670
|
+
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */;
|
|
3667
3671
|
}
|
|
3668
3672
|
isFinallyKeywordContext(positionDescription) {
|
|
3669
3673
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
|
3670
3674
|
return false;
|
|
3671
3675
|
}
|
|
3672
3676
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
|
3673
|
-
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
|
3677
|
+
return tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */ || tokenOrKeyword.parent.parent.kind === 101 /* CatchClause */);
|
|
3674
3678
|
}
|
|
3675
3679
|
isTypeKindCompletionContext(positionDescription) {
|
|
3676
3680
|
return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(58 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
|
|
@@ -3687,10 +3691,10 @@ var CompletionService = class {
|
|
|
3687
3691
|
return false;
|
|
3688
3692
|
}
|
|
3689
3693
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
|
3690
|
-
if (tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
|
3694
|
+
if (tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 122 /* CaseClause */) {
|
|
3691
3695
|
return true;
|
|
3692
3696
|
}
|
|
3693
|
-
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind ===
|
|
3697
|
+
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 120 /* SwitchStatement */) {
|
|
3694
3698
|
return true;
|
|
3695
3699
|
}
|
|
3696
3700
|
return false;
|
|
@@ -3900,7 +3904,7 @@ var CompletionService = class {
|
|
|
3900
3904
|
return new NamedTypeCompletionItemInfo(this.completionItemInfoContext, entity, prefix, sortText);
|
|
3901
3905
|
}
|
|
3902
3906
|
getTypeMemberCompletionItemInfos(ctx) {
|
|
3903
|
-
const type = this._analyzer.
|
|
3907
|
+
const type = this._analyzer.excludeNullFromType(ctx.type);
|
|
3904
3908
|
const memberLookup = TypeMemberLookup.ofType(this._analyzer, type, this._locale);
|
|
3905
3909
|
const options6 = ctx.isStaticAccess ? 2 /* OnlyStaticMembers */ : 1 /* OnlyInstanceMembers */;
|
|
3906
3910
|
return memberLookup.getNamedMembers(options6, ctx.hidingMatcher, ctx.typeExtensionLookup).map((m) => {
|
|
@@ -4242,11 +4246,11 @@ function getRightmostChildExcludingValidEmptyNodes(node) {
|
|
|
4242
4246
|
}
|
|
4243
4247
|
function isInvalidNode(node) {
|
|
4244
4248
|
switch (node.kind) {
|
|
4245
|
-
case 71 /*
|
|
4246
|
-
case 41 /*
|
|
4247
|
-
case
|
|
4248
|
-
case 55 /*
|
|
4249
|
-
case 16 /*
|
|
4249
|
+
case 71 /* MissingExpression */:
|
|
4250
|
+
case 41 /* MissingPackageMemberDeclaration */:
|
|
4251
|
+
case 114 /* MissingStatement */:
|
|
4252
|
+
case 55 /* MissingTypeMemberDeclaration */:
|
|
4253
|
+
case 16 /* MissingTypeSpecifier */:
|
|
4250
4254
|
return true;
|
|
4251
4255
|
case 0 /* Token */:
|
|
4252
4256
|
return node.isMissing;
|
|
@@ -5039,7 +5043,7 @@ var SyntaxContextFactory = class {
|
|
|
5039
5043
|
if (positionDescription.kind === "after-token-or-keyword") {
|
|
5040
5044
|
isUnqualifiedTypeContext = this.isUnqualifiedTypeContext(positionDescription.tokenOrKeyword);
|
|
5041
5045
|
}
|
|
5042
|
-
const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(36 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind ===
|
|
5046
|
+
const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(36 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind === 154 /* Tag */;
|
|
5043
5047
|
let isTopLevelTranslationListContext;
|
|
5044
5048
|
if (positionDescription.kind === "after-token-or-keyword") {
|
|
5045
5049
|
isTopLevelTranslationListContext = this.isTopLevelTranslationListContext(positionDescription.tokenOrKeyword);
|
|
@@ -5065,7 +5069,7 @@ var SyntaxContextFactory = class {
|
|
|
5065
5069
|
}
|
|
5066
5070
|
static isExpressionOrStatementContext(tokenOrKeyword) {
|
|
5067
5071
|
if (tokenOrKeyword.isToken(58 /* Equals */)) {
|
|
5068
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5072
|
+
if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
|
5069
5073
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
|
5070
5074
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5071
5075
|
}
|
|
@@ -5081,20 +5085,20 @@ var SyntaxContextFactory = class {
|
|
|
5081
5085
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
|
5082
5086
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5083
5087
|
}
|
|
5084
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5088
|
+
if (tokenOrKeyword.parent.kind === 151 /* ParameterDeclaration */) {
|
|
5085
5089
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.defaultValue);
|
|
5086
5090
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5087
5091
|
}
|
|
5088
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5092
|
+
if (tokenOrKeyword.parent.kind === 152 /* Argument */) {
|
|
5089
5093
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
|
5090
5094
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5091
5095
|
}
|
|
5092
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5096
|
+
if (tokenOrKeyword.parent.kind === 149 /* VariantDeclaration */) {
|
|
5093
5097
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
|
5094
5098
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5095
5099
|
}
|
|
5096
5100
|
}
|
|
5097
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5101
|
+
if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
|
5098
5102
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
|
5099
5103
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5100
5104
|
}
|
|
@@ -5110,7 +5114,7 @@ var SyntaxContextFactory = class {
|
|
|
5110
5114
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.spanList.spans.at(0)?.expression);
|
|
5111
5115
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5112
5116
|
}
|
|
5113
|
-
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind ===
|
|
5117
|
+
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind === 82 /* TextTemplateSpan */) {
|
|
5114
5118
|
let expressionForTargetType;
|
|
5115
5119
|
const spanList = tokenOrKeyword.parent.parent;
|
|
5116
5120
|
const spanIndex = spanList.spans.indexOf(tokenOrKeyword.parent);
|
|
@@ -5122,12 +5126,12 @@ var SyntaxContextFactory = class {
|
|
|
5122
5126
|
isStatementContext: false
|
|
5123
5127
|
};
|
|
5124
5128
|
}
|
|
5125
|
-
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
|
5129
|
+
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */) {
|
|
5126
5130
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
|
5127
5131
|
}
|
|
5128
|
-
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
|
5132
|
+
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */) {
|
|
5129
5133
|
const block = tokenOrKeyword.parent;
|
|
5130
|
-
if (block.expressionOrStatementList.kind !==
|
|
5134
|
+
if (block.expressionOrStatementList.kind !== 93 /* StatementList */ || block.expressionOrStatementList.statements.count() === 0) {
|
|
5131
5135
|
return {
|
|
5132
5136
|
isExpressionContext: { expressionRole: new ExpressionRole_functionBlockExpression(block) },
|
|
5133
5137
|
isStatementContext: true
|
|
@@ -5139,7 +5143,7 @@ var SyntaxContextFactory = class {
|
|
|
5139
5143
|
};
|
|
5140
5144
|
}
|
|
5141
5145
|
}
|
|
5142
|
-
if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
|
5146
|
+
if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 93 /* StatementList */) {
|
|
5143
5147
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
|
5144
5148
|
}
|
|
5145
5149
|
if (tokenOrKeyword.isToken(45 /* OpenParenthesis */)) {
|
|
@@ -5159,7 +5163,7 @@ var SyntaxContextFactory = class {
|
|
|
5159
5163
|
const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
|
|
5160
5164
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5161
5165
|
}
|
|
5162
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5166
|
+
if (tokenOrKeyword.parent.kind === 154 /* Tag */) {
|
|
5163
5167
|
const argumentList = tokenOrKeyword.parent.argumentList;
|
|
5164
5168
|
if (argumentList !== void 0) {
|
|
5165
5169
|
const expressionRole = new ExpressionRole_argument(argumentList, 0);
|
|
@@ -5194,7 +5198,7 @@ var SyntaxContextFactory = class {
|
|
|
5194
5198
|
const expressionRole = new ExpressionRole_argument(argumentList, index);
|
|
5195
5199
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5196
5200
|
}
|
|
5197
|
-
if (tokenOrKeyword.parent.kind ===
|
|
5201
|
+
if (tokenOrKeyword.parent.kind === 121 /* MatchExpressionList */) {
|
|
5198
5202
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent.parent);
|
|
5199
5203
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5200
5204
|
}
|
|
@@ -5214,47 +5218,47 @@ var SyntaxContextFactory = class {
|
|
|
5214
5218
|
return { isExpressionContext: void 0, isStatementContext: false };
|
|
5215
5219
|
}
|
|
5216
5220
|
}
|
|
5217
|
-
if (tokenOrKeyword.isKeyword(45 /* Case */) && tokenOrKeyword.parent.kind ===
|
|
5221
|
+
if (tokenOrKeyword.isKeyword(45 /* Case */) && tokenOrKeyword.parent.kind === 122 /* CaseClause */) {
|
|
5218
5222
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent);
|
|
5219
5223
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5220
5224
|
}
|
|
5221
|
-
if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind ===
|
|
5225
|
+
if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind === 118 /* ReturnStatement */) {
|
|
5222
5226
|
const expressionRole = new ExpressionRole_returnedValue(tokenOrKeyword.parent);
|
|
5223
5227
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5224
5228
|
}
|
|
5225
|
-
if (tokenOrKeyword.isKeyword(20 /* Error */) && tokenOrKeyword.parent.kind ===
|
|
5229
|
+
if (tokenOrKeyword.isKeyword(20 /* Error */) && tokenOrKeyword.parent.kind === 105 /* ErrorStatement */) {
|
|
5226
5230
|
const expressionRole = new ExpressionRole_errorValue(tokenOrKeyword.parent);
|
|
5227
5231
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5228
5232
|
}
|
|
5229
|
-
if (tokenOrKeyword.isKeyword(19 /* Important */) && tokenOrKeyword.parent.kind ===
|
|
5233
|
+
if (tokenOrKeyword.isKeyword(19 /* Important */) && tokenOrKeyword.parent.kind === 106 /* ImportantStatement */) {
|
|
5230
5234
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
|
5231
5235
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5232
5236
|
}
|
|
5233
|
-
if (tokenOrKeyword.isKeyword(44 /* Switch */) && tokenOrKeyword.parent.kind ===
|
|
5237
|
+
if (tokenOrKeyword.isKeyword(44 /* Switch */) && tokenOrKeyword.parent.kind === 120 /* SwitchStatement */) {
|
|
5234
5238
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
|
5235
5239
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5236
5240
|
}
|
|
5237
|
-
if (tokenOrKeyword.isKeyword(13 /* If */) && tokenOrKeyword.parent.kind ===
|
|
5241
|
+
if (tokenOrKeyword.isKeyword(13 /* If */) && tokenOrKeyword.parent.kind === 110 /* IfStatement */) {
|
|
5238
5242
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
|
5239
5243
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5240
5244
|
}
|
|
5241
|
-
if (tokenOrKeyword.isKeyword(11 /* ElseIf */) && tokenOrKeyword.parent.kind ===
|
|
5245
|
+
if (tokenOrKeyword.isKeyword(11 /* ElseIf */) && tokenOrKeyword.parent.kind === 112 /* ElseIfClause */) {
|
|
5242
5246
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
|
5243
5247
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5244
5248
|
}
|
|
5245
|
-
if (tokenOrKeyword.isKeyword(9 /* From */) && tokenOrKeyword.parent.kind ===
|
|
5249
|
+
if (tokenOrKeyword.isKeyword(9 /* From */) && tokenOrKeyword.parent.kind === 109 /* ForStatement */) {
|
|
5246
5250
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.enumeratedExpression);
|
|
5247
5251
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5248
5252
|
}
|
|
5249
|
-
if (tokenOrKeyword.isKeyword(25 /* While */) && tokenOrKeyword.parent.kind ===
|
|
5253
|
+
if (tokenOrKeyword.isKeyword(25 /* While */) && tokenOrKeyword.parent.kind === 123 /* WhileStatement */) {
|
|
5250
5254
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
|
5251
5255
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5252
5256
|
}
|
|
5253
|
-
if (tokenOrKeyword.isKeyword(27 /* RepeatWhile */) && tokenOrKeyword.parent.kind ===
|
|
5257
|
+
if (tokenOrKeyword.isKeyword(27 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 117 /* LoopStatement */) {
|
|
5254
5258
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
|
5255
5259
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5256
5260
|
}
|
|
5257
|
-
if (tokenOrKeyword.isKeyword(28 /* Yield */) && tokenOrKeyword.parent.kind ===
|
|
5261
|
+
if (tokenOrKeyword.isKeyword(28 /* Yield */) && tokenOrKeyword.parent.kind === 124 /* YieldStatement */) {
|
|
5258
5262
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
|
5259
5263
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
|
5260
5264
|
}
|
|
@@ -5280,7 +5284,7 @@ var SyntaxContextFactory = class {
|
|
|
5280
5284
|
if (tokenOrKeyword.isToken(21 /* CloseBrace */) && tokenOrKeyword.parent.kind === 30 /* TypeMemberDeclarationBlock */ && (tokenOrKeyword.parent.parent.kind === 38 /* TypeExtensionDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 31 /* PackageStructuredTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 36 /* PackageVariantTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 20 /* PackageAliasTypeDeclaration */)) {
|
|
5281
5285
|
return true;
|
|
5282
5286
|
}
|
|
5283
|
-
if (tokenOrKeyword.isToken(21 /* CloseBrace */) && (tokenOrKeyword.parent.kind ===
|
|
5287
|
+
if (tokenOrKeyword.isToken(21 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 125 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 22 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && (tokenOrKeyword.parent.parent.kind === 23 /* PackageConstructorDeclaration */ || tokenOrKeyword.parent.parent.kind === 24 /* PackageEntryPointDeclaration */ || tokenOrKeyword.parent.parent.kind === 25 /* PackageFunctionDeclaration */))) {
|
|
5284
5288
|
return true;
|
|
5285
5289
|
}
|
|
5286
5290
|
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 22 /* PackageMemberGroupDeclaration */) {
|
|
@@ -5292,13 +5296,13 @@ var SyntaxContextFactory = class {
|
|
|
5292
5296
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 35 /* PackageVariableSetterDeclaration */)) {
|
|
5293
5297
|
return true;
|
|
5294
5298
|
}
|
|
5295
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
|
5299
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 156 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
|
5296
5300
|
return true;
|
|
5297
5301
|
}
|
|
5298
|
-
if (tokenOrKeyword.isToken(22 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
|
5302
|
+
if (tokenOrKeyword.isToken(22 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 156 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
|
5299
5303
|
return true;
|
|
5300
5304
|
}
|
|
5301
|
-
const tag = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
|
5305
|
+
const tag = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 154 /* Tag */);
|
|
5302
5306
|
if (tag !== void 0 && NodeTypeUtils.isPackageMemberDeclaration(tag.parent.parent)) {
|
|
5303
5307
|
return true;
|
|
5304
5308
|
}
|
|
@@ -5326,16 +5330,16 @@ var SyntaxContextFactory = class {
|
|
|
5326
5330
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
|
5327
5331
|
tokenOrKeyword,
|
|
5328
5332
|
49 /* DereferencedVariableSetterDeclaration */
|
|
5329
|
-
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 50 /* MethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 51 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 43 /* ConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 44 /* DestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
|
5333
|
+
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 50 /* MethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 51 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 43 /* ConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 44 /* DestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 149 /* VariantDeclaration */)) {
|
|
5330
5334
|
return true;
|
|
5331
5335
|
}
|
|
5332
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
|
5336
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 156 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
|
5333
5337
|
return true;
|
|
5334
5338
|
}
|
|
5335
|
-
if (tokenOrKeyword.isToken(22 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
|
5339
|
+
if (tokenOrKeyword.isToken(22 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 156 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
|
5336
5340
|
return true;
|
|
5337
5341
|
}
|
|
5338
|
-
const tag = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
|
5342
|
+
const tag = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 154 /* Tag */);
|
|
5339
5343
|
if (tag !== void 0 && NodeTypeUtils.isTypeMemberDeclaration(tag.parent.parent)) {
|
|
5340
5344
|
return true;
|
|
5341
5345
|
}
|
|
@@ -5373,7 +5377,7 @@ var SyntaxContextFactory = class {
|
|
|
5373
5377
|
return result;
|
|
5374
5378
|
}
|
|
5375
5379
|
static isUnqualifiedTypeContext(tokenOrKeyword) {
|
|
5376
|
-
if (tokenOrKeyword.isToken(24 /* Colon */) && tokenOrKeyword.parent.kind ===
|
|
5380
|
+
if (tokenOrKeyword.isToken(24 /* Colon */) && tokenOrKeyword.parent.kind === 163 /* TypeAnnotation */) {
|
|
5377
5381
|
return { allowsAnonymousTypes: true };
|
|
5378
5382
|
}
|
|
5379
5383
|
if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 32 /* StructuredTypeDeclarationBody */) {
|
|
@@ -5382,16 +5386,16 @@ var SyntaxContextFactory = class {
|
|
|
5382
5386
|
if (tokenOrKeyword.isKeyword(16 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind === 38 /* TypeExtensionDeclaration */)) {
|
|
5383
5387
|
return { allowsAnonymousTypes: false };
|
|
5384
5388
|
}
|
|
5385
|
-
if (tokenOrKeyword.isToken(37 /* LessThan */) && tokenOrKeyword.parent.kind ===
|
|
5389
|
+
if (tokenOrKeyword.isToken(37 /* LessThan */) && tokenOrKeyword.parent.kind === 159 /* TypeArgumentClause */) {
|
|
5386
5390
|
return { allowsAnonymousTypes: true };
|
|
5387
5391
|
}
|
|
5388
|
-
if (tokenOrKeyword.isToken(25 /* Comma */) && (tokenOrKeyword.parent.kind === 28 /* BaseTypeList */ || tokenOrKeyword.parent.kind ===
|
|
5389
|
-
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind ===
|
|
5392
|
+
if (tokenOrKeyword.isToken(25 /* Comma */) && (tokenOrKeyword.parent.kind === 28 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 160 /* TypeArgumentList */)) {
|
|
5393
|
+
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 160 /* TypeArgumentList */ };
|
|
5390
5394
|
}
|
|
5391
|
-
if (tokenOrKeyword.isToken(36 /* HashSign */) && tokenOrKeyword.parent.kind ===
|
|
5395
|
+
if (tokenOrKeyword.isToken(36 /* HashSign */) && tokenOrKeyword.parent.kind === 154 /* Tag */) {
|
|
5392
5396
|
return { allowsAnonymousTypes: false };
|
|
5393
5397
|
}
|
|
5394
|
-
if ((tokenOrKeyword.isToken(24 /* Colon */) || tokenOrKeyword.isToken(58 /* Equals */)) && tokenOrKeyword.parent.kind ===
|
|
5398
|
+
if ((tokenOrKeyword.isToken(24 /* Colon */) || tokenOrKeyword.isToken(58 /* Equals */)) && tokenOrKeyword.parent.kind === 150 /* TypeParameterDeclaration */) {
|
|
5395
5399
|
return { allowsAnonymousTypes: false };
|
|
5396
5400
|
}
|
|
5397
5401
|
if (tokenOrKeyword.isToken(58 /* Equals */) && tokenOrKeyword.parent.kind === 20 /* PackageAliasTypeDeclaration */) {
|
|
@@ -5415,40 +5419,43 @@ var SyntaxContextFactory = class {
|
|
|
5415
5419
|
return void 0;
|
|
5416
5420
|
}
|
|
5417
5421
|
static isTopLevelTranslationListContext(tokenOrKeyword) {
|
|
5418
|
-
if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
|
5422
|
+
if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 126 /* TopLevelTranslationList */) {
|
|
5419
5423
|
return { translationsDeclaration: tokenOrKeyword.parent.parent };
|
|
5420
5424
|
}
|
|
5421
|
-
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
|
5425
|
+
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 125 /* TranslationsDeclaration */) {
|
|
5422
5426
|
return { translationsDeclaration: tokenOrKeyword.parent };
|
|
5423
5427
|
}
|
|
5424
5428
|
const packageImport = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5425
5429
|
tokenOrKeyword,
|
|
5426
|
-
|
|
5430
|
+
137 /* PackageImportTranslationDeclaration */
|
|
5427
5431
|
);
|
|
5428
5432
|
if (packageImport !== void 0) {
|
|
5429
5433
|
return { translationsDeclaration: packageImport.parent.parent };
|
|
5430
5434
|
}
|
|
5431
|
-
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5435
|
+
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5436
|
+
tokenOrKeyword,
|
|
5437
|
+
142 /* TypeTranslationDeclaration */
|
|
5438
|
+
);
|
|
5432
5439
|
if (type !== void 0) {
|
|
5433
5440
|
return { translationsDeclaration: type.parent.parent };
|
|
5434
5441
|
}
|
|
5435
5442
|
const functionType = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5436
5443
|
tokenOrKeyword,
|
|
5437
|
-
|
|
5444
|
+
136 /* FunctionTypeTranslationDeclaration */
|
|
5438
5445
|
);
|
|
5439
5446
|
if (functionType !== void 0) {
|
|
5440
5447
|
return { translationsDeclaration: functionType.parent.parent };
|
|
5441
5448
|
}
|
|
5442
5449
|
const variable = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5443
5450
|
tokenOrKeyword,
|
|
5444
|
-
|
|
5451
|
+
139 /* PackageVariableTranslationDeclaration */
|
|
5445
5452
|
);
|
|
5446
5453
|
if (variable !== void 0) {
|
|
5447
5454
|
return { translationsDeclaration: variable.parent.parent };
|
|
5448
5455
|
}
|
|
5449
5456
|
const func = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5450
5457
|
tokenOrKeyword,
|
|
5451
|
-
|
|
5458
|
+
134 /* PackageFunctionTranslationDeclaration */
|
|
5452
5459
|
);
|
|
5453
5460
|
if (func !== void 0) {
|
|
5454
5461
|
return { translationsDeclaration: func.parent.parent };
|
|
@@ -5456,33 +5463,33 @@ var SyntaxContextFactory = class {
|
|
|
5456
5463
|
return void 0;
|
|
5457
5464
|
}
|
|
5458
5465
|
static isTypeMemberTranslationListContext(tokenOrKeyword) {
|
|
5459
|
-
if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
|
5466
|
+
if (tokenOrKeyword.isToken(52 /* Semicolon */) && tokenOrKeyword.parent.kind === 141 /* TypeMemberTranslationList */) {
|
|
5460
5467
|
return { typeTranslation: tokenOrKeyword.parent.parent };
|
|
5461
5468
|
}
|
|
5462
|
-
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
|
5469
|
+
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 142 /* TypeTranslationDeclaration */) {
|
|
5463
5470
|
return { typeTranslation: tokenOrKeyword.parent };
|
|
5464
5471
|
}
|
|
5465
|
-
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
|
5472
|
+
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 131 /* IndexerTranslation */);
|
|
5466
5473
|
if (indexer !== void 0) {
|
|
5467
5474
|
return { typeTranslation: indexer.parent.parent };
|
|
5468
5475
|
}
|
|
5469
5476
|
const constructor = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5470
5477
|
tokenOrKeyword,
|
|
5471
|
-
|
|
5478
|
+
129 /* ConstructorTranslation */
|
|
5472
5479
|
);
|
|
5473
5480
|
if (constructor !== void 0) {
|
|
5474
5481
|
return { typeTranslation: constructor.parent.parent };
|
|
5475
5482
|
}
|
|
5476
5483
|
const variableOrVariant = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5477
5484
|
tokenOrKeyword,
|
|
5478
|
-
|
|
5485
|
+
140 /* FieldOrVariantTranslation */
|
|
5479
5486
|
);
|
|
5480
5487
|
if (variableOrVariant !== void 0) {
|
|
5481
5488
|
return { typeTranslation: variableOrVariant.parent.parent };
|
|
5482
5489
|
}
|
|
5483
5490
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
|
5484
5491
|
tokenOrKeyword,
|
|
5485
|
-
|
|
5492
|
+
135 /* MethodTranslation */
|
|
5486
5493
|
);
|
|
5487
5494
|
if (method !== void 0) {
|
|
5488
5495
|
return { typeTranslation: method.parent.parent };
|
|
@@ -5605,15 +5612,15 @@ var NodeSemanticInfoService = class {
|
|
|
5605
5612
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
|
5606
5613
|
} else if (tokenOrKeyword.isToken(20 /* Caret */) && tokenOrKeyword.parent.kind === 78 /* DereferenceExpression */) {
|
|
5607
5614
|
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
|
5608
|
-
} else if (tokenOrKeyword.parent.kind ===
|
|
5615
|
+
} else if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
|
5609
5616
|
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options6);
|
|
5610
5617
|
} else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 43 /* ConstructorDeclaration */) {
|
|
5611
5618
|
return this.ofConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
|
5612
|
-
} else if (tokenOrKeyword.isToken(14 /* Asterisk */) && tokenOrKeyword.parent.kind ===
|
|
5619
|
+
} else if (tokenOrKeyword.isToken(14 /* Asterisk */) && tokenOrKeyword.parent.kind === 91 /* DefaultMatchExpression */) {
|
|
5613
5620
|
return this.ofDefaultMatchExpression(analyzer, tokenOrKeyword.parent);
|
|
5614
|
-
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind ===
|
|
5621
|
+
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 87 /* ObjectExpression */) {
|
|
5615
5622
|
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options6);
|
|
5616
|
-
} else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind ===
|
|
5623
|
+
} else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind === 88 /* BaseExpression */) {
|
|
5617
5624
|
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options6);
|
|
5618
5625
|
} else if ((tokenOrKeyword.isToken(46 /* OpenSquareBracket */) || tokenOrKeyword.isToken(23 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 47 /* IndexParameterClause */) {
|
|
5619
5626
|
return this.ofIndexedElementAccessorDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
|
@@ -5630,11 +5637,11 @@ var NodeSemanticInfoService = class {
|
|
|
5630
5637
|
let result;
|
|
5631
5638
|
const parent = node.parent;
|
|
5632
5639
|
switch (parent.kind) {
|
|
5633
|
-
case
|
|
5640
|
+
case 132 /* TranslationTypeParameterList */:
|
|
5634
5641
|
break;
|
|
5635
|
-
case
|
|
5642
|
+
case 127 /* TranslationParameterList */:
|
|
5636
5643
|
break;
|
|
5637
|
-
case
|
|
5644
|
+
case 152 /* Argument */: {
|
|
5638
5645
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
|
5639
5646
|
if (respectiveParameter !== void 0) {
|
|
5640
5647
|
const target = new MatchResultValueParameterReferenceTarget(respectiveParameter, 0 /* Get */);
|
|
@@ -5648,7 +5655,7 @@ var NodeSemanticInfoService = class {
|
|
|
5648
5655
|
case 58 /* EnumerationVariableDeclaration */:
|
|
5649
5656
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofEnumerationVariableDeclaration(parent));
|
|
5650
5657
|
break;
|
|
5651
|
-
case
|
|
5658
|
+
case 102 /* ErrorVariableDeclaration */:
|
|
5652
5659
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofErrorVariableDeclaration(parent));
|
|
5653
5660
|
break;
|
|
5654
5661
|
case 20 /* PackageAliasTypeDeclaration */:
|
|
@@ -5669,7 +5676,7 @@ var NodeSemanticInfoService = class {
|
|
|
5669
5676
|
case 36 /* PackageVariantTypeDeclaration */:
|
|
5670
5677
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariantTypeDeclaration(parent));
|
|
5671
5678
|
break;
|
|
5672
|
-
case
|
|
5679
|
+
case 89 /* IdentifierExpression */:
|
|
5673
5680
|
result = this.ofIdentifierExpression(analyzer, parent, options6);
|
|
5674
5681
|
break;
|
|
5675
5682
|
case 56 /* NestedFunctionDeclaration */:
|
|
@@ -5678,10 +5685,10 @@ var NodeSemanticInfoService = class {
|
|
|
5678
5685
|
case 57 /* LocalVariableDeclaration */:
|
|
5679
5686
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
|
5680
5687
|
break;
|
|
5681
|
-
case
|
|
5688
|
+
case 138 /* QualifiedName */:
|
|
5682
5689
|
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options6);
|
|
5683
5690
|
break;
|
|
5684
|
-
case
|
|
5691
|
+
case 139 /* PackageVariableTranslationDeclaration */: {
|
|
5685
5692
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
5686
5693
|
const getTargetResult = translationPackage?.getPackageVariableTranslationTarget(parent);
|
|
5687
5694
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
|
@@ -5701,7 +5708,7 @@ var NodeSemanticInfoService = class {
|
|
|
5701
5708
|
}
|
|
5702
5709
|
break;
|
|
5703
5710
|
}
|
|
5704
|
-
case
|
|
5711
|
+
case 140 /* FieldOrVariantTranslation */: {
|
|
5705
5712
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
5706
5713
|
const getTargetsResult = translationPackage?.getFieldOrVariantTranslationTargets(parent);
|
|
5707
5714
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
|
@@ -5724,7 +5731,7 @@ var NodeSemanticInfoService = class {
|
|
|
5724
5731
|
}
|
|
5725
5732
|
break;
|
|
5726
5733
|
}
|
|
5727
|
-
case
|
|
5734
|
+
case 134 /* PackageFunctionTranslationDeclaration */: {
|
|
5728
5735
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
5729
5736
|
const getTargetsResult = translationPackage?.getPackageFunctionTranslationTargets(parent);
|
|
5730
5737
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
|
@@ -5747,7 +5754,7 @@ var NodeSemanticInfoService = class {
|
|
|
5747
5754
|
}
|
|
5748
5755
|
break;
|
|
5749
5756
|
}
|
|
5750
|
-
case
|
|
5757
|
+
case 135 /* MethodTranslation */: {
|
|
5751
5758
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
5752
5759
|
const getTargetsResult = translationPackage?.getMethodTranslationTargets(parent);
|
|
5753
5760
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
|
@@ -5770,7 +5777,7 @@ var NodeSemanticInfoService = class {
|
|
|
5770
5777
|
}
|
|
5771
5778
|
break;
|
|
5772
5779
|
}
|
|
5773
|
-
case
|
|
5780
|
+
case 142 /* TypeTranslationDeclaration */: {
|
|
5774
5781
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
5775
5782
|
const getTargetResult = translationPackage?.getTypeTranslationTarget(parent);
|
|
5776
5783
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
|
@@ -5790,7 +5797,7 @@ var NodeSemanticInfoService = class {
|
|
|
5790
5797
|
}
|
|
5791
5798
|
break;
|
|
5792
5799
|
}
|
|
5793
|
-
case
|
|
5800
|
+
case 136 /* FunctionTypeTranslationDeclaration */: {
|
|
5794
5801
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
|
5795
5802
|
const getTargetResult = translationPackage?.getFunctionTypeTranslationTarget(parent);
|
|
5796
5803
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
|
@@ -5810,7 +5817,7 @@ var NodeSemanticInfoService = class {
|
|
|
5810
5817
|
}
|
|
5811
5818
|
break;
|
|
5812
5819
|
}
|
|
5813
|
-
case
|
|
5820
|
+
case 151 /* ParameterDeclaration */:
|
|
5814
5821
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofParameterDeclaration(parent));
|
|
5815
5822
|
break;
|
|
5816
5823
|
case 8 /* PackageImport */:
|
|
@@ -5831,10 +5838,10 @@ var NodeSemanticInfoService = class {
|
|
|
5831
5838
|
case 52 /* FieldDeclaration */:
|
|
5832
5839
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofFieldDeclaration(parent));
|
|
5833
5840
|
break;
|
|
5834
|
-
case
|
|
5841
|
+
case 150 /* TypeParameterDeclaration */:
|
|
5835
5842
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
|
|
5836
5843
|
break;
|
|
5837
|
-
case
|
|
5844
|
+
case 149 /* VariantDeclaration */:
|
|
5838
5845
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
|
|
5839
5846
|
break;
|
|
5840
5847
|
case 34 /* PackageVariableGetterDeclaration */:
|
|
@@ -5953,10 +5960,10 @@ var NodeSemanticInfoService = class {
|
|
|
5953
5960
|
switch (node.parent.kind) {
|
|
5954
5961
|
case 10 /* NamedTypeSpecifier */:
|
|
5955
5962
|
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier, options6);
|
|
5956
|
-
case
|
|
5963
|
+
case 154 /* Tag */:
|
|
5957
5964
|
return this.ofTagNameQualifier(analyzer, node.parent, qualifier, options6);
|
|
5958
5965
|
case 40 /* ExtendedTypeClause */:
|
|
5959
|
-
case
|
|
5966
|
+
case 137 /* PackageImportTranslationDeclaration */:
|
|
5960
5967
|
return void 0;
|
|
5961
5968
|
default:
|
|
5962
5969
|
Debug.never(node.parent);
|
|
@@ -6390,7 +6397,7 @@ var NodeSemanticInfoService = class {
|
|
|
6390
6397
|
let parentCallExpression;
|
|
6391
6398
|
if (parent.kind === 68 /* CallExpression */) {
|
|
6392
6399
|
parentCallExpression = parent;
|
|
6393
|
-
} else if (parent.kind ===
|
|
6400
|
+
} else if (parent.kind === 90 /* GenericSpecializationExpression */) {
|
|
6394
6401
|
const grandParent = getParentSkippingParenthesizedExpressions(parent);
|
|
6395
6402
|
if (grandParent.kind === 68 /* CallExpression */) {
|
|
6396
6403
|
parentCallExpression = grandParent;
|
|
@@ -6619,6 +6626,15 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
|
6619
6626
|
return new SourceLocation(sourceFile, range);
|
|
6620
6627
|
});
|
|
6621
6628
|
}
|
|
6629
|
+
} else if (entity.kind === 13 /* LocalizableText */) {
|
|
6630
|
+
const definition = entity.getDefinition();
|
|
6631
|
+
if (definition.kind === 0 /* Source */) {
|
|
6632
|
+
result = definition.nodes.map((d) => {
|
|
6633
|
+
const range = d.rangeWithoutTrivia;
|
|
6634
|
+
const sourceFile = TreeQuery.fromNode(d).projectSourceFile(analyzer);
|
|
6635
|
+
return new SourceLocation(sourceFile, range);
|
|
6636
|
+
});
|
|
6637
|
+
}
|
|
6622
6638
|
} else {
|
|
6623
6639
|
const definition = entity.getDefinition();
|
|
6624
6640
|
if (definition.kind === 0 /* Source */) {
|
|
@@ -6637,7 +6653,7 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
|
6637
6653
|
case 36 /* PackageVariantTypeDeclaration */:
|
|
6638
6654
|
case 56 /* NestedFunctionDeclaration */:
|
|
6639
6655
|
case 50 /* MethodDeclaration */:
|
|
6640
|
-
case
|
|
6656
|
+
case 150 /* TypeParameterDeclaration */:
|
|
6641
6657
|
case 51 /* OperatorDeclaration */:
|
|
6642
6658
|
range = node.name.rangeWithoutTrivia;
|
|
6643
6659
|
break;
|
|
@@ -6742,20 +6758,30 @@ var DefinitionService = class {
|
|
|
6742
6758
|
default:
|
|
6743
6759
|
Debug.never(semanticInfo);
|
|
6744
6760
|
}
|
|
6745
|
-
if (
|
|
6746
|
-
const sourceLocations =
|
|
6747
|
-
|
|
6761
|
+
if (this._sourceGenerationService !== void 0 && semanticInfo.kind === "reference") {
|
|
6762
|
+
const sourceLocations = new Array();
|
|
6763
|
+
for (const referenceTarget of semanticInfo.betterTargets ?? semanticInfo.targets) {
|
|
6764
|
+
const referencedEntity = this.getReferenceTargetEntity(referenceTarget);
|
|
6748
6765
|
if (referencedEntity !== void 0 && this._sourceGenerationService.entityDefinitionRequiresSourceGeneration(referencedEntity)) {
|
|
6749
|
-
|
|
6766
|
+
const locations = yield this._sourceGenerationService.getDefinitionInGeneratedCode(
|
|
6750
6767
|
analyzer,
|
|
6751
6768
|
referencedEntity,
|
|
6752
6769
|
cancellationToken
|
|
6753
6770
|
);
|
|
6771
|
+
if (locations !== void 0) {
|
|
6772
|
+
sourceLocations.push(...locations);
|
|
6773
|
+
}
|
|
6754
6774
|
}
|
|
6755
|
-
|
|
6756
|
-
}).toArray())).filter((l) => l !== void 0).flatMap((l) => l);
|
|
6775
|
+
}
|
|
6757
6776
|
if (sourceLocations.length > 0) {
|
|
6758
|
-
result
|
|
6777
|
+
if (result === void 0) {
|
|
6778
|
+
result = new DefinitionsAndReferenceInfo(sourceLocations, tokenOrKeyword.value.rangeWithoutTrivia);
|
|
6779
|
+
} else {
|
|
6780
|
+
result = new DefinitionsAndReferenceInfo(
|
|
6781
|
+
result.definitionLocations.concat(sourceLocations),
|
|
6782
|
+
result.referenceRange
|
|
6783
|
+
);
|
|
6784
|
+
}
|
|
6759
6785
|
}
|
|
6760
6786
|
}
|
|
6761
6787
|
return result;
|
|
@@ -7049,7 +7075,7 @@ var ReferencesService = class {
|
|
|
7049
7075
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
|
7050
7076
|
}
|
|
7051
7077
|
}
|
|
7052
|
-
if (node.kind ===
|
|
7078
|
+
if (node.kind === 92 /* AssignmentStatement */ && restrictions.canBeAssignmentStatementOperator) {
|
|
7053
7079
|
const semanticInfo = NodeSemanticInfoService.ofAssignmentStatementOperator(
|
|
7054
7080
|
analyzer,
|
|
7055
7081
|
node,
|
|
@@ -7077,7 +7103,7 @@ var ReferencesService = class {
|
|
|
7077
7103
|
result.push(new Reference(sourceFile2, node.creationKeyword.rangeWithoutTrivia, referenceKind));
|
|
7078
7104
|
}
|
|
7079
7105
|
}
|
|
7080
|
-
if (node.kind ===
|
|
7106
|
+
if (node.kind === 87 /* ObjectExpression */ && restrictions.canBeObjectExpression) {
|
|
7081
7107
|
const semanticInfo = NodeSemanticInfoService.ofObjectExpression(analyzer, node, semanticInfoOptions);
|
|
7082
7108
|
const referenceKind = this.ifReferenceToSomeOfDefinitionsThenKind(
|
|
7083
7109
|
definitions,
|
|
@@ -7089,7 +7115,7 @@ var ReferencesService = class {
|
|
|
7089
7115
|
result.push(new Reference(sourceFile2, node.keyword.rangeWithoutTrivia, referenceKind));
|
|
7090
7116
|
}
|
|
7091
7117
|
}
|
|
7092
|
-
if (node.kind ===
|
|
7118
|
+
if (node.kind === 88 /* BaseExpression */ && restrictions.canBeBaseExpression) {
|
|
7093
7119
|
const semanticInfo = NodeSemanticInfoService.ofBaseExpression(analyzer, node, semanticInfoOptions);
|
|
7094
7120
|
const referenceKind = this.ifReferenceToSomeOfDefinitionsThenKind(
|
|
7095
7121
|
definitions,
|
|
@@ -7383,6 +7409,7 @@ var ReferencesService = class {
|
|
|
7383
7409
|
case 12 /* Package */:
|
|
7384
7410
|
case 11 /* TypeExtension */:
|
|
7385
7411
|
case 9 /* Operator */:
|
|
7412
|
+
case 13 /* LocalizableText */:
|
|
7386
7413
|
return void 0;
|
|
7387
7414
|
default:
|
|
7388
7415
|
Debug.never(entity);
|
|
@@ -7493,7 +7520,7 @@ var EvaluatableExpressionService = class {
|
|
|
7493
7520
|
getEvaluatableExpressionForIdentifier(node) {
|
|
7494
7521
|
const parent = node.parent;
|
|
7495
7522
|
switch (parent.kind) {
|
|
7496
|
-
case
|
|
7523
|
+
case 89 /* IdentifierExpression */:
|
|
7497
7524
|
return parent;
|
|
7498
7525
|
case 76 /* MemberAccessExpression */:
|
|
7499
7526
|
if (this.isEvaluatableReceiver(parent.expression)) {
|
|
@@ -7516,7 +7543,7 @@ var EvaluatableExpressionService = class {
|
|
|
7516
7543
|
}
|
|
7517
7544
|
isEvaluatableReceiver(expression) {
|
|
7518
7545
|
switch (expression.kind) {
|
|
7519
|
-
case
|
|
7546
|
+
case 89 /* IdentifierExpression */:
|
|
7520
7547
|
return true;
|
|
7521
7548
|
case 76 /* MemberAccessExpression */:
|
|
7522
7549
|
return this.isEvaluatableReceiver(expression.expression);
|
|
@@ -7544,17 +7571,17 @@ var EvaluatableExpressionService = class {
|
|
|
7544
7571
|
return { nameIdentifier: node.name };
|
|
7545
7572
|
case 57 /* LocalVariableDeclaration */:
|
|
7546
7573
|
return { nameIdentifier: node.name };
|
|
7547
|
-
case
|
|
7574
|
+
case 151 /* ParameterDeclaration */:
|
|
7548
7575
|
return { nameIdentifier: node.name };
|
|
7549
7576
|
case 50 /* MethodDeclaration */:
|
|
7550
7577
|
return { nameIdentifier: node.name };
|
|
7551
7578
|
case 52 /* FieldDeclaration */:
|
|
7552
7579
|
return { nameIdentifier: node.name };
|
|
7553
|
-
case
|
|
7580
|
+
case 150 /* TypeParameterDeclaration */:
|
|
7554
7581
|
return { nameIdentifier: node.name };
|
|
7555
|
-
case
|
|
7582
|
+
case 149 /* VariantDeclaration */:
|
|
7556
7583
|
return { nameIdentifier: node.name };
|
|
7557
|
-
case
|
|
7584
|
+
case 102 /* ErrorVariableDeclaration */:
|
|
7558
7585
|
return { nameIdentifier: node.name };
|
|
7559
7586
|
default:
|
|
7560
7587
|
return void 0;
|
|
@@ -7955,7 +7982,7 @@ var SourceFileItemsService = class {
|
|
|
7955
7982
|
);
|
|
7956
7983
|
break;
|
|
7957
7984
|
}
|
|
7958
|
-
case
|
|
7985
|
+
case 149 /* VariantDeclaration */: {
|
|
7959
7986
|
result.push(
|
|
7960
7987
|
this.createItem(
|
|
7961
7988
|
9 /* Variant */,
|
|
@@ -7967,7 +7994,7 @@ var SourceFileItemsService = class {
|
|
|
7967
7994
|
);
|
|
7968
7995
|
break;
|
|
7969
7996
|
}
|
|
7970
|
-
case
|
|
7997
|
+
case 150 /* TypeParameterDeclaration */: {
|
|
7971
7998
|
result.push(
|
|
7972
7999
|
this.createItem(
|
|
7973
8000
|
18 /* TypeParameter */,
|
|
@@ -8236,13 +8263,13 @@ var SelectionRangeService = class {
|
|
|
8236
8263
|
}
|
|
8237
8264
|
}
|
|
8238
8265
|
switch (node.kind) {
|
|
8239
|
-
case
|
|
8266
|
+
case 163 /* TypeAnnotation */:
|
|
8240
8267
|
case 32 /* StructuredTypeDeclarationBody */:
|
|
8241
8268
|
case 37 /* VariantTypeDeclarationBody */:
|
|
8242
8269
|
case 21 /* AliasTypeDeclarationBody */:
|
|
8243
8270
|
case 27 /* FunctionTypeDeclarationBody */:
|
|
8244
|
-
case
|
|
8245
|
-
case
|
|
8271
|
+
case 82 /* TextTemplateSpan */:
|
|
8272
|
+
case 81 /* TextTemplateSpanList */:
|
|
8246
8273
|
return true;
|
|
8247
8274
|
default:
|
|
8248
8275
|
return false;
|
|
@@ -8280,7 +8307,7 @@ var SemanticTokensService = class {
|
|
|
8280
8307
|
controller.stopChildrenTraverse();
|
|
8281
8308
|
return;
|
|
8282
8309
|
}
|
|
8283
|
-
if (node.kind ===
|
|
8310
|
+
if (node.kind === 89 /* IdentifierExpression */) {
|
|
8284
8311
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
|
8285
8312
|
if (meaning.kind === "variable-access") {
|
|
8286
8313
|
const variable = meaning.variable.getEntity();
|
|
@@ -8381,7 +8408,7 @@ var SemanticTokensService = class {
|
|
|
8381
8408
|
));
|
|
8382
8409
|
}
|
|
8383
8410
|
}
|
|
8384
|
-
if (node.kind ===
|
|
8411
|
+
if (node.kind === 149 /* VariantDeclaration */) {
|
|
8385
8412
|
result.push(
|
|
8386
8413
|
new SemanticToken(
|
|
8387
8414
|
node.name.rangeWithoutTrivia,
|
|
@@ -8561,7 +8588,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
|
8561
8588
|
}
|
|
8562
8589
|
let node = token.parent;
|
|
8563
8590
|
while (node !== void 0) {
|
|
8564
|
-
if (node.kind ===
|
|
8591
|
+
if (node.kind === 159 /* TypeArgumentClause */ && this._offset >= node.lessThanToken.rangeWithoutTrivia.end && (node.greaterThanToken.rangeWithoutTrivia.isEmpty || this._offset <= node.greaterThanToken.rangeWithoutTrivia.start)) {
|
|
8565
8592
|
const argumentIndex = this.getArgumentIndex(node.typeArgumentList, this._offset);
|
|
8566
8593
|
const argumentCount = this.countArguments(node.typeArgumentList);
|
|
8567
8594
|
return new NodeWithTypeArgumentsInfo(node.parent, argumentIndex, argumentCount);
|
|
@@ -8606,9 +8633,9 @@ var TypeParameterSignatureHelpProvider = class {
|
|
|
8606
8633
|
switch (node.kind) {
|
|
8607
8634
|
case 10 /* NamedTypeSpecifier */:
|
|
8608
8635
|
return this.getSignaturesForNamedTypeSpecifier(node);
|
|
8609
|
-
case
|
|
8636
|
+
case 90 /* GenericSpecializationExpression */:
|
|
8610
8637
|
return this.getSignaturesForGenericSpecializationExpression(node);
|
|
8611
|
-
case
|
|
8638
|
+
case 154 /* Tag */:
|
|
8612
8639
|
return this.getSignaturesForTag(node);
|
|
8613
8640
|
default:
|
|
8614
8641
|
Debug.never(node);
|
|
@@ -8647,7 +8674,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
|
8647
8674
|
}
|
|
8648
8675
|
getSignaturesForGenericSpecializationExpression(node) {
|
|
8649
8676
|
const expression = unwrapParenthesizedExpressions(node.expression);
|
|
8650
|
-
if (expression.kind ===
|
|
8677
|
+
if (expression.kind === 89 /* IdentifierExpression */) {
|
|
8651
8678
|
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
|
8652
8679
|
if (meaning.kind === "function-access") {
|
|
8653
8680
|
return Query.from(meaning.candidates).mapAndFilter((o) => {
|
|
@@ -8933,7 +8960,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
|
8933
8960
|
}
|
|
8934
8961
|
break;
|
|
8935
8962
|
}
|
|
8936
|
-
case
|
|
8963
|
+
case 154 /* Tag */: {
|
|
8937
8964
|
if (node.openParenthesisToken !== void 0 && this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && node.argumentList !== void 0 && (node.closeParenthesisToken === void 0 || node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
|
8938
8965
|
const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
|
|
8939
8966
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(node);
|
|
@@ -9767,7 +9794,8 @@ var ReadonlyCompilationState = class {
|
|
|
9767
9794
|
}
|
|
9768
9795
|
collectSourceFileDiagnostics(sourceFile, cancellationToken) {
|
|
9769
9796
|
return __async(this, null, function* () {
|
|
9770
|
-
const
|
|
9797
|
+
const diagnosticCollector = new DiagnosticCollector(this.analyzer, sourceFile);
|
|
9798
|
+
const diagnostics = yield diagnosticCollector.collect(cancellationToken);
|
|
9771
9799
|
const summary = this.createDiagnosticsCollectionSummary(diagnostics);
|
|
9772
9800
|
return { diagnostics, summary };
|
|
9773
9801
|
});
|
|
@@ -11531,6 +11559,12 @@ var EntityToSyntax = class {
|
|
|
11531
11559
|
if (isHidden !== void 0) {
|
|
11532
11560
|
modifiers.push(this.createHidingModifier(isHidden));
|
|
11533
11561
|
}
|
|
11562
|
+
if (entity.markedBasic()) {
|
|
11563
|
+
modifiers.push(SyntaxFactory.modifier(17 /* Basic */));
|
|
11564
|
+
}
|
|
11565
|
+
if (entity.isAbstract()) {
|
|
11566
|
+
modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
|
|
11567
|
+
}
|
|
11534
11568
|
const name = this.getEntityName(entity);
|
|
11535
11569
|
const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
|
|
11536
11570
|
const body = this.createStructuredTypeDeclarationBody(entity);
|
|
@@ -11802,7 +11836,7 @@ var EntityToSyntax = class {
|
|
|
11802
11836
|
const type = this.convertType(entity.getType());
|
|
11803
11837
|
let defaultValue;
|
|
11804
11838
|
if (entity.isOptional()) {
|
|
11805
|
-
defaultValue = SyntaxFactory.
|
|
11839
|
+
defaultValue = SyntaxFactory.nullLiteral();
|
|
11806
11840
|
}
|
|
11807
11841
|
return SyntaxFactory.parameterDeclaration(tags, name, type, defaultValue);
|
|
11808
11842
|
}
|
|
@@ -11894,10 +11928,10 @@ var EntityToSyntax = class {
|
|
|
11894
11928
|
}
|
|
11895
11929
|
convertUnionType(type) {
|
|
11896
11930
|
if (type.originalTypes.length === 2) {
|
|
11897
|
-
const
|
|
11898
|
-
if (
|
|
11899
|
-
const
|
|
11900
|
-
const result = SyntaxFactory.nullableTypeSpecifier(this.convertType(
|
|
11931
|
+
const nullTypeIndex = type.originalTypes.findIndex((t) => t.equals(this._analyzer.originalStandardTypes.nullType));
|
|
11932
|
+
if (nullTypeIndex >= 0) {
|
|
11933
|
+
const nonNullType = nullTypeIndex === 0 ? type.originalTypes[1] : type.originalTypes[0];
|
|
11934
|
+
const result = SyntaxFactory.nullableTypeSpecifier(this.convertType(nonNullType));
|
|
11901
11935
|
return result;
|
|
11902
11936
|
}
|
|
11903
11937
|
}
|
|
@@ -12114,6 +12148,8 @@ var SourceGenerationService = class extends ObservableObject7 {
|
|
|
12114
12148
|
return false;
|
|
12115
12149
|
case 11 /* TypeExtension */:
|
|
12116
12150
|
return true;
|
|
12151
|
+
case 13 /* LocalizableText */:
|
|
12152
|
+
return true;
|
|
12117
12153
|
default:
|
|
12118
12154
|
Debug.never(entity);
|
|
12119
12155
|
}
|
|
@@ -12189,6 +12225,8 @@ var EntityFinder = class {
|
|
|
12189
12225
|
case 12 /* Package */:
|
|
12190
12226
|
case 11 /* TypeExtension */:
|
|
12191
12227
|
return void 0;
|
|
12228
|
+
case 13 /* LocalizableText */:
|
|
12229
|
+
return void 0;
|
|
12192
12230
|
default:
|
|
12193
12231
|
Debug.never(entity);
|
|
12194
12232
|
}
|
|
@@ -12377,6 +12415,8 @@ var EntityFinder = class {
|
|
|
12377
12415
|
case 11 /* TypeExtension */:
|
|
12378
12416
|
case 6 /* DereferenceOperator */:
|
|
12379
12417
|
return void 0;
|
|
12418
|
+
case 13 /* LocalizableText */:
|
|
12419
|
+
return void 0;
|
|
12380
12420
|
default:
|
|
12381
12421
|
Debug.never(entity);
|
|
12382
12422
|
}
|
|
@@ -12402,6 +12442,7 @@ var EntityFinder = class {
|
|
|
12402
12442
|
case 12 /* Package */:
|
|
12403
12443
|
case 11 /* TypeExtension */:
|
|
12404
12444
|
case 9 /* Operator */:
|
|
12445
|
+
case 13 /* LocalizableText */:
|
|
12405
12446
|
return void 0;
|
|
12406
12447
|
default:
|
|
12407
12448
|
Debug.never(entity);
|
|
@@ -13085,7 +13126,7 @@ var LanguageServer = class {
|
|
|
13085
13126
|
const sourceFileContext = yield this.getSourceFileContext(uri, token);
|
|
13086
13127
|
if (sourceFileContext !== void 0) {
|
|
13087
13128
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
13088
|
-
if (node?.kind ===
|
|
13129
|
+
if (node?.kind === 92 /* AssignmentStatement */) {
|
|
13089
13130
|
const sourceFileEdit = this._addPropertyAssignmentService.createEditWithAssignment(
|
|
13090
13131
|
sourceFileContext.sourceFile,
|
|
13091
13132
|
node,
|
|
@@ -13122,7 +13163,7 @@ var LanguageServer = class {
|
|
|
13122
13163
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
|
13123
13164
|
if (node !== void 0) {
|
|
13124
13165
|
let nodeForRange = node;
|
|
13125
|
-
if (node.kind ===
|
|
13166
|
+
if (node.kind === 92 /* AssignmentStatement */) {
|
|
13126
13167
|
nodeForRange = node.right;
|
|
13127
13168
|
}
|
|
13128
13169
|
result = this.convertSourceFileRange(sourceFileContext.sourceFile, nodeForRange.rangeWithoutTrivia);
|
|
@@ -13156,7 +13197,7 @@ var LanguageServer = class {
|
|
|
13156
13197
|
return result;
|
|
13157
13198
|
});
|
|
13158
13199
|
}
|
|
13159
|
-
onEmitCodeToString(params,
|
|
13200
|
+
onEmitCodeToString(params, cancellationToken) {
|
|
13160
13201
|
return __async(this, null, function* () {
|
|
13161
13202
|
let compilationControllerUri;
|
|
13162
13203
|
if (params.workspaceFolderUri !== void 0) {
|
|
@@ -13170,7 +13211,7 @@ var LanguageServer = class {
|
|
|
13170
13211
|
}
|
|
13171
13212
|
compilationControllerUri = this._workspace.workspaceFolderUris[0];
|
|
13172
13213
|
}
|
|
13173
|
-
const workspaceElementInfo = yield this._workspace.waitLoadedAndGetWorkspaceElementInfo(compilationControllerUri,
|
|
13214
|
+
const workspaceElementInfo = yield this._workspace.waitLoadedAndGetWorkspaceElementInfo(compilationControllerUri, cancellationToken);
|
|
13174
13215
|
const compilationController = workspaceElementInfo?.compilationController;
|
|
13175
13216
|
if (compilationController === void 0) {
|
|
13176
13217
|
throw new ls3.ResponseError(
|
|
@@ -13191,7 +13232,7 @@ var LanguageServer = class {
|
|
|
13191
13232
|
continue;
|
|
13192
13233
|
}
|
|
13193
13234
|
for (const sourceFile of pkg.sourceFiles) {
|
|
13194
|
-
const summary = yield compilationState.getDiagnosticsCollectionSummary(sourceFile,
|
|
13235
|
+
const summary = yield compilationState.getDiagnosticsCollectionSummary(sourceFile, cancellationToken);
|
|
13195
13236
|
hasErrors ||= summary.hasErrors;
|
|
13196
13237
|
if (summary.hasErrors) {
|
|
13197
13238
|
const uri = this.convertUriToVscodeUri(sourceFile.uri).toString();
|
|
@@ -13209,8 +13250,8 @@ var LanguageServer = class {
|
|
|
13209
13250
|
};
|
|
13210
13251
|
let result;
|
|
13211
13252
|
try {
|
|
13212
|
-
const emitter =
|
|
13213
|
-
const code = emitter.emitToString();
|
|
13253
|
+
const emitter = new Emitter(compilationController.mainCompilationState.analyzer, options6);
|
|
13254
|
+
const code = yield emitter.emitToString(cancellationToken);
|
|
13214
13255
|
result = { hasErrors: false, code };
|
|
13215
13256
|
} catch (e) {
|
|
13216
13257
|
Logger.error(`\u0412\u043E \u0432\u0440\u0435\u043C\u044F \u0433\u0435\u043D\u0435\u0440\u0430\u0446\u0438\u0438 \u043A\u043E\u0434\u0430 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 ${compilationController.uri} \u0432\u043E\u0437\u043D\u0438\u043A\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430
|