@artel/artc 0.6.25226 → 0.6.25227
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 -56
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +396 -315
- package/build/{chunk-YNR2KYMJ.js → chunk-74TFH7TE.js} +3 -3
- package/build/{chunk-VRQPLLYS.js → chunk-NOECPQMV.js} +5773 -5236
- package/build/{chunk-MHPX52MT.js → chunk-VD6OPILI.js} +3 -3
- package/build/types/analysis/Analyzer.d.ts +24 -70
- package/build/types/analysis/AssignmentChecker.d.ts +11 -0
- package/build/types/analysis/CallExpressionMeaning.d.ts +2 -0
- package/build/types/analysis/DiagnosticCollector.d.ts +6 -3
- package/build/types/analysis/IdentifierExpressionMeaning.d.ts +6 -6
- package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +3 -3
- package/build/types/analysis/MemberAccessExpressionMeaning.d.ts +9 -9
- package/build/types/analysis/NamedTypeResolver.d.ts +3 -2
- package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +3 -2
- package/build/types/analysis/NodeTypeUtils.d.ts +3 -2
- package/build/types/analysis/TagMeaning.d.ts +3 -2
- package/build/types/analysis/TypeMemberLookup.d.ts +11 -11
- package/build/types/analysis/TypeNarrower.d.ts +0 -69
- package/build/types/analysis/control-flow/GraphBuilder.d.ts +1 -0
- package/build/types/analysis/control-flow/NarrowableReference.d.ts +73 -0
- package/build/types/analysis/control-flow/Nodes.d.ts +9 -0
- package/build/types/analysis/control-flow/index.d.ts +1 -0
- package/build/types/analysis/semantic-context/Declarations.d.ts +117 -0
- package/build/types/analysis/semantic-context/FieldWithInitializerSemanticContext.d.ts +22 -0
- package/build/types/analysis/semantic-context/SemanticContext.d.ts +13 -0
- package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +168 -0
- package/build/types/analysis/semantic-context/SemanticContextBasedEntityHidingMatcher.d.ts +14 -0
- package/build/types/analysis/semantic-context/SemanticContextBuilder.d.ts +84 -0
- package/build/types/analysis/semantic-context/SemanticContextValidatingNameConflicts.d.ts +124 -0
- package/build/types/analysis/semantic-context/SemanticContextWithParent.d.ts +9 -0
- package/build/types/analysis/semantic-context/SourceFileSemanticContext.d.ts +42 -0
- package/build/types/analysis/semantic-context/SpecialLocalDeclarationsBuilder.d.ts +23 -0
- package/build/types/analysis/semantic-context/SubprogramSemanticContext.d.ts +122 -0
- package/build/types/analysis/semantic-context/TypeSemanticContext.d.ts +109 -0
- package/build/types/analysis/semantic-context/index.d.ts +9 -0
- package/build/types/api/Api.d.ts +3 -5
- package/build/types/common/Errors.d.ts +2 -0
- package/build/types/common/Lazy.d.ts +4 -0
- package/build/types/common/Query.d.ts +2 -1
- package/build/types/common/WithDiagnostics.d.ts +4 -3
- package/build/types/common/index.d.ts +1 -0
- package/build/types/diagnostic/DiagnosticCode.d.ts +26 -20
- package/build/types/emitter/IrBuilder.d.ts +1 -0
- package/build/types/emitter/Transformer.d.ts +1 -1
- package/build/types/entities/FunctionEntity.d.ts +2 -2
- package/build/types/entities/VariableEntity.d.ts +35 -19
- package/build/types/services/DefinitionService.d.ts +3 -0
- package/build/types/tree/KeywordKind.d.ts +31 -30
- package/build/types/tree/NodeKind.d.ts +81 -80
- package/build/types/tree/green/Nodes.d.ts +40 -18
- package/build/types/tree/red/Nodes.d.ts +31 -15
- package/build/types/types/TypeFactory.d.ts +0 -2
- package/package.json +1 -1
- package/build/types/analysis/Lookup.d.ts +0 -28
- package/build/types/analysis/Scope.d.ts +0 -205
- package/build/types/analysis/SemanticContext.d.ts +0 -367
- package/build/types/analysis/SemanticContextBuilder.d.ts +0 -59
- package/build/types/analysis/StatementBlockScopeBuilder.d.ts +0 -26
package/build/api/ApiServices.js
CHANGED
@@ -182,7 +182,7 @@ import {
|
|
182
182
|
unwrapParenthesizedExpressions,
|
183
183
|
visitChildren,
|
184
184
|
yieldExecution
|
185
|
-
} from "../chunk-
|
185
|
+
} from "../chunk-NOECPQMV.js";
|
186
186
|
|
187
187
|
// source/services/CustomCommand.ts
|
188
188
|
import * as ls from "vscode-languageserver";
|
@@ -302,7 +302,7 @@ var AddPropertyAssignmentService = class {
|
|
302
302
|
let result;
|
303
303
|
let leftValueText;
|
304
304
|
if (propertyName !== void 0) {
|
305
|
-
if (assignmentNode.left.kind !==
|
305
|
+
if (assignmentNode.left.kind !== 79 /* MemberAccessExpression */) {
|
306
306
|
return void 0;
|
307
307
|
}
|
308
308
|
const propertyReceiver = assignmentNode.left.expression;
|
@@ -319,7 +319,7 @@ var AddPropertyAssignmentService = class {
|
|
319
319
|
const reassignmentText = `${leftValueText} = ${value}`;
|
320
320
|
const subprogramBody = this.ifShouldBeAssignedAtTheEndOfSubprogramThenBody(assignmentNode);
|
321
321
|
if (subprogramBody !== void 0) {
|
322
|
-
const lastStatement = subprogramBody.expressionOrStatementList.kind ===
|
322
|
+
const lastStatement = subprogramBody.expressionOrStatementList.kind === 93 /* StatementList */ ? subprogramBody.expressionOrStatementList?.statements.last() : subprogramBody.expressionOrStatementList;
|
323
323
|
let editRangeStart;
|
324
324
|
let indentationText;
|
325
325
|
if (lastStatement !== void 0) {
|
@@ -351,9 +351,9 @@ var AddPropertyAssignmentService = class {
|
|
351
351
|
ifShouldBeAssignedAtTheEndOfSubprogramThenBody(node) {
|
352
352
|
const parent = node.parent.parent;
|
353
353
|
switch (parent.kind) {
|
354
|
-
case
|
354
|
+
case 94 /* StatementBlock */:
|
355
355
|
return this.getContainingSubprogram(parent)?.block;
|
356
|
-
case
|
356
|
+
case 95 /* FunctionBlock */:
|
357
357
|
return void 0;
|
358
358
|
default:
|
359
359
|
Debug.never(parent);
|
@@ -545,7 +545,7 @@ var SyntaxFactory = class {
|
|
545
545
|
static packageVariableGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
546
546
|
const tagList = new TagList(tags);
|
547
547
|
const modifierList = new ModifierList(modifiers);
|
548
|
-
const getKeyword = this.keyword(
|
548
|
+
const getKeyword = this.keyword(59 /* Get */);
|
549
549
|
const nameIdentifier = this.createIdentifier(name);
|
550
550
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
551
551
|
return new PackageVariableGetterDeclaration(
|
@@ -560,7 +560,7 @@ var SyntaxFactory = class {
|
|
560
560
|
static packageVariableSetterDeclaration(tags, modifiers, name, body) {
|
561
561
|
const tagList = new TagList(tags);
|
562
562
|
const modifierList = new ModifierList(modifiers);
|
563
|
-
const setKeyword = this.keyword(
|
563
|
+
const setKeyword = this.keyword(60 /* Set */);
|
564
564
|
const nameIdentifier = this.createIdentifier(name);
|
565
565
|
return new PackageVariableSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body);
|
566
566
|
}
|
@@ -607,7 +607,7 @@ var SyntaxFactory = class {
|
|
607
607
|
static fieldGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
608
608
|
const tagList = new TagList(tags);
|
609
609
|
const modifierList = new ModifierList(modifiers);
|
610
|
-
const getKeyword = this.keyword(
|
610
|
+
const getKeyword = this.keyword(59 /* Get */);
|
611
611
|
const nameIdentifier = this.createIdentifier(name);
|
612
612
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
613
613
|
return new FieldGetterDeclaration(
|
@@ -622,7 +622,7 @@ var SyntaxFactory = class {
|
|
622
622
|
static fieldSetterDeclaration(tags, modifiers, name, body) {
|
623
623
|
const tagList = new TagList(tags);
|
624
624
|
const modifierList = new ModifierList(modifiers);
|
625
|
-
const setKeyword = this.keyword(
|
625
|
+
const setKeyword = this.keyword(60 /* Set */);
|
626
626
|
const nameIdentifier = this.createIdentifier(name);
|
627
627
|
return new FieldSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body);
|
628
628
|
}
|
@@ -648,21 +648,21 @@ var SyntaxFactory = class {
|
|
648
648
|
static constructorDeclaration(tags, modifiers, parameters, body) {
|
649
649
|
const tagList = new TagList(tags);
|
650
650
|
const modifierList = new ModifierList(modifiers);
|
651
|
-
const creationKeyword = this.keyword(
|
651
|
+
const creationKeyword = this.keyword(31 /* Creation */);
|
652
652
|
const parameterClause = this.parameterClause(parameters);
|
653
653
|
return new ConstructorDeclaration(tagList, modifierList, creationKeyword, parameterClause, body);
|
654
654
|
}
|
655
655
|
static destructorDeclaration(tags, modifiers, parameters, body) {
|
656
656
|
const tagList = new TagList(tags);
|
657
657
|
const modifierList = new ModifierList(modifiers);
|
658
|
-
const destructionKeyword = this.keyword(
|
658
|
+
const destructionKeyword = this.keyword(48 /* Destruction */);
|
659
659
|
const parameterClause = this.parameterClause(parameters);
|
660
660
|
return new DestructorDeclaration(tagList, modifierList, destructionKeyword, parameterClause, body);
|
661
661
|
}
|
662
662
|
static indexedElementGetterDeclaration(tags, modifiers, parameters, typeSpecifier, body) {
|
663
663
|
const tagList = new TagList(tags);
|
664
664
|
const modifierList = new ModifierList(modifiers);
|
665
|
-
const getKeyword = this.keyword(
|
665
|
+
const getKeyword = this.keyword(59 /* Get */);
|
666
666
|
const parameterClause = this.indexParameterClause(parameters);
|
667
667
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
668
668
|
return new IndexedElementGetterDeclaration(
|
@@ -677,7 +677,7 @@ var SyntaxFactory = class {
|
|
677
677
|
static indexedElementSetterDeclaration(tags, modifiers, parameters, body) {
|
678
678
|
const tagList = new TagList(tags);
|
679
679
|
const modifierList = new ModifierList(modifiers);
|
680
|
-
const getKeyword = this.keyword(
|
680
|
+
const getKeyword = this.keyword(60 /* Set */);
|
681
681
|
const parameterClause = this.indexParameterClause(parameters);
|
682
682
|
return new IndexedElementSetterDeclaration(tagList, modifierList, getKeyword, parameterClause, body);
|
683
683
|
}
|
@@ -845,7 +845,7 @@ var SyntaxFactory = class {
|
|
845
845
|
return new FunctionBlock(openBraceToken, statementList, closeBraceToken);
|
846
846
|
}
|
847
847
|
static noneLiteral() {
|
848
|
-
return new KeywordExpression(this.keyword(
|
848
|
+
return new KeywordExpression(this.keyword(58 /* None */));
|
849
849
|
}
|
850
850
|
static integerLiteral(value) {
|
851
851
|
return new TokenExpression(this.token(2 /* IntegerLiteral */, value.toString()));
|
@@ -853,7 +853,7 @@ var SyntaxFactory = class {
|
|
853
853
|
static translationsDeclaration(translations) {
|
854
854
|
const tagList = new TagList([]);
|
855
855
|
const modifierList = new ModifierList([]);
|
856
|
-
const translationsKeyword = this.keyword(
|
856
|
+
const translationsKeyword = this.keyword(56 /* Translations */);
|
857
857
|
const openBraceToken = this.token(43 /* OpenBrace */);
|
858
858
|
const translationList = new TopLevelTranslationList(translations);
|
859
859
|
const closeBraceToken = this.token(20 /* CloseBrace */);
|
@@ -970,7 +970,7 @@ var SyntaxFactory = class {
|
|
970
970
|
);
|
971
971
|
}
|
972
972
|
static constructorTranslation(sourceParameters, translatedParameters) {
|
973
|
-
const creationKeyword = this.keyword(
|
973
|
+
const creationKeyword = this.keyword(31 /* Creation */);
|
974
974
|
const sourceParameterClause = this.translationParameterClause(sourceParameters);
|
975
975
|
const minusGreaterThanToken = this.token(42 /* MinusGreaterThan */);
|
976
976
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
@@ -1697,7 +1697,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1697
1697
|
this.writeNodeDefault(node);
|
1698
1698
|
}
|
1699
1699
|
writeDeclarationBody(node, addLeadingNewLineOrWhitespace = true) {
|
1700
|
-
if (node.expressionOrStatementList.kind !==
|
1700
|
+
if (node.expressionOrStatementList.kind !== 93 /* StatementList */ || node.expressionOrStatementList.elements.length === 0) {
|
1701
1701
|
this.writeWhitespace();
|
1702
1702
|
this.writeFunctionBlock(node, false);
|
1703
1703
|
} else {
|
@@ -2038,19 +2038,19 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2038
2038
|
[54 /* FieldDeclaration */]: this.prototype.writeFieldDeclaration,
|
2039
2039
|
[55 /* FieldGetterDeclaration */]: this.prototype.writeFieldGetterDeclaration,
|
2040
2040
|
[56 /* FieldSetterDeclaration */]: this.prototype.writeFieldSetterDeclaration,
|
2041
|
-
[
|
2042
|
-
[
|
2043
|
-
[
|
2044
|
-
[
|
2045
|
-
[
|
2046
|
-
[
|
2047
|
-
[
|
2048
|
-
[
|
2049
|
-
[
|
2050
|
-
[
|
2051
|
-
[
|
2052
|
-
[
|
2053
|
-
[
|
2041
|
+
[94 /* StatementBlock */]: this.prototype.writeStatementBlock,
|
2042
|
+
[95 /* FunctionBlock */]: this.prototype.writeFunctionBlock,
|
2043
|
+
[136 /* QualifiedName */]: this.prototype.writeQualifiedName,
|
2044
|
+
[143 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
|
2045
|
+
[144 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
|
2046
|
+
[145 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
|
2047
|
+
[146 /* Argument */]: this.prototype.writeArgument,
|
2048
|
+
[148 /* Tag */]: this.prototype.writeTag,
|
2049
|
+
[150 /* Modifier */]: this.prototype.writeModifier,
|
2050
|
+
[151 /* ParameterClause */]: this.prototype.writeParameterClause,
|
2051
|
+
[152 /* ParameterList */]: this.prototype.writeParameterList,
|
2052
|
+
[153 /* TypeArgumentClause */]: this.prototype.writeTypeArgumentClause,
|
2053
|
+
[155 /* TypeParameterClause */]: this.prototype.writeTypeParameterClause,
|
2054
2054
|
[17 /* AnonymousFunctionTypeDeclaration */]: this.prototype.writeAnonymousFunctionTypeDeclaration,
|
2055
2055
|
[18 /* AnonymousStructuredTypeDeclaration */]: this.prototype.writeAnonymousStructuredTypeDeclaration,
|
2056
2056
|
[19 /* AnonymousVariantTypeDeclaration */]: this.prototype.writeAnonymousVariantTypeDeclaration,
|
@@ -2086,73 +2086,74 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2086
2086
|
[74 /* FunctionLiteral */]: this.prototype.writeNodeDefault,
|
2087
2087
|
[75 /* ParenthesizedExpression */]: this.prototype.writeNodeDefault,
|
2088
2088
|
[76 /* WhenTernaryExpression */]: this.prototype.writeNodeDefault,
|
2089
|
-
[77 /*
|
2090
|
-
[78 /*
|
2091
|
-
[79 /*
|
2092
|
-
[80 /*
|
2093
|
-
[81 /*
|
2094
|
-
[82 /*
|
2095
|
-
[83 /*
|
2096
|
-
[84 /*
|
2097
|
-
[85 /*
|
2098
|
-
[86 /*
|
2099
|
-
[87 /*
|
2100
|
-
[88 /*
|
2101
|
-
[89 /*
|
2102
|
-
[90 /*
|
2103
|
-
[91 /*
|
2104
|
-
[92 /*
|
2105
|
-
[
|
2106
|
-
[96 /*
|
2107
|
-
[97 /*
|
2108
|
-
[98 /*
|
2109
|
-
[99 /*
|
2110
|
-
[100 /*
|
2111
|
-
[101 /*
|
2112
|
-
[102 /*
|
2113
|
-
[103 /*
|
2114
|
-
[104 /*
|
2115
|
-
[105 /*
|
2116
|
-
[106 /*
|
2117
|
-
[107 /*
|
2118
|
-
[108 /*
|
2119
|
-
[109 /*
|
2120
|
-
[110 /*
|
2121
|
-
[111 /*
|
2122
|
-
[112 /*
|
2123
|
-
[113 /*
|
2124
|
-
[114 /*
|
2125
|
-
[115 /*
|
2126
|
-
[116 /*
|
2127
|
-
[117 /*
|
2128
|
-
[118 /*
|
2129
|
-
[119 /*
|
2130
|
-
[120 /*
|
2131
|
-
[121 /*
|
2132
|
-
[122 /*
|
2133
|
-
[123 /*
|
2134
|
-
[124 /*
|
2135
|
-
[125 /*
|
2136
|
-
[126 /*
|
2137
|
-
[127 /*
|
2138
|
-
[128 /*
|
2139
|
-
[129 /*
|
2140
|
-
[130 /*
|
2141
|
-
[131 /*
|
2142
|
-
[132 /*
|
2143
|
-
[133 /*
|
2144
|
-
[134 /*
|
2145
|
-
[
|
2146
|
-
[137 /*
|
2147
|
-
[138 /*
|
2148
|
-
[139 /*
|
2149
|
-
[140 /*
|
2150
|
-
[141 /*
|
2151
|
-
[
|
2152
|
-
[
|
2153
|
-
[
|
2154
|
-
[
|
2155
|
-
[156 /*
|
2089
|
+
[77 /* ConditionalExpression */]: this.prototype.writeNodeDefault,
|
2090
|
+
[78 /* PrefixUnaryExpression */]: this.prototype.writeNodeDefault,
|
2091
|
+
[79 /* MemberAccessExpression */]: this.prototype.writeNodeDefault,
|
2092
|
+
[80 /* ReferenceExpression */]: this.prototype.writeNodeDefault,
|
2093
|
+
[81 /* DereferenceExpression */]: this.prototype.writeNodeDefault,
|
2094
|
+
[82 /* TextTemplateLiteral */]: this.prototype.writeNodeDefault,
|
2095
|
+
[83 /* TextTemplateSpanList */]: this.prototype.writeNodeDefault,
|
2096
|
+
[84 /* TextTemplateSpan */]: this.prototype.writeNodeDefault,
|
2097
|
+
[85 /* TokenExpression */]: this.prototype.writeNodeDefault,
|
2098
|
+
[86 /* KeywordExpression */]: this.prototype.writeNodeDefault,
|
2099
|
+
[87 /* ObjectExpression */]: this.prototype.writeNodeDefault,
|
2100
|
+
[88 /* BaseExpression */]: this.prototype.writeNodeDefault,
|
2101
|
+
[89 /* IdentifierExpression */]: this.prototype.writeNodeDefault,
|
2102
|
+
[90 /* GenericSpecializationExpression */]: this.prototype.writeNodeDefault,
|
2103
|
+
[91 /* DefaultMatchExpression */]: this.prototype.writeNodeDefault,
|
2104
|
+
[92 /* AssignmentStatement */]: this.prototype.writeNodeDefault,
|
2105
|
+
[93 /* StatementList */]: this.prototype.writeNodeDefault,
|
2106
|
+
[96 /* BreakLoopStatement */]: this.prototype.writeNodeDefault,
|
2107
|
+
[97 /* ContinueLoopStatement */]: this.prototype.writeNodeDefault,
|
2108
|
+
[98 /* DisposeStatement */]: this.prototype.writeNodeDefault,
|
2109
|
+
[99 /* RunStatement */]: this.prototype.writeNodeDefault,
|
2110
|
+
[100 /* TryStatement */]: this.prototype.writeNodeDefault,
|
2111
|
+
[101 /* CatchClause */]: this.prototype.writeNodeDefault,
|
2112
|
+
[102 /* ErrorVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2113
|
+
[103 /* FinallyClause */]: this.prototype.writeNodeDefault,
|
2114
|
+
[104 /* EmptyStatement */]: this.prototype.writeNodeDefault,
|
2115
|
+
[105 /* ErrorStatement */]: this.prototype.writeNodeDefault,
|
2116
|
+
[106 /* ImportantStatement */]: this.prototype.writeNodeDefault,
|
2117
|
+
[107 /* ExpressionStatement */]: this.prototype.writeNodeDefault,
|
2118
|
+
[108 /* EnumerationVariableList */]: this.prototype.writeNodeDefault,
|
2119
|
+
[109 /* ForStatement */]: this.prototype.writeNodeDefault,
|
2120
|
+
[110 /* IfStatement */]: this.prototype.writeNodeDefault,
|
2121
|
+
[111 /* ElseIfClauseList */]: this.prototype.writeNodeDefault,
|
2122
|
+
[112 /* ElseIfClause */]: this.prototype.writeNodeDefault,
|
2123
|
+
[113 /* ElseClause */]: this.prototype.writeNodeDefault,
|
2124
|
+
[114 /* InvalidStatement */]: this.prototype.writeNodeDefault,
|
2125
|
+
[115 /* NestedFunctionDeclarationStatement */]: this.prototype.writeNodeDefault,
|
2126
|
+
[116 /* LocalVariableDeclarationStatement */]: this.prototype.writeNodeDefault,
|
2127
|
+
[117 /* LoopStatement */]: this.prototype.writeNodeDefault,
|
2128
|
+
[118 /* ReturnStatement */]: this.prototype.writeNodeDefault,
|
2129
|
+
[119 /* CaseClauseList */]: this.prototype.writeNodeDefault,
|
2130
|
+
[120 /* SwitchStatement */]: this.prototype.writeNodeDefault,
|
2131
|
+
[121 /* MatchExpressionList */]: this.prototype.writeNodeDefault,
|
2132
|
+
[122 /* CaseClause */]: this.prototype.writeNodeDefault,
|
2133
|
+
[123 /* WhileStatement */]: this.prototype.writeNodeDefault,
|
2134
|
+
[124 /* YieldStatement */]: this.prototype.writeNodeDefault,
|
2135
|
+
[125 /* TranslationParameterList */]: this.prototype.writeNodeDefault,
|
2136
|
+
[126 /* TranslationParameterClause */]: this.prototype.writeTranslationParameterClause,
|
2137
|
+
[127 /* ConstructorTranslation */]: this.prototype.writeConstructorTranslation,
|
2138
|
+
[128 /* IndexParameterTranslationClause */]: this.prototype.writeIndexParameterTranslationClause,
|
2139
|
+
[129 /* IndexerTranslation */]: this.prototype.writeIndexerTranslation,
|
2140
|
+
[130 /* TranslationTypeParameterList */]: this.prototype.writeNodeDefault,
|
2141
|
+
[131 /* TranslationTypeParameterClause */]: this.prototype.writeTranslationTypeParameterClause,
|
2142
|
+
[132 /* PackageFunctionTranslation */]: this.prototype.writePackageFunctionTranslation,
|
2143
|
+
[133 /* MethodTranslation */]: this.prototype.writeMethodTranslation,
|
2144
|
+
[134 /* FunctionTypeTranslation */]: this.prototype.writeFunctionTypeTranslation,
|
2145
|
+
[135 /* PackageImportTranslation */]: this.prototype.writePackageImportTranslation,
|
2146
|
+
[137 /* PackageVariableTranslation */]: this.prototype.writePackageVariableTranslation,
|
2147
|
+
[138 /* FieldOrVariantTranslation */]: this.prototype.writeFieldOrVariantTranslation,
|
2148
|
+
[139 /* TypeMemberTranslationList */]: this.prototype.writeNodeDefault,
|
2149
|
+
[140 /* TypeTranslation */]: this.prototype.writeTypeTranslation,
|
2150
|
+
[141 /* TextLiteralTranslation */]: this.prototype.writeNodeDefault,
|
2151
|
+
[142 /* TextTemplateLiteralTranslation */]: this.prototype.writeNodeDefault,
|
2152
|
+
[147 /* TagList */]: this.prototype.writeNodeDefault,
|
2153
|
+
[149 /* ModifierList */]: this.prototype.writeNodeDefault,
|
2154
|
+
[154 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
|
2155
|
+
[156 /* TypeParameterList */]: this.prototype.writeNodeDefault,
|
2156
|
+
[157 /* TypeAnnotation */]: this.prototype.writeNodeDefault
|
2156
2157
|
};
|
2157
2158
|
return writeFunctions;
|
2158
2159
|
}
|
@@ -2162,14 +2163,14 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2162
2163
|
}
|
2163
2164
|
};
|
2164
2165
|
var modifierSortOrder = {
|
2165
|
-
[
|
2166
|
-
[
|
2166
|
+
[37 /* Hidden */]: 0,
|
2167
|
+
[42 /* Static */]: 1,
|
2167
2168
|
[17 /* Basic */]: 2,
|
2168
|
-
[
|
2169
|
-
[
|
2170
|
-
[
|
2171
|
-
[
|
2172
|
-
[
|
2169
|
+
[39 /* Redefinable */]: 3,
|
2170
|
+
[38 /* Abstract */]: 4,
|
2171
|
+
[40 /* Redefined */]: 5,
|
2172
|
+
[41 /* Async */]: 6,
|
2173
|
+
[36 /* Const */]: 7
|
2173
2174
|
};
|
2174
2175
|
|
2175
2176
|
// source/services/TreeUtils.ts
|
@@ -2337,7 +2338,7 @@ var TranslationsGenerationService = class {
|
|
2337
2338
|
return void 0;
|
2338
2339
|
}
|
2339
2340
|
let result;
|
2340
|
-
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind ===
|
2341
|
+
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind === 140 /* TypeTranslation */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
|
2341
2342
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2342
2343
|
if (translationPackage !== void 0) {
|
2343
2344
|
const generator = new TranslationsGenerator(
|
@@ -2349,7 +2350,7 @@ var TranslationsGenerationService = class {
|
|
2349
2350
|
result = generator.generateMissingTypeMemberTranslations(tokenOrKeyword.parent);
|
2350
2351
|
}
|
2351
2352
|
}
|
2352
|
-
if (result === void 0 && tokenOrKeyword.isKeyword(
|
2353
|
+
if (result === void 0 && tokenOrKeyword.isKeyword(56 /* Translations */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */) {
|
2353
2354
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2354
2355
|
if (translationPackage !== void 0) {
|
2355
2356
|
const generator = new TranslationsGenerator(
|
@@ -2375,7 +2376,7 @@ var TranslationsGenerationService = class {
|
|
2375
2376
|
if (tokenOrKeyword === void 0) {
|
2376
2377
|
return false;
|
2377
2378
|
}
|
2378
|
-
if (!(tokenOrKeyword.isKeyword(
|
2379
|
+
if (!(tokenOrKeyword.isKeyword(56 /* Translations */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */)) {
|
2379
2380
|
return false;
|
2380
2381
|
}
|
2381
2382
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
@@ -2383,7 +2384,7 @@ var TranslationsGenerationService = class {
|
|
2383
2384
|
return false;
|
2384
2385
|
}
|
2385
2386
|
const generator = new TranslationsGenerator(analyzer, sourceFile, translationPackage, sourceFile.package.dialect);
|
2386
|
-
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind ===
|
2387
|
+
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 140 /* TypeTranslation */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
|
2387
2388
|
}
|
2388
2389
|
};
|
2389
2390
|
var TranslationsGenerator = class _TranslationsGenerator {
|
@@ -2410,7 +2411,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2410
2411
|
};
|
2411
2412
|
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createPackageMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) => {
|
2412
2413
|
const code = new SyntaxToCode(n, syntaxToCodeOptions).convert();
|
2413
|
-
if (n.kind ===
|
2414
|
+
if (n.kind === 140 /* TypeTranslation */) {
|
2414
2415
|
const startOffset = Math.max(code.indexOf(newLine), 0);
|
2415
2416
|
return this.addNewLineBeforeArrowsInTranslation(
|
2416
2417
|
code,
|
@@ -2442,7 +2443,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2442
2443
|
generateMissingTranslationsForPartiallyTranslatedTypes(translationsDeclaration) {
|
2443
2444
|
const result = new Array();
|
2444
2445
|
for (const translation of translationsDeclaration.translationList.translationDeclarations) {
|
2445
|
-
if (translation.kind ===
|
2446
|
+
if (translation.kind === 140 /* TypeTranslation */) {
|
2446
2447
|
const edits = this.generateMissingTypeMemberTranslations(translation);
|
2447
2448
|
if (edits !== void 0) {
|
2448
2449
|
result.push(...edits);
|
@@ -2539,13 +2540,13 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2539
2540
|
}
|
2540
2541
|
detectIndentationStepForTypeMemberTranslations(node) {
|
2541
2542
|
let indentationStepSize;
|
2542
|
-
if (node.kind ===
|
2543
|
+
if (node.kind === 140 /* TypeTranslation */) {
|
2543
2544
|
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(node, this._sourceFile);
|
2544
2545
|
}
|
2545
2546
|
if (indentationStepSize === void 0) {
|
2546
2547
|
const translationsDeclarations = node.kind === 21 /* TranslationsDeclaration */ ? node : node.parent.parent;
|
2547
2548
|
for (const member of translationsDeclarations.translationList.translationDeclarations) {
|
2548
|
-
if (member.kind ===
|
2549
|
+
if (member.kind === 140 /* TypeTranslation */) {
|
2549
2550
|
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(member, this._sourceFile);
|
2550
2551
|
if (indentationStepSize !== void 0) {
|
2551
2552
|
break;
|
@@ -2832,7 +2833,7 @@ var SignatureForNode = class _SignatureForNode {
|
|
2832
2833
|
return _SignatureForNode.getSignaturesForAutotypeCallExpression(analyzer, node);
|
2833
2834
|
case 71 /* IndexedAccessExpression */:
|
2834
2835
|
return _SignatureForNode.getSignaturesForIndexedAccessExpression(analyzer, node);
|
2835
|
-
case
|
2836
|
+
case 148 /* Tag */:
|
2836
2837
|
return _SignatureForNode.getSignaturesForTag(analyzer, node);
|
2837
2838
|
default:
|
2838
2839
|
Debug.never(node);
|
@@ -3226,7 +3227,7 @@ var CompletionService = class {
|
|
3226
3227
|
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || this.tokenOrKeywordIsPackageImportListChild(tokenOrKeyword)) {
|
3227
3228
|
return new PackageImportCompletionContext([], void 0);
|
3228
3229
|
}
|
3229
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3230
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 79 /* MemberAccessExpression */) {
|
3230
3231
|
const propertyAccess = tokenOrKeyword.parent;
|
3231
3232
|
{
|
3232
3233
|
const info = this._analyzer.checkExpressionDenotesPackageNameSegment(propertyAccess.expression);
|
@@ -3258,16 +3259,15 @@ var CompletionService = class {
|
|
3258
3259
|
const localizationContext = semanticContext.getLocalizationContext();
|
3259
3260
|
const isStaticAccess = this._analyzer.checkExpressionDenotesType(propertyAccess.expression) !== void 0;
|
3260
3261
|
const hidingMatcher = semanticContext.getHidingMatcher();
|
3261
|
-
const typeExtensionLookup = semanticContext.getScopeLookup();
|
3262
3262
|
return new TypeMemberCompletionContext(
|
3263
3263
|
type,
|
3264
3264
|
localizationContext,
|
3265
3265
|
isStaticAccess,
|
3266
3266
|
hidingMatcher,
|
3267
|
-
|
3267
|
+
semanticContext
|
3268
3268
|
);
|
3269
3269
|
}
|
3270
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3270
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 136 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
|
3271
3271
|
const namedTypeSpecifier = tokenOrKeyword.parent.parent;
|
3272
3272
|
const resolutionResult = this._analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
|
3273
3273
|
const segmentIndex = Math.floor(
|
@@ -3309,7 +3309,7 @@ var CompletionService = class {
|
|
3309
3309
|
}
|
3310
3310
|
return { kind: "none" };
|
3311
3311
|
}
|
3312
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3312
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 136 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 148 /* Tag */) {
|
3313
3313
|
const tag = tokenOrKeyword.parent.parent;
|
3314
3314
|
const resolutionResult = this._analyzer.resolveTag(tag);
|
3315
3315
|
const segmentIndex = Math.floor(
|
@@ -3352,20 +3352,22 @@ var CompletionService = class {
|
|
3352
3352
|
expressionType: this._analyzer.type.ofExpression(tokenOrKeyword.parent.expression)
|
3353
3353
|
};
|
3354
3354
|
}
|
3355
|
-
const
|
3356
|
-
const typeSearchLocation = new ScopeTypeSearchLocation(lookup);
|
3355
|
+
const typeSearchLocation = new ScopeTypeSearchLocation(semanticContext);
|
3357
3356
|
return new TypeCompletionContext(typeSearchLocation, completionInIsOrAsExpressionInfo);
|
3358
3357
|
}
|
3359
3358
|
if (syntaxContext.isUnqualifiedTagNameCompletionContext) {
|
3360
|
-
const
|
3361
|
-
const typeSearchLocation = new ScopeTypeSearchLocation(lookup);
|
3359
|
+
const typeSearchLocation = new ScopeTypeSearchLocation(semanticContext);
|
3362
3360
|
return new TagCompletionContext(typeSearchLocation);
|
3363
3361
|
}
|
3364
3362
|
if (syntaxContext.isExpressionContext !== void 0) {
|
3365
|
-
const lookup = semanticContext.getScopeLookup();
|
3366
3363
|
const { targetTypes, targetSignaturesParameters } = this.getTargetTypesAndTargetSignaturesParameters(syntaxContext.isExpressionContext.expressionRole, semanticContext);
|
3367
3364
|
const localizationContext = semanticContext.getLocalizationContext();
|
3368
|
-
return new ExpressionCompletionContext(
|
3365
|
+
return new ExpressionCompletionContext(
|
3366
|
+
semanticContext,
|
3367
|
+
targetSignaturesParameters,
|
3368
|
+
targetTypes,
|
3369
|
+
localizationContext
|
3370
|
+
);
|
3369
3371
|
}
|
3370
3372
|
const topLevelTranslationCompletionContext = this.tryGetTopLevelTranslationCompletionContext(
|
3371
3373
|
syntaxContext,
|
@@ -3402,17 +3404,17 @@ var CompletionService = class {
|
|
3402
3404
|
translationKind = 0 /* Any */;
|
3403
3405
|
hasPrecedingKeyword = false;
|
3404
3406
|
}
|
3405
|
-
if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind ===
|
3407
|
+
if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind === 135 /* PackageImportTranslation */) {
|
3406
3408
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3407
3409
|
translationKind = 1 /* PackageImport */;
|
3408
3410
|
hasPrecedingKeyword = true;
|
3409
3411
|
}
|
3410
|
-
if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind ===
|
3412
|
+
if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind === 140 /* TypeTranslation */ || tokenOrKeyword.parent.kind === 134 /* FunctionTypeTranslation */)) {
|
3411
3413
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3412
3414
|
translationKind = 3 /* Type */;
|
3413
3415
|
hasPrecedingKeyword = true;
|
3414
3416
|
}
|
3415
|
-
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind ===
|
3417
|
+
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 132 /* PackageFunctionTranslation */) {
|
3416
3418
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3417
3419
|
translationKind = 2 /* Method */;
|
3418
3420
|
hasPrecedingKeyword = true;
|
@@ -3432,9 +3434,9 @@ var CompletionService = class {
|
|
3432
3434
|
hasPrecedingKeyword
|
3433
3435
|
);
|
3434
3436
|
}
|
3435
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3437
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 136 /* QualifiedName */) {
|
3436
3438
|
const qualifiedName = tokenOrKeyword.parent;
|
3437
|
-
if (qualifiedName.parent.kind ===
|
3439
|
+
if (qualifiedName.parent.kind === 135 /* PackageImportTranslation */ && qualifiedName === qualifiedName.parent.sourceName) {
|
3438
3440
|
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
3439
3441
|
const sourceLocale = translationPackage.getTranslatedPackage().getLocale();
|
3440
3442
|
return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
|
@@ -3459,12 +3461,12 @@ var CompletionService = class {
|
|
3459
3461
|
translationKind = 0 /* Any */;
|
3460
3462
|
hasPrecedingKeyword = false;
|
3461
3463
|
}
|
3462
|
-
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind ===
|
3464
|
+
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 133 /* MethodTranslation */) {
|
3463
3465
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3464
3466
|
translationKind = 1 /* Method */;
|
3465
3467
|
hasPrecedingKeyword = true;
|
3466
3468
|
}
|
3467
|
-
if (tokenOrKeyword.isKeyword(
|
3469
|
+
if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 127 /* ConstructorTranslation */) {
|
3468
3470
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3469
3471
|
translationKind = 3 /* Constructor */;
|
3470
3472
|
hasPrecedingKeyword = true;
|
@@ -3504,7 +3506,7 @@ var CompletionService = class {
|
|
3504
3506
|
role.argumentList.parent
|
3505
3507
|
);
|
3506
3508
|
break;
|
3507
|
-
case
|
3509
|
+
case 148 /* Tag */:
|
3508
3510
|
signatures = SignatureForNode.getSignaturesForTag(this._analyzer, role.argumentList.parent);
|
3509
3511
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(role.argumentList.parent);
|
3510
3512
|
break;
|
@@ -3649,22 +3651,22 @@ var CompletionService = class {
|
|
3649
3651
|
}
|
3650
3652
|
const kinds = /* @__PURE__ */ new Set();
|
3651
3653
|
if (syntaxContext.isPackageMemberDeclarationListContext) {
|
3652
|
-
kinds.add(18 /* Import */).add(7 /* Run */).add(
|
3654
|
+
kinds.add(18 /* Import */).add(7 /* Run */).add(31 /* Creation */).add(12 /* Function */).add(17 /* Basic */).add(16 /* Type */).add(59 /* Get */).add(60 /* Set */).add(56 /* Translations */);
|
3653
3655
|
}
|
3654
3656
|
if (syntaxContext.isPackageMemberDeclarationListContext || syntaxContext.isTypeMemberDeclarationListContext) {
|
3655
|
-
kinds.add(
|
3657
|
+
kinds.add(37 /* Hidden */).add(42 /* Static */).add(39 /* Redefinable */).add(38 /* Abstract */).add(40 /* Redefined */).add(41 /* Async */).add(36 /* Const */);
|
3656
3658
|
}
|
3657
3659
|
if (syntaxContext.isTypeMemberDeclarationListContext) {
|
3658
|
-
kinds.add(
|
3660
|
+
kinds.add(31 /* Creation */).add(12 /* Function */).add(48 /* Destruction */).add(59 /* Get */).add(60 /* Set */);
|
3659
3661
|
}
|
3660
3662
|
if (syntaxContext.isStatementContext) {
|
3661
|
-
kinds.add(7 /* Run */).add(
|
3663
|
+
kinds.add(7 /* Run */).add(35 /* For */).add(25 /* While */).add(26 /* Loop */).add(15 /* Return */).add(20 /* Error */).add(19 /* Important */).add(28 /* Yield */).add(33 /* BreakLoop */).add(34 /* ContinueLoop */).add(13 /* If */).add(45 /* Switch */).add(1 /* Let */).add(36 /* Const */).add(47 /* Dispose */).add(8 /* Try */).add(12 /* Function */).add(41 /* Async */);
|
3662
3664
|
}
|
3663
3665
|
if (this.isFromKeywordContext(positionDescription)) {
|
3664
3666
|
kinds.add(9 /* From */);
|
3665
3667
|
}
|
3666
3668
|
if (syntaxContext.isExpressionContext !== void 0) {
|
3667
|
-
kinds.add(
|
3669
|
+
kinds.add(44 /* Not */).add(53 /* Yes */).add(54 /* No */).add(58 /* None */).add(41 /* Async */).add(12 /* Function */).add(55 /* Reference */).add(2 /* Autotype */).add(30 /* Cond */);
|
3668
3670
|
if (positionDescription.kind === "after-token-or-keyword") {
|
3669
3671
|
const container = semanticContext.getContainingTypeOrTypeExtension();
|
3670
3672
|
if (container !== void 0) {
|
@@ -3672,20 +3674,20 @@ var CompletionService = class {
|
|
3672
3674
|
if (container.kind === "type") {
|
3673
3675
|
const typeEntity = container.value;
|
3674
3676
|
if (typeEntity?.typeEntityKind === 1 /* Structured */ && typeEntity.getBaseObjectType() !== void 0 || typeEntity?.typeEntityKind === 3 /* Variant */ || typeEntity?.typeEntityKind === 4 /* Alias */) {
|
3675
|
-
kinds.add(
|
3677
|
+
kinds.add(57 /* Base */);
|
3676
3678
|
}
|
3677
3679
|
}
|
3678
3680
|
}
|
3679
3681
|
}
|
3680
3682
|
}
|
3681
3683
|
if (this.isTypeKindCompletionContext(positionDescription)) {
|
3682
|
-
kinds.add(4 /* Object */).add(5 /* PlainObject */).add(3 /* Aspect */).add(6 /* Variant */).add(12 /* Function */).add(
|
3684
|
+
kinds.add(4 /* Object */).add(5 /* PlainObject */).add(3 /* Aspect */).add(6 /* Variant */).add(12 /* Function */).add(41 /* Async */);
|
3683
3685
|
}
|
3684
3686
|
if (this.isCaseKeywordContext(positionDescription, syntaxContext)) {
|
3685
|
-
kinds.add(
|
3687
|
+
kinds.add(46 /* Case */);
|
3686
3688
|
}
|
3687
3689
|
if (this.isCatchKeywordContext(positionDescription)) {
|
3688
|
-
kinds.add(
|
3690
|
+
kinds.add(32 /* Catch */);
|
3689
3691
|
}
|
3690
3692
|
if (this.isFinallyKeywordContext(positionDescription)) {
|
3691
3693
|
kinds.add(21 /* Finally */);
|
@@ -3694,18 +3696,18 @@ var CompletionService = class {
|
|
3694
3696
|
kinds.add(10 /* Else */).add(11 /* ElseIf */);
|
3695
3697
|
}
|
3696
3698
|
if (syntaxContext.precedingExpression !== void 0) {
|
3697
|
-
kinds.add(
|
3699
|
+
kinds.add(43 /* As */).add(14 /* Is */).add(22 /* And */).add(23 /* Or */).add(24 /* Xor */).add(29 /* When */);
|
3698
3700
|
}
|
3699
3701
|
if (this.isModifierLevelContext(positionDescription)) {
|
3700
|
-
kinds.add(
|
3702
|
+
kinds.add(52 /* InType */).add(49 /* InHierarchy */).add(50 /* InFile */).add(51 /* InPackage */);
|
3701
3703
|
}
|
3702
3704
|
if (this.isRepeatWhileKeywordContext(positionDescription)) {
|
3703
3705
|
kinds.add(27 /* RepeatWhile */);
|
3704
3706
|
}
|
3705
3707
|
if (syntaxContext.isUnqualifiedTypeContext?.allowsAnonymousTypes === true) {
|
3706
|
-
kinds.add(5 /* PlainObject */).add(4 /* Object */).add(6 /* Variant */).add(3 /* Aspect */).add(12 /* Function */).add(
|
3708
|
+
kinds.add(5 /* PlainObject */).add(4 /* Object */).add(6 /* Variant */).add(3 /* Aspect */).add(12 /* Function */).add(41 /* Async */);
|
3707
3709
|
}
|
3708
|
-
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(
|
3710
|
+
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(41 /* Async */) && (positionDescription.tokenOrKeyword.parent.kind === 58 /* NestedFunctionDeclaration */ || positionDescription.tokenOrKeyword.parent.kind === 74 /* FunctionLiteral */ || positionDescription.tokenOrKeyword.parent.kind === 29 /* FunctionTypeDeclarationBody */)) {
|
3709
3711
|
kinds.add(12 /* Function */);
|
3710
3712
|
}
|
3711
3713
|
return Query.from(kinds.values()).map(
|
@@ -3717,35 +3719,35 @@ var CompletionService = class {
|
|
3717
3719
|
return false;
|
3718
3720
|
}
|
3719
3721
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3720
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3722
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 117 /* LoopStatement */;
|
3721
3723
|
}
|
3722
3724
|
isModifierLevelContext(positionDescription) {
|
3723
3725
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3724
3726
|
return false;
|
3725
3727
|
}
|
3726
3728
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3727
|
-
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind ===
|
3729
|
+
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 150 /* Modifier */;
|
3728
3730
|
}
|
3729
3731
|
isElseOrElseIfKeywordContext(positionDescription) {
|
3730
3732
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3731
3733
|
return false;
|
3732
3734
|
}
|
3733
3735
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3734
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3736
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 110 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.block || tokenOrKeyword.parent.parent.kind === 112 /* ElseIfClause */);
|
3735
3737
|
}
|
3736
3738
|
isCatchKeywordContext(positionDescription) {
|
3737
3739
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3738
3740
|
return false;
|
3739
3741
|
}
|
3740
3742
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3741
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3743
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */;
|
3742
3744
|
}
|
3743
3745
|
isFinallyKeywordContext(positionDescription) {
|
3744
3746
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3745
3747
|
return false;
|
3746
3748
|
}
|
3747
3749
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3748
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3750
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 100 /* TryStatement */ || tokenOrKeyword.parent.parent.kind === 101 /* CatchClause */);
|
3749
3751
|
}
|
3750
3752
|
isTypeKindCompletionContext(positionDescription) {
|
3751
3753
|
return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(57 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
|
@@ -3762,16 +3764,16 @@ var CompletionService = class {
|
|
3762
3764
|
return false;
|
3763
3765
|
}
|
3764
3766
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3765
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3767
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 122 /* CaseClause */) {
|
3766
3768
|
return true;
|
3767
3769
|
}
|
3768
|
-
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind ===
|
3770
|
+
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 120 /* SwitchStatement */) {
|
3769
3771
|
return true;
|
3770
3772
|
}
|
3771
3773
|
return false;
|
3772
3774
|
}
|
3773
3775
|
getExpressionCompletionItemInfos(ctx) {
|
3774
|
-
let query = this.getScopeCompletionItemInfos(ctx.
|
3776
|
+
let query = this.getScopeCompletionItemInfos(ctx.semanticContext);
|
3775
3777
|
if (ctx.targetSignaturesValueParameters !== void 0) {
|
3776
3778
|
query = query.chain(this.getCompletionItemInfosForTargetSignaturesValueParameters(ctx.targetSignaturesValueParameters));
|
3777
3779
|
}
|
@@ -3796,8 +3798,8 @@ var CompletionService = class {
|
|
3796
3798
|
getCompletionItemInfosForTargetSignaturesValueParameters(valueParameters) {
|
3797
3799
|
return valueParameters.map((p) => new TargetSignatureValueParameterCompletionItemInfo(this.completionItemInfoContext, p));
|
3798
3800
|
}
|
3799
|
-
getScopeCompletionItemInfos(
|
3800
|
-
return Query.from(
|
3801
|
+
getScopeCompletionItemInfos(semanticContext) {
|
3802
|
+
return Query.from(semanticContext.getNamedDeclarations()).map((d) => {
|
3801
3803
|
switch (d.value.kind) {
|
3802
3804
|
case "variable": {
|
3803
3805
|
if (d.value.value.kind === "entity") {
|
@@ -3844,7 +3846,7 @@ var CompletionService = class {
|
|
3844
3846
|
Debug.never(d.value);
|
3845
3847
|
}
|
3846
3848
|
}).chain(
|
3847
|
-
Query.from(
|
3849
|
+
Query.from(semanticContext.getOperators()).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o.value, o.localization))
|
3848
3850
|
);
|
3849
3851
|
}
|
3850
3852
|
getTypeCompletionItemInfos(ctx) {
|
@@ -3902,7 +3904,7 @@ var CompletionService = class {
|
|
3902
3904
|
return query.toArray();
|
3903
3905
|
}
|
3904
3906
|
getTypeCompletionItemInfosFromScope(searchLocation) {
|
3905
|
-
return searchLocation.
|
3907
|
+
return searchLocation.semanticContext.getTypesOrContainersWithTypes().map((d) => {
|
3906
3908
|
switch (d.value.kind) {
|
3907
3909
|
case "type": {
|
3908
3910
|
return new NamedTypeCompletionItemInfo(
|
@@ -3984,7 +3986,7 @@ var CompletionService = class {
|
|
3984
3986
|
return query.toArray();
|
3985
3987
|
}
|
3986
3988
|
getTagCompletionItemInfosFromScope(searchLocation) {
|
3987
|
-
return searchLocation.
|
3989
|
+
return searchLocation.semanticContext.getNamedDeclarations().map((d) => {
|
3988
3990
|
switch (d.value.kind) {
|
3989
3991
|
case "type":
|
3990
3992
|
return new NamedTypeCompletionItemInfo(
|
@@ -4059,8 +4061,8 @@ var CompletionService = class {
|
|
4059
4061
|
getTypeMemberCompletionItemInfos(ctx) {
|
4060
4062
|
const type = this._analyzer.excludeNoneFromType(ctx.type);
|
4061
4063
|
const memberLookup = TypeMemberLookup.ofType(this._analyzer, type, ctx.localizationContext);
|
4062
|
-
const options6 = ctx.isStaticAccess ? 2 /* OnlyStaticMembers */ :
|
4063
|
-
return memberLookup.getNamedMembers(options6, ctx.hidingMatcher, ctx.
|
4064
|
+
const options6 = ctx.isStaticAccess ? 2 /* OnlyStaticMembers */ : 1 /* OnlyInstanceMembers */;
|
4065
|
+
return memberLookup.getNamedMembers(options6, ctx.hidingMatcher, ctx.typeExtensionLookup).map((m) => {
|
4064
4066
|
switch (m.value.kind) {
|
4065
4067
|
case "method":
|
4066
4068
|
return new MethodCompletionItemInfo(
|
@@ -4079,7 +4081,7 @@ var CompletionService = class {
|
|
4079
4081
|
default:
|
4080
4082
|
Debug.never(m.value);
|
4081
4083
|
}
|
4082
|
-
}).concat(memberLookup.getOperators(options6, ctx.hidingMatcher, ctx.
|
4084
|
+
}).concat(memberLookup.getOperators(options6, ctx.hidingMatcher, ctx.typeExtensionLookup).map((o) => new OperatorCompletionItemInfo(this.completionItemInfoContext, o.value, o.localization)));
|
4083
4085
|
}
|
4084
4086
|
getPackageImportCompletionItemInfos(ctx) {
|
4085
4087
|
const result = this._analyzer.packageImports.getPackagesAvailableForImport(this._sourceFile.package).map((p) => p.getImportName()).filter((n) => {
|
@@ -4252,7 +4254,7 @@ var CompletionService = class {
|
|
4252
4254
|
if (!ctx.hasPrecedingKeyword) {
|
4253
4255
|
const keywords = [
|
4254
4256
|
12 /* Function */,
|
4255
|
-
|
4257
|
+
31 /* Creation */
|
4256
4258
|
];
|
4257
4259
|
result = result.chain(
|
4258
4260
|
Query.from(keywords).map(
|
@@ -4415,7 +4417,7 @@ function isInvalidNode(node) {
|
|
4415
4417
|
switch (node.kind) {
|
4416
4418
|
case 72 /* InvalidExpression */:
|
4417
4419
|
case 43 /* InvalidPackageMemberDeclaration */:
|
4418
|
-
case
|
4420
|
+
case 114 /* InvalidStatement */:
|
4419
4421
|
case 57 /* InvalidTypeMemberDeclaration */:
|
4420
4422
|
case 16 /* InvalidTypeSpecifier */:
|
4421
4423
|
return true;
|
@@ -4435,12 +4437,12 @@ var PackageImportCompletionContext = class {
|
|
4435
4437
|
}
|
4436
4438
|
};
|
4437
4439
|
var TypeMemberCompletionContext = class {
|
4438
|
-
constructor(type, localizationContext, isStaticAccess, hidingMatcher,
|
4440
|
+
constructor(type, localizationContext, isStaticAccess, hidingMatcher, typeExtensionLookup) {
|
4439
4441
|
this.type = type;
|
4440
4442
|
this.localizationContext = localizationContext;
|
4441
4443
|
this.isStaticAccess = isStaticAccess;
|
4442
4444
|
this.hidingMatcher = hidingMatcher;
|
4443
|
-
this.
|
4445
|
+
this.typeExtensionLookup = typeExtensionLookup;
|
4444
4446
|
this.kind = "type-member";
|
4445
4447
|
}
|
4446
4448
|
};
|
@@ -4479,8 +4481,8 @@ var OperatorNameCompletionContext = class {
|
|
4479
4481
|
}
|
4480
4482
|
};
|
4481
4483
|
var ScopeTypeSearchLocation = class {
|
4482
|
-
constructor(
|
4483
|
-
this.
|
4484
|
+
constructor(semanticContext) {
|
4485
|
+
this.semanticContext = semanticContext;
|
4484
4486
|
this.kind = "scope";
|
4485
4487
|
}
|
4486
4488
|
};
|
@@ -4500,8 +4502,8 @@ var PackageNameSegmentTypeSearchLocation = class {
|
|
4500
4502
|
}
|
4501
4503
|
};
|
4502
4504
|
var ExpressionCompletionContext = class {
|
4503
|
-
constructor(
|
4504
|
-
this.
|
4505
|
+
constructor(semanticContext, targetSignaturesValueParameters, targetTypes, localizationContext) {
|
4506
|
+
this.semanticContext = semanticContext;
|
4505
4507
|
this.targetSignaturesValueParameters = targetSignaturesValueParameters;
|
4506
4508
|
this.targetTypes = targetTypes;
|
4507
4509
|
this.localizationContext = localizationContext;
|
@@ -5107,7 +5109,7 @@ var AliasesSourceConstructorCompletionItemInfo = class {
|
|
5107
5109
|
Localization.Original.ofEntity(this.constructor_)
|
5108
5110
|
);
|
5109
5111
|
const displayParts = this.displayService.getConstructorDeclarationDisplayParts(constructorDeclaration);
|
5110
|
-
const creationKeyword = this.displayService.displayKeyword(
|
5112
|
+
const creationKeyword = this.displayService.displayKeyword(31 /* Creation */);
|
5111
5113
|
return creationKeyword + displayParts.valueParametersStart + displayParts.valueParameters.map((p) => p.toString()).join(displayParts.valueParameterSeparator) + displayParts.valueParametersEnd;
|
5112
5114
|
});
|
5113
5115
|
}
|
@@ -5121,7 +5123,7 @@ var AliasesSourceConstructorCompletionItemInfo = class {
|
|
5121
5123
|
return this.label;
|
5122
5124
|
}
|
5123
5125
|
getInsertText() {
|
5124
|
-
const creationKeyword = this.includeOnCreateKeyword ? this.displayService.displayKeyword(
|
5126
|
+
const creationKeyword = this.includeOnCreateKeyword ? this.displayService.displayKeyword(31 /* Creation */) : "";
|
5125
5127
|
const parameters = this.constructor_.getValueParameters().map((p) => this.ctx.getInsertTextForName(p.getName(), true)).join(", ");
|
5126
5128
|
return `${creationKeyword}(${parameters})`;
|
5127
5129
|
}
|
@@ -5247,7 +5249,7 @@ var SyntaxContextFactory = class {
|
|
5247
5249
|
if (positionDescription.kind === "after-token-or-keyword") {
|
5248
5250
|
isUnqualifiedTypeContext = this.isUnqualifiedTypeContext(positionDescription.tokenOrKeyword);
|
5249
5251
|
}
|
5250
|
-
const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(35 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind ===
|
5252
|
+
const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(35 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind === 148 /* Tag */;
|
5251
5253
|
let isTopLevelTranslationListContext;
|
5252
5254
|
if (positionDescription.kind === "after-token-or-keyword") {
|
5253
5255
|
isTopLevelTranslationListContext = this.isTopLevelTranslationListContext(positionDescription.tokenOrKeyword);
|
@@ -5273,7 +5275,7 @@ var SyntaxContextFactory = class {
|
|
5273
5275
|
}
|
5274
5276
|
static isExpressionOrStatementContext(tokenOrKeyword) {
|
5275
5277
|
if (tokenOrKeyword.isToken(57 /* Equals */)) {
|
5276
|
-
if (tokenOrKeyword.parent.kind ===
|
5278
|
+
if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
5277
5279
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5278
5280
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5279
5281
|
}
|
@@ -5289,24 +5291,24 @@ var SyntaxContextFactory = class {
|
|
5289
5291
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5290
5292
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5291
5293
|
}
|
5292
|
-
if (tokenOrKeyword.parent.kind ===
|
5294
|
+
if (tokenOrKeyword.parent.kind === 145 /* ParameterDeclaration */) {
|
5293
5295
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.defaultValue);
|
5294
5296
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5295
5297
|
}
|
5296
|
-
if (tokenOrKeyword.parent.kind ===
|
5298
|
+
if (tokenOrKeyword.parent.kind === 146 /* Argument */) {
|
5297
5299
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5298
5300
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5299
5301
|
}
|
5300
|
-
if (tokenOrKeyword.parent.kind ===
|
5302
|
+
if (tokenOrKeyword.parent.kind === 143 /* VariantDeclaration */) {
|
5301
5303
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5302
5304
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5303
5305
|
}
|
5304
5306
|
}
|
5305
|
-
if (tokenOrKeyword.parent.kind ===
|
5307
|
+
if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
5306
5308
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5307
5309
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5308
5310
|
}
|
5309
|
-
if (tokenOrKeyword.parent.kind ===
|
5311
|
+
if (tokenOrKeyword.parent.kind === 78 /* PrefixUnaryExpression */) {
|
5310
5312
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.operand);
|
5311
5313
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5312
5314
|
}
|
@@ -5314,11 +5316,11 @@ var SyntaxContextFactory = class {
|
|
5314
5316
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5315
5317
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5316
5318
|
}
|
5317
|
-
if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && tokenOrKeyword.parent.kind ===
|
5319
|
+
if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && tokenOrKeyword.parent.kind === 82 /* TextTemplateLiteral */) {
|
5318
5320
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.spanList.spans.at(0)?.expression);
|
5319
5321
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5320
5322
|
}
|
5321
|
-
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind ===
|
5323
|
+
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind === 84 /* TextTemplateSpan */) {
|
5322
5324
|
let expressionForTargetType;
|
5323
5325
|
const spanList = tokenOrKeyword.parent.parent;
|
5324
5326
|
const spanIndex = spanList.spans.indexOf(tokenOrKeyword.parent);
|
@@ -5330,12 +5332,12 @@ var SyntaxContextFactory = class {
|
|
5330
5332
|
isStatementContext: false
|
5331
5333
|
};
|
5332
5334
|
}
|
5333
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5335
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 94 /* StatementBlock */) {
|
5334
5336
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5335
5337
|
}
|
5336
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5338
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 95 /* FunctionBlock */) {
|
5337
5339
|
const block = tokenOrKeyword.parent;
|
5338
|
-
if (block.expressionOrStatementList.kind !==
|
5340
|
+
if (block.expressionOrStatementList.kind !== 93 /* StatementList */ || block.expressionOrStatementList.statements.count() === 0) {
|
5339
5341
|
return {
|
5340
5342
|
isExpressionContext: { expressionRole: new ExpressionRole_functionBlockExpression(block) },
|
5341
5343
|
isStatementContext: true
|
@@ -5347,7 +5349,7 @@ var SyntaxContextFactory = class {
|
|
5347
5349
|
};
|
5348
5350
|
}
|
5349
5351
|
}
|
5350
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5352
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 93 /* StatementList */) {
|
5351
5353
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5352
5354
|
}
|
5353
5355
|
if (tokenOrKeyword.isToken(44 /* OpenParenthesis */)) {
|
@@ -5355,7 +5357,7 @@ var SyntaxContextFactory = class {
|
|
5355
5357
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5356
5358
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5357
5359
|
}
|
5358
|
-
if (tokenOrKeyword.parent.kind ===
|
5360
|
+
if (tokenOrKeyword.parent.kind === 80 /* ReferenceExpression */) {
|
5359
5361
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5360
5362
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5361
5363
|
}
|
@@ -5367,7 +5369,7 @@ var SyntaxContextFactory = class {
|
|
5367
5369
|
const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
|
5368
5370
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5369
5371
|
}
|
5370
|
-
if (tokenOrKeyword.parent.kind ===
|
5372
|
+
if (tokenOrKeyword.parent.kind === 148 /* Tag */) {
|
5371
5373
|
const argumentList = tokenOrKeyword.parent.argumentList;
|
5372
5374
|
if (argumentList !== void 0) {
|
5373
5375
|
const expressionRole = new ExpressionRole_argument(argumentList, 0);
|
@@ -5398,7 +5400,7 @@ var SyntaxContextFactory = class {
|
|
5398
5400
|
const expressionRole = new ExpressionRole_argument(argumentList, index);
|
5399
5401
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5400
5402
|
}
|
5401
|
-
if (tokenOrKeyword.parent.kind ===
|
5403
|
+
if (tokenOrKeyword.parent.kind === 121 /* MatchExpressionList */) {
|
5402
5404
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent.parent);
|
5403
5405
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5404
5406
|
}
|
@@ -5407,47 +5409,47 @@ var SyntaxContextFactory = class {
|
|
5407
5409
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5408
5410
|
}
|
5409
5411
|
}
|
5410
|
-
if (tokenOrKeyword.isKeyword(
|
5412
|
+
if (tokenOrKeyword.isKeyword(46 /* Case */) && tokenOrKeyword.parent.kind === 122 /* CaseClause */) {
|
5411
5413
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent);
|
5412
5414
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5413
5415
|
}
|
5414
|
-
if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind ===
|
5416
|
+
if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind === 118 /* ReturnStatement */) {
|
5415
5417
|
const expressionRole = new ExpressionRole_returnedValue(tokenOrKeyword.parent);
|
5416
5418
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5417
5419
|
}
|
5418
|
-
if (tokenOrKeyword.isKeyword(20 /* Error */) && tokenOrKeyword.parent.kind ===
|
5420
|
+
if (tokenOrKeyword.isKeyword(20 /* Error */) && tokenOrKeyword.parent.kind === 105 /* ErrorStatement */) {
|
5419
5421
|
const expressionRole = new ExpressionRole_errorValue(tokenOrKeyword.parent);
|
5420
5422
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5421
5423
|
}
|
5422
|
-
if (tokenOrKeyword.isKeyword(19 /* Important */) && tokenOrKeyword.parent.kind ===
|
5424
|
+
if (tokenOrKeyword.isKeyword(19 /* Important */) && tokenOrKeyword.parent.kind === 106 /* ImportantStatement */) {
|
5423
5425
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5424
5426
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5425
5427
|
}
|
5426
|
-
if (tokenOrKeyword.isKeyword(
|
5428
|
+
if (tokenOrKeyword.isKeyword(45 /* Switch */) && tokenOrKeyword.parent.kind === 120 /* SwitchStatement */) {
|
5427
5429
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5428
5430
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5429
5431
|
}
|
5430
|
-
if (tokenOrKeyword.isKeyword(13 /* If */) && tokenOrKeyword.parent.kind ===
|
5432
|
+
if (tokenOrKeyword.isKeyword(13 /* If */) && tokenOrKeyword.parent.kind === 110 /* IfStatement */) {
|
5431
5433
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5432
5434
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5433
5435
|
}
|
5434
|
-
if (tokenOrKeyword.isKeyword(11 /* ElseIf */) && tokenOrKeyword.parent.kind ===
|
5436
|
+
if (tokenOrKeyword.isKeyword(11 /* ElseIf */) && tokenOrKeyword.parent.kind === 112 /* ElseIfClause */) {
|
5435
5437
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5436
5438
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5437
5439
|
}
|
5438
|
-
if (tokenOrKeyword.isKeyword(9 /* From */) && tokenOrKeyword.parent.kind ===
|
5440
|
+
if (tokenOrKeyword.isKeyword(9 /* From */) && tokenOrKeyword.parent.kind === 109 /* ForStatement */) {
|
5439
5441
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.enumeratedExpression);
|
5440
5442
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5441
5443
|
}
|
5442
|
-
if (tokenOrKeyword.isKeyword(25 /* While */) && tokenOrKeyword.parent.kind ===
|
5444
|
+
if (tokenOrKeyword.isKeyword(25 /* While */) && tokenOrKeyword.parent.kind === 123 /* WhileStatement */) {
|
5443
5445
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5444
5446
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5445
5447
|
}
|
5446
|
-
if (tokenOrKeyword.isKeyword(27 /* RepeatWhile */) && tokenOrKeyword.parent.kind ===
|
5448
|
+
if (tokenOrKeyword.isKeyword(27 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 117 /* LoopStatement */) {
|
5447
5449
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5448
5450
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5449
5451
|
}
|
5450
|
-
if (tokenOrKeyword.isKeyword(28 /* Yield */) && tokenOrKeyword.parent.kind ===
|
5452
|
+
if (tokenOrKeyword.isKeyword(28 /* Yield */) && tokenOrKeyword.parent.kind === 124 /* YieldStatement */) {
|
5451
5453
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5452
5454
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5453
5455
|
}
|
@@ -5459,6 +5461,10 @@ var SyntaxContextFactory = class {
|
|
5459
5461
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.secondExpression);
|
5460
5462
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5461
5463
|
}
|
5464
|
+
if (tokenOrKeyword.isKeyword(30 /* Cond */) && tokenOrKeyword.parent.kind === 77 /* ConditionalExpression */) {
|
5465
|
+
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5466
|
+
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5467
|
+
}
|
5462
5468
|
{
|
5463
5469
|
const checkResult = SyntaxContextUtils.tokenOrKeywordIsValidEndOfStatement(tokenOrKeyword);
|
5464
5470
|
if (checkResult !== void 0) {
|
@@ -5477,7 +5483,7 @@ var SyntaxContextFactory = class {
|
|
5477
5483
|
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 32 /* TypeMemberDeclarationBlock */ && (tokenOrKeyword.parent.parent.kind === 40 /* TypeExtensionDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 33 /* PackageStructuredTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 38 /* PackageVariantTypeDeclaration */ || tokenOrKeyword.parent.parent.parent.kind === 22 /* PackageAliasTypeDeclaration */)) {
|
5478
5484
|
return true;
|
5479
5485
|
}
|
5480
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind ===
|
5486
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind === 95 /* FunctionBlock */ && (tokenOrKeyword.parent.parent.kind === 25 /* PackageConstructorDeclaration */ || tokenOrKeyword.parent.parent.kind === 26 /* PackageEntryPointDeclaration */ || tokenOrKeyword.parent.parent.kind === 27 /* PackageFunctionDeclaration */))) {
|
5481
5487
|
return true;
|
5482
5488
|
}
|
5483
5489
|
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */) {
|
@@ -5489,10 +5495,10 @@ var SyntaxContextFactory = class {
|
|
5489
5495
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 37 /* PackageVariableSetterDeclaration */)) {
|
5490
5496
|
return true;
|
5491
5497
|
}
|
5492
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
5498
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 150 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5493
5499
|
return true;
|
5494
5500
|
}
|
5495
|
-
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
5501
|
+
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 150 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5496
5502
|
return true;
|
5497
5503
|
}
|
5498
5504
|
return false;
|
@@ -5519,13 +5525,13 @@ var SyntaxContextFactory = class {
|
|
5519
5525
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5520
5526
|
tokenOrKeyword,
|
5521
5527
|
51 /* DereferencedVariableSetterDeclaration */
|
5522
|
-
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* MethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 53 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 45 /* ConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 46 /* DestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
5528
|
+
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 52 /* MethodDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 53 /* OperatorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 45 /* ConstructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 46 /* DestructorDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 143 /* VariantDeclaration */)) {
|
5523
5529
|
return true;
|
5524
5530
|
}
|
5525
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
5531
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 150 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5526
5532
|
return true;
|
5527
5533
|
}
|
5528
|
-
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
5534
|
+
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 150 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5529
5535
|
return true;
|
5530
5536
|
}
|
5531
5537
|
return false;
|
@@ -5562,7 +5568,7 @@ var SyntaxContextFactory = class {
|
|
5562
5568
|
return result;
|
5563
5569
|
}
|
5564
5570
|
static isUnqualifiedTypeContext(tokenOrKeyword) {
|
5565
|
-
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind ===
|
5571
|
+
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 157 /* TypeAnnotation */) {
|
5566
5572
|
return { allowsAnonymousTypes: true };
|
5567
5573
|
}
|
5568
5574
|
if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 34 /* StructuredTypeDeclarationBody */) {
|
@@ -5571,16 +5577,16 @@ var SyntaxContextFactory = class {
|
|
5571
5577
|
if (tokenOrKeyword.isKeyword(16 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind === 40 /* TypeExtensionDeclaration */)) {
|
5572
5578
|
return { allowsAnonymousTypes: false };
|
5573
5579
|
}
|
5574
|
-
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind ===
|
5580
|
+
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind === 153 /* TypeArgumentClause */) {
|
5575
5581
|
return { allowsAnonymousTypes: true };
|
5576
5582
|
}
|
5577
|
-
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind ===
|
5578
|
-
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind ===
|
5583
|
+
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 154 /* TypeArgumentList */)) {
|
5584
|
+
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 154 /* TypeArgumentList */ };
|
5579
5585
|
}
|
5580
|
-
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind ===
|
5586
|
+
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind === 148 /* Tag */) {
|
5581
5587
|
return { allowsAnonymousTypes: false };
|
5582
5588
|
}
|
5583
|
-
if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind ===
|
5589
|
+
if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind === 144 /* TypeParameterDeclaration */) {
|
5584
5590
|
return { allowsAnonymousTypes: false };
|
5585
5591
|
}
|
5586
5592
|
if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind === 22 /* PackageAliasTypeDeclaration */) {
|
@@ -5589,7 +5595,7 @@ var SyntaxContextFactory = class {
|
|
5589
5595
|
if (tokenOrKeyword.isKeyword(14 /* Is */) && tokenOrKeyword.parent.kind === 73 /* IsExpression */) {
|
5590
5596
|
return { allowsAnonymousTypes: true };
|
5591
5597
|
}
|
5592
|
-
if (tokenOrKeyword.isKeyword(
|
5598
|
+
if (tokenOrKeyword.isKeyword(43 /* As */) && tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
5593
5599
|
return { allowsAnonymousTypes: true };
|
5594
5600
|
}
|
5595
5601
|
if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind === 11 /* UnionTypeSpecifier */) {
|
@@ -5612,32 +5618,32 @@ var SyntaxContextFactory = class {
|
|
5612
5618
|
}
|
5613
5619
|
const packageImport = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5614
5620
|
tokenOrKeyword,
|
5615
|
-
|
5621
|
+
135 /* PackageImportTranslation */
|
5616
5622
|
);
|
5617
5623
|
if (packageImport !== void 0) {
|
5618
5624
|
return { translationsDeclaration: packageImport.parent.parent };
|
5619
5625
|
}
|
5620
|
-
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5626
|
+
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 140 /* TypeTranslation */);
|
5621
5627
|
if (type !== void 0) {
|
5622
5628
|
return { translationsDeclaration: type.parent.parent };
|
5623
5629
|
}
|
5624
5630
|
const functionType = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5625
5631
|
tokenOrKeyword,
|
5626
|
-
|
5632
|
+
134 /* FunctionTypeTranslation */
|
5627
5633
|
);
|
5628
5634
|
if (functionType !== void 0) {
|
5629
5635
|
return { translationsDeclaration: functionType.parent.parent };
|
5630
5636
|
}
|
5631
5637
|
const variable = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5632
5638
|
tokenOrKeyword,
|
5633
|
-
|
5639
|
+
137 /* PackageVariableTranslation */
|
5634
5640
|
);
|
5635
5641
|
if (variable !== void 0) {
|
5636
5642
|
return { translationsDeclaration: variable.parent.parent };
|
5637
5643
|
}
|
5638
5644
|
const func = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5639
5645
|
tokenOrKeyword,
|
5640
|
-
|
5646
|
+
132 /* PackageFunctionTranslation */
|
5641
5647
|
);
|
5642
5648
|
if (func !== void 0) {
|
5643
5649
|
return { translationsDeclaration: func.parent.parent };
|
@@ -5645,33 +5651,33 @@ var SyntaxContextFactory = class {
|
|
5645
5651
|
return void 0;
|
5646
5652
|
}
|
5647
5653
|
static isTypeMemberTranslationListContext(tokenOrKeyword) {
|
5648
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5654
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 139 /* TypeMemberTranslationList */) {
|
5649
5655
|
return { typeTranslation: tokenOrKeyword.parent.parent };
|
5650
5656
|
}
|
5651
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5657
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 140 /* TypeTranslation */) {
|
5652
5658
|
return { typeTranslation: tokenOrKeyword.parent };
|
5653
5659
|
}
|
5654
|
-
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5660
|
+
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 129 /* IndexerTranslation */);
|
5655
5661
|
if (indexer !== void 0) {
|
5656
5662
|
return { typeTranslation: indexer.parent.parent };
|
5657
5663
|
}
|
5658
5664
|
const constructor = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5659
5665
|
tokenOrKeyword,
|
5660
|
-
|
5666
|
+
127 /* ConstructorTranslation */
|
5661
5667
|
);
|
5662
5668
|
if (constructor !== void 0) {
|
5663
5669
|
return { typeTranslation: constructor.parent.parent };
|
5664
5670
|
}
|
5665
5671
|
const variableOrVariant = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5666
5672
|
tokenOrKeyword,
|
5667
|
-
|
5673
|
+
138 /* FieldOrVariantTranslation */
|
5668
5674
|
);
|
5669
5675
|
if (variableOrVariant !== void 0) {
|
5670
5676
|
return { typeTranslation: variableOrVariant.parent.parent };
|
5671
5677
|
}
|
5672
5678
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5673
5679
|
tokenOrKeyword,
|
5674
|
-
|
5680
|
+
133 /* MethodTranslation */
|
5675
5681
|
);
|
5676
5682
|
if (method !== void 0) {
|
5677
5683
|
return { typeTranslation: method.parent.parent };
|
@@ -5786,23 +5792,23 @@ var NodeSemanticInfoService = class {
|
|
5786
5792
|
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options6);
|
5787
5793
|
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5788
5794
|
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent, options6);
|
5789
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5795
|
+
} else if (tokenOrKeyword.parent.kind === 78 /* PrefixUnaryExpression */) {
|
5790
5796
|
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5791
5797
|
} else if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5792
5798
|
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5793
5799
|
} else if (tokenOrKeyword.isToken(19 /* Caret */) && (tokenOrKeyword.parent.kind === 50 /* DereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 51 /* DereferencedVariableSetterDeclaration */)) {
|
5794
5800
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
5795
|
-
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind ===
|
5801
|
+
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind === 81 /* DereferenceExpression */) {
|
5796
5802
|
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5797
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5803
|
+
} else if (tokenOrKeyword.parent.kind === 92 /* AssignmentStatement */) {
|
5798
5804
|
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options6);
|
5799
|
-
} else if (tokenOrKeyword.isKeyword(
|
5805
|
+
} else if (tokenOrKeyword.isKeyword(31 /* Creation */) && tokenOrKeyword.parent.kind === 45 /* ConstructorDeclaration */) {
|
5800
5806
|
return this.ofConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
5801
|
-
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind ===
|
5807
|
+
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind === 91 /* DefaultMatchExpression */) {
|
5802
5808
|
return this.ofDefaultMatchExpression(analyzer, tokenOrKeyword.parent);
|
5803
|
-
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind ===
|
5809
|
+
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 87 /* ObjectExpression */) {
|
5804
5810
|
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options6);
|
5805
|
-
} else if (tokenOrKeyword.isKeyword(
|
5811
|
+
} else if (tokenOrKeyword.isKeyword(57 /* Base */) && tokenOrKeyword.parent.kind === 88 /* BaseExpression */) {
|
5806
5812
|
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options6);
|
5807
5813
|
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 49 /* IndexParameterClause */) {
|
5808
5814
|
return this.ofIndexedElementAccessorDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
@@ -5819,11 +5825,11 @@ var NodeSemanticInfoService = class {
|
|
5819
5825
|
let result;
|
5820
5826
|
const parent = node.parent;
|
5821
5827
|
switch (parent.kind) {
|
5822
|
-
case
|
5828
|
+
case 130 /* TranslationTypeParameterList */:
|
5823
5829
|
break;
|
5824
|
-
case
|
5830
|
+
case 125 /* TranslationParameterList */:
|
5825
5831
|
break;
|
5826
|
-
case
|
5832
|
+
case 146 /* Argument */: {
|
5827
5833
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
5828
5834
|
if (respectiveParameter !== void 0) {
|
5829
5835
|
const target = new SimpleWithLocalization(
|
@@ -5840,7 +5846,7 @@ var NodeSemanticInfoService = class {
|
|
5840
5846
|
case 60 /* EnumerationVariableDeclaration */:
|
5841
5847
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofEnumerationVariableDeclaration(parent));
|
5842
5848
|
break;
|
5843
|
-
case
|
5849
|
+
case 102 /* ErrorVariableDeclaration */:
|
5844
5850
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofErrorVariableDeclaration(parent));
|
5845
5851
|
break;
|
5846
5852
|
case 22 /* PackageAliasTypeDeclaration */:
|
@@ -5861,7 +5867,7 @@ var NodeSemanticInfoService = class {
|
|
5861
5867
|
case 38 /* PackageVariantTypeDeclaration */:
|
5862
5868
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariantTypeDeclaration(parent));
|
5863
5869
|
break;
|
5864
|
-
case
|
5870
|
+
case 89 /* IdentifierExpression */:
|
5865
5871
|
result = this.ofIdentifierExpression(analyzer, parent, options6);
|
5866
5872
|
break;
|
5867
5873
|
case 58 /* NestedFunctionDeclaration */:
|
@@ -5870,10 +5876,10 @@ var NodeSemanticInfoService = class {
|
|
5870
5876
|
case 59 /* LocalVariableDeclaration */:
|
5871
5877
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
5872
5878
|
break;
|
5873
|
-
case
|
5879
|
+
case 136 /* QualifiedName */:
|
5874
5880
|
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options6);
|
5875
5881
|
break;
|
5876
|
-
case
|
5882
|
+
case 137 /* PackageVariableTranslation */: {
|
5877
5883
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5878
5884
|
const getTargetResult = translationPackage?.getPackageVariableTranslationTarget(parent);
|
5879
5885
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5893,7 +5899,7 @@ var NodeSemanticInfoService = class {
|
|
5893
5899
|
}
|
5894
5900
|
break;
|
5895
5901
|
}
|
5896
|
-
case
|
5902
|
+
case 138 /* FieldOrVariantTranslation */: {
|
5897
5903
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5898
5904
|
const getTargetsResult = translationPackage?.getFieldOrVariantTranslationTargets(parent);
|
5899
5905
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5917,7 +5923,7 @@ var NodeSemanticInfoService = class {
|
|
5917
5923
|
}
|
5918
5924
|
break;
|
5919
5925
|
}
|
5920
|
-
case
|
5926
|
+
case 132 /* PackageFunctionTranslation */: {
|
5921
5927
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5922
5928
|
const getTargetsResult = translationPackage?.getPackageFunctionTranslationTargets(parent);
|
5923
5929
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5941,7 +5947,7 @@ var NodeSemanticInfoService = class {
|
|
5941
5947
|
}
|
5942
5948
|
break;
|
5943
5949
|
}
|
5944
|
-
case
|
5950
|
+
case 133 /* MethodTranslation */: {
|
5945
5951
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5946
5952
|
const getTargetsResult = translationPackage?.getMethodTranslationTargets(parent);
|
5947
5953
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
@@ -5965,7 +5971,7 @@ var NodeSemanticInfoService = class {
|
|
5965
5971
|
}
|
5966
5972
|
break;
|
5967
5973
|
}
|
5968
|
-
case
|
5974
|
+
case 140 /* TypeTranslation */: {
|
5969
5975
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5970
5976
|
const getTargetResult = translationPackage?.getTypeTranslationTarget(parent);
|
5971
5977
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5985,7 +5991,7 @@ var NodeSemanticInfoService = class {
|
|
5985
5991
|
}
|
5986
5992
|
break;
|
5987
5993
|
}
|
5988
|
-
case
|
5994
|
+
case 134 /* FunctionTypeTranslation */: {
|
5989
5995
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5990
5996
|
const getTargetResult = translationPackage?.getFunctionTypeTranslationTarget(parent);
|
5991
5997
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -6005,7 +6011,7 @@ var NodeSemanticInfoService = class {
|
|
6005
6011
|
}
|
6006
6012
|
break;
|
6007
6013
|
}
|
6008
|
-
case
|
6014
|
+
case 145 /* ParameterDeclaration */:
|
6009
6015
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofParameterDeclaration(parent));
|
6010
6016
|
break;
|
6011
6017
|
case 8 /* PackageImport */:
|
@@ -6014,7 +6020,7 @@ var NodeSemanticInfoService = class {
|
|
6014
6020
|
case 9 /* PackageName */:
|
6015
6021
|
result = void 0;
|
6016
6022
|
break;
|
6017
|
-
case
|
6023
|
+
case 79 /* MemberAccessExpression */:
|
6018
6024
|
result = this.ofProperty(analyzer, parent, options6);
|
6019
6025
|
break;
|
6020
6026
|
case 52 /* MethodDeclaration */:
|
@@ -6026,10 +6032,10 @@ var NodeSemanticInfoService = class {
|
|
6026
6032
|
case 54 /* FieldDeclaration */:
|
6027
6033
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofFieldDeclaration(parent));
|
6028
6034
|
break;
|
6029
|
-
case
|
6035
|
+
case 144 /* TypeParameterDeclaration */:
|
6030
6036
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
|
6031
6037
|
break;
|
6032
|
-
case
|
6038
|
+
case 143 /* VariantDeclaration */:
|
6033
6039
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
|
6034
6040
|
break;
|
6035
6041
|
case 36 /* PackageVariableGetterDeclaration */:
|
@@ -6052,7 +6058,7 @@ var NodeSemanticInfoService = class {
|
|
6052
6058
|
let result;
|
6053
6059
|
const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
|
6054
6060
|
switch (meaning.kind) {
|
6055
|
-
case "instance-
|
6061
|
+
case "instance-field-access": {
|
6056
6062
|
let narrowedType;
|
6057
6063
|
if (isNarrowableReferenceExpression(node)) {
|
6058
6064
|
narrowedType = analyzer.type.ofExpression(node);
|
@@ -6065,7 +6071,7 @@ var NodeSemanticInfoService = class {
|
|
6065
6071
|
result = new ReferenceNodeSemanticInfo([target], false);
|
6066
6072
|
break;
|
6067
6073
|
}
|
6068
|
-
case "static-
|
6074
|
+
case "static-field-access": {
|
6069
6075
|
let narrowedType;
|
6070
6076
|
if (isNarrowableReferenceExpression(node)) {
|
6071
6077
|
narrowedType = analyzer.type.ofExpression(node);
|
@@ -6165,10 +6171,10 @@ var NodeSemanticInfoService = class {
|
|
6165
6171
|
switch (node.parent.kind) {
|
6166
6172
|
case 10 /* NamedTypeSpecifier */:
|
6167
6173
|
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier, options6);
|
6168
|
-
case
|
6174
|
+
case 148 /* Tag */:
|
6169
6175
|
return this.ofTagNameQualifier(analyzer, node.parent, qualifier, options6);
|
6170
6176
|
case 42 /* ExtendedTypeClause */:
|
6171
|
-
case
|
6177
|
+
case 135 /* PackageImportTranslation */:
|
6172
6178
|
return void 0;
|
6173
6179
|
default:
|
6174
6180
|
Debug.never(node.parent);
|
@@ -6631,7 +6637,7 @@ var NodeSemanticInfoService = class {
|
|
6631
6637
|
}
|
6632
6638
|
static ofPackageNameSegmentAccess(analyzer, packageTreeNode, node) {
|
6633
6639
|
let parent = getParentSkippingParenthesizedExpressions(node);
|
6634
|
-
while (parent.kind ===
|
6640
|
+
while (parent.kind === 79 /* MemberAccessExpression */) {
|
6635
6641
|
const meaning = analyzer.resolveMemberAccessExpression(parent).meaning;
|
6636
6642
|
if (meaning.kind === "package-name-segment-access") {
|
6637
6643
|
packageTreeNode = meaning.packageTreeNode;
|
@@ -6672,7 +6678,7 @@ var NodeSemanticInfoService = class {
|
|
6672
6678
|
let parentCallExpression;
|
6673
6679
|
if (parent.kind === 69 /* CallExpression */) {
|
6674
6680
|
parentCallExpression = parent;
|
6675
|
-
} else if (parent.kind ===
|
6681
|
+
} else if (parent.kind === 90 /* GenericSpecializationExpression */) {
|
6676
6682
|
const grandParent = getParentSkippingParenthesizedExpressions(parent);
|
6677
6683
|
if (grandParent.kind === 69 /* CallExpression */) {
|
6678
6684
|
parentCallExpression = grandParent;
|
@@ -6928,8 +6934,6 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6928
6934
|
case 17 /* AnonymousFunctionTypeDeclaration */:
|
6929
6935
|
case 18 /* AnonymousStructuredTypeDeclaration */:
|
6930
6936
|
case 19 /* AnonymousVariantTypeDeclaration */:
|
6931
|
-
case 67 /* FunctionBlockLiteral */:
|
6932
|
-
case 74 /* FunctionLiteral */:
|
6933
6937
|
range = node.rangeWithoutTrivia;
|
6934
6938
|
break;
|
6935
6939
|
case 22 /* PackageAliasTypeDeclaration */:
|
@@ -6939,7 +6943,7 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6939
6943
|
case 38 /* PackageVariantTypeDeclaration */:
|
6940
6944
|
case 58 /* NestedFunctionDeclaration */:
|
6941
6945
|
case 52 /* MethodDeclaration */:
|
6942
|
-
case
|
6946
|
+
case 144 /* TypeParameterDeclaration */:
|
6943
6947
|
case 53 /* OperatorDeclaration */:
|
6944
6948
|
range = node.name.rangeWithoutTrivia;
|
6945
6949
|
break;
|
@@ -7084,9 +7088,12 @@ var DefinitionService = class {
|
|
7084
7088
|
getReferenceTargetSourceLocation(analyzer, target, tokenOrKeyword, sourceFile) {
|
7085
7089
|
switch (target.kind) {
|
7086
7090
|
case "entity":
|
7091
|
+
if (target.entity.kind === 0 /* Variable */) {
|
7092
|
+
return this.getSourceLocationsOfVariableEntity(analyzer, target.entity);
|
7093
|
+
}
|
7087
7094
|
return getEntitySourceLocations(analyzer, target.entity);
|
7088
7095
|
case "type-variable":
|
7089
|
-
return
|
7096
|
+
return this.getSourceLocationsOfVariableEntity(analyzer, target.variable.getEntity());
|
7090
7097
|
case "type-constructor":
|
7091
7098
|
return getEntitySourceLocations(analyzer, target.constructor_.getEntity());
|
7092
7099
|
case "accessed-function":
|
@@ -7096,9 +7103,9 @@ var DefinitionService = class {
|
|
7096
7103
|
case "type-dereference-operator":
|
7097
7104
|
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
7098
7105
|
case "match-result-value-parameter":
|
7099
|
-
return
|
7106
|
+
return this.getSourceLocationsOfVariableEntity(analyzer, target.parameter.entity);
|
7100
7107
|
case "type-value-parameter":
|
7101
|
-
return
|
7108
|
+
return this.getSourceLocationsOfVariableEntity(analyzer, target.parameter.getEntity());
|
7102
7109
|
case "package":
|
7103
7110
|
return [new SourceLocation(sourceFile, tokenOrKeyword.value.rangeWithoutTrivia)];
|
7104
7111
|
case "package-name-tree-node":
|
@@ -7158,6 +7165,80 @@ var DefinitionService = class {
|
|
7158
7165
|
}
|
7159
7166
|
return new LocalizationContext(translationPackages, referenceContext.originalLocale);
|
7160
7167
|
}
|
7168
|
+
getSourceLocationsOfVariableEntity(analyzer, entity) {
|
7169
|
+
let result = getEntitySourceLocations(analyzer, entity);
|
7170
|
+
if (result === void 0 && entity.kind === 0 /* Variable */) {
|
7171
|
+
const specialVariableInfo = entity.isSpecial();
|
7172
|
+
if (specialVariableInfo !== void 0) {
|
7173
|
+
result = this.getSourceLocationsOfSpecialVariable(analyzer, specialVariableInfo);
|
7174
|
+
}
|
7175
|
+
}
|
7176
|
+
return result;
|
7177
|
+
}
|
7178
|
+
getSourceLocationsOfSpecialVariable(analyzer, info) {
|
7179
|
+
switch (info.kind) {
|
7180
|
+
case "result":
|
7181
|
+
return [this.getSourceLocationOfSubprogramNode(analyzer, info.subprogramNode)];
|
7182
|
+
case "value":
|
7183
|
+
return [this.getSourceLocationOfSubprogramNode(analyzer, info.setterDeclaration)];
|
7184
|
+
case "implicit-function-block-parameter":
|
7185
|
+
return [this.getSourceLocationOfSubprogramNode(analyzer, info.functionBlockLiteral)];
|
7186
|
+
case "backing":
|
7187
|
+
return void 0;
|
7188
|
+
default:
|
7189
|
+
Debug.never(info);
|
7190
|
+
}
|
7191
|
+
}
|
7192
|
+
getSourceLocationOfSubprogramNode(analyzer, node) {
|
7193
|
+
let range;
|
7194
|
+
switch (node.kind) {
|
7195
|
+
case 27 /* PackageFunctionDeclaration */:
|
7196
|
+
case 36 /* PackageVariableGetterDeclaration */:
|
7197
|
+
case 37 /* PackageVariableSetterDeclaration */:
|
7198
|
+
case 52 /* MethodDeclaration */:
|
7199
|
+
case 55 /* FieldGetterDeclaration */:
|
7200
|
+
case 56 /* FieldSetterDeclaration */:
|
7201
|
+
case 58 /* NestedFunctionDeclaration */:
|
7202
|
+
range = node.name.rangeWithoutTrivia;
|
7203
|
+
break;
|
7204
|
+
case 25 /* PackageConstructorDeclaration */:
|
7205
|
+
range = node.creationKeyword.rangeWithoutTrivia;
|
7206
|
+
break;
|
7207
|
+
case 26 /* PackageEntryPointDeclaration */:
|
7208
|
+
range = node.runKeyword.rangeWithoutTrivia;
|
7209
|
+
break;
|
7210
|
+
case 45 /* ConstructorDeclaration */:
|
7211
|
+
range = node.creationKeyword.rangeWithoutTrivia;
|
7212
|
+
break;
|
7213
|
+
case 46 /* DestructorDeclaration */:
|
7214
|
+
range = node.destructionKeyword.rangeWithoutTrivia;
|
7215
|
+
break;
|
7216
|
+
case 47 /* IndexedElementGetterDeclaration */:
|
7217
|
+
case 48 /* IndexedElementSetterDeclaration */:
|
7218
|
+
range = node.parameterClause.rangeWithoutTrivia;
|
7219
|
+
break;
|
7220
|
+
case 50 /* DereferencedVariableGetterDeclaration */:
|
7221
|
+
case 51 /* DereferencedVariableSetterDeclaration */:
|
7222
|
+
range = node.caretToken.rangeWithoutTrivia;
|
7223
|
+
break;
|
7224
|
+
case 53 /* OperatorDeclaration */:
|
7225
|
+
range = node.name.rangeWithoutTrivia;
|
7226
|
+
break;
|
7227
|
+
case 67 /* FunctionBlockLiteral */:
|
7228
|
+
range = node.block.openBraceToken.rangeWithoutTrivia;
|
7229
|
+
break;
|
7230
|
+
case 74 /* FunctionLiteral */: {
|
7231
|
+
const rangeStart = node.functionKeyword.rangeWithoutTrivia.start;
|
7232
|
+
const rangeEnd = node.parameterClause.rangeWithoutTrivia.end;
|
7233
|
+
range = new Range(rangeStart, rangeEnd);
|
7234
|
+
break;
|
7235
|
+
}
|
7236
|
+
default:
|
7237
|
+
Debug.never(node);
|
7238
|
+
}
|
7239
|
+
const sourceFile = TreeQuery.fromNode(node).projectSourceFile(analyzer);
|
7240
|
+
return new SourceLocation(sourceFile, range);
|
7241
|
+
}
|
7161
7242
|
};
|
7162
7243
|
var DefinitionsAndReferenceInfo = class {
|
7163
7244
|
constructor(definitionLocations, referenceRange) {
|
@@ -7234,7 +7315,7 @@ var ReferencesService = class {
|
|
7234
7315
|
result.push(new Reference(sourceFile2, node.autotypeKeyword.rangeWithoutTrivia, referenceKind));
|
7235
7316
|
}
|
7236
7317
|
}
|
7237
|
-
if (node.kind ===
|
7318
|
+
if (node.kind === 78 /* PrefixUnaryExpression */ && restrictions.canBePrefixUnaryOperator) {
|
7238
7319
|
const semanticInfo = NodeSemanticInfoService.ofPrefixUnaryExpressionOperator(
|
7239
7320
|
analyzer,
|
7240
7321
|
node,
|
@@ -7278,7 +7359,7 @@ var ReferencesService = class {
|
|
7278
7359
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
7279
7360
|
}
|
7280
7361
|
}
|
7281
|
-
if (node.kind ===
|
7362
|
+
if (node.kind === 81 /* DereferenceExpression */ && restrictions.canBeDereferenceOperator) {
|
7282
7363
|
const semanticInfo = NodeSemanticInfoService.ofDereferenceExpressionOperator(
|
7283
7364
|
analyzer,
|
7284
7365
|
node,
|
@@ -7294,7 +7375,7 @@ var ReferencesService = class {
|
|
7294
7375
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
7295
7376
|
}
|
7296
7377
|
}
|
7297
|
-
if (node.kind ===
|
7378
|
+
if (node.kind === 92 /* AssignmentStatement */ && restrictions.canBeAssignmentStatementOperator) {
|
7298
7379
|
const semanticInfo = NodeSemanticInfoService.ofAssignmentStatementOperator(
|
7299
7380
|
analyzer,
|
7300
7381
|
node,
|
@@ -7322,7 +7403,7 @@ var ReferencesService = class {
|
|
7322
7403
|
result.push(new Reference(sourceFile2, node.creationKeyword.rangeWithoutTrivia, referenceKind));
|
7323
7404
|
}
|
7324
7405
|
}
|
7325
|
-
if (node.kind ===
|
7406
|
+
if (node.kind === 87 /* ObjectExpression */ && restrictions.canBeObjectExpression) {
|
7326
7407
|
const semanticInfo = NodeSemanticInfoService.ofObjectExpression(analyzer, node, semanticInfoOptions);
|
7327
7408
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7328
7409
|
definition,
|
@@ -7334,7 +7415,7 @@ var ReferencesService = class {
|
|
7334
7415
|
result.push(new Reference(sourceFile2, node.keyword.rangeWithoutTrivia, referenceKind));
|
7335
7416
|
}
|
7336
7417
|
}
|
7337
|
-
if (node.kind ===
|
7418
|
+
if (node.kind === 88 /* BaseExpression */ && restrictions.canBeBaseExpression) {
|
7338
7419
|
const semanticInfo = NodeSemanticInfoService.ofBaseExpression(analyzer, node, semanticInfoOptions);
|
7339
7420
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7340
7421
|
definition,
|
@@ -7740,9 +7821,9 @@ var EvaluatableExpressionService = class {
|
|
7740
7821
|
getEvaluatableExpressionForIdentifier(node) {
|
7741
7822
|
const parent = node.parent;
|
7742
7823
|
switch (parent.kind) {
|
7743
|
-
case
|
7824
|
+
case 89 /* IdentifierExpression */:
|
7744
7825
|
return parent;
|
7745
|
-
case
|
7826
|
+
case 79 /* MemberAccessExpression */:
|
7746
7827
|
if (this.isEvaluatableReceiver(parent.expression)) {
|
7747
7828
|
return parent;
|
7748
7829
|
}
|
@@ -7763,9 +7844,9 @@ var EvaluatableExpressionService = class {
|
|
7763
7844
|
}
|
7764
7845
|
isEvaluatableReceiver(expression) {
|
7765
7846
|
switch (expression.kind) {
|
7766
|
-
case
|
7847
|
+
case 89 /* IdentifierExpression */:
|
7767
7848
|
return true;
|
7768
|
-
case
|
7849
|
+
case 79 /* MemberAccessExpression */:
|
7769
7850
|
return this.isEvaluatableReceiver(expression.expression);
|
7770
7851
|
default:
|
7771
7852
|
return false;
|
@@ -7791,17 +7872,17 @@ var EvaluatableExpressionService = class {
|
|
7791
7872
|
return { nameIdentifier: node.name };
|
7792
7873
|
case 59 /* LocalVariableDeclaration */:
|
7793
7874
|
return { nameIdentifier: node.name };
|
7794
|
-
case
|
7875
|
+
case 145 /* ParameterDeclaration */:
|
7795
7876
|
return { nameIdentifier: node.name };
|
7796
7877
|
case 52 /* MethodDeclaration */:
|
7797
7878
|
return { nameIdentifier: node.name };
|
7798
7879
|
case 54 /* FieldDeclaration */:
|
7799
7880
|
return { nameIdentifier: node.name };
|
7800
|
-
case
|
7881
|
+
case 144 /* TypeParameterDeclaration */:
|
7801
7882
|
return { nameIdentifier: node.name };
|
7802
|
-
case
|
7883
|
+
case 143 /* VariantDeclaration */:
|
7803
7884
|
return { nameIdentifier: node.name };
|
7804
|
-
case
|
7885
|
+
case 102 /* ErrorVariableDeclaration */:
|
7805
7886
|
return { nameIdentifier: node.name };
|
7806
7887
|
default:
|
7807
7888
|
return void 0;
|
@@ -7981,7 +8062,7 @@ var HoverService = class {
|
|
7981
8062
|
const typeText = this._displayService.displayType(firstTarget.value.type);
|
7982
8063
|
return new Hover(`${keywordText}: ${typeText}`, range);
|
7983
8064
|
} else if (firstTarget.value.typeContextKind === "base") {
|
7984
|
-
const keywordText = this._displayService.displayKeyword(
|
8065
|
+
const keywordText = this._displayService.displayKeyword(57 /* Base */);
|
7985
8066
|
const typeText = this._displayService.displayType(firstTarget.value.type);
|
7986
8067
|
return new Hover(`${keywordText}: ${typeText}`, range);
|
7987
8068
|
} else {
|
@@ -8238,7 +8319,7 @@ var SourceFileItemsService = class {
|
|
8238
8319
|
);
|
8239
8320
|
break;
|
8240
8321
|
}
|
8241
|
-
case
|
8322
|
+
case 143 /* VariantDeclaration */: {
|
8242
8323
|
result.push(
|
8243
8324
|
this.createItem(
|
8244
8325
|
9 /* Variant */,
|
@@ -8250,7 +8331,7 @@ var SourceFileItemsService = class {
|
|
8250
8331
|
);
|
8251
8332
|
break;
|
8252
8333
|
}
|
8253
|
-
case
|
8334
|
+
case 144 /* TypeParameterDeclaration */: {
|
8254
8335
|
result.push(
|
8255
8336
|
this.createItem(
|
8256
8337
|
18 /* TypeParameter */,
|
@@ -8306,23 +8387,23 @@ var SourceFileItemsService = class {
|
|
8306
8387
|
case 8 /* InvalidType */:
|
8307
8388
|
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(16 /* Type */, this.locale, this.dialect)}>`;
|
8308
8389
|
case 10 /* Constructor */:
|
8309
|
-
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(
|
8390
|
+
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(31 /* Creation */, this.locale, this.dialect);
|
8310
8391
|
case 11 /* Destructor */:
|
8311
|
-
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(
|
8392
|
+
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(48 /* Destruction */, this.locale, this.dialect);
|
8312
8393
|
case 9 /* Variant */:
|
8313
8394
|
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(6 /* Variant */, this.locale, this.dialect)}>`;
|
8314
8395
|
case 18 /* TypeParameter */:
|
8315
8396
|
return name ?? `<${LocalizationHelper.localizeHelperPhrase(2 /* TypeParameter */, this.locale)}>`;
|
8316
8397
|
case 2 /* PackageVariableGetter */:
|
8317
8398
|
case 13 /* FieldGetter */:
|
8318
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8399
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Get */, this.locale, this.dialect)} ${name ?? ""}`;
|
8319
8400
|
case 3 /* PackageVariableSetter */:
|
8320
8401
|
case 14 /* FieldSetter */:
|
8321
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8402
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(60 /* Set */, this.locale, this.dialect)} ${name ?? ""}`;
|
8322
8403
|
case 16 /* IndexedElementGetter */:
|
8323
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8404
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Get */, this.locale, this.dialect)} []`;
|
8324
8405
|
case 17 /* IndexedElementSetter */:
|
8325
|
-
return `${LocalizationHelper.localizeKeywordAndTakeFirst(
|
8406
|
+
return `${LocalizationHelper.localizeKeywordAndTakeFirst(60 /* Set */, this.locale, this.dialect)} []`;
|
8326
8407
|
default:
|
8327
8408
|
Debug.never(kind);
|
8328
8409
|
}
|
@@ -8487,7 +8568,7 @@ var SelectionRangeService = class {
|
|
8487
8568
|
if (!this.nodeShouldBeSkipped(child) && !child.rangeWithoutTrivia.equals(result.range)) {
|
8488
8569
|
result = new SelectionRange(child.rangeWithoutTrivia, result);
|
8489
8570
|
}
|
8490
|
-
if (child.kind === 0 /* Token */ && (child.tokenKind === 6 /* TextLiteral */ || child.tokenKind === 7 /* TextTemplateHead */ || child.tokenKind === 8 /* TextTemplatePart */ || child.tokenKind === 9 /* TextTemplateTail */ || child.tokenKind === 5 /* CharLiteral */) || child.kind ===
|
8571
|
+
if (child.kind === 0 /* Token */ && (child.tokenKind === 6 /* TextLiteral */ || child.tokenKind === 7 /* TextTemplateHead */ || child.tokenKind === 8 /* TextTemplatePart */ || child.tokenKind === 9 /* TextTemplateTail */ || child.tokenKind === 5 /* CharLiteral */) || child.kind === 82 /* TextTemplateLiteral */) {
|
8491
8572
|
const textContentStart = child.rangeWithoutTrivia.start + 1;
|
8492
8573
|
const textContentEnd = child.rangeWithoutTrivia.end - 1;
|
8493
8574
|
if (offset >= textContentStart && offset < textContentEnd) {
|
@@ -8518,13 +8599,13 @@ var SelectionRangeService = class {
|
|
8518
8599
|
}
|
8519
8600
|
}
|
8520
8601
|
switch (node.kind) {
|
8521
|
-
case
|
8602
|
+
case 157 /* TypeAnnotation */:
|
8522
8603
|
case 34 /* StructuredTypeDeclarationBody */:
|
8523
8604
|
case 39 /* VariantTypeDeclarationBody */:
|
8524
8605
|
case 23 /* AliasTypeDeclarationBody */:
|
8525
8606
|
case 29 /* FunctionTypeDeclarationBody */:
|
8526
|
-
case
|
8527
|
-
case
|
8607
|
+
case 84 /* TextTemplateSpan */:
|
8608
|
+
case 83 /* TextTemplateSpanList */:
|
8528
8609
|
return true;
|
8529
8610
|
default:
|
8530
8611
|
return false;
|
@@ -8562,7 +8643,7 @@ var SemanticTokensService = class {
|
|
8562
8643
|
controller.stopChildrenTraverse();
|
8563
8644
|
return;
|
8564
8645
|
}
|
8565
|
-
if (node.kind ===
|
8646
|
+
if (node.kind === 89 /* IdentifierExpression */) {
|
8566
8647
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
8567
8648
|
if (meaning.kind === "variable-access") {
|
8568
8649
|
const variable = meaning.variable.value.getEntity();
|
@@ -8618,9 +8699,9 @@ var SemanticTokensService = class {
|
|
8618
8699
|
));
|
8619
8700
|
}
|
8620
8701
|
}
|
8621
|
-
if (node.kind ===
|
8702
|
+
if (node.kind === 79 /* MemberAccessExpression */) {
|
8622
8703
|
const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
|
8623
|
-
if (meaning.kind === "static-
|
8704
|
+
if (meaning.kind === "static-field-access") {
|
8624
8705
|
const entity = meaning.variable.value.getEntity();
|
8625
8706
|
if (entity.subkind === "field" && entity.isVariant()) {
|
8626
8707
|
result.push(
|
@@ -8662,7 +8743,7 @@ var SemanticTokensService = class {
|
|
8662
8743
|
));
|
8663
8744
|
}
|
8664
8745
|
}
|
8665
|
-
if (node.kind ===
|
8746
|
+
if (node.kind === 143 /* VariantDeclaration */) {
|
8666
8747
|
result.push(
|
8667
8748
|
new SemanticToken(
|
8668
8749
|
node.name.rangeWithoutTrivia,
|
@@ -8850,7 +8931,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8850
8931
|
}
|
8851
8932
|
let node = token.parent;
|
8852
8933
|
while (node !== void 0) {
|
8853
|
-
if (node.kind ===
|
8934
|
+
if (node.kind === 153 /* TypeArgumentClause */ && this._offset >= node.lessThanToken.rangeWithoutTrivia.end && (node.greaterThanToken.rangeWithoutTrivia.isEmpty || this._offset <= node.greaterThanToken.rangeWithoutTrivia.start)) {
|
8854
8935
|
const argumentIndex = this.getArgumentIndex(node.typeArgumentList, this._offset);
|
8855
8936
|
const argumentCount = this.countArguments(node.typeArgumentList);
|
8856
8937
|
return new NodeWithTypeArgumentsInfo(node.parent, argumentIndex, argumentCount);
|
@@ -8895,9 +8976,9 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8895
8976
|
switch (node.kind) {
|
8896
8977
|
case 10 /* NamedTypeSpecifier */:
|
8897
8978
|
return this.getSignaturesForNamedTypeSpecifier(node);
|
8898
|
-
case
|
8979
|
+
case 90 /* GenericSpecializationExpression */:
|
8899
8980
|
return this.getSignaturesForGenericSpecializationExpression(node);
|
8900
|
-
case
|
8981
|
+
case 148 /* Tag */:
|
8901
8982
|
return this.getSignaturesForTag(node);
|
8902
8983
|
default:
|
8903
8984
|
Debug.never(node);
|
@@ -8936,7 +9017,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8936
9017
|
}
|
8937
9018
|
getSignaturesForGenericSpecializationExpression(node) {
|
8938
9019
|
const expression = unwrapParenthesizedExpressions(node.expression);
|
8939
|
-
if (expression.kind ===
|
9020
|
+
if (expression.kind === 89 /* IdentifierExpression */) {
|
8940
9021
|
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
8941
9022
|
if (meaning.kind === "function-access") {
|
8942
9023
|
return Query.from(meaning.candidates).mapAndFilter((o) => {
|
@@ -8951,7 +9032,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8951
9032
|
}
|
8952
9033
|
return void 0;
|
8953
9034
|
}
|
8954
|
-
if (expression.kind ===
|
9035
|
+
if (expression.kind === 79 /* MemberAccessExpression */) {
|
8955
9036
|
const meaning = this._analyzer.resolveMemberAccessExpression(expression).meaning;
|
8956
9037
|
let accessedFunctions;
|
8957
9038
|
if (meaning.kind === "instance-method-access") {
|
@@ -9228,7 +9309,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
9228
9309
|
}
|
9229
9310
|
break;
|
9230
9311
|
}
|
9231
|
-
case
|
9312
|
+
case 148 /* Tag */: {
|
9232
9313
|
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)) {
|
9233
9314
|
const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
|
9234
9315
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(node);
|
@@ -11765,7 +11846,7 @@ var EntityToSyntax = class {
|
|
11765
11846
|
convertPackageVariable(entity) {
|
11766
11847
|
const commonModifiers = new Array();
|
11767
11848
|
if (entity.isConstant()) {
|
11768
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11849
|
+
commonModifiers.push(SyntaxFactory.modifier(36 /* Const */));
|
11769
11850
|
}
|
11770
11851
|
const name = this.getEntityName(entity);
|
11771
11852
|
const type = this.convertType(entity.getType());
|
@@ -11807,7 +11888,7 @@ var EntityToSyntax = class {
|
|
11807
11888
|
const tags = this.convertTags(entity.getTags());
|
11808
11889
|
const modifiers = new Array();
|
11809
11890
|
if (entity.isAsync()) {
|
11810
|
-
modifiers.push(SyntaxFactory.modifier(
|
11891
|
+
modifiers.push(SyntaxFactory.modifier(41 /* Async */));
|
11811
11892
|
}
|
11812
11893
|
const isHidden = entity.isHidden();
|
11813
11894
|
if (isHidden !== void 0) {
|
@@ -11889,19 +11970,19 @@ var EntityToSyntax = class {
|
|
11889
11970
|
}
|
11890
11971
|
const commonModifiers = new Array();
|
11891
11972
|
if (entity.isConstant()) {
|
11892
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11973
|
+
commonModifiers.push(SyntaxFactory.modifier(36 /* Const */));
|
11893
11974
|
}
|
11894
11975
|
if (entity.isStatic()) {
|
11895
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11976
|
+
commonModifiers.push(SyntaxFactory.modifier(42 /* Static */));
|
11896
11977
|
}
|
11897
11978
|
if (entity.isAbstract()) {
|
11898
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11979
|
+
commonModifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
|
11899
11980
|
}
|
11900
11981
|
if (entity.isRedefinable()) {
|
11901
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11982
|
+
commonModifiers.push(SyntaxFactory.modifier(39 /* Redefinable */));
|
11902
11983
|
}
|
11903
11984
|
if (entity.isRedefined()) {
|
11904
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
11985
|
+
commonModifiers.push(SyntaxFactory.modifier(40 /* Redefined */));
|
11905
11986
|
}
|
11906
11987
|
const name = this.getEntityName(entity);
|
11907
11988
|
const type = this.convertType(entity.getType());
|
@@ -11947,16 +12028,16 @@ var EntityToSyntax = class {
|
|
11947
12028
|
modifiers.push(this.createHidingModifier(isHidden));
|
11948
12029
|
}
|
11949
12030
|
if (entity.isStatic()) {
|
11950
|
-
modifiers.push(SyntaxFactory.modifier(
|
12031
|
+
modifiers.push(SyntaxFactory.modifier(42 /* Static */));
|
11951
12032
|
}
|
11952
12033
|
if (entity.isAbstract()) {
|
11953
|
-
modifiers.push(SyntaxFactory.modifier(
|
12034
|
+
modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
|
11954
12035
|
}
|
11955
12036
|
if (entity.isRedefinable()) {
|
11956
|
-
modifiers.push(SyntaxFactory.modifier(
|
12037
|
+
modifiers.push(SyntaxFactory.modifier(39 /* Redefinable */));
|
11957
12038
|
}
|
11958
12039
|
if (entity.isRedefined()) {
|
11959
|
-
modifiers.push(SyntaxFactory.modifier(
|
12040
|
+
modifiers.push(SyntaxFactory.modifier(40 /* Redefined */));
|
11960
12041
|
}
|
11961
12042
|
const name = this.getEntityName(entity);
|
11962
12043
|
const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
|
@@ -11972,7 +12053,7 @@ var EntityToSyntax = class {
|
|
11972
12053
|
modifiers.push(this.createHidingModifier(isHidden));
|
11973
12054
|
}
|
11974
12055
|
if (entity.isAbstract()) {
|
11975
|
-
modifiers.push(SyntaxFactory.modifier(
|
12056
|
+
modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
|
11976
12057
|
}
|
11977
12058
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11978
12059
|
return SyntaxFactory.constructorDeclaration(tags, modifiers, parameters, void 0);
|
@@ -11985,7 +12066,7 @@ var EntityToSyntax = class {
|
|
11985
12066
|
modifiers.push(this.createHidingModifier(isHidden));
|
11986
12067
|
}
|
11987
12068
|
if (entity.isAbstract()) {
|
11988
|
-
modifiers.push(SyntaxFactory.modifier(
|
12069
|
+
modifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
|
11989
12070
|
}
|
11990
12071
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11991
12072
|
return SyntaxFactory.destructorDeclaration(tags, modifiers, parameters, void 0);
|
@@ -11993,10 +12074,10 @@ var EntityToSyntax = class {
|
|
11993
12074
|
convertIndexer(entity) {
|
11994
12075
|
const commonModifiers = new Array();
|
11995
12076
|
if (entity.isStatic()) {
|
11996
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
12077
|
+
commonModifiers.push(SyntaxFactory.modifier(42 /* Static */));
|
11997
12078
|
}
|
11998
12079
|
if (entity.isAbstract()) {
|
11999
|
-
commonModifiers.push(SyntaxFactory.modifier(
|
12080
|
+
commonModifiers.push(SyntaxFactory.modifier(38 /* Abstract */));
|
12000
12081
|
}
|
12001
12082
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
12002
12083
|
const result = new Array();
|
@@ -12110,21 +12191,21 @@ var EntityToSyntax = class {
|
|
12110
12191
|
let levelKeyword;
|
12111
12192
|
switch (hiding.kind) {
|
12112
12193
|
case "type":
|
12113
|
-
levelKeyword =
|
12194
|
+
levelKeyword = 52 /* InType */;
|
12114
12195
|
break;
|
12115
12196
|
case "type-hierarchy":
|
12116
|
-
levelKeyword =
|
12197
|
+
levelKeyword = 49 /* InHierarchy */;
|
12117
12198
|
break;
|
12118
12199
|
case "file":
|
12119
|
-
levelKeyword =
|
12200
|
+
levelKeyword = 50 /* InFile */;
|
12120
12201
|
break;
|
12121
12202
|
case "package":
|
12122
|
-
levelKeyword =
|
12203
|
+
levelKeyword = 51 /* InPackage */;
|
12123
12204
|
break;
|
12124
12205
|
default:
|
12125
12206
|
Debug.never(hiding);
|
12126
12207
|
}
|
12127
|
-
return SyntaxFactory.modifier(
|
12208
|
+
return SyntaxFactory.modifier(37 /* Hidden */, levelKeyword);
|
12128
12209
|
}
|
12129
12210
|
convertTags(_entityTags) {
|
12130
12211
|
return [];
|
@@ -13392,7 +13473,7 @@ var LanguageServer = class {
|
|
13392
13473
|
const sourceFileContext = yield this.getSourceFileContext(uri, token);
|
13393
13474
|
if (sourceFileContext !== void 0) {
|
13394
13475
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
13395
|
-
if (node?.kind ===
|
13476
|
+
if (node?.kind === 92 /* AssignmentStatement */) {
|
13396
13477
|
const sourceFileEdit = this._addPropertyAssignmentService.createEditWithAssignment(
|
13397
13478
|
sourceFileContext.sourceFile,
|
13398
13479
|
node,
|
@@ -13429,7 +13510,7 @@ var LanguageServer = class {
|
|
13429
13510
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
13430
13511
|
if (node !== void 0) {
|
13431
13512
|
let nodeForRange = node;
|
13432
|
-
if (node.kind ===
|
13513
|
+
if (node.kind === 92 /* AssignmentStatement */) {
|
13433
13514
|
nodeForRange = node.right;
|
13434
13515
|
}
|
13435
13516
|
result = this.convertSourceFileRange(sourceFileContext.sourceFile, nodeForRange.rangeWithoutTrivia);
|