@artel/artc 0.6.25224 → 0.6.25225
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 +81 -79
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +995 -1001
- package/build/{chunk-24QZJOMF.js → chunk-TFTCV5R5.js} +5434 -5343
- package/build/{chunk-62KHK23H.js → chunk-UB6LHKS5.js} +3 -3
- package/build/{chunk-Y6DODJCG.js → chunk-Z6TZA6SN.js} +3 -3
- package/build/types/analysis/AccessedFunction.d.ts +53 -0
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +15 -15
- package/build/types/analysis/Analyzer.d.ts +133 -124
- package/build/types/analysis/CallExpressionMeaning.d.ts +10 -10
- package/build/types/analysis/DiagnosticCollector.d.ts +16 -16
- package/build/types/analysis/EntityLocalizationHelper.d.ts +6 -6
- package/build/types/analysis/IdentifierExpressionMeaning.d.ts +10 -10
- package/build/types/analysis/LocalizationContext.d.ts +2 -2
- package/build/types/analysis/{PropertyAccessExpressionMeaning.d.ts → MemberAccessExpressionMeaning.d.ts} +20 -20
- package/build/types/analysis/NodeTypeUtils.d.ts +13 -13
- package/build/types/analysis/OperationOverloadResolver.d.ts +1 -1
- package/build/types/analysis/Scope.d.ts +15 -15
- package/build/types/analysis/SemanticContext.d.ts +29 -29
- package/build/types/analysis/SemanticContextBuilder.d.ts +22 -22
- package/build/types/analysis/SourceFileMembers.d.ts +2 -2
- package/build/types/analysis/StatementBlockScopeBuilder.d.ts +12 -12
- package/build/types/analysis/{SubstitutedMethod.d.ts → SubstitutedFunction.d.ts} +14 -14
- package/build/types/analysis/TagMeaning.d.ts +19 -19
- package/build/types/analysis/Tags.d.ts +6 -6
- package/build/types/analysis/Utils.d.ts +3 -3
- package/build/types/analysis/WellKnownDeclarations.d.ts +4 -4
- package/build/types/analysis/control-flow/NarrowableExpression.d.ts +1 -1
- package/build/types/api/Api.d.ts +3 -3
- package/build/types/diagnostic/DiagnosticCode.d.ts +130 -131
- package/build/types/emitter/EmitPhaseName.d.ts +8 -8
- package/build/types/emitter/Emitter.d.ts +4 -4
- package/build/types/emitter/EmitterContext.d.ts +2 -2
- package/build/types/emitter/Entities.d.ts +26 -25
- package/build/types/emitter/EntityMap.d.ts +8 -8
- package/build/types/emitter/IrBuilder.d.ts +18 -18
- package/build/types/emitter/IrToJs.d.ts +9 -9
- package/build/types/emitter/Transformer.d.ts +37 -37
- package/build/types/emitter/ir/AccessedEntities.d.ts +5 -5
- package/build/types/emitter/ir/ComputedAccess.d.ts +5 -5
- package/build/types/emitter/ir/EmitOptions.d.ts +41 -27
- package/build/types/emitter/ir/Nodes.d.ts +140 -139
- package/build/types/emitter/ir/types.d.ts +8 -8
- package/build/types/entities/ConstructorEntity.d.ts +9 -9
- package/build/types/entities/DereferenceOperatorEntity.d.ts +4 -4
- package/build/types/entities/DestructorEntity.d.ts +4 -4
- package/build/types/entities/{MethodEntity.d.ts → FunctionEntity.d.ts} +36 -36
- package/build/types/entities/{MethodTypeEntity.d.ts → FunctionTypeEntity.d.ts} +23 -23
- package/build/types/entities/GetterEntity.d.ts +9 -9
- package/build/types/entities/IndexerEntity.d.ts +4 -4
- package/build/types/entities/SetterEntity.d.ts +9 -9
- package/build/types/entities/TypeEntity.d.ts +3 -3
- package/build/types/entities/TypeEntityMembers.d.ts +3 -3
- package/build/types/entities/TypeParameterEntity.d.ts +2 -2
- package/build/types/entities/VariableEntity.d.ts +32 -32
- package/build/types/entities/index.d.ts +14 -14
- package/build/types/services/CompletionService.d.ts +8 -8
- package/build/types/services/DisplayService.d.ts +62 -62
- package/build/types/services/HoverService.d.ts +1 -1
- package/build/types/services/NodeSemanticInfo.d.ts +17 -17
- package/build/types/services/SemanticTokensService.d.ts +6 -6
- package/build/types/services/SourceFileItemsService.d.ts +11 -11
- package/build/types/services/TypeDefinitionService.d.ts +2 -2
- package/build/types/services/signature-help/SignatureWithValueParameters.d.ts +10 -10
- package/build/types/services/signature-help/TypeParameterSignatureHelpProvider.d.ts +1 -1
- package/build/types/services/source-generation/EntityToSyntax.d.ts +9 -9
- package/build/types/tree/NodeKind.d.ts +146 -148
- package/build/types/tree/green/Nodes.d.ts +119 -139
- package/build/types/tree/green/SyntaxFactory.d.ts +19 -19
- package/build/types/tree/green/SyntaxToCode.d.ts +20 -22
- package/build/types/tree/red/Nodes.d.ts +165 -189
- package/build/types/ts-interop/Entities.d.ts +28 -28
- package/build/types/ts-interop/TsInteropContext.d.ts +1 -1
- package/build/types/ts-interop/TsPackageMembersCreator.d.ts +1 -1
- package/build/types/ts-interop/TsTypeMembersCreator.d.ts +1 -1
- package/build/types/types/{MethodType.d.ts → FunctionType.d.ts} +6 -6
- package/build/types/types/StandardTypes.d.ts +2 -2
- package/build/types/types/Type.d.ts +2 -2
- package/build/types/types/TypeFactory.d.ts +6 -7
- package/build/types/types/TypeMembers.d.ts +8 -8
- package/build/types/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/build/types/analysis/AccessedMethod.d.ts +0 -53
package/build/api/ApiServices.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import {
|
2
|
-
|
2
|
+
AccessedFunction_typeMember,
|
3
3
|
AliasTypeDeclarationBody,
|
4
4
|
Analyzer,
|
5
|
-
|
5
|
+
AnonymousFunctionTypeDeclaration,
|
6
6
|
AnonymousStructuredTypeDeclaration,
|
7
7
|
AnonymousTypeSpecifier,
|
8
8
|
AnonymousVariantTypeDeclaration,
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
ConfigurationConverter,
|
15
15
|
ConfigurationDirectoryNameSet,
|
16
16
|
ConfigurationFileParser,
|
17
|
+
ConstructorDeclaration,
|
17
18
|
ConstructorDeclaration_entity,
|
18
19
|
ConstructorDeclaration_typeMember,
|
19
20
|
ConstructorTranslation,
|
@@ -22,21 +23,34 @@ import {
|
|
22
23
|
DefaultLocale,
|
23
24
|
DefaultNamesOfDirectoriesToIgnore,
|
24
25
|
DereferenceOperatorDeclaration_typeMember,
|
26
|
+
DestructorDeclaration,
|
25
27
|
DiagnosticCollector,
|
26
28
|
DisplayService,
|
27
29
|
Emitter,
|
28
30
|
EntityLocalizationHelper,
|
31
|
+
FieldDeclaration,
|
32
|
+
FieldGetterDeclaration,
|
33
|
+
FieldOrVariantTranslation,
|
34
|
+
FieldSetterDeclaration,
|
29
35
|
FileSystemTree,
|
30
36
|
FunctionBlock,
|
37
|
+
FunctionDeclaration_accessedFunction,
|
38
|
+
FunctionDeclaration_entity,
|
39
|
+
FunctionDeclaration_substitutedFunction,
|
40
|
+
FunctionDeclaration_typeMember,
|
41
|
+
FunctionTypeDeclarationBody,
|
42
|
+
FunctionTypeTranslation,
|
31
43
|
GeneratedSourceFileScheme,
|
32
44
|
GenericCancellationToken,
|
33
45
|
InMemoryPackageScheme,
|
46
|
+
IndexParameterClause,
|
47
|
+
IndexParameterTranslationClause,
|
48
|
+
IndexedElementGetterDeclaration,
|
49
|
+
IndexedElementSetterDeclaration,
|
34
50
|
IndexerDeclaration_entity,
|
35
51
|
IndexerDeclaration_typeMember,
|
36
52
|
IndexerTranslation,
|
37
|
-
IndexerTranslationParameterClause,
|
38
53
|
IntersectionTypeSpecifier,
|
39
|
-
IntersectionTypeSpecifierTypeList,
|
40
54
|
JavaScriptInterfacePackageImplementationConfig,
|
41
55
|
JsonConfigurationFileNameSet,
|
42
56
|
Keyword,
|
@@ -47,18 +61,14 @@ import {
|
|
47
61
|
LocalizationContext,
|
48
62
|
LocalizationHelper,
|
49
63
|
Logger,
|
50
|
-
|
51
|
-
|
52
|
-
MethodDeclaration_substitutedMethod,
|
53
|
-
MethodDeclaration_typeMember,
|
54
|
-
MethodTypeDeclarationBody,
|
55
|
-
MethodTypeTranslation,
|
64
|
+
MethodDeclaration,
|
65
|
+
MethodTranslation,
|
56
66
|
Modifier,
|
57
67
|
ModifierList,
|
58
68
|
Name,
|
59
69
|
NamedTypeSpecifier,
|
60
70
|
NamedType_alias,
|
61
|
-
|
71
|
+
NamedType_function,
|
62
72
|
NamedType_structured,
|
63
73
|
NamedType_variant,
|
64
74
|
NodeModulesDirectoryName,
|
@@ -67,15 +77,15 @@ import {
|
|
67
77
|
NullableTypeSpecifier,
|
68
78
|
OperatorDeclaration_typeMember,
|
69
79
|
PackageAliasTypeDeclaration,
|
80
|
+
PackageFunctionDeclaration,
|
81
|
+
PackageFunctionTranslation,
|
82
|
+
PackageFunctionTypeDeclaration,
|
70
83
|
PackageImport,
|
71
84
|
PackageImportDirectiveList,
|
72
85
|
PackageMemberDeclarationList,
|
73
86
|
PackageMemberGroupDeclaration,
|
74
87
|
PackageMemberLookup,
|
75
|
-
|
76
|
-
PackageMethodTranslation,
|
77
|
-
PackageMethodTypeDeclaration,
|
78
|
-
PackagePath,
|
88
|
+
PackageName,
|
79
89
|
PackageStructuredTypeDeclaration,
|
80
90
|
PackageVariableDeclaration,
|
81
91
|
PackageVariableGetterDeclaration,
|
@@ -118,36 +128,24 @@ import {
|
|
118
128
|
TypeAnnotation,
|
119
129
|
TypeArgumentClause,
|
120
130
|
TypeArgumentList,
|
121
|
-
TypeConstructorDeclaration,
|
122
131
|
TypeDeclarationAlias_entity,
|
123
|
-
|
132
|
+
TypeDeclarationFunction_entity,
|
124
133
|
TypeDeclarationStructured_entity,
|
125
134
|
TypeDeclarationVariant_entity,
|
126
135
|
TypeDeclaration_alias,
|
127
|
-
|
136
|
+
TypeDeclaration_function,
|
128
137
|
TypeDeclaration_structured,
|
129
138
|
TypeDeclaration_variant,
|
130
|
-
TypeDestructorDeclaration,
|
131
|
-
TypeIndexedGetterDeclaration,
|
132
|
-
TypeIndexedSetterDeclaration,
|
133
|
-
TypeIndexerParameterClause,
|
134
139
|
TypeMemberDeclarationBlock,
|
135
140
|
TypeMemberDeclarationList,
|
136
141
|
TypeMemberGroupDeclaration,
|
137
142
|
TypeMemberLookup,
|
138
143
|
TypeMemberTranslationList,
|
139
|
-
TypeMethodDeclaration,
|
140
|
-
TypeMethodTranslation,
|
141
144
|
TypeParameterClause,
|
142
145
|
TypeParameterDeclaration,
|
143
146
|
TypeParameterList,
|
144
147
|
TypeTranslation,
|
145
|
-
TypeVariableDeclaration,
|
146
|
-
TypeVariableGetterDeclaration,
|
147
|
-
TypeVariableOrVariantTranslation,
|
148
|
-
TypeVariableSetterDeclaration,
|
149
148
|
UnionTypeSpecifier,
|
150
|
-
UnionTypeSpecifierTypeList,
|
151
149
|
Uri,
|
152
150
|
ValueParameterDeclaration_matchResultValueParameter,
|
153
151
|
ValueParameterDeclaration_typeMember,
|
@@ -184,7 +182,7 @@ import {
|
|
184
182
|
unwrapParenthesizedExpressions,
|
185
183
|
visitChildren,
|
186
184
|
yieldExecution
|
187
|
-
} from "../chunk-
|
185
|
+
} from "../chunk-TFTCV5R5.js";
|
188
186
|
|
189
187
|
// source/services/CustomCommand.ts
|
190
188
|
import * as ls from "vscode-languageserver";
|
@@ -304,7 +302,7 @@ var AddPropertyAssignmentService = class {
|
|
304
302
|
let result;
|
305
303
|
let leftValueText;
|
306
304
|
if (propertyName !== void 0) {
|
307
|
-
if (assignmentNode.left.kind !==
|
305
|
+
if (assignmentNode.left.kind !== 78 /* MemberAccessExpression */) {
|
308
306
|
return void 0;
|
309
307
|
}
|
310
308
|
const propertyReceiver = assignmentNode.left.expression;
|
@@ -321,7 +319,7 @@ var AddPropertyAssignmentService = class {
|
|
321
319
|
const reassignmentText = `${leftValueText} = ${value}`;
|
322
320
|
const subprogramBody = this.ifShouldBeAssignedAtTheEndOfSubprogramThenBody(assignmentNode);
|
323
321
|
if (subprogramBody !== void 0) {
|
324
|
-
const lastStatement = subprogramBody.expressionOrStatementList.kind ===
|
322
|
+
const lastStatement = subprogramBody.expressionOrStatementList.kind === 92 /* StatementList */ ? subprogramBody.expressionOrStatementList?.statements.last() : subprogramBody.expressionOrStatementList;
|
325
323
|
let editRangeStart;
|
326
324
|
let indentationText;
|
327
325
|
if (lastStatement !== void 0) {
|
@@ -353,9 +351,9 @@ var AddPropertyAssignmentService = class {
|
|
353
351
|
ifShouldBeAssignedAtTheEndOfSubprogramThenBody(node) {
|
354
352
|
const parent = node.parent.parent;
|
355
353
|
switch (parent.kind) {
|
356
|
-
case
|
354
|
+
case 93 /* StatementBlock */:
|
357
355
|
return this.getContainingSubprogram(parent)?.block;
|
358
|
-
case
|
356
|
+
case 94 /* FunctionBlock */:
|
359
357
|
return void 0;
|
360
358
|
default:
|
361
359
|
Debug.never(parent);
|
@@ -374,23 +372,23 @@ var AddPropertyAssignmentService = class {
|
|
374
372
|
};
|
375
373
|
function isSubprogramDeclaration(node) {
|
376
374
|
switch (node.kind) {
|
377
|
-
case
|
378
|
-
case
|
379
|
-
case
|
380
|
-
case
|
381
|
-
case
|
382
|
-
case
|
383
|
-
case
|
384
|
-
case
|
385
|
-
case
|
386
|
-
case
|
387
|
-
case
|
388
|
-
case
|
389
|
-
case
|
390
|
-
case
|
391
|
-
case
|
392
|
-
case
|
393
|
-
case
|
375
|
+
case 25 /* PackageConstructorDeclaration */:
|
376
|
+
case 26 /* PackageEntryPointDeclaration */:
|
377
|
+
case 27 /* PackageFunctionDeclaration */:
|
378
|
+
case 36 /* PackageVariableGetterDeclaration */:
|
379
|
+
case 37 /* PackageVariableSetterDeclaration */:
|
380
|
+
case 45 /* ConstructorDeclaration */:
|
381
|
+
case 46 /* DestructorDeclaration */:
|
382
|
+
case 47 /* IndexedElementGetterDeclaration */:
|
383
|
+
case 48 /* IndexedElementSetterDeclaration */:
|
384
|
+
case 50 /* DereferencedVariableGetterDeclaration */:
|
385
|
+
case 51 /* DereferencedVariableSetterDeclaration */:
|
386
|
+
case 52 /* MethodDeclaration */:
|
387
|
+
case 55 /* FieldGetterDeclaration */:
|
388
|
+
case 56 /* FieldSetterDeclaration */:
|
389
|
+
case 58 /* NestedFunctionDeclaration */:
|
390
|
+
case 67 /* FunctionBlockLiteral */:
|
391
|
+
case 74 /* FunctionLiteral */:
|
394
392
|
return true;
|
395
393
|
default:
|
396
394
|
Debug.typeIsAssignableTo();
|
@@ -414,15 +412,15 @@ var SyntaxFactory = class {
|
|
414
412
|
aliasIdentifier = this.createIdentifier(alias);
|
415
413
|
equalsToken = this.token(57 /* Equals */);
|
416
414
|
}
|
417
|
-
const
|
418
|
-
const packageImport = new PackageImport(aliasIdentifier, equalsToken,
|
415
|
+
const packageName = this.packageName(pathSegments);
|
416
|
+
const packageImport = new PackageImport(aliasIdentifier, equalsToken, packageName);
|
419
417
|
const importKeyword = this.keyword(18 /* Import */);
|
420
418
|
return new SinglePackageImportDirective(importKeyword, packageImport);
|
421
419
|
}
|
422
|
-
static
|
420
|
+
static packageName(segments) {
|
423
421
|
const segmentIdentifiers = segments.map((s) => this.createIdentifier(s));
|
424
|
-
const
|
425
|
-
return new
|
422
|
+
const packageNameParts = this.createTokenSeparatedElements(segmentIdentifiers, 26 /* Dot */);
|
423
|
+
return new PackageName(packageNameParts);
|
426
424
|
}
|
427
425
|
static packageAliasTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
428
426
|
const tagList = new TagList(tags);
|
@@ -457,7 +455,7 @@ var SyntaxFactory = class {
|
|
457
455
|
this.token(20 /* CloseBrace */)
|
458
456
|
);
|
459
457
|
}
|
460
|
-
static
|
458
|
+
static packageFunctionDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
|
461
459
|
const tagList = new TagList(tags);
|
462
460
|
const modifierList = new ModifierList(modifiers);
|
463
461
|
const functionKeyword = this.keyword(12 /* Function */);
|
@@ -465,7 +463,7 @@ var SyntaxFactory = class {
|
|
465
463
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
466
464
|
const parameterClause = this.parameterClause(parameters);
|
467
465
|
const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
|
468
|
-
return new
|
466
|
+
return new PackageFunctionDeclaration(
|
469
467
|
tagList,
|
470
468
|
modifierList,
|
471
469
|
functionKeyword,
|
@@ -476,14 +474,14 @@ var SyntaxFactory = class {
|
|
476
474
|
body
|
477
475
|
);
|
478
476
|
}
|
479
|
-
static
|
477
|
+
static packageFunctionTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
480
478
|
const tagList = new TagList(tags);
|
481
479
|
const modifierList = new ModifierList(modifiers);
|
482
480
|
const typeKeyword = this.keyword(16 /* Type */);
|
483
481
|
const nameIdentifier = this.createIdentifier(name);
|
484
482
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
485
483
|
const equalsToken = this.token(57 /* Equals */);
|
486
|
-
return new
|
484
|
+
return new PackageFunctionTypeDeclaration(
|
487
485
|
tagList,
|
488
486
|
modifierList,
|
489
487
|
typeKeyword,
|
@@ -493,11 +491,11 @@ var SyntaxFactory = class {
|
|
493
491
|
body
|
494
492
|
);
|
495
493
|
}
|
496
|
-
static
|
494
|
+
static functionTypeDeclarationBody(parameters, returnTypeSpecifier) {
|
497
495
|
const functionKeyword = this.keyword(12 /* Function */);
|
498
496
|
const parameterClause = this.parameterClause(parameters);
|
499
497
|
const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
|
500
|
-
return new
|
498
|
+
return new FunctionTypeDeclarationBody(void 0, functionKeyword, parameterClause, returnTypeAnnotation);
|
501
499
|
}
|
502
500
|
static packageStructuredTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
503
501
|
const tagList = new TagList(tags);
|
@@ -588,7 +586,7 @@ var SyntaxFactory = class {
|
|
588
586
|
const memberBlock = this.typeMemberDeclarationBlock(members);
|
589
587
|
return new VariantTypeDeclarationBody(variantKeyword, void 0, memberBlock);
|
590
588
|
}
|
591
|
-
static
|
589
|
+
static fieldDeclaration(tags, modifiers, name, typeSpecifier, initializer) {
|
592
590
|
const tagList = new TagList(tags);
|
593
591
|
const modifierList = new ModifierList(modifiers);
|
594
592
|
const nameIdentifier = this.createIdentifier(name);
|
@@ -597,7 +595,7 @@ var SyntaxFactory = class {
|
|
597
595
|
if (initializer !== void 0) {
|
598
596
|
equalsToken = this.token(57 /* Equals */);
|
599
597
|
}
|
600
|
-
return new
|
598
|
+
return new FieldDeclaration(
|
601
599
|
tagList,
|
602
600
|
modifierList,
|
603
601
|
nameIdentifier,
|
@@ -606,13 +604,13 @@ var SyntaxFactory = class {
|
|
606
604
|
initializer
|
607
605
|
);
|
608
606
|
}
|
609
|
-
static
|
607
|
+
static fieldGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
610
608
|
const tagList = new TagList(tags);
|
611
609
|
const modifierList = new ModifierList(modifiers);
|
612
610
|
const getKeyword = this.keyword(58 /* Get */);
|
613
611
|
const nameIdentifier = this.createIdentifier(name);
|
614
612
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
615
|
-
return new
|
613
|
+
return new FieldGetterDeclaration(
|
616
614
|
tagList,
|
617
615
|
modifierList,
|
618
616
|
getKeyword,
|
@@ -621,14 +619,14 @@ var SyntaxFactory = class {
|
|
621
619
|
body
|
622
620
|
);
|
623
621
|
}
|
624
|
-
static
|
622
|
+
static fieldSetterDeclaration(tags, modifiers, name, body) {
|
625
623
|
const tagList = new TagList(tags);
|
626
624
|
const modifierList = new ModifierList(modifiers);
|
627
625
|
const setKeyword = this.keyword(59 /* Set */);
|
628
626
|
const nameIdentifier = this.createIdentifier(name);
|
629
|
-
return new
|
627
|
+
return new FieldSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body);
|
630
628
|
}
|
631
|
-
static
|
629
|
+
static methodDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
|
632
630
|
const tagList = new TagList(tags);
|
633
631
|
const modifierList = new ModifierList(modifiers);
|
634
632
|
const functionKeyword = this.keyword(12 /* Function */);
|
@@ -636,7 +634,7 @@ var SyntaxFactory = class {
|
|
636
634
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
637
635
|
const parameterClause = this.parameterClause(parameters);
|
638
636
|
const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
|
639
|
-
return new
|
637
|
+
return new MethodDeclaration(
|
640
638
|
tagList,
|
641
639
|
modifierList,
|
642
640
|
functionKeyword,
|
@@ -647,27 +645,27 @@ var SyntaxFactory = class {
|
|
647
645
|
body
|
648
646
|
);
|
649
647
|
}
|
650
|
-
static
|
648
|
+
static constructorDeclaration(tags, modifiers, parameters, body) {
|
651
649
|
const tagList = new TagList(tags);
|
652
650
|
const modifierList = new ModifierList(modifiers);
|
653
651
|
const creationKeyword = this.keyword(30 /* Creation */);
|
654
652
|
const parameterClause = this.parameterClause(parameters);
|
655
|
-
return new
|
653
|
+
return new ConstructorDeclaration(tagList, modifierList, creationKeyword, parameterClause, body);
|
656
654
|
}
|
657
|
-
static
|
655
|
+
static destructorDeclaration(tags, modifiers, parameters, body) {
|
658
656
|
const tagList = new TagList(tags);
|
659
657
|
const modifierList = new ModifierList(modifiers);
|
660
658
|
const destructionKeyword = this.keyword(47 /* Destruction */);
|
661
659
|
const parameterClause = this.parameterClause(parameters);
|
662
|
-
return new
|
660
|
+
return new DestructorDeclaration(tagList, modifierList, destructionKeyword, parameterClause, body);
|
663
661
|
}
|
664
|
-
static
|
662
|
+
static indexedElementGetterDeclaration(tags, modifiers, parameters, typeSpecifier, body) {
|
665
663
|
const tagList = new TagList(tags);
|
666
664
|
const modifierList = new ModifierList(modifiers);
|
667
665
|
const getKeyword = this.keyword(58 /* Get */);
|
668
|
-
const parameterClause = this.
|
666
|
+
const parameterClause = this.indexParameterClause(parameters);
|
669
667
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
670
|
-
return new
|
668
|
+
return new IndexedElementGetterDeclaration(
|
671
669
|
tagList,
|
672
670
|
modifierList,
|
673
671
|
getKeyword,
|
@@ -676,12 +674,12 @@ var SyntaxFactory = class {
|
|
676
674
|
body
|
677
675
|
);
|
678
676
|
}
|
679
|
-
static
|
677
|
+
static indexedElementSetterDeclaration(tags, modifiers, parameters, body) {
|
680
678
|
const tagList = new TagList(tags);
|
681
679
|
const modifierList = new ModifierList(modifiers);
|
682
680
|
const getKeyword = this.keyword(59 /* Set */);
|
683
|
-
const parameterClause = this.
|
684
|
-
return new
|
681
|
+
const parameterClause = this.indexParameterClause(parameters);
|
682
|
+
return new IndexedElementSetterDeclaration(tagList, modifierList, getKeyword, parameterClause, body);
|
685
683
|
}
|
686
684
|
static typeMemberGroupDeclaration(tags, modifiers, members) {
|
687
685
|
const tagList = new TagList(tags);
|
@@ -713,10 +711,10 @@ var SyntaxFactory = class {
|
|
713
711
|
this.token(21 /* CloseParenthesis */)
|
714
712
|
);
|
715
713
|
}
|
716
|
-
static
|
717
|
-
return new
|
714
|
+
static indexParameterClause(indexParameters) {
|
715
|
+
return new IndexParameterClause(
|
718
716
|
this.token(45 /* OpenSquareBracket */),
|
719
|
-
new ParameterList(this.createTokenSeparatedElements(
|
717
|
+
new ParameterList(this.createTokenSeparatedElements(indexParameters, 24 /* Comma */)),
|
720
718
|
this.token(22 /* CloseSquareBracket */)
|
721
719
|
);
|
722
720
|
}
|
@@ -732,17 +730,13 @@ var SyntaxFactory = class {
|
|
732
730
|
return new NamedTypeSpecifier(qualifiedName, typeArgumentClause);
|
733
731
|
}
|
734
732
|
static unionTypeSpecifier(typeSpecifiers) {
|
735
|
-
return new UnionTypeSpecifier(
|
736
|
-
new UnionTypeSpecifierTypeList(this.createTokenSeparatedElements(typeSpecifiers, 17 /* Bar */))
|
737
|
-
);
|
733
|
+
return new UnionTypeSpecifier(this.createTokenSeparatedElements(typeSpecifiers, 17 /* Bar */));
|
738
734
|
}
|
739
735
|
static intersectionTypeSpecifier(typeSpecifiers) {
|
740
|
-
return new IntersectionTypeSpecifier(
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
))
|
745
|
-
);
|
736
|
+
return new IntersectionTypeSpecifier(this.createTokenSeparatedElements(
|
737
|
+
typeSpecifiers,
|
738
|
+
10 /* Ampersand */
|
739
|
+
));
|
746
740
|
}
|
747
741
|
static nullableTypeSpecifier(typeSpecifier) {
|
748
742
|
const questionToken = this.token(49 /* Question */);
|
@@ -756,8 +750,8 @@ var SyntaxFactory = class {
|
|
756
750
|
static anonymousStructuredTypeSpecifier(body) {
|
757
751
|
return new AnonymousTypeSpecifier(new AnonymousStructuredTypeDeclaration(body));
|
758
752
|
}
|
759
|
-
static
|
760
|
-
return new AnonymousTypeSpecifier(new
|
753
|
+
static anonymousFunctionTypeSpecifier(body) {
|
754
|
+
return new AnonymousTypeSpecifier(new AnonymousFunctionTypeDeclaration(body));
|
761
755
|
}
|
762
756
|
static anonymousVariantTypeSpecifier(body) {
|
763
757
|
return new AnonymousTypeSpecifier(new AnonymousVariantTypeDeclaration(body));
|
@@ -878,7 +872,7 @@ var SyntaxFactory = class {
|
|
878
872
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
879
873
|
return new PackageVariableTranslation(sourceNameIdentifier, minusGreaterThanToken, translatedNameIdentifier);
|
880
874
|
}
|
881
|
-
static
|
875
|
+
static packageFunctionTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
882
876
|
const functionKeyword = this.keyword(12 /* Function */);
|
883
877
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
884
878
|
const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
|
@@ -887,7 +881,7 @@ var SyntaxFactory = class {
|
|
887
881
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
888
882
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
889
883
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
890
|
-
return new
|
884
|
+
return new PackageFunctionTranslation(
|
891
885
|
functionKeyword,
|
892
886
|
sourceNameIdentifier,
|
893
887
|
sourceTypeParameterClause,
|
@@ -925,7 +919,7 @@ var SyntaxFactory = class {
|
|
925
919
|
closeBraceToken
|
926
920
|
);
|
927
921
|
}
|
928
|
-
static
|
922
|
+
static functionTypeTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
929
923
|
const typeKeyword = this.keyword(16 /* Type */);
|
930
924
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
931
925
|
const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
|
@@ -934,7 +928,7 @@ var SyntaxFactory = class {
|
|
934
928
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
935
929
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
936
930
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
937
|
-
return new
|
931
|
+
return new FunctionTypeTranslation(
|
938
932
|
typeKeyword,
|
939
933
|
sourceNameIdentifier,
|
940
934
|
sourceTypeParameterClause,
|
@@ -945,17 +939,17 @@ var SyntaxFactory = class {
|
|
945
939
|
translatedParameterClause
|
946
940
|
);
|
947
941
|
}
|
948
|
-
static
|
942
|
+
static fieldOrVariantTranslation(sourceName, translatedName) {
|
949
943
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
950
944
|
const minusGreaterThanToken = this.token(42 /* MinusGreaterThan */);
|
951
945
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
952
|
-
return new
|
946
|
+
return new FieldOrVariantTranslation(
|
953
947
|
sourceNameIdentifier,
|
954
948
|
minusGreaterThanToken,
|
955
949
|
translatedNameIdentifier
|
956
950
|
);
|
957
951
|
}
|
958
|
-
static
|
952
|
+
static methodTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
959
953
|
const functionKeyword = this.keyword(12 /* Function */);
|
960
954
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
961
955
|
const sourceTypeParameterClause = this.createTranslationTypeParameterClause(sourceTypeParameters);
|
@@ -964,7 +958,7 @@ var SyntaxFactory = class {
|
|
964
958
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
965
959
|
const translatedTypeParameterClause = this.createTranslationTypeParameterClause(translatedTypeParameters);
|
966
960
|
const translatedParameterClause = this.translationParameterClause(translatedParameters);
|
967
|
-
return new
|
961
|
+
return new MethodTranslation(
|
968
962
|
functionKeyword,
|
969
963
|
sourceNameIdentifier,
|
970
964
|
sourceTypeParameterClause,
|
@@ -988,9 +982,9 @@ var SyntaxFactory = class {
|
|
988
982
|
);
|
989
983
|
}
|
990
984
|
static indexerTranslation(sourceParameters, translatedParameters) {
|
991
|
-
const sourceParameterClause = this.
|
985
|
+
const sourceParameterClause = this.indexParameterTranslationClause(sourceParameters);
|
992
986
|
const minusGreaterThanToken = this.token(42 /* MinusGreaterThan */);
|
993
|
-
const translatedParameterClause = this.
|
987
|
+
const translatedParameterClause = this.indexParameterTranslationClause(translatedParameters);
|
994
988
|
return new IndexerTranslation(sourceParameterClause, minusGreaterThanToken, translatedParameterClause);
|
995
989
|
}
|
996
990
|
static translationParameterClause(parameters) {
|
@@ -1001,13 +995,13 @@ var SyntaxFactory = class {
|
|
1001
995
|
const closeParenthesisToken = this.token(21 /* CloseParenthesis */);
|
1002
996
|
return new TranslationParameterClause(openParenthesisToken, parameterList, closeParenthesisToken);
|
1003
997
|
}
|
1004
|
-
static
|
998
|
+
static indexParameterTranslationClause(parameters) {
|
1005
999
|
const openSquareBracketToken = this.token(45 /* OpenSquareBracket */);
|
1006
1000
|
const parameterList = new TranslationParameterList(
|
1007
1001
|
this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 24 /* Comma */)
|
1008
1002
|
);
|
1009
1003
|
const closeSquareBracketToken = this.token(22 /* CloseSquareBracket */);
|
1010
|
-
return new
|
1004
|
+
return new IndexParameterTranslationClause(openSquareBracketToken, parameterList, closeSquareBracketToken);
|
1011
1005
|
}
|
1012
1006
|
static token(kind, value) {
|
1013
1007
|
const flags = value === void 0 ? 1 /* Missing */ : 0 /* None */;
|
@@ -1115,9 +1109,9 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1115
1109
|
this.writeToken(node.equalsToken);
|
1116
1110
|
this.writeWhitespace();
|
1117
1111
|
}
|
1118
|
-
this.
|
1112
|
+
this.writePackageName(node.packageName);
|
1119
1113
|
}
|
1120
|
-
|
1114
|
+
writePackageName(node) {
|
1121
1115
|
for (const part of node.parts) {
|
1122
1116
|
this.writeToken(part);
|
1123
1117
|
}
|
@@ -1161,7 +1155,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1161
1155
|
this.writeDeclarationBody(node.block);
|
1162
1156
|
}
|
1163
1157
|
}
|
1164
|
-
|
1158
|
+
writePackageFunctionDeclaration(node) {
|
1165
1159
|
this.writeDeclarationTags(node.tagList);
|
1166
1160
|
this.writeDeclarationModifiers(node.modifierList);
|
1167
1161
|
this.writeKeyword(node.functionKeyword);
|
@@ -1223,7 +1217,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1223
1217
|
this.writeWhitespace();
|
1224
1218
|
this.writeVariantTypeDeclarationBody(node.body);
|
1225
1219
|
}
|
1226
|
-
|
1220
|
+
writePackageFunctionTypeDeclaration(node) {
|
1227
1221
|
this.writeDeclarationTags(node.tagList);
|
1228
1222
|
this.writeDeclarationModifiers(node.modifierList);
|
1229
1223
|
this.writeKeyword(node.typeKeyword);
|
@@ -1235,7 +1229,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1235
1229
|
this.writeWhitespace();
|
1236
1230
|
this.writeToken(node.equalsToken);
|
1237
1231
|
this.writeWhitespace();
|
1238
|
-
this.
|
1232
|
+
this.writeFunctionTypeDeclarationBody(node.body);
|
1239
1233
|
}
|
1240
1234
|
writePackageMemberGroupDeclaration(node) {
|
1241
1235
|
this.writeDeclarationTags(node.tagList);
|
@@ -1278,7 +1272,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1278
1272
|
}
|
1279
1273
|
this.writeTypeMemberDeclarationBlock(node.memberBlock);
|
1280
1274
|
}
|
1281
|
-
|
1275
|
+
writeFunctionTypeDeclarationBody(node) {
|
1282
1276
|
this.writeKeyword(node.functionKeyword);
|
1283
1277
|
this.writeParameterClause(node.parameterClause);
|
1284
1278
|
if (node.returnTypeAnnotation !== void 0) {
|
@@ -1303,7 +1297,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1303
1297
|
}
|
1304
1298
|
this.writeToken(node.closeBraceToken);
|
1305
1299
|
}
|
1306
|
-
|
1300
|
+
writeFieldDeclaration(node) {
|
1307
1301
|
this.writeDeclarationTags(node.tagList);
|
1308
1302
|
this.writeDeclarationModifiers(node.modifierList);
|
1309
1303
|
this.writeToken(node.name);
|
@@ -1317,7 +1311,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1317
1311
|
this.writeExpression(node.initializer);
|
1318
1312
|
}
|
1319
1313
|
}
|
1320
|
-
|
1314
|
+
writeFieldGetterDeclaration(node) {
|
1321
1315
|
this.writeDeclarationTags(node.tagList);
|
1322
1316
|
this.writeDeclarationModifiers(node.modifierList);
|
1323
1317
|
this.writeKeyword(node.getKeyword);
|
@@ -1328,7 +1322,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1328
1322
|
this.writeDeclarationBody(node.block);
|
1329
1323
|
}
|
1330
1324
|
}
|
1331
|
-
|
1325
|
+
writeFieldSetterDeclaration(node) {
|
1332
1326
|
this.writeDeclarationTags(node.tagList);
|
1333
1327
|
this.writeDeclarationModifiers(node.modifierList);
|
1334
1328
|
this.writeKeyword(node.setKeyword);
|
@@ -1338,7 +1332,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1338
1332
|
this.writeDeclarationBody(node.block);
|
1339
1333
|
}
|
1340
1334
|
}
|
1341
|
-
|
1335
|
+
writeMethodDeclaration(node) {
|
1342
1336
|
this.writeDeclarationTags(node.tagList);
|
1343
1337
|
this.writeDeclarationModifiers(node.modifierList);
|
1344
1338
|
this.writeKeyword(node.functionKeyword);
|
@@ -1369,7 +1363,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1369
1363
|
this.writeDeclarationBody(node.block);
|
1370
1364
|
}
|
1371
1365
|
}
|
1372
|
-
|
1366
|
+
writeConstructorDeclaration(node) {
|
1373
1367
|
this.writeDeclarationTags(node.tagList);
|
1374
1368
|
this.writeDeclarationModifiers(node.modifierList);
|
1375
1369
|
this.writeKeyword(node.creationKeyword);
|
@@ -1378,7 +1372,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1378
1372
|
this.writeDeclarationBody(node.block);
|
1379
1373
|
}
|
1380
1374
|
}
|
1381
|
-
|
1375
|
+
writeDestructorDeclaration(node) {
|
1382
1376
|
this.writeDeclarationTags(node.tagList);
|
1383
1377
|
this.writeDeclarationModifiers(node.modifierList);
|
1384
1378
|
this.writeKeyword(node.destructionKeyword);
|
@@ -1387,7 +1381,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1387
1381
|
this.writeDeclarationBody(node.block);
|
1388
1382
|
}
|
1389
1383
|
}
|
1390
|
-
|
1384
|
+
writeIndexedElementGetterDeclaration(node) {
|
1391
1385
|
this.writeDeclarationTags(node.tagList);
|
1392
1386
|
this.writeDeclarationModifiers(node.modifierList);
|
1393
1387
|
this.writeKeyword(node.getKeyword);
|
@@ -1400,7 +1394,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1400
1394
|
this.writeDeclarationBody(node.block);
|
1401
1395
|
}
|
1402
1396
|
}
|
1403
|
-
|
1397
|
+
writeIndexedElementSetterDeclaration(node) {
|
1404
1398
|
this.writeDeclarationTags(node.tagList);
|
1405
1399
|
this.writeDeclarationModifiers(node.modifierList);
|
1406
1400
|
this.writeKeyword(node.setKeyword);
|
@@ -1412,7 +1406,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1412
1406
|
this.writeDeclarationBody(node.block);
|
1413
1407
|
}
|
1414
1408
|
}
|
1415
|
-
|
1409
|
+
writeDereferencedVariableGetterDeclaration(node) {
|
1416
1410
|
this.writeDeclarationTags(node.tagList);
|
1417
1411
|
this.writeDeclarationModifiers(node.modifierList);
|
1418
1412
|
this.writeKeyword(node.getKeyword);
|
@@ -1423,7 +1417,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1423
1417
|
this.writeDeclarationBody(node.block);
|
1424
1418
|
}
|
1425
1419
|
}
|
1426
|
-
|
1420
|
+
writeDereferencedVariableSetterDeclaration(node) {
|
1427
1421
|
this.writeDeclarationTags(node.tagList);
|
1428
1422
|
this.writeDeclarationModifiers(node.modifierList);
|
1429
1423
|
this.writeKeyword(node.setKeyword);
|
@@ -1552,8 +1546,8 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1552
1546
|
writeAnonymousTypeSpecifier(node) {
|
1553
1547
|
this.writeNode(node.typeDeclaration);
|
1554
1548
|
}
|
1555
|
-
|
1556
|
-
this.
|
1549
|
+
writeAnonymousFunctionTypeDeclaration(node) {
|
1550
|
+
this.writeFunctionTypeDeclarationBody(node.body);
|
1557
1551
|
}
|
1558
1552
|
writeAnonymousStructuredTypeDeclaration(node) {
|
1559
1553
|
this.writeStructuredTypeDeclarationBody(node.body);
|
@@ -1562,11 +1556,8 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1562
1556
|
this.writeVariantTypeDeclarationBody(node.body);
|
1563
1557
|
}
|
1564
1558
|
writeUnionTypeSpecifier(node) {
|
1565
|
-
|
1566
|
-
|
1567
|
-
writeUnionTypeSpecifierTypeList(node) {
|
1568
|
-
for (let i = 0; i < node.elements.length; i++) {
|
1569
|
-
const element = node.elements[i];
|
1559
|
+
for (let i = 0; i < node.typeListElements.length; i++) {
|
1560
|
+
const element = node.typeListElements[i];
|
1570
1561
|
if (element.kind === 0 /* Token */) {
|
1571
1562
|
this.writeWhitespace();
|
1572
1563
|
this.writeToken(element);
|
@@ -1586,11 +1577,8 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1586
1577
|
}
|
1587
1578
|
}
|
1588
1579
|
writeIntersectionTypeSpecifier(node) {
|
1589
|
-
|
1590
|
-
|
1591
|
-
writeIntersectionTypeSpecifierTypeList(node) {
|
1592
|
-
for (let i = 0; i < node.elements.length; i++) {
|
1593
|
-
const element = node.elements[i];
|
1580
|
+
for (let i = 0; i < node.typeListElements.length; i++) {
|
1581
|
+
const element = node.typeListElements[i];
|
1594
1582
|
if (element.kind === 0 /* Token */) {
|
1595
1583
|
this.writeWhitespace();
|
1596
1584
|
this.writeToken(element);
|
@@ -1629,22 +1617,22 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1629
1617
|
switch (node.kind) {
|
1630
1618
|
case 11 /* UnionTypeSpecifier */:
|
1631
1619
|
return true;
|
1632
|
-
case
|
1620
|
+
case 15 /* AnonymousTypeSpecifier */: {
|
1633
1621
|
switch (node.typeDeclaration.body.kind) {
|
1634
|
-
case
|
1622
|
+
case 29 /* FunctionTypeDeclarationBody */:
|
1635
1623
|
return true;
|
1636
|
-
case
|
1637
|
-
case
|
1624
|
+
case 34 /* StructuredTypeDeclarationBody */:
|
1625
|
+
case 39 /* VariantTypeDeclarationBody */:
|
1638
1626
|
return false;
|
1639
1627
|
default:
|
1640
1628
|
Debug.never(node.typeDeclaration.body);
|
1641
1629
|
}
|
1642
1630
|
}
|
1643
1631
|
case 10 /* NamedTypeSpecifier */:
|
1644
|
-
case
|
1645
|
-
case
|
1646
|
-
case
|
1647
|
-
case
|
1632
|
+
case 13 /* ParenthesizedTypeSpecifier */:
|
1633
|
+
case 14 /* NullableTypeSpecifier */:
|
1634
|
+
case 16 /* InvalidTypeSpecifier */:
|
1635
|
+
case 12 /* IntersectionTypeSpecifier */:
|
1648
1636
|
return false;
|
1649
1637
|
default:
|
1650
1638
|
Debug.never(node);
|
@@ -1653,23 +1641,23 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1653
1641
|
doesIntersectionTypeElementRequireParenthesis(node) {
|
1654
1642
|
switch (node.kind) {
|
1655
1643
|
case 11 /* UnionTypeSpecifier */:
|
1656
|
-
case
|
1644
|
+
case 12 /* IntersectionTypeSpecifier */:
|
1657
1645
|
return true;
|
1658
|
-
case
|
1646
|
+
case 15 /* AnonymousTypeSpecifier */: {
|
1659
1647
|
switch (node.typeDeclaration.body.kind) {
|
1660
|
-
case
|
1648
|
+
case 29 /* FunctionTypeDeclarationBody */:
|
1661
1649
|
return true;
|
1662
|
-
case
|
1663
|
-
case
|
1650
|
+
case 34 /* StructuredTypeDeclarationBody */:
|
1651
|
+
case 39 /* VariantTypeDeclarationBody */:
|
1664
1652
|
return false;
|
1665
1653
|
default:
|
1666
1654
|
Debug.never(node.typeDeclaration.body);
|
1667
1655
|
}
|
1668
1656
|
}
|
1669
1657
|
case 10 /* NamedTypeSpecifier */:
|
1670
|
-
case
|
1671
|
-
case
|
1672
|
-
case
|
1658
|
+
case 13 /* ParenthesizedTypeSpecifier */:
|
1659
|
+
case 14 /* NullableTypeSpecifier */:
|
1660
|
+
case 16 /* InvalidTypeSpecifier */:
|
1673
1661
|
return false;
|
1674
1662
|
default:
|
1675
1663
|
Debug.never(node);
|
@@ -1678,13 +1666,13 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1678
1666
|
doesTypeMadeNullableRequireParenthesis(node) {
|
1679
1667
|
switch (node.kind) {
|
1680
1668
|
case 11 /* UnionTypeSpecifier */:
|
1681
|
-
case
|
1682
|
-
case
|
1669
|
+
case 12 /* IntersectionTypeSpecifier */:
|
1670
|
+
case 15 /* AnonymousTypeSpecifier */:
|
1683
1671
|
return true;
|
1684
1672
|
case 10 /* NamedTypeSpecifier */:
|
1685
|
-
case
|
1686
|
-
case
|
1687
|
-
case
|
1673
|
+
case 13 /* ParenthesizedTypeSpecifier */:
|
1674
|
+
case 14 /* NullableTypeSpecifier */:
|
1675
|
+
case 16 /* InvalidTypeSpecifier */:
|
1688
1676
|
return false;
|
1689
1677
|
default:
|
1690
1678
|
Debug.never(node);
|
@@ -1709,7 +1697,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1709
1697
|
this.writeNodeDefault(node);
|
1710
1698
|
}
|
1711
1699
|
writeDeclarationBody(node, addLeadingNewLineOrWhitespace = true) {
|
1712
|
-
if (node.expressionOrStatementList.kind !==
|
1700
|
+
if (node.expressionOrStatementList.kind !== 92 /* StatementList */ || node.expressionOrStatementList.elements.length === 0) {
|
1713
1701
|
this.writeWhitespace();
|
1714
1702
|
this.writeFunctionBlock(node, false);
|
1715
1703
|
} else {
|
@@ -1758,7 +1746,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1758
1746
|
this.writeWhitespace();
|
1759
1747
|
this.writeToken(node.translatedName);
|
1760
1748
|
}
|
1761
|
-
|
1749
|
+
writePackageFunctionTranslation(node) {
|
1762
1750
|
this.writeKeyword(node.functionKeyword);
|
1763
1751
|
this.writeWhitespace();
|
1764
1752
|
this.writeToken(node.sourceName);
|
@@ -1803,7 +1791,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1803
1791
|
this.writeToken(node.closeBraceToken);
|
1804
1792
|
}
|
1805
1793
|
}
|
1806
|
-
|
1794
|
+
writeFunctionTypeTranslation(node) {
|
1807
1795
|
this.writeKeyword(node.typeKeyword);
|
1808
1796
|
this.writeWhitespace();
|
1809
1797
|
this.writeToken(node.sourceName);
|
@@ -1820,14 +1808,14 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1820
1808
|
}
|
1821
1809
|
this.writeTranslationParameterClause(node.translatedParameterClause);
|
1822
1810
|
}
|
1823
|
-
|
1811
|
+
writeFieldOrVariantTranslation(node) {
|
1824
1812
|
this.writeToken(node.sourceName);
|
1825
1813
|
this.writeWhitespace();
|
1826
1814
|
this.writeToken(node.minusGreaterThanToken);
|
1827
1815
|
this.writeWhitespace();
|
1828
1816
|
this.writeToken(node.translatedName);
|
1829
1817
|
}
|
1830
|
-
|
1818
|
+
writeMethodTranslation(node) {
|
1831
1819
|
this.writeKeyword(node.functionKeyword);
|
1832
1820
|
this.writeWhitespace();
|
1833
1821
|
this.writeToken(node.sourceName);
|
@@ -1845,11 +1833,11 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1845
1833
|
this.writeTranslationParameterClause(node.translatedParameterClause);
|
1846
1834
|
}
|
1847
1835
|
writeIndexerTranslation(node) {
|
1848
|
-
this.
|
1836
|
+
this.writeIndexParameterTranslationClause(node.sourceParameterClause);
|
1849
1837
|
this.writeWhitespace();
|
1850
1838
|
this.writeToken(node.minusGreaterThanToken);
|
1851
1839
|
this.writeWhitespace();
|
1852
|
-
this.
|
1840
|
+
this.writeIndexParameterTranslationClause(node.translatedParameterClause);
|
1853
1841
|
}
|
1854
1842
|
writeConstructorTranslation(node) {
|
1855
1843
|
this.writeKeyword(node.creationKeyword);
|
@@ -1871,7 +1859,7 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
1871
1859
|
this.writeCommaSeparatedList(node.parameterList.elements, (p) => this.writeToken(p));
|
1872
1860
|
this.writeToken(node.closeParenthesisToken);
|
1873
1861
|
}
|
1874
|
-
|
1862
|
+
writeIndexParameterTranslationClause(node) {
|
1875
1863
|
this.writeToken(node.openSquareBracketToken);
|
1876
1864
|
this.writeCommaSeparatedList(node.parameterList.elements, (p) => this.writeToken(p));
|
1877
1865
|
this.writeToken(node.closeSquareBracketToken);
|
@@ -2006,7 +1994,6 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2006
1994
|
decreaseIndentation() {
|
2007
1995
|
this._indentation = this._indentation.substring(0, this._indentation.length - this._indentationStep.length);
|
2008
1996
|
}
|
2009
|
-
/* eslint-disable @stylistic/max-len */
|
2010
1997
|
static createWriteFunctions() {
|
2011
1998
|
const writeFunctions = {
|
2012
1999
|
[0 /* Token */]: this.prototype.writeToken,
|
@@ -2016,162 +2003,159 @@ var SyntaxToCode = class _SyntaxToCode {
|
|
2016
2003
|
[4 /* PackageImportDirectiveList */]: this.prototype.writePackageImportDirectiveList,
|
2017
2004
|
[5 /* SinglePackageImportDirective */]: this.prototype.writeSinglePackageImportDirective,
|
2018
2005
|
[8 /* PackageImport */]: this.prototype.writePackageImport,
|
2019
|
-
[9 /*
|
2006
|
+
[9 /* PackageName */]: this.prototype.writePackageName,
|
2020
2007
|
[10 /* NamedTypeSpecifier */]: this.prototype.writeNamedTypeSpecifier,
|
2021
2008
|
[11 /* UnionTypeSpecifier */]: this.prototype.writeUnionTypeSpecifier,
|
2022
|
-
[
|
2023
|
-
[
|
2024
|
-
[
|
2025
|
-
[
|
2026
|
-
[
|
2027
|
-
[
|
2028
|
-
[
|
2029
|
-
[
|
2030
|
-
[
|
2031
|
-
[
|
2032
|
-
[
|
2033
|
-
[
|
2034
|
-
[
|
2035
|
-
[
|
2036
|
-
[
|
2037
|
-
[
|
2038
|
-
[
|
2039
|
-
[
|
2040
|
-
[
|
2041
|
-
[
|
2042
|
-
[
|
2043
|
-
[
|
2044
|
-
[
|
2045
|
-
[
|
2046
|
-
[
|
2047
|
-
[
|
2048
|
-
[
|
2049
|
-
[
|
2050
|
-
[
|
2051
|
-
[
|
2052
|
-
[
|
2053
|
-
[
|
2054
|
-
[
|
2055
|
-
[
|
2056
|
-
[
|
2057
|
-
[
|
2058
|
-
[
|
2059
|
-
[
|
2060
|
-
[
|
2061
|
-
[
|
2062
|
-
[
|
2063
|
-
[
|
2064
|
-
[
|
2065
|
-
[
|
2066
|
-
[
|
2067
|
-
[
|
2068
|
-
[
|
2069
|
-
[
|
2009
|
+
[12 /* IntersectionTypeSpecifier */]: this.prototype.writeIntersectionTypeSpecifier,
|
2010
|
+
[13 /* ParenthesizedTypeSpecifier */]: this.prototype.writeParenthesizedTypeSpecifier,
|
2011
|
+
[14 /* NullableTypeSpecifier */]: this.prototype.writeNullableTypeSpecifier,
|
2012
|
+
[15 /* AnonymousTypeSpecifier */]: this.prototype.writeAnonymousTypeSpecifier,
|
2013
|
+
[22 /* PackageAliasTypeDeclaration */]: this.prototype.writePackageAliasTypeDeclaration,
|
2014
|
+
[24 /* PackageMemberGroupDeclaration */]: this.prototype.writePackageMemberGroupDeclaration,
|
2015
|
+
[25 /* PackageConstructorDeclaration */]: this.prototype.writePackageConstructorDeclaration,
|
2016
|
+
[26 /* PackageEntryPointDeclaration */]: this.prototype.writePackageEntryPointDeclaration,
|
2017
|
+
[27 /* PackageFunctionDeclaration */]: this.prototype.writePackageFunctionDeclaration,
|
2018
|
+
[28 /* PackageFunctionTypeDeclaration */]: this.prototype.writePackageFunctionTypeDeclaration,
|
2019
|
+
[29 /* FunctionTypeDeclarationBody */]: this.prototype.writeFunctionTypeDeclarationBody,
|
2020
|
+
[30 /* BaseTypeList */]: this.prototype.writeBaseTypeList,
|
2021
|
+
[32 /* TypeMemberDeclarationBlock */]: this.prototype.writeTypeMemberDeclarationBlock,
|
2022
|
+
[33 /* PackageStructuredTypeDeclaration */]: this.prototype.writePackageStructuredTypeDeclaration,
|
2023
|
+
[34 /* StructuredTypeDeclarationBody */]: this.prototype.writeStructuredTypeDeclarationBody,
|
2024
|
+
[35 /* PackageVariableDeclaration */]: this.prototype.writePackageVariableDeclaration,
|
2025
|
+
[36 /* PackageVariableGetterDeclaration */]: this.prototype.writePackageVariableGetterDeclaration,
|
2026
|
+
[37 /* PackageVariableSetterDeclaration */]: this.prototype.writePackageVariableSetterDeclaration,
|
2027
|
+
[38 /* PackageVariantTypeDeclaration */]: this.prototype.writePackageVariantTypeDeclaration,
|
2028
|
+
[39 /* VariantTypeDeclarationBody */]: this.prototype.writeVariantTypeDeclarationBody,
|
2029
|
+
[44 /* TypeMemberGroupDeclaration */]: this.prototype.writeTypeMemberGroupDeclaration,
|
2030
|
+
[45 /* ConstructorDeclaration */]: this.prototype.writeConstructorDeclaration,
|
2031
|
+
[46 /* DestructorDeclaration */]: this.prototype.writeDestructorDeclaration,
|
2032
|
+
[47 /* IndexedElementGetterDeclaration */]: this.prototype.writeIndexedElementGetterDeclaration,
|
2033
|
+
[48 /* IndexedElementSetterDeclaration */]: this.prototype.writeIndexedElementSetterDeclaration,
|
2034
|
+
[50 /* DereferencedVariableGetterDeclaration */]: this.prototype.writeDereferencedVariableGetterDeclaration,
|
2035
|
+
[51 /* DereferencedVariableSetterDeclaration */]: this.prototype.writeDereferencedVariableSetterDeclaration,
|
2036
|
+
[52 /* MethodDeclaration */]: this.prototype.writeMethodDeclaration,
|
2037
|
+
[53 /* OperatorDeclaration */]: this.prototype.writeOperatorDeclaration,
|
2038
|
+
[54 /* FieldDeclaration */]: this.prototype.writeFieldDeclaration,
|
2039
|
+
[55 /* FieldGetterDeclaration */]: this.prototype.writeFieldGetterDeclaration,
|
2040
|
+
[56 /* FieldSetterDeclaration */]: this.prototype.writeFieldSetterDeclaration,
|
2041
|
+
[93 /* StatementBlock */]: this.prototype.writeStatementBlock,
|
2042
|
+
[94 /* FunctionBlock */]: this.prototype.writeFunctionBlock,
|
2043
|
+
[135 /* QualifiedName */]: this.prototype.writeQualifiedName,
|
2044
|
+
[142 /* VariantDeclaration */]: this.prototype.writeVariantDeclaration,
|
2045
|
+
[143 /* TypeParameterDeclaration */]: this.prototype.writeTypeParameterDeclaration,
|
2046
|
+
[144 /* ParameterDeclaration */]: this.prototype.writeParameterDeclaration,
|
2047
|
+
[145 /* Argument */]: this.prototype.writeArgument,
|
2048
|
+
[147 /* Tag */]: this.prototype.writeTag,
|
2049
|
+
[149 /* Modifier */]: this.prototype.writeModifier,
|
2050
|
+
[150 /* ParameterClause */]: this.prototype.writeParameterClause,
|
2051
|
+
[151 /* ParameterList */]: this.prototype.writeParameterList,
|
2052
|
+
[152 /* TypeArgumentClause */]: this.prototype.writeTypeArgumentClause,
|
2053
|
+
[154 /* TypeParameterClause */]: this.prototype.writeTypeParameterClause,
|
2054
|
+
[17 /* AnonymousFunctionTypeDeclaration */]: this.prototype.writeAnonymousFunctionTypeDeclaration,
|
2055
|
+
[18 /* AnonymousStructuredTypeDeclaration */]: this.prototype.writeAnonymousStructuredTypeDeclaration,
|
2056
|
+
[19 /* AnonymousVariantTypeDeclaration */]: this.prototype.writeAnonymousVariantTypeDeclaration,
|
2070
2057
|
[6 /* PackageGroupImportDirective */]: this.prototype.writeNodeDefault,
|
2071
2058
|
[7 /* PackageImportList */]: this.prototype.writeNodeDefault,
|
2072
|
-
[
|
2073
|
-
[
|
2074
|
-
[
|
2075
|
-
[
|
2076
|
-
[
|
2077
|
-
[
|
2078
|
-
[
|
2079
|
-
[42 /*
|
2080
|
-
[43 /*
|
2081
|
-
[
|
2082
|
-
[
|
2083
|
-
[
|
2084
|
-
[59 /*
|
2085
|
-
[60 /*
|
2086
|
-
[61 /*
|
2087
|
-
[62 /*
|
2088
|
-
[63 /*
|
2089
|
-
[64 /*
|
2090
|
-
[65 /*
|
2091
|
-
[66 /*
|
2092
|
-
[67 /*
|
2093
|
-
[68 /*
|
2094
|
-
[69 /*
|
2095
|
-
[70 /*
|
2096
|
-
[71 /*
|
2097
|
-
[72 /*
|
2098
|
-
[73 /*
|
2099
|
-
[74 /*
|
2100
|
-
[75 /*
|
2101
|
-
[76 /*
|
2102
|
-
[77 /*
|
2103
|
-
[78 /*
|
2104
|
-
[79 /*
|
2105
|
-
[80 /*
|
2106
|
-
[81 /*
|
2107
|
-
[82 /*
|
2108
|
-
[83 /*
|
2109
|
-
[84 /*
|
2110
|
-
[85 /*
|
2111
|
-
[86 /*
|
2112
|
-
[87 /*
|
2113
|
-
[88 /*
|
2114
|
-
[89 /*
|
2115
|
-
[90 /*
|
2116
|
-
[91 /*
|
2117
|
-
[92 /*
|
2118
|
-
[
|
2119
|
-
[
|
2120
|
-
[97 /*
|
2121
|
-
[98 /*
|
2122
|
-
[99 /*
|
2123
|
-
[100 /*
|
2124
|
-
[101 /*
|
2125
|
-
[102 /*
|
2126
|
-
[103 /*
|
2127
|
-
[104 /*
|
2128
|
-
[105 /*
|
2129
|
-
[106 /*
|
2130
|
-
[107 /*
|
2131
|
-
[108 /*
|
2132
|
-
[109 /*
|
2133
|
-
[110 /*
|
2134
|
-
[111 /*
|
2135
|
-
[112 /*
|
2136
|
-
[113 /*
|
2137
|
-
[114 /*
|
2138
|
-
[115 /*
|
2139
|
-
[116 /*
|
2140
|
-
[117 /*
|
2141
|
-
[118 /*
|
2142
|
-
[119 /*
|
2143
|
-
[120 /*
|
2144
|
-
[121 /*
|
2145
|
-
[122 /*
|
2146
|
-
[123 /*
|
2147
|
-
[124 /*
|
2148
|
-
[125 /*
|
2149
|
-
[126 /*
|
2150
|
-
[127 /*
|
2151
|
-
[128 /*
|
2152
|
-
[129 /*
|
2153
|
-
[130 /*
|
2154
|
-
[131 /*
|
2155
|
-
[132 /*
|
2156
|
-
[133 /*
|
2157
|
-
[134 /*
|
2158
|
-
[
|
2159
|
-
[
|
2160
|
-
[138 /*
|
2161
|
-
[139 /*
|
2162
|
-
[140 /*
|
2163
|
-
[141 /*
|
2164
|
-
[
|
2165
|
-
[
|
2166
|
-
[
|
2167
|
-
[
|
2168
|
-
[
|
2169
|
-
[157 /* TypeParameterList */]: this.prototype.writeNodeDefault,
|
2170
|
-
[158 /* TypeAnnotation */]: this.prototype.writeNodeDefault
|
2059
|
+
[16 /* InvalidTypeSpecifier */]: this.prototype.writeNodeDefault,
|
2060
|
+
[20 /* TopLevelTranslationList */]: this.prototype.writeNodeDefault,
|
2061
|
+
[21 /* TranslationsDeclaration */]: this.prototype.writeTranslationsDeclaration,
|
2062
|
+
[23 /* AliasTypeDeclarationBody */]: this.prototype.writeNodeDefault,
|
2063
|
+
[31 /* TypeMemberDeclarationList */]: this.prototype.writeNodeDefault,
|
2064
|
+
[40 /* TypeExtensionDeclaration */]: this.prototype.writeNodeDefault,
|
2065
|
+
[41 /* ExtendedTypeClauseCommaList */]: this.prototype.writeNodeDefault,
|
2066
|
+
[42 /* ExtendedTypeClause */]: this.prototype.writeNodeDefault,
|
2067
|
+
[43 /* InvalidPackageMemberDeclaration */]: this.prototype.writeNodeDefault,
|
2068
|
+
[49 /* IndexParameterClause */]: this.prototype.writeNodeDefault,
|
2069
|
+
[57 /* InvalidTypeMemberDeclaration */]: this.prototype.writeNodeDefault,
|
2070
|
+
[58 /* NestedFunctionDeclaration */]: this.prototype.writeNodeDefault,
|
2071
|
+
[59 /* LocalVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2072
|
+
[60 /* EnumerationVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2073
|
+
[61 /* ArrayLiteral */]: this.prototype.writeNodeDefault,
|
2074
|
+
[62 /* ArrayLiteralElementList */]: this.prototype.writeNodeDefault,
|
2075
|
+
[63 /* AssertionExpression */]: this.prototype.writeNodeDefault,
|
2076
|
+
[64 /* AssumptionExpression */]: this.prototype.writeNodeDefault,
|
2077
|
+
[65 /* AsExpression */]: this.prototype.writeNodeDefault,
|
2078
|
+
[66 /* BinaryExpression */]: this.prototype.writeNodeDefault,
|
2079
|
+
[67 /* FunctionBlockLiteral */]: this.prototype.writeNodeDefault,
|
2080
|
+
[68 /* ArgumentList */]: this.prototype.writeNodeDefault,
|
2081
|
+
[69 /* CallExpression */]: this.prototype.writeNodeDefault,
|
2082
|
+
[70 /* AutotypeCallExpression */]: this.prototype.writeNodeDefault,
|
2083
|
+
[71 /* IndexedAccessExpression */]: this.prototype.writeNodeDefault,
|
2084
|
+
[72 /* InvalidExpression */]: this.prototype.writeNodeDefault,
|
2085
|
+
[73 /* IsExpression */]: this.prototype.writeNodeDefault,
|
2086
|
+
[74 /* FunctionLiteral */]: this.prototype.writeNodeDefault,
|
2087
|
+
[75 /* ParenthesizedExpression */]: this.prototype.writeNodeDefault,
|
2088
|
+
[76 /* WhenTernaryExpression */]: this.prototype.writeNodeDefault,
|
2089
|
+
[77 /* PrefixUnaryExpression */]: this.prototype.writeNodeDefault,
|
2090
|
+
[78 /* MemberAccessExpression */]: this.prototype.writeNodeDefault,
|
2091
|
+
[79 /* ReferenceExpression */]: this.prototype.writeNodeDefault,
|
2092
|
+
[80 /* DereferenceExpression */]: this.prototype.writeNodeDefault,
|
2093
|
+
[81 /* TextTemplateLiteral */]: this.prototype.writeNodeDefault,
|
2094
|
+
[82 /* TextTemplateSpanList */]: this.prototype.writeNodeDefault,
|
2095
|
+
[83 /* TextTemplateSpan */]: this.prototype.writeNodeDefault,
|
2096
|
+
[84 /* TokenExpression */]: this.prototype.writeNodeDefault,
|
2097
|
+
[85 /* KeywordExpression */]: this.prototype.writeNodeDefault,
|
2098
|
+
[86 /* ObjectExpression */]: this.prototype.writeNodeDefault,
|
2099
|
+
[87 /* BaseExpression */]: this.prototype.writeNodeDefault,
|
2100
|
+
[88 /* IdentifierExpression */]: this.prototype.writeNodeDefault,
|
2101
|
+
[89 /* GenericSpecializationExpression */]: this.prototype.writeNodeDefault,
|
2102
|
+
[90 /* DefaultMatchExpression */]: this.prototype.writeNodeDefault,
|
2103
|
+
[91 /* AssignmentStatement */]: this.prototype.writeNodeDefault,
|
2104
|
+
[92 /* StatementList */]: this.prototype.writeNodeDefault,
|
2105
|
+
[95 /* BreakLoopStatement */]: this.prototype.writeNodeDefault,
|
2106
|
+
[96 /* ContinueLoopStatement */]: this.prototype.writeNodeDefault,
|
2107
|
+
[97 /* DisposeStatement */]: this.prototype.writeNodeDefault,
|
2108
|
+
[98 /* RunStatement */]: this.prototype.writeNodeDefault,
|
2109
|
+
[99 /* TryStatement */]: this.prototype.writeNodeDefault,
|
2110
|
+
[100 /* CatchClause */]: this.prototype.writeNodeDefault,
|
2111
|
+
[101 /* ErrorVariableDeclaration */]: this.prototype.writeNodeDefault,
|
2112
|
+
[102 /* FinallyClause */]: this.prototype.writeNodeDefault,
|
2113
|
+
[103 /* EmptyStatement */]: this.prototype.writeNodeDefault,
|
2114
|
+
[104 /* ErrorStatement */]: this.prototype.writeNodeDefault,
|
2115
|
+
[105 /* ImportantStatement */]: this.prototype.writeNodeDefault,
|
2116
|
+
[106 /* ExpressionStatement */]: this.prototype.writeNodeDefault,
|
2117
|
+
[107 /* EnumerationVariableList */]: this.prototype.writeNodeDefault,
|
2118
|
+
[108 /* ForStatement */]: this.prototype.writeNodeDefault,
|
2119
|
+
[109 /* IfStatement */]: this.prototype.writeNodeDefault,
|
2120
|
+
[110 /* ElseIfClauseList */]: this.prototype.writeNodeDefault,
|
2121
|
+
[111 /* ElseIfClause */]: this.prototype.writeNodeDefault,
|
2122
|
+
[112 /* ElseClause */]: this.prototype.writeNodeDefault,
|
2123
|
+
[113 /* InvalidStatement */]: this.prototype.writeNodeDefault,
|
2124
|
+
[114 /* NestedFunctionDeclarationStatement */]: this.prototype.writeNodeDefault,
|
2125
|
+
[115 /* LocalVariableDeclarationStatement */]: this.prototype.writeNodeDefault,
|
2126
|
+
[116 /* LoopStatement */]: this.prototype.writeNodeDefault,
|
2127
|
+
[117 /* ReturnStatement */]: this.prototype.writeNodeDefault,
|
2128
|
+
[118 /* CaseClauseList */]: this.prototype.writeNodeDefault,
|
2129
|
+
[119 /* SwitchStatement */]: this.prototype.writeNodeDefault,
|
2130
|
+
[120 /* MatchExpressionList */]: this.prototype.writeNodeDefault,
|
2131
|
+
[121 /* CaseClause */]: this.prototype.writeNodeDefault,
|
2132
|
+
[122 /* WhileStatement */]: this.prototype.writeNodeDefault,
|
2133
|
+
[123 /* YieldStatement */]: this.prototype.writeNodeDefault,
|
2134
|
+
[124 /* TranslationParameterList */]: this.prototype.writeNodeDefault,
|
2135
|
+
[125 /* TranslationParameterClause */]: this.prototype.writeTranslationParameterClause,
|
2136
|
+
[126 /* ConstructorTranslation */]: this.prototype.writeConstructorTranslation,
|
2137
|
+
[127 /* IndexParameterTranslationClause */]: this.prototype.writeIndexParameterTranslationClause,
|
2138
|
+
[128 /* IndexerTranslation */]: this.prototype.writeIndexerTranslation,
|
2139
|
+
[129 /* TranslationTypeParameterList */]: this.prototype.writeNodeDefault,
|
2140
|
+
[130 /* TranslationTypeParameterClause */]: this.prototype.writeTranslationTypeParameterClause,
|
2141
|
+
[131 /* PackageFunctionTranslation */]: this.prototype.writePackageFunctionTranslation,
|
2142
|
+
[132 /* MethodTranslation */]: this.prototype.writeMethodTranslation,
|
2143
|
+
[133 /* FunctionTypeTranslation */]: this.prototype.writeFunctionTypeTranslation,
|
2144
|
+
[134 /* PackageImportTranslation */]: this.prototype.writePackageImportTranslation,
|
2145
|
+
[136 /* PackageVariableTranslation */]: this.prototype.writePackageVariableTranslation,
|
2146
|
+
[137 /* FieldOrVariantTranslation */]: this.prototype.writeFieldOrVariantTranslation,
|
2147
|
+
[138 /* TypeMemberTranslationList */]: this.prototype.writeNodeDefault,
|
2148
|
+
[139 /* TypeTranslation */]: this.prototype.writeTypeTranslation,
|
2149
|
+
[140 /* TextLiteralTranslation */]: this.prototype.writeNodeDefault,
|
2150
|
+
[141 /* TextTemplateLiteralTranslation */]: this.prototype.writeNodeDefault,
|
2151
|
+
[146 /* TagList */]: this.prototype.writeNodeDefault,
|
2152
|
+
[148 /* ModifierList */]: this.prototype.writeNodeDefault,
|
2153
|
+
[153 /* TypeArgumentList */]: this.prototype.writeNodeDefault,
|
2154
|
+
[155 /* TypeParameterList */]: this.prototype.writeNodeDefault,
|
2155
|
+
[156 /* TypeAnnotation */]: this.prototype.writeNodeDefault
|
2171
2156
|
};
|
2172
2157
|
return writeFunctions;
|
2173
2158
|
}
|
2174
|
-
/* eslint-enable @stylistic/max-len */
|
2175
2159
|
// TODO: перенести метод в другое место (в Scanner)
|
2176
2160
|
escapeLiteralIdentifier(value) {
|
2177
2161
|
return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
@@ -2353,7 +2337,7 @@ var TranslationsGenerationService = class {
|
|
2353
2337
|
return void 0;
|
2354
2338
|
}
|
2355
2339
|
let result;
|
2356
|
-
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind ===
|
2340
|
+
if (tokenOrKeyword.isToken(63 /* Identifier */) && tokenOrKeyword.parent.kind === 139 /* TypeTranslation */ && tokenOrKeyword.value === tokenOrKeyword.parent.sourceName) {
|
2357
2341
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2358
2342
|
if (translationPackage !== void 0) {
|
2359
2343
|
const generator = new TranslationsGenerator(
|
@@ -2365,7 +2349,7 @@ var TranslationsGenerationService = class {
|
|
2365
2349
|
result = generator.generateMissingTypeMemberTranslations(tokenOrKeyword.parent);
|
2366
2350
|
}
|
2367
2351
|
}
|
2368
|
-
if (result === void 0 && tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind ===
|
2352
|
+
if (result === void 0 && tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */) {
|
2369
2353
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
2370
2354
|
if (translationPackage !== void 0) {
|
2371
2355
|
const generator = new TranslationsGenerator(
|
@@ -2391,7 +2375,7 @@ var TranslationsGenerationService = class {
|
|
2391
2375
|
if (tokenOrKeyword === void 0) {
|
2392
2376
|
return false;
|
2393
2377
|
}
|
2394
|
-
if (!(tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind ===
|
2378
|
+
if (!(tokenOrKeyword.isKeyword(55 /* Translations */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */)) {
|
2395
2379
|
return false;
|
2396
2380
|
}
|
2397
2381
|
const translationPackage = analyzer.getAnalyzedTranslationPackageIfTargetResolved(sourceFile.package);
|
@@ -2399,7 +2383,7 @@ var TranslationsGenerationService = class {
|
|
2399
2383
|
return false;
|
2400
2384
|
}
|
2401
2385
|
const generator = new TranslationsGenerator(analyzer, sourceFile, translationPackage, sourceFile.package.dialect);
|
2402
|
-
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind ===
|
2386
|
+
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 139 /* TypeTranslation */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
|
2403
2387
|
}
|
2404
2388
|
};
|
2405
2389
|
var TranslationsGenerator = class _TranslationsGenerator {
|
@@ -2426,7 +2410,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2426
2410
|
};
|
2427
2411
|
const memberTranslationsCode = Query.from(memberEntities).mapAndFilter((m) => this.createPackageMemberTranslationNode(m)).uniqueWithComparator(compareNodes).map((n) => {
|
2428
2412
|
const code = new SyntaxToCode(n, syntaxToCodeOptions).convert();
|
2429
|
-
if (n.kind ===
|
2413
|
+
if (n.kind === 139 /* TypeTranslation */) {
|
2430
2414
|
const startOffset = Math.max(code.indexOf(newLine), 0);
|
2431
2415
|
return this.addNewLineBeforeArrowsInTranslation(
|
2432
2416
|
code,
|
@@ -2458,7 +2442,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2458
2442
|
generateMissingTranslationsForPartiallyTranslatedTypes(translationsDeclaration) {
|
2459
2443
|
const result = new Array();
|
2460
2444
|
for (const translation of translationsDeclaration.translationList.translationDeclarations) {
|
2461
|
-
if (translation.kind ===
|
2445
|
+
if (translation.kind === 139 /* TypeTranslation */) {
|
2462
2446
|
const edits = this.generateMissingTypeMemberTranslations(translation);
|
2463
2447
|
if (edits !== void 0) {
|
2464
2448
|
result.push(...edits);
|
@@ -2555,13 +2539,13 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2555
2539
|
}
|
2556
2540
|
detectIndentationStepForTypeMemberTranslations(node) {
|
2557
2541
|
let indentationStepSize;
|
2558
|
-
if (node.kind ===
|
2542
|
+
if (node.kind === 139 /* TypeTranslation */) {
|
2559
2543
|
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(node, this._sourceFile);
|
2560
2544
|
}
|
2561
2545
|
if (indentationStepSize === void 0) {
|
2562
|
-
const translationsDeclarations = node.kind ===
|
2546
|
+
const translationsDeclarations = node.kind === 21 /* TranslationsDeclaration */ ? node : node.parent.parent;
|
2563
2547
|
for (const member of translationsDeclarations.translationList.translationDeclarations) {
|
2564
|
-
if (member.kind ===
|
2548
|
+
if (member.kind === 139 /* TypeTranslation */) {
|
2565
2549
|
indentationStepSize = tryDetectIndentationStepSizeUsingTypeTranslation(member, this._sourceFile);
|
2566
2550
|
if (indentationStepSize !== void 0) {
|
2567
2551
|
break;
|
@@ -2612,11 +2596,11 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2612
2596
|
switch (entity.kind) {
|
2613
2597
|
case 0 /* Variable */:
|
2614
2598
|
return this.createPackageVariableTranslation(entity);
|
2615
|
-
case 1 /*
|
2616
|
-
return this.
|
2599
|
+
case 1 /* Function */:
|
2600
|
+
return this.createPackageFunctionTranslation(entity);
|
2617
2601
|
case 2 /* Type */:
|
2618
|
-
if (entity.typeEntityKind === 0 /*
|
2619
|
-
return this.
|
2602
|
+
if (entity.typeEntityKind === 0 /* Function */) {
|
2603
|
+
return this.createPackageFunctionTypeTranslation(entity);
|
2620
2604
|
} else {
|
2621
2605
|
return this.createPackageTypeWithMembersTranslation(entity);
|
2622
2606
|
}
|
@@ -2630,11 +2614,11 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2630
2614
|
const name = this.getNameText(entity.getName());
|
2631
2615
|
return SyntaxFactory.packageVariableTranslation(name, name);
|
2632
2616
|
}
|
2633
|
-
|
2617
|
+
createPackageFunctionTranslation(entity) {
|
2634
2618
|
const name = this.getNameText(entity.getName());
|
2635
2619
|
const typeParameters = entity.getTypeParameters().map((p) => this.getNameText(p.getName()));
|
2636
2620
|
const parameters = entity.getValueParameters().map((p) => this.getNameText(p.getName()));
|
2637
|
-
return SyntaxFactory.
|
2621
|
+
return SyntaxFactory.packageFunctionTranslation(name, typeParameters, parameters, name, typeParameters, parameters);
|
2638
2622
|
}
|
2639
2623
|
createPackageTypeWithMembersTranslation(entity) {
|
2640
2624
|
const name = this.getNameText(entity.getName());
|
@@ -2642,18 +2626,18 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2642
2626
|
const members = Query.from(this.collectNotTranslatedTypeMembers(entity)).mapAndFilter((e) => this.createTypeMemberTranslationNode(e)).filter((n) => n !== void 0).uniqueWithComparator(compareNodes).toArray();
|
2643
2627
|
return SyntaxFactory.typeTranslation(name, typeParameters, name, typeParameters, members);
|
2644
2628
|
}
|
2645
|
-
|
2629
|
+
createPackageFunctionTypeTranslation(entity) {
|
2646
2630
|
const name = this.getNameText(entity.getName());
|
2647
2631
|
const typeParameters = entity.getTypeParameters().map((p) => this.getNameText(p.getName()));
|
2648
2632
|
const parameters = entity.getValueParameters().map((p) => this.getNameText(p.getName()));
|
2649
|
-
return SyntaxFactory.
|
2633
|
+
return SyntaxFactory.functionTypeTranslation(name, typeParameters, parameters, name, typeParameters, parameters);
|
2650
2634
|
}
|
2651
2635
|
createTypeMemberTranslationNode(entity) {
|
2652
2636
|
switch (entity.kind) {
|
2653
2637
|
case 0 /* Variable */:
|
2654
|
-
return this.
|
2655
|
-
case 1 /*
|
2656
|
-
return this.
|
2638
|
+
return this.createFieldTranslation(entity);
|
2639
|
+
case 1 /* Function */:
|
2640
|
+
return this.createMethodTranslation(entity);
|
2657
2641
|
case 7 /* Constructor */:
|
2658
2642
|
return this.createConstructorTranslation(entity);
|
2659
2643
|
case 5 /* Indexer */:
|
@@ -2666,15 +2650,15 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
2666
2650
|
Debug.never(entity);
|
2667
2651
|
}
|
2668
2652
|
}
|
2669
|
-
|
2653
|
+
createFieldTranslation(entity) {
|
2670
2654
|
const name = this.getNameText(entity.getName());
|
2671
|
-
return SyntaxFactory.
|
2655
|
+
return SyntaxFactory.fieldOrVariantTranslation(name, name);
|
2672
2656
|
}
|
2673
|
-
|
2657
|
+
createMethodTranslation(entity) {
|
2674
2658
|
const name = this.getNameText(entity.getName());
|
2675
2659
|
const typeParameters = entity.getTypeParameters().map((p) => this.getNameText(p.getName()));
|
2676
2660
|
const parameters = entity.getValueParameters().map((p) => this.getNameText(p.getName()));
|
2677
|
-
return SyntaxFactory.
|
2661
|
+
return SyntaxFactory.methodTranslation(name, typeParameters, parameters, name, typeParameters, parameters);
|
2678
2662
|
}
|
2679
2663
|
createConstructorTranslation(entity) {
|
2680
2664
|
const parameters = entity.getValueParameters().map((p) => this.getNameText(p.getName()));
|
@@ -2743,7 +2727,7 @@ var CodeActionsService = class {
|
|
2743
2727
|
}
|
2744
2728
|
const result = new Array();
|
2745
2729
|
const diagnosticCodeSet = new Set(diagnosticCodes);
|
2746
|
-
if (diagnosticCodeSet.has(
|
2730
|
+
if (diagnosticCodeSet.has(2073 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(2074 /* TheFollowingDeclarationAreNotTranslated0And1More */)) {
|
2747
2731
|
const data = { onlyTypeMembers: false };
|
2748
2732
|
result.push(CodeAction.unresolved(
|
2749
2733
|
"\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043D\u0435\u0434\u043E\u0441\u0442\u0430\u044E\u0449\u0438\u0435 \u043F\u0435\u0440\u0435\u0432\u043E\u0434\u044B.",
|
@@ -2842,13 +2826,13 @@ var ValueArgumentFactory = class _ValueArgumentFactory {
|
|
2842
2826
|
var SignatureForNode = class _SignatureForNode {
|
2843
2827
|
static getSignaturesForNode(analyzer, node) {
|
2844
2828
|
switch (node.kind) {
|
2845
|
-
case
|
2829
|
+
case 69 /* CallExpression */:
|
2846
2830
|
return _SignatureForNode.getSignaturesForCallExpression(analyzer, node);
|
2847
|
-
case
|
2831
|
+
case 70 /* AutotypeCallExpression */:
|
2848
2832
|
return _SignatureForNode.getSignaturesForAutotypeCallExpression(analyzer, node);
|
2849
|
-
case
|
2833
|
+
case 71 /* IndexedAccessExpression */:
|
2850
2834
|
return _SignatureForNode.getSignaturesForIndexedAccessExpression(analyzer, node);
|
2851
|
-
case
|
2835
|
+
case 147 /* Tag */:
|
2852
2836
|
return _SignatureForNode.getSignaturesForTag(analyzer, node);
|
2853
2837
|
default:
|
2854
2838
|
Debug.never(node);
|
@@ -2864,17 +2848,17 @@ var SignatureForNode = class _SignatureForNode {
|
|
2864
2848
|
const signatures = meaning.candidates.map((c) => new ConstructorSignature(c));
|
2865
2849
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
2866
2850
|
}
|
2867
|
-
const info = analyzer.
|
2851
|
+
const info = analyzer.checkExpressionDenotesFunction(node.expression);
|
2868
2852
|
if (info !== void 0) {
|
2869
2853
|
let suitableSignatureIndex;
|
2870
|
-
if (info.
|
2871
|
-
suitableSignatureIndex = info.candidates.indexOf(info.
|
2854
|
+
if (info.suitableFunctions.length === 1) {
|
2855
|
+
suitableSignatureIndex = info.candidates.indexOf(info.suitableFunctions[0]);
|
2872
2856
|
}
|
2873
|
-
const signatures = info.candidates.map((c) => new
|
2857
|
+
const signatures = info.candidates.map((c) => new AccessedFunctionSignature(c));
|
2874
2858
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
2875
2859
|
}
|
2876
|
-
if (meaning.kind === "object-
|
2877
|
-
const signature = new
|
2860
|
+
if (meaning.kind === "object-function-call") {
|
2861
|
+
const signature = new FunctionTypeSignature(meaning.type);
|
2878
2862
|
return new SignaturesWithSingleSuitable([signature], 0);
|
2879
2863
|
}
|
2880
2864
|
return void 0;
|
@@ -2918,12 +2902,12 @@ var SignatureForNode = class _SignatureForNode {
|
|
2918
2902
|
const signatures = meaning.candidates.map((c) => new ConstructorSignature(c));
|
2919
2903
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
2920
2904
|
}
|
2921
|
-
if (meaning.kind === "tag-
|
2905
|
+
if (meaning.kind === "tag-function") {
|
2922
2906
|
let suitableSignatureIndex;
|
2923
|
-
if (meaning.
|
2924
|
-
suitableSignatureIndex = meaning.candidates.indexOf(meaning.
|
2907
|
+
if (meaning.suitableFunctions.length === 1) {
|
2908
|
+
suitableSignatureIndex = meaning.candidates.indexOf(meaning.suitableFunctions[0]);
|
2925
2909
|
}
|
2926
|
-
const signatures = meaning.candidates.map((c) => new
|
2910
|
+
const signatures = meaning.candidates.map((c) => new AccessedFunctionSignature(c));
|
2927
2911
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
2928
2912
|
}
|
2929
2913
|
if (meaning.kind === "unresolved") {
|
@@ -2986,7 +2970,7 @@ var SimplifiedOverloadResolver = class _SimplifiedOverloadResolver {
|
|
2986
2970
|
result = false;
|
2987
2971
|
break;
|
2988
2972
|
}
|
2989
|
-
if (argument.expression === void 0 || argument.expression.kind ===
|
2973
|
+
if (argument.expression === void 0 || argument.expression.kind === 72 /* InvalidExpression */) {
|
2990
2974
|
continue;
|
2991
2975
|
}
|
2992
2976
|
const targetParameterType = targetParameter.getType();
|
@@ -3034,34 +3018,34 @@ var MatchedSignature = class {
|
|
3034
3018
|
this.matchResult = matchResult;
|
3035
3019
|
}
|
3036
3020
|
};
|
3037
|
-
var
|
3038
|
-
constructor(
|
3039
|
-
this.kind = "accessed-
|
3021
|
+
var AccessedFunctionSignature = class {
|
3022
|
+
constructor(func) {
|
3023
|
+
this.kind = "accessed-function";
|
3040
3024
|
this._valueParameters = new Cached();
|
3041
|
-
this.
|
3025
|
+
this.func = func;
|
3042
3026
|
}
|
3043
3027
|
getValueParameters() {
|
3044
3028
|
return this._valueParameters.getOrInsertWith(() => {
|
3045
|
-
const localizedSignature = EntityLocalizationHelper.
|
3046
|
-
this.
|
3047
|
-
this.
|
3029
|
+
const localizedSignature = EntityLocalizationHelper.getLocalizedFunctionSignature(
|
3030
|
+
this.func.value.getEntity(),
|
3031
|
+
this.func.localization
|
3048
3032
|
);
|
3049
|
-
return Query.from(this.
|
3033
|
+
return Query.from(this.func.value.getValueParameters()).zip(
|
3050
3034
|
localizedSignature.getValueParameterNames(),
|
3051
3035
|
(p, n) => new UniversalValueParameter(n.value, p.type, p.entity, n.localization)
|
3052
3036
|
).toArray();
|
3053
3037
|
});
|
3054
3038
|
}
|
3055
3039
|
};
|
3056
|
-
var
|
3057
|
-
constructor(
|
3058
|
-
this.kind = "
|
3040
|
+
var FunctionTypeSignature = class {
|
3041
|
+
constructor(functionType) {
|
3042
|
+
this.kind = "function-type";
|
3059
3043
|
this._valueParameters = new Cached();
|
3060
|
-
this.
|
3044
|
+
this.functionType = functionType;
|
3061
3045
|
}
|
3062
3046
|
getValueParameters() {
|
3063
3047
|
return this._valueParameters.getOrInsertWith(
|
3064
|
-
() => this.
|
3048
|
+
() => this.functionType.getValueParameters().map(
|
3065
3049
|
(p) => new UniversalValueParameter(
|
3066
3050
|
p.getName(),
|
3067
3051
|
p.getType(),
|
@@ -3160,7 +3144,7 @@ var CompletionService = class {
|
|
3160
3144
|
semanticContext,
|
3161
3145
|
positionDescription
|
3162
3146
|
);
|
3163
|
-
completionItemInfos = this.
|
3147
|
+
completionItemInfos = this.mergeOverloadedFunctions(completionItemInfos);
|
3164
3148
|
completionItemInfos = this.removeCompletionItemsWithDuplicateLabels(completionItemInfos);
|
3165
3149
|
const cacheId = this._cache.add(completionItemInfos, sourceFile).id;
|
3166
3150
|
const result = this.convertCompletionItemInfos(completionItemInfos, cacheId);
|
@@ -3224,7 +3208,7 @@ var CompletionService = class {
|
|
3224
3208
|
if (syntaxContext.isInComment || syntaxContext.isInStringOrChar) {
|
3225
3209
|
return { kind: "none" };
|
3226
3210
|
}
|
3227
|
-
if (syntaxContext.isInQuotedIdentifier !== void 0 && (syntaxContext.isInQuotedIdentifier.parent.kind ===
|
3211
|
+
if (syntaxContext.isInQuotedIdentifier !== void 0 && (syntaxContext.isInQuotedIdentifier.parent.kind === 53 /* OperatorDeclaration */ || syntaxContext.isInQuotedIdentifier.parent.kind === 52 /* MethodDeclaration */)) {
|
3228
3212
|
return new OperatorNameCompletionContext(syntaxContext.isInQuotedIdentifier);
|
3229
3213
|
}
|
3230
3214
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
@@ -3234,15 +3218,15 @@ var CompletionService = class {
|
|
3234
3218
|
if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind === 8 /* PackageImport */) {
|
3235
3219
|
return new PackageImportCompletionContext([], void 0);
|
3236
3220
|
}
|
3237
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 9 /*
|
3221
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 9 /* PackageName */) {
|
3238
3222
|
const packageImport = tokenOrKeyword.parent.parent;
|
3239
|
-
const precedingSegmentNames = packageImport.
|
3223
|
+
const precedingSegmentNames = packageImport.packageName.segments.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
3240
3224
|
return new PackageImportCompletionContext(precedingSegmentNames, void 0);
|
3241
3225
|
}
|
3242
3226
|
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || this.tokenOrKeywordIsPackageImportListChild(tokenOrKeyword)) {
|
3243
3227
|
return new PackageImportCompletionContext([], void 0);
|
3244
3228
|
}
|
3245
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3229
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 78 /* MemberAccessExpression */) {
|
3246
3230
|
const propertyAccess = tokenOrKeyword.parent;
|
3247
3231
|
{
|
3248
3232
|
const info = this._analyzer.checkExpressionDenotesPackageNameSegment(propertyAccess.expression);
|
@@ -3283,7 +3267,7 @@ var CompletionService = class {
|
|
3283
3267
|
typeExtensionLookup
|
3284
3268
|
);
|
3285
3269
|
}
|
3286
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3270
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 10 /* NamedTypeSpecifier */) {
|
3287
3271
|
const namedTypeSpecifier = tokenOrKeyword.parent.parent;
|
3288
3272
|
const resolutionResult = this._analyzer.resolveNamedTypeSpecifier(namedTypeSpecifier);
|
3289
3273
|
const segmentIndex = Math.floor(
|
@@ -3291,7 +3275,7 @@ var CompletionService = class {
|
|
3291
3275
|
);
|
3292
3276
|
if (segmentIndex < resolutionResult.resolvedQualifiers.length) {
|
3293
3277
|
let completionInIsOrAsExpressionInfo;
|
3294
|
-
if (namedTypeSpecifier.parent.kind ===
|
3278
|
+
if (namedTypeSpecifier.parent.kind === 73 /* IsExpression */ || namedTypeSpecifier.parent.kind === 65 /* AsExpression */) {
|
3295
3279
|
completionInIsOrAsExpressionInfo = {
|
3296
3280
|
expressionType: this._analyzer.type.ofExpression(namedTypeSpecifier.parent.expression)
|
3297
3281
|
};
|
@@ -3325,7 +3309,7 @@ var CompletionService = class {
|
|
3325
3309
|
}
|
3326
3310
|
return { kind: "none" };
|
3327
3311
|
}
|
3328
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3312
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */ && tokenOrKeyword.parent.parent.kind === 147 /* Tag */) {
|
3329
3313
|
const tag = tokenOrKeyword.parent.parent;
|
3330
3314
|
const resolutionResult = this._analyzer.resolveTag(tag);
|
3331
3315
|
const segmentIndex = Math.floor(
|
@@ -3363,7 +3347,7 @@ var CompletionService = class {
|
|
3363
3347
|
}
|
3364
3348
|
if (syntaxContext.isUnqualifiedTypeContext !== void 0) {
|
3365
3349
|
let completionInIsOrAsExpressionInfo;
|
3366
|
-
if (tokenOrKeyword.parent.kind ===
|
3350
|
+
if (tokenOrKeyword.parent.kind === 73 /* IsExpression */ || tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
3367
3351
|
completionInIsOrAsExpressionInfo = {
|
3368
3352
|
expressionType: this._analyzer.type.ofExpression(tokenOrKeyword.parent.expression)
|
3369
3353
|
};
|
@@ -3418,17 +3402,17 @@ var CompletionService = class {
|
|
3418
3402
|
translationKind = 0 /* Any */;
|
3419
3403
|
hasPrecedingKeyword = false;
|
3420
3404
|
}
|
3421
|
-
if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind ===
|
3405
|
+
if (tokenOrKeyword.isKeyword(18 /* Import */) && tokenOrKeyword.parent.kind === 134 /* PackageImportTranslation */) {
|
3422
3406
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3423
3407
|
translationKind = 1 /* PackageImport */;
|
3424
3408
|
hasPrecedingKeyword = true;
|
3425
3409
|
}
|
3426
|
-
if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind ===
|
3410
|
+
if (tokenOrKeyword.isKeyword(16 /* Type */) && (tokenOrKeyword.parent.kind === 139 /* TypeTranslation */ || tokenOrKeyword.parent.kind === 133 /* FunctionTypeTranslation */)) {
|
3427
3411
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3428
3412
|
translationKind = 3 /* Type */;
|
3429
3413
|
hasPrecedingKeyword = true;
|
3430
3414
|
}
|
3431
|
-
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind ===
|
3415
|
+
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 131 /* PackageFunctionTranslation */) {
|
3432
3416
|
translationsDeclaration = tokenOrKeyword.parent.parent.parent;
|
3433
3417
|
translationKind = 2 /* Method */;
|
3434
3418
|
hasPrecedingKeyword = true;
|
@@ -3448,9 +3432,9 @@ var CompletionService = class {
|
|
3448
3432
|
hasPrecedingKeyword
|
3449
3433
|
);
|
3450
3434
|
}
|
3451
|
-
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind ===
|
3435
|
+
if (tokenOrKeyword.isToken(26 /* Dot */) && tokenOrKeyword.parent.kind === 135 /* QualifiedName */) {
|
3452
3436
|
const qualifiedName = tokenOrKeyword.parent;
|
3453
|
-
if (qualifiedName.parent.kind ===
|
3437
|
+
if (qualifiedName.parent.kind === 134 /* PackageImportTranslation */ && qualifiedName === qualifiedName.parent.sourceName) {
|
3454
3438
|
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeStart < tokenOrKeyword.value.rangeStart).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
3455
3439
|
const sourceLocale = translationPackage.getTranslatedPackage().getLocale();
|
3456
3440
|
return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
|
@@ -3475,12 +3459,12 @@ var CompletionService = class {
|
|
3475
3459
|
translationKind = 0 /* Any */;
|
3476
3460
|
hasPrecedingKeyword = false;
|
3477
3461
|
}
|
3478
|
-
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind ===
|
3462
|
+
if (tokenOrKeyword.isKeyword(12 /* Function */) && tokenOrKeyword.parent.kind === 132 /* MethodTranslation */) {
|
3479
3463
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3480
3464
|
translationKind = 1 /* Method */;
|
3481
3465
|
hasPrecedingKeyword = true;
|
3482
3466
|
}
|
3483
|
-
if (tokenOrKeyword.isKeyword(30 /* Creation */) && tokenOrKeyword.parent.kind ===
|
3467
|
+
if (tokenOrKeyword.isKeyword(30 /* Creation */) && tokenOrKeyword.parent.kind === 126 /* ConstructorTranslation */) {
|
3484
3468
|
typeTranslation = tokenOrKeyword.parent.parent.parent;
|
3485
3469
|
translationKind = 3 /* Constructor */;
|
3486
3470
|
hasPrecedingKeyword = true;
|
@@ -3510,21 +3494,21 @@ var CompletionService = class {
|
|
3510
3494
|
let signatures;
|
3511
3495
|
let valueArguments;
|
3512
3496
|
switch (role.argumentList.parent.kind) {
|
3513
|
-
case
|
3497
|
+
case 69 /* CallExpression */:
|
3514
3498
|
signatures = SignatureForNode.getSignaturesForCallExpression(this._analyzer, role.argumentList.parent);
|
3515
3499
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfCallExpression(role.argumentList.parent);
|
3516
3500
|
break;
|
3517
|
-
case
|
3501
|
+
case 70 /* AutotypeCallExpression */:
|
3518
3502
|
signatures = SignatureForNode.getSignaturesForAutotypeCallExpression(this._analyzer, role.argumentList.parent);
|
3519
3503
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfAutotypeCallExpression(
|
3520
3504
|
role.argumentList.parent
|
3521
3505
|
);
|
3522
3506
|
break;
|
3523
|
-
case
|
3507
|
+
case 147 /* Tag */:
|
3524
3508
|
signatures = SignatureForNode.getSignaturesForTag(this._analyzer, role.argumentList.parent);
|
3525
3509
|
valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(role.argumentList.parent);
|
3526
3510
|
break;
|
3527
|
-
case
|
3511
|
+
case 71 /* IndexedAccessExpression */:
|
3528
3512
|
signatures = SignatureForNode.getSignaturesForIndexedAccessExpression(
|
3529
3513
|
this._analyzer,
|
3530
3514
|
role.argumentList.parent
|
@@ -3607,7 +3591,7 @@ var CompletionService = class {
|
|
3607
3591
|
}
|
3608
3592
|
tokenOrKeywordIsPackageImportListChild(tokenOrKeyword) {
|
3609
3593
|
let parent = tokenOrKeyword.parent;
|
3610
|
-
while (parent.kind === 3 /* Keyword */ || parent.kind === 9 /*
|
3594
|
+
while (parent.kind === 3 /* Keyword */ || parent.kind === 9 /* PackageName */ || parent.kind === 8 /* PackageImport */) {
|
3611
3595
|
parent = parent.parent;
|
3612
3596
|
}
|
3613
3597
|
return parent.kind === 7 /* PackageImportList */;
|
@@ -3721,7 +3705,7 @@ var CompletionService = class {
|
|
3721
3705
|
if (syntaxContext.isUnqualifiedTypeContext?.allowsAnonymousTypes === true) {
|
3722
3706
|
kinds.add(5 /* PlainObject */).add(4 /* Object */).add(6 /* Variant */).add(3 /* Aspect */).add(12 /* Function */).add(40 /* Async */);
|
3723
3707
|
}
|
3724
|
-
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(40 /* Async */) && (positionDescription.tokenOrKeyword.parent.kind ===
|
3708
|
+
if (positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isKeyword(40 /* Async */) && (positionDescription.tokenOrKeyword.parent.kind === 58 /* NestedFunctionDeclaration */ || positionDescription.tokenOrKeyword.parent.kind === 74 /* FunctionLiteral */ || positionDescription.tokenOrKeyword.parent.kind === 29 /* FunctionTypeDeclarationBody */)) {
|
3725
3709
|
kinds.add(12 /* Function */);
|
3726
3710
|
}
|
3727
3711
|
return Query.from(kinds.values()).map(
|
@@ -3733,35 +3717,35 @@ var CompletionService = class {
|
|
3733
3717
|
return false;
|
3734
3718
|
}
|
3735
3719
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3736
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3720
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 116 /* LoopStatement */;
|
3737
3721
|
}
|
3738
3722
|
isModifierLevelContext(positionDescription) {
|
3739
3723
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3740
3724
|
return false;
|
3741
3725
|
}
|
3742
3726
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3743
|
-
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind ===
|
3727
|
+
return tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 149 /* Modifier */;
|
3744
3728
|
}
|
3745
3729
|
isElseOrElseIfKeywordContext(positionDescription) {
|
3746
3730
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3747
3731
|
return false;
|
3748
3732
|
}
|
3749
3733
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3750
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3734
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 109 /* IfStatement */ && tokenOrKeyword.parent === tokenOrKeyword.parent.parent.block || tokenOrKeyword.parent.parent.kind === 111 /* ElseIfClause */);
|
3751
3735
|
}
|
3752
3736
|
isCatchKeywordContext(positionDescription) {
|
3753
3737
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3754
3738
|
return false;
|
3755
3739
|
}
|
3756
3740
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3757
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3741
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 99 /* TryStatement */;
|
3758
3742
|
}
|
3759
3743
|
isFinallyKeywordContext(positionDescription) {
|
3760
3744
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3761
3745
|
return false;
|
3762
3746
|
}
|
3763
3747
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3764
|
-
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3748
|
+
return tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && (tokenOrKeyword.parent.parent.kind === 99 /* TryStatement */ || tokenOrKeyword.parent.parent.kind === 100 /* CatchClause */);
|
3765
3749
|
}
|
3766
3750
|
isTypeKindCompletionContext(positionDescription) {
|
3767
3751
|
return positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(57 /* Equals */) && NodeTypeUtils.isPackageTypeDeclaration(positionDescription.tokenOrKeyword.parent);
|
@@ -3771,17 +3755,17 @@ var CompletionService = class {
|
|
3771
3755
|
return false;
|
3772
3756
|
}
|
3773
3757
|
const token = positionDescription.tokenOrKeyword.value;
|
3774
|
-
return token.parent.kind ===
|
3758
|
+
return token.parent.kind === 60 /* EnumerationVariableDeclaration */ && (token.parent.parent.elements.length > 0 && token.parent.parent.elements[token.parent.parent.elements.length - 1] === token.parent || token.parent.parent.elements.length > 1 && token.parent.parent.elements[token.parent.parent.elements.length - 2] === token.parent);
|
3775
3759
|
}
|
3776
3760
|
isCaseKeywordContext(positionDescription, syntaxContext) {
|
3777
3761
|
if (positionDescription.kind !== "after-token-or-keyword") {
|
3778
3762
|
return false;
|
3779
3763
|
}
|
3780
3764
|
const tokenOrKeyword = positionDescription.tokenOrKeyword;
|
3781
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
3765
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */ && tokenOrKeyword.parent.parent.kind === 121 /* CaseClause */) {
|
3782
3766
|
return true;
|
3783
3767
|
}
|
3784
|
-
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind ===
|
3768
|
+
if (syntaxContext.precedingExpression !== void 0 && syntaxContext.precedingExpression.parent.kind === 119 /* SwitchStatement */) {
|
3785
3769
|
return true;
|
3786
3770
|
}
|
3787
3771
|
return false;
|
@@ -3824,7 +3808,7 @@ var CompletionService = class {
|
|
3824
3808
|
d.requiresExplicitOriginalName
|
3825
3809
|
);
|
3826
3810
|
} else {
|
3827
|
-
return new
|
3811
|
+
return new FieldCompletionItemInfo(
|
3828
3812
|
this.completionItemInfoContext,
|
3829
3813
|
d.value.value.value,
|
3830
3814
|
d.name,
|
@@ -3832,16 +3816,16 @@ var CompletionService = class {
|
|
3832
3816
|
);
|
3833
3817
|
}
|
3834
3818
|
}
|
3835
|
-
case "
|
3819
|
+
case "function": {
|
3836
3820
|
if (d.value.value.kind === "entity") {
|
3837
|
-
return new
|
3821
|
+
return new FunctionEntityCompletionItemInfo(
|
3838
3822
|
this.completionItemInfoContext,
|
3839
3823
|
d.value.value.value,
|
3840
3824
|
d.name,
|
3841
3825
|
d.requiresExplicitOriginalName
|
3842
3826
|
);
|
3843
3827
|
} else {
|
3844
|
-
return new
|
3828
|
+
return new MethodCompletionItemInfo(
|
3845
3829
|
this.completionItemInfoContext,
|
3846
3830
|
d.value.value.value,
|
3847
3831
|
d.name,
|
@@ -3961,8 +3945,8 @@ var CompletionService = class {
|
|
3961
3945
|
m.name,
|
3962
3946
|
m.requiresExplicitOriginalName
|
3963
3947
|
);
|
3964
|
-
} else if (m.value.kind === 1 /*
|
3965
|
-
return new
|
3948
|
+
} else if (m.value.kind === 1 /* Function */) {
|
3949
|
+
return new FunctionEntityCompletionItemInfo(
|
3966
3950
|
this.completionItemInfoContext,
|
3967
3951
|
m.value,
|
3968
3952
|
m.name,
|
@@ -3985,8 +3969,8 @@ var CompletionService = class {
|
|
3985
3969
|
m.name,
|
3986
3970
|
m.requiresExplicitOriginalName
|
3987
3971
|
);
|
3988
|
-
} else if (m.value.kind === 1 /*
|
3989
|
-
return new
|
3972
|
+
} else if (m.value.kind === 1 /* Function */) {
|
3973
|
+
return new FunctionEntityCompletionItemInfo(
|
3990
3974
|
this.completionItemInfoContext,
|
3991
3975
|
m.value,
|
3992
3976
|
m.name,
|
@@ -4009,8 +3993,8 @@ var CompletionService = class {
|
|
4009
3993
|
d.name,
|
4010
3994
|
d.requiresExplicitOriginalName
|
4011
3995
|
);
|
4012
|
-
case "
|
4013
|
-
return new
|
3996
|
+
case "function":
|
3997
|
+
return new FunctionEntityCompletionItemInfo(
|
4014
3998
|
this.completionItemInfoContext,
|
4015
3999
|
d.value.value.getEntity(),
|
4016
4000
|
d.name,
|
@@ -4049,8 +4033,8 @@ var CompletionService = class {
|
|
4049
4033
|
name,
|
4050
4034
|
isNameExplicitlyOriginal
|
4051
4035
|
);
|
4052
|
-
case 1 /*
|
4053
|
-
return new
|
4036
|
+
case 1 /* Function */:
|
4037
|
+
return new FunctionEntityCompletionItemInfo(
|
4054
4038
|
this.completionItemInfoContext,
|
4055
4039
|
member,
|
4056
4040
|
name,
|
@@ -4079,14 +4063,14 @@ var CompletionService = class {
|
|
4079
4063
|
return memberLookup.getNamedMembers(options6, ctx.hidingMatcher, ctx.typeExtensionsLookup).map((m) => {
|
4080
4064
|
switch (m.value.kind) {
|
4081
4065
|
case "method":
|
4082
|
-
return new
|
4066
|
+
return new MethodCompletionItemInfo(
|
4083
4067
|
this.completionItemInfoContext,
|
4084
4068
|
m.value,
|
4085
4069
|
m.name,
|
4086
4070
|
m.requiresExplicitOriginalName
|
4087
4071
|
);
|
4088
4072
|
case "variable":
|
4089
|
-
return new
|
4073
|
+
return new FieldCompletionItemInfo(
|
4090
4074
|
this.completionItemInfoContext,
|
4091
4075
|
m.value,
|
4092
4076
|
m.name,
|
@@ -4129,8 +4113,8 @@ var CompletionService = class {
|
|
4129
4113
|
result = items ?? Query.empty();
|
4130
4114
|
} else if (ctx.translationKind === 2 /* Method */) {
|
4131
4115
|
result = Query.from(ctx.packageMemberLookup.getNamedMembers(ctx.hidingMatcher)).mapAndFilter((d) => {
|
4132
|
-
if (d.value.kind === 1 /*
|
4133
|
-
return new
|
4116
|
+
if (d.value.kind === 1 /* Function */) {
|
4117
|
+
return new AliasesSourceFunctionCompletionItemInfo(
|
4134
4118
|
this.completionItemInfoContext,
|
4135
4119
|
d.value,
|
4136
4120
|
!ctx.hasPrecedingKeyword,
|
@@ -4171,8 +4155,8 @@ var CompletionService = class {
|
|
4171
4155
|
d.value,
|
4172
4156
|
displayService_
|
4173
4157
|
);
|
4174
|
-
case 1 /*
|
4175
|
-
return new
|
4158
|
+
case 1 /* Function */:
|
4159
|
+
return new AliasesSourceFunctionCompletionItemInfo(
|
4176
4160
|
this.completionItemInfoContext,
|
4177
4161
|
d.value,
|
4178
4162
|
!ctx.hasPrecedingKeyword,
|
@@ -4213,8 +4197,8 @@ var CompletionService = class {
|
|
4213
4197
|
const displayService_ = new DisplayService(this._analyzer, ctx.sourceLocale, this._dialect);
|
4214
4198
|
if (ctx.translationKind === 1 /* Method */) {
|
4215
4199
|
result = Query.from(ctx.typeEntity.getMembers().getNamedMembers()).mapAndFilter((m) => {
|
4216
|
-
if (m.kind === 1 /*
|
4217
|
-
return new
|
4200
|
+
if (m.kind === 1 /* Function */) {
|
4201
|
+
return new AliasesSourceFunctionCompletionItemInfo(
|
4218
4202
|
this.completionItemInfoContext,
|
4219
4203
|
m,
|
4220
4204
|
!ctx.hasPrecedingKeyword,
|
@@ -4225,7 +4209,7 @@ var CompletionService = class {
|
|
4225
4209
|
});
|
4226
4210
|
} else if (ctx.translationKind === 3 /* Constructor */) {
|
4227
4211
|
result = Query.from(ctx.typeEntity.getMembers().getConstructors()).map(
|
4228
|
-
(c) => new
|
4212
|
+
(c) => new AliasesSourceConstructorCompletionItemInfo(
|
4229
4213
|
this.completionItemInfoContext,
|
4230
4214
|
c,
|
4231
4215
|
!ctx.hasPrecedingKeyword,
|
@@ -4233,13 +4217,13 @@ var CompletionService = class {
|
|
4233
4217
|
)
|
4234
4218
|
);
|
4235
4219
|
} else if (ctx.translationKind === 2 /* Indexer */) {
|
4236
|
-
result = Query.from(ctx.typeEntity.getMembers().getIndexers()).map((i) => new
|
4220
|
+
result = Query.from(ctx.typeEntity.getMembers().getIndexers()).map((i) => new AliasesSourceIndexerCompletionItemInfo(this.completionItemInfoContext, i, displayService_));
|
4237
4221
|
} else if (ctx.translationKind === 0 /* Any */) {
|
4238
4222
|
result = Query.from(ctx.typeEntity.getMembers().getNamedMembers()).mapAndFilter((m) => {
|
4239
4223
|
if (m.kind === 0 /* Variable */) {
|
4240
4224
|
return new AliasesSourceVariableCompletionItemInfo(this.completionItemInfoContext, m, displayService_);
|
4241
|
-
} else if (m.kind === 1 /*
|
4242
|
-
return new
|
4225
|
+
} else if (m.kind === 1 /* Function */) {
|
4226
|
+
return new AliasesSourceFunctionCompletionItemInfo(
|
4243
4227
|
this.completionItemInfoContext,
|
4244
4228
|
m,
|
4245
4229
|
!ctx.hasPrecedingKeyword,
|
@@ -4249,7 +4233,7 @@ var CompletionService = class {
|
|
4249
4233
|
return void 0;
|
4250
4234
|
}).chain(
|
4251
4235
|
ctx.typeEntity.getMembers().getConstructors().map(
|
4252
|
-
(c) => new
|
4236
|
+
(c) => new AliasesSourceConstructorCompletionItemInfo(
|
4253
4237
|
this.completionItemInfoContext,
|
4254
4238
|
c,
|
4255
4239
|
!ctx.hasPrecedingKeyword,
|
@@ -4258,7 +4242,7 @@ var CompletionService = class {
|
|
4258
4242
|
)
|
4259
4243
|
).chain(
|
4260
4244
|
ctx.typeEntity.getMembers().getIndexers().map(
|
4261
|
-
(i) => new
|
4245
|
+
(i) => new AliasesSourceIndexerCompletionItemInfo(this.completionItemInfoContext, i, displayService_)
|
4262
4246
|
)
|
4263
4247
|
);
|
4264
4248
|
} else {
|
@@ -4289,20 +4273,20 @@ var CompletionService = class {
|
|
4289
4273
|
return new OperatorNameCompletionItemInfo(this.completionItemInfoContext, value, editRange);
|
4290
4274
|
});
|
4291
4275
|
}
|
4292
|
-
|
4276
|
+
mergeOverloadedFunctions(completionItemInfos) {
|
4293
4277
|
const result = new Array();
|
4294
|
-
const
|
4278
|
+
const functionInfoByLabel = /* @__PURE__ */ new Map();
|
4295
4279
|
for (const itemInfo of completionItemInfos) {
|
4296
4280
|
switch (itemInfo.kind) {
|
4297
|
-
case "
|
4298
|
-
case "
|
4281
|
+
case "method":
|
4282
|
+
case "function-entity":
|
4299
4283
|
case "operator": {
|
4300
4284
|
const label = itemInfo.getLabel();
|
4301
|
-
const
|
4302
|
-
if (
|
4303
|
-
|
4285
|
+
const functionInfo = functionInfoByLabel.get(label);
|
4286
|
+
if (functionInfo !== void 0) {
|
4287
|
+
functionInfo.count++;
|
4304
4288
|
} else {
|
4305
|
-
|
4289
|
+
functionInfoByLabel.set(label, { itemInfo, count: 1 });
|
4306
4290
|
}
|
4307
4291
|
break;
|
4308
4292
|
}
|
@@ -4310,17 +4294,17 @@ var CompletionService = class {
|
|
4310
4294
|
result.push(itemInfo);
|
4311
4295
|
}
|
4312
4296
|
}
|
4313
|
-
for (const
|
4314
|
-
if (
|
4297
|
+
for (const functionInfo of functionInfoByLabel.values()) {
|
4298
|
+
if (functionInfo.count > 1) {
|
4315
4299
|
result.push(
|
4316
|
-
new
|
4300
|
+
new MergedOverloadedFunctionCompletionItemInfo(
|
4317
4301
|
this.completionItemInfoContext,
|
4318
|
-
|
4319
|
-
|
4302
|
+
functionInfo.itemInfo,
|
4303
|
+
functionInfo.count
|
4320
4304
|
)
|
4321
4305
|
);
|
4322
4306
|
} else {
|
4323
|
-
result.push(
|
4307
|
+
result.push(functionInfo.itemInfo);
|
4324
4308
|
}
|
4325
4309
|
}
|
4326
4310
|
return result;
|
@@ -4329,7 +4313,7 @@ var CompletionService = class {
|
|
4329
4313
|
const seenLabels = /* @__PURE__ */ new Set();
|
4330
4314
|
const result = new Array();
|
4331
4315
|
for (const completionItemInfo of completionItemInfos) {
|
4332
|
-
if (completionItemInfo.kind === "aliases-source-
|
4316
|
+
if (completionItemInfo.kind === "aliases-source-function" || completionItemInfo.kind === "aliases-source-package-type") {
|
4333
4317
|
result.push(completionItemInfo);
|
4334
4318
|
continue;
|
4335
4319
|
}
|
@@ -4429,11 +4413,11 @@ function getRightmostChildExcludingValidEmptyNodes(node) {
|
|
4429
4413
|
}
|
4430
4414
|
function isInvalidNode(node) {
|
4431
4415
|
switch (node.kind) {
|
4432
|
-
case
|
4433
|
-
case
|
4434
|
-
case
|
4435
|
-
case
|
4436
|
-
case
|
4416
|
+
case 72 /* InvalidExpression */:
|
4417
|
+
case 43 /* InvalidPackageMemberDeclaration */:
|
4418
|
+
case 113 /* InvalidStatement */:
|
4419
|
+
case 57 /* InvalidTypeMemberDeclaration */:
|
4420
|
+
case 16 /* InvalidTypeSpecifier */:
|
4437
4421
|
return true;
|
4438
4422
|
case 0 /* Token */:
|
4439
4423
|
return node.isMissing;
|
@@ -4619,7 +4603,7 @@ var PackageAliasEntityCompletionItemInfo = class {
|
|
4619
4603
|
return void 0;
|
4620
4604
|
}
|
4621
4605
|
};
|
4622
|
-
var
|
4606
|
+
var FieldCompletionItemInfo = class {
|
4623
4607
|
constructor(ctx, variable, name, isNameExplicitlyOriginal) {
|
4624
4608
|
this.ctx = ctx;
|
4625
4609
|
this.variable = variable;
|
@@ -4631,7 +4615,7 @@ var TypeVariableCompletionItemInfo = class {
|
|
4631
4615
|
return `${this.isNameExplicitlyOriginal ? "~" : ""}${this.ctx.getInsertTextForName(this.name.value)}`;
|
4632
4616
|
}
|
4633
4617
|
getCompletionItemKind() {
|
4634
|
-
return this.variable.isVariant() ? 12 /* Variant */ : 2 /*
|
4618
|
+
return this.variable.isVariant() ? 12 /* Variant */ : 2 /* Field */;
|
4635
4619
|
}
|
4636
4620
|
getDetails() {
|
4637
4621
|
return this.ctx.displayService.displayVariableDeclaration(
|
@@ -4648,23 +4632,23 @@ var TypeVariableCompletionItemInfo = class {
|
|
4648
4632
|
return void 0;
|
4649
4633
|
}
|
4650
4634
|
};
|
4651
|
-
var
|
4635
|
+
var MethodCompletionItemInfo = class {
|
4652
4636
|
constructor(ctx, method, name, isNameExplicitlyOriginal) {
|
4653
4637
|
this.ctx = ctx;
|
4654
4638
|
this.method = method;
|
4655
4639
|
this.name = name;
|
4656
4640
|
this.isNameExplicitlyOriginal = isNameExplicitlyOriginal;
|
4657
|
-
this.kind = "
|
4641
|
+
this.kind = "method";
|
4658
4642
|
}
|
4659
4643
|
getLabel() {
|
4660
4644
|
return `${this.isNameExplicitlyOriginal ? "~" : ""}${this.ctx.getInsertTextForName(this.name.value)}`;
|
4661
4645
|
}
|
4662
4646
|
getCompletionItemKind() {
|
4663
|
-
return 3 /*
|
4647
|
+
return 3 /* Method */;
|
4664
4648
|
}
|
4665
4649
|
getDetails() {
|
4666
|
-
return this.ctx.displayService.
|
4667
|
-
new
|
4650
|
+
return this.ctx.displayService.displayFunctionDeclaration(
|
4651
|
+
new FunctionDeclaration_typeMember(this.method, this.name.localization)
|
4668
4652
|
);
|
4669
4653
|
}
|
4670
4654
|
getInsertText() {
|
@@ -4720,8 +4704,8 @@ var VariableEntityCompletionItemInfo = class {
|
|
4720
4704
|
switch (this.entity.subkind) {
|
4721
4705
|
case "package":
|
4722
4706
|
return 7 /* PackageVariable */;
|
4723
|
-
case "
|
4724
|
-
return this.entity.isVariant() ? 12 /* Variant */ : 2 /*
|
4707
|
+
case "field":
|
4708
|
+
return this.entity.isVariant() ? 12 /* Variant */ : 2 /* Field */;
|
4725
4709
|
case "parameter":
|
4726
4710
|
return 10 /* ParameterVariable */;
|
4727
4711
|
case "local":
|
@@ -4745,13 +4729,13 @@ var VariableEntityCompletionItemInfo = class {
|
|
4745
4729
|
return void 0;
|
4746
4730
|
}
|
4747
4731
|
};
|
4748
|
-
var
|
4732
|
+
var FunctionEntityCompletionItemInfo = class {
|
4749
4733
|
constructor(ctx, entity, name, isNameExplicitlyOriginal) {
|
4750
4734
|
this.ctx = ctx;
|
4751
4735
|
this.entity = entity;
|
4752
4736
|
this.name = name;
|
4753
4737
|
this.isNameExplicitlyOriginal = isNameExplicitlyOriginal;
|
4754
|
-
this.kind = "
|
4738
|
+
this.kind = "function-entity";
|
4755
4739
|
}
|
4756
4740
|
getLabel() {
|
4757
4741
|
return `${this.isNameExplicitlyOriginal ? "~" : ""}${this.ctx.getInsertTextForName(this.name.value)}`;
|
@@ -4759,18 +4743,18 @@ var MethodEntityCompletionItemInfo = class {
|
|
4759
4743
|
getCompletionItemKind() {
|
4760
4744
|
switch (this.entity.subkind) {
|
4761
4745
|
case "package":
|
4762
|
-
return 8 /*
|
4763
|
-
case "
|
4764
|
-
return 3 /*
|
4746
|
+
return 8 /* PackageFunction */;
|
4747
|
+
case "method":
|
4748
|
+
return 3 /* Method */;
|
4765
4749
|
case "nested":
|
4766
|
-
return 11 /*
|
4750
|
+
return 11 /* NestedFunction */;
|
4767
4751
|
default:
|
4768
4752
|
Debug.never(this.entity);
|
4769
4753
|
}
|
4770
4754
|
}
|
4771
4755
|
getDetails() {
|
4772
|
-
return this.ctx.displayService.
|
4773
|
-
new
|
4756
|
+
return this.ctx.displayService.displayFunctionDeclaration(
|
4757
|
+
new FunctionDeclaration_entity(this.entity, this.name.localization)
|
4774
4758
|
);
|
4775
4759
|
}
|
4776
4760
|
getInsertText() {
|
@@ -4802,8 +4786,8 @@ var NamedTypeCompletionItemInfo = class {
|
|
4802
4786
|
return 16 /* VariantType */;
|
4803
4787
|
case 2 /* Parameter */:
|
4804
4788
|
return 17 /* TypeParameter */;
|
4805
|
-
case 0 /*
|
4806
|
-
return 18 /*
|
4789
|
+
case 0 /* Function */:
|
4790
|
+
return 18 /* FunctionType */;
|
4807
4791
|
case 1 /* Structured */:
|
4808
4792
|
if (this.entity.isRefObject()) {
|
4809
4793
|
return 13 /* RefObjectType */;
|
@@ -4859,12 +4843,12 @@ var KeywordCompletionItemInfo = class {
|
|
4859
4843
|
return void 0;
|
4860
4844
|
}
|
4861
4845
|
};
|
4862
|
-
var
|
4846
|
+
var MergedOverloadedFunctionCompletionItemInfo = class {
|
4863
4847
|
constructor(ctx, firstOverloadInfo, overloadCount) {
|
4864
4848
|
this.ctx = ctx;
|
4865
4849
|
this.firstOverloadInfo = firstOverloadInfo;
|
4866
4850
|
this.overloadCount = overloadCount;
|
4867
|
-
this.kind = "merged-overloaded-
|
4851
|
+
this.kind = "merged-overloaded-function";
|
4868
4852
|
}
|
4869
4853
|
getLabel() {
|
4870
4854
|
return this.firstOverloadInfo.getLabel();
|
@@ -4933,8 +4917,8 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
4933
4917
|
switch (this.variable.subkind) {
|
4934
4918
|
case "package":
|
4935
4919
|
return 7 /* PackageVariable */;
|
4936
|
-
case "
|
4937
|
-
return 2 /*
|
4920
|
+
case "field":
|
4921
|
+
return 2 /* Field */;
|
4938
4922
|
case "parameter":
|
4939
4923
|
return 7 /* PackageVariable */;
|
4940
4924
|
case "local":
|
@@ -4958,39 +4942,39 @@ var AliasesSourceVariableCompletionItemInfo = class {
|
|
4958
4942
|
return void 0;
|
4959
4943
|
}
|
4960
4944
|
};
|
4961
|
-
var
|
4962
|
-
constructor(ctx,
|
4945
|
+
var AliasesSourceFunctionCompletionItemInfo = class {
|
4946
|
+
constructor(ctx, func, includeFunctionKeyword, displayService) {
|
4963
4947
|
this.ctx = ctx;
|
4964
|
-
this.
|
4965
|
-
this.
|
4948
|
+
this.func = func;
|
4949
|
+
this.includeFunctionKeyword = includeFunctionKeyword;
|
4966
4950
|
this.displayService = displayService;
|
4967
|
-
this.kind = "aliases-source-
|
4951
|
+
this.kind = "aliases-source-function";
|
4968
4952
|
}
|
4969
4953
|
getLabel() {
|
4970
|
-
return this.ctx.getInsertTextForName(this.
|
4954
|
+
return this.ctx.getInsertTextForName(this.func.getName());
|
4971
4955
|
}
|
4972
4956
|
getCompletionItemKind() {
|
4973
|
-
switch (this.
|
4957
|
+
switch (this.func.subkind) {
|
4974
4958
|
case "package":
|
4975
|
-
return 8 /*
|
4976
|
-
case "
|
4977
|
-
return 3 /*
|
4959
|
+
return 8 /* PackageFunction */;
|
4960
|
+
case "method":
|
4961
|
+
return 3 /* Method */;
|
4978
4962
|
case "nested":
|
4979
|
-
return 11 /*
|
4963
|
+
return 11 /* NestedFunction */;
|
4980
4964
|
default:
|
4981
|
-
Debug.never(this.
|
4965
|
+
Debug.never(this.func);
|
4982
4966
|
}
|
4983
4967
|
}
|
4984
4968
|
getDetails() {
|
4985
|
-
return this.displayService.
|
4986
|
-
new
|
4969
|
+
return this.displayService.displayFunctionDeclaration(
|
4970
|
+
new FunctionDeclaration_entity(this.func, Localization.Original.ofEntity(this.func))
|
4987
4971
|
);
|
4988
4972
|
}
|
4989
4973
|
getInsertText() {
|
4990
|
-
const displayParts = this.displayService.
|
4991
|
-
new
|
4974
|
+
const displayParts = this.displayService.getFunctionDeclarationDisplayParts(
|
4975
|
+
new FunctionDeclaration_entity(this.func, Localization.Original.ofEntity(this.func))
|
4992
4976
|
);
|
4993
|
-
const keywordWithWhitespace = this.
|
4977
|
+
const keywordWithWhitespace = this.includeFunctionKeyword ? displayParts.functionKeyword + displayParts.whitespaceAfterFunctionKeyword : "";
|
4994
4978
|
const valueParameters = displayParts.valueParameters.map((p) => p.name).join(displayParts.typeParameterSeparator);
|
4995
4979
|
return keywordWithWhitespace + displayParts.name + displayParts.typeParametersStart + displayParts.typeParameters.join(displayParts.typeParameterSeparator) + displayParts.typeParametersEnd + displayParts.valueParametersStart + valueParameters + displayParts.valueParametersEnd;
|
4996
4980
|
}
|
@@ -5016,8 +5000,8 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
5016
5000
|
switch (this.typeEntity.typeEntityKind) {
|
5017
5001
|
case 3 /* Variant */:
|
5018
5002
|
return 16 /* VariantType */;
|
5019
|
-
case 0 /*
|
5020
|
-
return 18 /*
|
5003
|
+
case 0 /* Function */:
|
5004
|
+
return 18 /* FunctionType */;
|
5021
5005
|
case 1 /* Structured */: {
|
5022
5006
|
if (this.typeEntity.isRefObject()) {
|
5023
5007
|
return 13 /* RefObjectType */;
|
@@ -5052,9 +5036,9 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
5052
5036
|
return new TypeDeclaration_variant(
|
5053
5037
|
new TypeDeclarationVariant_entity(this.typeEntity, localization)
|
5054
5038
|
);
|
5055
|
-
case 0 /*
|
5056
|
-
return new
|
5057
|
-
new
|
5039
|
+
case 0 /* Function */:
|
5040
|
+
return new TypeDeclaration_function(
|
5041
|
+
new TypeDeclarationFunction_entity(this.typeEntity, localization)
|
5058
5042
|
);
|
5059
5043
|
case 1 /* Structured */:
|
5060
5044
|
return new TypeDeclaration_structured(
|
@@ -5072,7 +5056,7 @@ var AliasesSourcePackageTypeCompletionItemInfo = class {
|
|
5072
5056
|
return void 0;
|
5073
5057
|
}
|
5074
5058
|
};
|
5075
|
-
var
|
5059
|
+
var AliasesSourceIndexerCompletionItemInfo = class {
|
5076
5060
|
constructor(ctx, indexer, displayService) {
|
5077
5061
|
this.ctx = ctx;
|
5078
5062
|
this.indexer = indexer;
|
@@ -5091,7 +5075,7 @@ var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
|
5091
5075
|
return this.label;
|
5092
5076
|
}
|
5093
5077
|
getCompletionItemKind() {
|
5094
|
-
return 5 /*
|
5078
|
+
return 5 /* Indexer */;
|
5095
5079
|
}
|
5096
5080
|
getDetails() {
|
5097
5081
|
return this.label;
|
@@ -5107,7 +5091,7 @@ var AliasesSourceTypeIndexerCompletionItemInfo = class {
|
|
5107
5091
|
return void 0;
|
5108
5092
|
}
|
5109
5093
|
};
|
5110
|
-
var
|
5094
|
+
var AliasesSourceConstructorCompletionItemInfo = class {
|
5111
5095
|
constructor(ctx, constructor_, includeOnCreateKeyword, displayService) {
|
5112
5096
|
this.ctx = ctx;
|
5113
5097
|
this.constructor_ = constructor_;
|
@@ -5131,7 +5115,7 @@ var AliasesSourceTypeConstructorCompletionItemInfo = class {
|
|
5131
5115
|
return this.label;
|
5132
5116
|
}
|
5133
5117
|
getCompletionItemKind() {
|
5134
|
-
return 6 /*
|
5118
|
+
return 6 /* Constructor */;
|
5135
5119
|
}
|
5136
5120
|
getDetails() {
|
5137
5121
|
return this.label;
|
@@ -5263,7 +5247,7 @@ var SyntaxContextFactory = class {
|
|
5263
5247
|
if (positionDescription.kind === "after-token-or-keyword") {
|
5264
5248
|
isUnqualifiedTypeContext = this.isUnqualifiedTypeContext(positionDescription.tokenOrKeyword);
|
5265
5249
|
}
|
5266
|
-
const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(35 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind ===
|
5250
|
+
const isUnqualifiedTagNameCompletionContext = positionDescription.kind === "after-token-or-keyword" && positionDescription.tokenOrKeyword.isToken(35 /* HashSign */) && positionDescription.tokenOrKeyword.parent.kind === 147 /* Tag */;
|
5267
5251
|
let isTopLevelTranslationListContext;
|
5268
5252
|
if (positionDescription.kind === "after-token-or-keyword") {
|
5269
5253
|
isTopLevelTranslationListContext = this.isTopLevelTranslationListContext(positionDescription.tokenOrKeyword);
|
@@ -5289,52 +5273,52 @@ var SyntaxContextFactory = class {
|
|
5289
5273
|
}
|
5290
5274
|
static isExpressionOrStatementContext(tokenOrKeyword) {
|
5291
5275
|
if (tokenOrKeyword.isToken(57 /* Equals */)) {
|
5292
|
-
if (tokenOrKeyword.parent.kind ===
|
5276
|
+
if (tokenOrKeyword.parent.kind === 91 /* AssignmentStatement */) {
|
5293
5277
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5294
5278
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5295
5279
|
}
|
5296
|
-
if (tokenOrKeyword.parent.kind ===
|
5280
|
+
if (tokenOrKeyword.parent.kind === 59 /* LocalVariableDeclaration */) {
|
5297
5281
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5298
5282
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5299
5283
|
}
|
5300
|
-
if (tokenOrKeyword.parent.kind ===
|
5284
|
+
if (tokenOrKeyword.parent.kind === 35 /* PackageVariableDeclaration */) {
|
5301
5285
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5302
5286
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5303
5287
|
}
|
5304
|
-
if (tokenOrKeyword.parent.kind ===
|
5288
|
+
if (tokenOrKeyword.parent.kind === 54 /* FieldDeclaration */) {
|
5305
5289
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.initializer);
|
5306
5290
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5307
5291
|
}
|
5308
|
-
if (tokenOrKeyword.parent.kind ===
|
5292
|
+
if (tokenOrKeyword.parent.kind === 144 /* ParameterDeclaration */) {
|
5309
5293
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.defaultValue);
|
5310
5294
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5311
5295
|
}
|
5312
|
-
if (tokenOrKeyword.parent.kind ===
|
5296
|
+
if (tokenOrKeyword.parent.kind === 145 /* Argument */) {
|
5313
5297
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5314
5298
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5315
5299
|
}
|
5316
|
-
if (tokenOrKeyword.parent.kind ===
|
5300
|
+
if (tokenOrKeyword.parent.kind === 142 /* VariantDeclaration */) {
|
5317
5301
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.value);
|
5318
5302
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5319
5303
|
}
|
5320
5304
|
}
|
5321
|
-
if (tokenOrKeyword.parent.kind ===
|
5305
|
+
if (tokenOrKeyword.parent.kind === 91 /* AssignmentStatement */) {
|
5322
5306
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5323
5307
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5324
5308
|
}
|
5325
|
-
if (tokenOrKeyword.parent.kind ===
|
5309
|
+
if (tokenOrKeyword.parent.kind === 77 /* PrefixUnaryExpression */) {
|
5326
5310
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.operand);
|
5327
5311
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5328
5312
|
}
|
5329
|
-
if (tokenOrKeyword.parent.kind ===
|
5313
|
+
if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5330
5314
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.right);
|
5331
5315
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5332
5316
|
}
|
5333
|
-
if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && tokenOrKeyword.parent.kind ===
|
5317
|
+
if (tokenOrKeyword.isToken(7 /* TextTemplateHead */) && tokenOrKeyword.parent.kind === 81 /* TextTemplateLiteral */) {
|
5334
5318
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.spanList.spans.at(0)?.expression);
|
5335
5319
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5336
5320
|
}
|
5337
|
-
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind ===
|
5321
|
+
if (tokenOrKeyword.isToken(8 /* TextTemplatePart */) && tokenOrKeyword.parent.kind === 83 /* TextTemplateSpan */) {
|
5338
5322
|
let expressionForTargetType;
|
5339
5323
|
const spanList = tokenOrKeyword.parent.parent;
|
5340
5324
|
const spanIndex = spanList.spans.indexOf(tokenOrKeyword.parent);
|
@@ -5346,12 +5330,12 @@ var SyntaxContextFactory = class {
|
|
5346
5330
|
isStatementContext: false
|
5347
5331
|
};
|
5348
5332
|
}
|
5349
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5333
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 93 /* StatementBlock */) {
|
5350
5334
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5351
5335
|
}
|
5352
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5336
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 94 /* FunctionBlock */) {
|
5353
5337
|
const block = tokenOrKeyword.parent;
|
5354
|
-
if (block.expressionOrStatementList.kind !==
|
5338
|
+
if (block.expressionOrStatementList.kind !== 92 /* StatementList */ || block.expressionOrStatementList.statements.count() === 0) {
|
5355
5339
|
return {
|
5356
5340
|
isExpressionContext: { expressionRole: new ExpressionRole_functionBlockExpression(block) },
|
5357
5341
|
isStatementContext: true
|
@@ -5363,27 +5347,27 @@ var SyntaxContextFactory = class {
|
|
5363
5347
|
};
|
5364
5348
|
}
|
5365
5349
|
}
|
5366
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5350
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 92 /* StatementList */) {
|
5367
5351
|
return { isExpressionContext: { expressionRole: new ExpressionRole_other(void 0) }, isStatementContext: true };
|
5368
5352
|
}
|
5369
5353
|
if (tokenOrKeyword.isToken(44 /* OpenParenthesis */)) {
|
5370
|
-
if (tokenOrKeyword.parent.kind ===
|
5354
|
+
if (tokenOrKeyword.parent.kind === 75 /* ParenthesizedExpression */) {
|
5371
5355
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5372
5356
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5373
5357
|
}
|
5374
|
-
if (tokenOrKeyword.parent.kind ===
|
5358
|
+
if (tokenOrKeyword.parent.kind === 79 /* ReferenceExpression */) {
|
5375
5359
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5376
5360
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5377
5361
|
}
|
5378
|
-
if (tokenOrKeyword.parent.kind ===
|
5362
|
+
if (tokenOrKeyword.parent.kind === 69 /* CallExpression */) {
|
5379
5363
|
const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
|
5380
5364
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5381
5365
|
}
|
5382
|
-
if (tokenOrKeyword.parent.kind ===
|
5366
|
+
if (tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5383
5367
|
const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
|
5384
5368
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5385
5369
|
}
|
5386
|
-
if (tokenOrKeyword.parent.kind ===
|
5370
|
+
if (tokenOrKeyword.parent.kind === 147 /* Tag */) {
|
5387
5371
|
const argumentList = tokenOrKeyword.parent.argumentList;
|
5388
5372
|
if (argumentList !== void 0) {
|
5389
5373
|
const expressionRole = new ExpressionRole_argument(argumentList, 0);
|
@@ -5391,16 +5375,16 @@ var SyntaxContextFactory = class {
|
|
5391
5375
|
}
|
5392
5376
|
}
|
5393
5377
|
}
|
5394
|
-
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind ===
|
5378
|
+
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 71 /* IndexedAccessExpression */) {
|
5395
5379
|
const expressionRole = new ExpressionRole_argument(tokenOrKeyword.parent.argumentList, 0);
|
5396
5380
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5397
5381
|
}
|
5398
|
-
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind ===
|
5382
|
+
if (tokenOrKeyword.isToken(45 /* OpenSquareBracket */) && tokenOrKeyword.parent.kind === 61 /* ArrayLiteral */) {
|
5399
5383
|
const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent);
|
5400
5384
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5401
5385
|
}
|
5402
5386
|
if (tokenOrKeyword.isToken(24 /* Comma */)) {
|
5403
|
-
if (tokenOrKeyword.parent.kind ===
|
5387
|
+
if (tokenOrKeyword.parent.kind === 68 /* ArgumentList */) {
|
5404
5388
|
const argumentList = tokenOrKeyword.parent;
|
5405
5389
|
let index = 0;
|
5406
5390
|
for (const element of argumentList.elements) {
|
@@ -5414,64 +5398,64 @@ var SyntaxContextFactory = class {
|
|
5414
5398
|
const expressionRole = new ExpressionRole_argument(argumentList, index);
|
5415
5399
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5416
5400
|
}
|
5417
|
-
if (tokenOrKeyword.parent.kind ===
|
5401
|
+
if (tokenOrKeyword.parent.kind === 120 /* MatchExpressionList */) {
|
5418
5402
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent.parent);
|
5419
5403
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5420
5404
|
}
|
5421
|
-
if (tokenOrKeyword.parent.kind ===
|
5405
|
+
if (tokenOrKeyword.parent.kind === 62 /* ArrayLiteralElementList */) {
|
5422
5406
|
const expressionRole = new ExpressionRole_arrayElement(tokenOrKeyword.parent.parent);
|
5423
5407
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5424
5408
|
}
|
5425
5409
|
}
|
5426
|
-
if (tokenOrKeyword.isKeyword(45 /* Case */) && tokenOrKeyword.parent.kind ===
|
5410
|
+
if (tokenOrKeyword.isKeyword(45 /* Case */) && tokenOrKeyword.parent.kind === 121 /* CaseClause */) {
|
5427
5411
|
const expressionRole = new ExpressionRole_matchListElement(tokenOrKeyword.parent.parent.parent);
|
5428
5412
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5429
5413
|
}
|
5430
|
-
if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind ===
|
5414
|
+
if (tokenOrKeyword.isKeyword(15 /* Return */) && tokenOrKeyword.parent.kind === 117 /* ReturnStatement */) {
|
5431
5415
|
const expressionRole = new ExpressionRole_returnedValue(tokenOrKeyword.parent);
|
5432
5416
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5433
5417
|
}
|
5434
|
-
if (tokenOrKeyword.isKeyword(20 /* Error */) && tokenOrKeyword.parent.kind ===
|
5418
|
+
if (tokenOrKeyword.isKeyword(20 /* Error */) && tokenOrKeyword.parent.kind === 104 /* ErrorStatement */) {
|
5435
5419
|
const expressionRole = new ExpressionRole_errorValue(tokenOrKeyword.parent);
|
5436
5420
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5437
5421
|
}
|
5438
|
-
if (tokenOrKeyword.isKeyword(19 /* Important */) && tokenOrKeyword.parent.kind ===
|
5422
|
+
if (tokenOrKeyword.isKeyword(19 /* Important */) && tokenOrKeyword.parent.kind === 105 /* ImportantStatement */) {
|
5439
5423
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5440
5424
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5441
5425
|
}
|
5442
|
-
if (tokenOrKeyword.isKeyword(44 /* Switch */) && tokenOrKeyword.parent.kind ===
|
5426
|
+
if (tokenOrKeyword.isKeyword(44 /* Switch */) && tokenOrKeyword.parent.kind === 119 /* SwitchStatement */) {
|
5443
5427
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5444
5428
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5445
5429
|
}
|
5446
|
-
if (tokenOrKeyword.isKeyword(13 /* If */) && tokenOrKeyword.parent.kind ===
|
5430
|
+
if (tokenOrKeyword.isKeyword(13 /* If */) && tokenOrKeyword.parent.kind === 109 /* IfStatement */) {
|
5447
5431
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5448
5432
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5449
5433
|
}
|
5450
|
-
if (tokenOrKeyword.isKeyword(11 /* ElseIf */) && tokenOrKeyword.parent.kind ===
|
5434
|
+
if (tokenOrKeyword.isKeyword(11 /* ElseIf */) && tokenOrKeyword.parent.kind === 111 /* ElseIfClause */) {
|
5451
5435
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5452
5436
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5453
5437
|
}
|
5454
|
-
if (tokenOrKeyword.isKeyword(9 /* From */) && tokenOrKeyword.parent.kind ===
|
5438
|
+
if (tokenOrKeyword.isKeyword(9 /* From */) && tokenOrKeyword.parent.kind === 108 /* ForStatement */) {
|
5455
5439
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.enumeratedExpression);
|
5456
5440
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5457
5441
|
}
|
5458
|
-
if (tokenOrKeyword.isKeyword(25 /* While */) && tokenOrKeyword.parent.kind ===
|
5442
|
+
if (tokenOrKeyword.isKeyword(25 /* While */) && tokenOrKeyword.parent.kind === 122 /* WhileStatement */) {
|
5459
5443
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5460
5444
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5461
5445
|
}
|
5462
|
-
if (tokenOrKeyword.isKeyword(27 /* RepeatWhile */) && tokenOrKeyword.parent.kind ===
|
5446
|
+
if (tokenOrKeyword.isKeyword(27 /* RepeatWhile */) && tokenOrKeyword.parent.kind === 116 /* LoopStatement */) {
|
5463
5447
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5464
5448
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5465
5449
|
}
|
5466
|
-
if (tokenOrKeyword.isKeyword(28 /* Yield */) && tokenOrKeyword.parent.kind ===
|
5450
|
+
if (tokenOrKeyword.isKeyword(28 /* Yield */) && tokenOrKeyword.parent.kind === 123 /* YieldStatement */) {
|
5467
5451
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.expression);
|
5468
5452
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5469
5453
|
}
|
5470
|
-
if (tokenOrKeyword.isKeyword(29 /* When */) && tokenOrKeyword.parent.kind ===
|
5454
|
+
if (tokenOrKeyword.isKeyword(29 /* When */) && tokenOrKeyword.parent.kind === 76 /* WhenTernaryExpression */) {
|
5471
5455
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.condition);
|
5472
5456
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5473
5457
|
}
|
5474
|
-
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind ===
|
5458
|
+
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 76 /* WhenTernaryExpression */) {
|
5475
5459
|
const expressionRole = new ExpressionRole_other(tokenOrKeyword.parent.secondExpression);
|
5476
5460
|
return { isExpressionContext: { expressionRole }, isStatementContext: false };
|
5477
5461
|
}
|
@@ -5490,52 +5474,58 @@ var SyntaxContextFactory = class {
|
|
5490
5474
|
if (tokenOrKeyword.isToken(51 /* Semicolon */) && (tokenOrKeyword.parent.kind === 2 /* PackageMemberDeclarationList */ || tokenOrKeyword.parent.kind === 4 /* PackageImportDirectiveList */)) {
|
5491
5475
|
return true;
|
5492
5476
|
}
|
5493
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
5477
|
+
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 */)) {
|
5494
5478
|
return true;
|
5495
5479
|
}
|
5496
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && (tokenOrKeyword.parent.kind ===
|
5480
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && (tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */ || tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */ || tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || tokenOrKeyword.parent.kind === 94 /* FunctionBlock */ && (tokenOrKeyword.parent.parent.kind === 25 /* PackageConstructorDeclaration */ || tokenOrKeyword.parent.parent.kind === 26 /* PackageEntryPointDeclaration */ || tokenOrKeyword.parent.parent.kind === 27 /* PackageFunctionDeclaration */))) {
|
5497
5481
|
return true;
|
5498
5482
|
}
|
5499
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5483
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 24 /* PackageMemberGroupDeclaration */) {
|
5500
5484
|
return true;
|
5501
5485
|
}
|
5502
|
-
if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 5 /* SinglePackageImportDirective */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
5486
|
+
if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 5 /* SinglePackageImportDirective */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 27 /* PackageFunctionDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 28 /* PackageFunctionTypeDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 22 /* PackageAliasTypeDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 35 /* PackageVariableDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5503
5487
|
tokenOrKeyword,
|
5504
|
-
|
5505
|
-
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
5488
|
+
36 /* PackageVariableGetterDeclaration */
|
5489
|
+
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 37 /* PackageVariableSetterDeclaration */)) {
|
5506
5490
|
return true;
|
5507
5491
|
}
|
5508
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
5492
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 149 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5509
5493
|
return true;
|
5510
5494
|
}
|
5511
|
-
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
5495
|
+
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 149 /* Modifier */ && NodeTypeUtils.isPackageMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5512
5496
|
return true;
|
5513
5497
|
}
|
5514
5498
|
return false;
|
5515
5499
|
}
|
5516
5500
|
static isTypeMemberDeclarationListContext(tokenOrKeyword) {
|
5517
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5501
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 31 /* TypeMemberDeclarationList */) {
|
5518
5502
|
return true;
|
5519
5503
|
}
|
5520
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5504
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 32 /* TypeMemberDeclarationBlock */) {
|
5521
5505
|
return true;
|
5522
5506
|
}
|
5523
|
-
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind ===
|
5507
|
+
if (tokenOrKeyword.isToken(20 /* CloseBrace */) && tokenOrKeyword.parent.kind === 44 /* TypeMemberGroupDeclaration */) {
|
5524
5508
|
return true;
|
5525
5509
|
}
|
5526
|
-
if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword,
|
5510
|
+
if (SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 54 /* FieldDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 55 /* FieldGetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(tokenOrKeyword, 56 /* FieldSetterDeclaration */) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5511
|
+
tokenOrKeyword,
|
5512
|
+
47 /* IndexedElementGetterDeclaration */
|
5513
|
+
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5527
5514
|
tokenOrKeyword,
|
5528
|
-
|
5515
|
+
48 /* IndexedElementSetterDeclaration */
|
5529
5516
|
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5530
5517
|
tokenOrKeyword,
|
5531
|
-
|
5532
|
-
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5518
|
+
50 /* DereferencedVariableGetterDeclaration */
|
5519
|
+
) || SyntaxContextUtils.tokenOrKeywordIsValidEndOfNode(
|
5520
|
+
tokenOrKeyword,
|
5521
|
+
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, 142 /* VariantDeclaration */)) {
|
5533
5523
|
return true;
|
5534
5524
|
}
|
5535
|
-
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind ===
|
5525
|
+
if (tokenOrKeyword.isKeyword() && tokenOrKeyword.parent.kind === 149 /* Modifier */ && tokenOrKeyword.value === tokenOrKeyword.parent.value && tokenOrKeyword.parent.openParenthesisToken === void 0 && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5536
5526
|
return true;
|
5537
5527
|
}
|
5538
|
-
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind ===
|
5528
|
+
if (tokenOrKeyword.isToken(21 /* CloseParenthesis */) && tokenOrKeyword.parent.kind === 149 /* Modifier */ && NodeTypeUtils.isTypeMemberDeclaration(tokenOrKeyword.parent.parent.parent)) {
|
5539
5529
|
return true;
|
5540
5530
|
}
|
5541
5531
|
return false;
|
@@ -5572,116 +5562,116 @@ var SyntaxContextFactory = class {
|
|
5572
5562
|
return result;
|
5573
5563
|
}
|
5574
5564
|
static isUnqualifiedTypeContext(tokenOrKeyword) {
|
5575
|
-
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind ===
|
5565
|
+
if (tokenOrKeyword.isToken(23 /* Colon */) && tokenOrKeyword.parent.kind === 156 /* TypeAnnotation */) {
|
5576
5566
|
return { allowsAnonymousTypes: true };
|
5577
5567
|
}
|
5578
|
-
if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind ===
|
5568
|
+
if ((tokenOrKeyword.isKeyword(4 /* Object */) || tokenOrKeyword.isKeyword(5 /* PlainObject */) || tokenOrKeyword.isKeyword(3 /* Aspect */)) && tokenOrKeyword.parent.kind === 34 /* StructuredTypeDeclarationBody */) {
|
5579
5569
|
return { allowsAnonymousTypes: false };
|
5580
5570
|
}
|
5581
|
-
if (tokenOrKeyword.isKeyword(16 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind ===
|
5571
|
+
if (tokenOrKeyword.isKeyword(16 /* Type */) && (NodeTypeUtils.isPackageTypeDeclaration(tokenOrKeyword.parent) || tokenOrKeyword.parent.kind === 40 /* TypeExtensionDeclaration */)) {
|
5582
5572
|
return { allowsAnonymousTypes: false };
|
5583
5573
|
}
|
5584
|
-
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind ===
|
5574
|
+
if (tokenOrKeyword.isToken(36 /* LessThan */) && tokenOrKeyword.parent.kind === 152 /* TypeArgumentClause */) {
|
5585
5575
|
return { allowsAnonymousTypes: true };
|
5586
5576
|
}
|
5587
|
-
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind ===
|
5588
|
-
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind ===
|
5577
|
+
if (tokenOrKeyword.isToken(24 /* Comma */) && (tokenOrKeyword.parent.kind === 30 /* BaseTypeList */ || tokenOrKeyword.parent.kind === 153 /* TypeArgumentList */)) {
|
5578
|
+
return { allowsAnonymousTypes: tokenOrKeyword.parent.kind === 153 /* TypeArgumentList */ };
|
5589
5579
|
}
|
5590
|
-
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind ===
|
5580
|
+
if (tokenOrKeyword.isToken(35 /* HashSign */) && tokenOrKeyword.parent.kind === 147 /* Tag */) {
|
5591
5581
|
return { allowsAnonymousTypes: false };
|
5592
5582
|
}
|
5593
|
-
if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind ===
|
5583
|
+
if ((tokenOrKeyword.isToken(23 /* Colon */) || tokenOrKeyword.isToken(57 /* Equals */)) && tokenOrKeyword.parent.kind === 143 /* TypeParameterDeclaration */) {
|
5594
5584
|
return { allowsAnonymousTypes: false };
|
5595
5585
|
}
|
5596
|
-
if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind ===
|
5586
|
+
if (tokenOrKeyword.isToken(57 /* Equals */) && tokenOrKeyword.parent.kind === 22 /* PackageAliasTypeDeclaration */) {
|
5597
5587
|
return { allowsAnonymousTypes: false };
|
5598
5588
|
}
|
5599
|
-
if (tokenOrKeyword.isKeyword(14 /* Is */) && tokenOrKeyword.parent.kind ===
|
5589
|
+
if (tokenOrKeyword.isKeyword(14 /* Is */) && tokenOrKeyword.parent.kind === 73 /* IsExpression */) {
|
5600
5590
|
return { allowsAnonymousTypes: true };
|
5601
5591
|
}
|
5602
|
-
if (tokenOrKeyword.isKeyword(42 /* As */) && tokenOrKeyword.parent.kind ===
|
5592
|
+
if (tokenOrKeyword.isKeyword(42 /* As */) && tokenOrKeyword.parent.kind === 65 /* AsExpression */) {
|
5603
5593
|
return { allowsAnonymousTypes: true };
|
5604
5594
|
}
|
5605
|
-
if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind ===
|
5595
|
+
if (tokenOrKeyword.isToken(17 /* Bar */) && tokenOrKeyword.parent.kind === 11 /* UnionTypeSpecifier */) {
|
5606
5596
|
return { allowsAnonymousTypes: false };
|
5607
5597
|
}
|
5608
|
-
if (tokenOrKeyword.isToken(10 /* Ampersand */) && tokenOrKeyword.parent.kind ===
|
5598
|
+
if (tokenOrKeyword.isToken(10 /* Ampersand */) && tokenOrKeyword.parent.kind === 12 /* IntersectionTypeSpecifier */) {
|
5609
5599
|
return { allowsAnonymousTypes: false };
|
5610
5600
|
}
|
5611
|
-
if (tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind ===
|
5601
|
+
if (tokenOrKeyword.isToken(44 /* OpenParenthesis */) && tokenOrKeyword.parent.kind === 13 /* ParenthesizedTypeSpecifier */) {
|
5612
5602
|
return { allowsAnonymousTypes: true };
|
5613
5603
|
}
|
5614
5604
|
return void 0;
|
5615
5605
|
}
|
5616
5606
|
static isTopLevelTranslationListContext(tokenOrKeyword) {
|
5617
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5607
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 20 /* TopLevelTranslationList */) {
|
5618
5608
|
return { translationsDeclaration: tokenOrKeyword.parent.parent };
|
5619
5609
|
}
|
5620
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5610
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 21 /* TranslationsDeclaration */) {
|
5621
5611
|
return { translationsDeclaration: tokenOrKeyword.parent };
|
5622
5612
|
}
|
5623
5613
|
const packageImport = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5624
5614
|
tokenOrKeyword,
|
5625
|
-
|
5615
|
+
134 /* PackageImportTranslation */
|
5626
5616
|
);
|
5627
5617
|
if (packageImport !== void 0) {
|
5628
5618
|
return { translationsDeclaration: packageImport.parent.parent };
|
5629
5619
|
}
|
5630
|
-
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5620
|
+
const type = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 139 /* TypeTranslation */);
|
5631
5621
|
if (type !== void 0) {
|
5632
5622
|
return { translationsDeclaration: type.parent.parent };
|
5633
5623
|
}
|
5634
|
-
const
|
5624
|
+
const functionType = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5635
5625
|
tokenOrKeyword,
|
5636
|
-
|
5626
|
+
133 /* FunctionTypeTranslation */
|
5637
5627
|
);
|
5638
|
-
if (
|
5639
|
-
return { translationsDeclaration:
|
5628
|
+
if (functionType !== void 0) {
|
5629
|
+
return { translationsDeclaration: functionType.parent.parent };
|
5640
5630
|
}
|
5641
5631
|
const variable = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5642
5632
|
tokenOrKeyword,
|
5643
|
-
|
5633
|
+
136 /* PackageVariableTranslation */
|
5644
5634
|
);
|
5645
5635
|
if (variable !== void 0) {
|
5646
5636
|
return { translationsDeclaration: variable.parent.parent };
|
5647
5637
|
}
|
5648
|
-
const
|
5638
|
+
const func = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5649
5639
|
tokenOrKeyword,
|
5650
|
-
|
5640
|
+
131 /* PackageFunctionTranslation */
|
5651
5641
|
);
|
5652
|
-
if (
|
5653
|
-
return { translationsDeclaration:
|
5642
|
+
if (func !== void 0) {
|
5643
|
+
return { translationsDeclaration: func.parent.parent };
|
5654
5644
|
}
|
5655
5645
|
return void 0;
|
5656
5646
|
}
|
5657
5647
|
static isTypeMemberTranslationListContext(tokenOrKeyword) {
|
5658
|
-
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind ===
|
5648
|
+
if (tokenOrKeyword.isToken(51 /* Semicolon */) && tokenOrKeyword.parent.kind === 138 /* TypeMemberTranslationList */) {
|
5659
5649
|
return { typeTranslation: tokenOrKeyword.parent.parent };
|
5660
5650
|
}
|
5661
|
-
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind ===
|
5651
|
+
if (tokenOrKeyword.isToken(43 /* OpenBrace */) && tokenOrKeyword.parent.kind === 139 /* TypeTranslation */) {
|
5662
5652
|
return { typeTranslation: tokenOrKeyword.parent };
|
5663
5653
|
}
|
5664
|
-
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword,
|
5654
|
+
const indexer = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(tokenOrKeyword, 128 /* IndexerTranslation */);
|
5665
5655
|
if (indexer !== void 0) {
|
5666
5656
|
return { typeTranslation: indexer.parent.parent };
|
5667
5657
|
}
|
5668
5658
|
const constructor = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5669
5659
|
tokenOrKeyword,
|
5670
|
-
|
5660
|
+
126 /* ConstructorTranslation */
|
5671
5661
|
);
|
5672
5662
|
if (constructor !== void 0) {
|
5673
5663
|
return { typeTranslation: constructor.parent.parent };
|
5674
5664
|
}
|
5675
5665
|
const variableOrVariant = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5676
5666
|
tokenOrKeyword,
|
5677
|
-
|
5667
|
+
137 /* FieldOrVariantTranslation */
|
5678
5668
|
);
|
5679
5669
|
if (variableOrVariant !== void 0) {
|
5680
5670
|
return { typeTranslation: variableOrVariant.parent.parent };
|
5681
5671
|
}
|
5682
5672
|
const method = SyntaxContextUtils.ifTokenIsValidEndOfNodeThenNode(
|
5683
5673
|
tokenOrKeyword,
|
5684
|
-
|
5674
|
+
132 /* MethodTranslation */
|
5685
5675
|
);
|
5686
5676
|
if (method !== void 0) {
|
5687
5677
|
return { typeTranslation: method.parent.parent };
|
@@ -5794,29 +5784,29 @@ var NodeSemanticInfoService = class {
|
|
5794
5784
|
static ofTokenOrKeyword(analyzer, tokenOrKeyword, options6) {
|
5795
5785
|
if (isIdentifier(tokenOrKeyword.value)) {
|
5796
5786
|
return this.ofNonKeywordIdentifier(analyzer, tokenOrKeyword.value, options6);
|
5797
|
-
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind ===
|
5787
|
+
} else if (tokenOrKeyword.isKeyword(2 /* Autotype */) && tokenOrKeyword.parent.kind === 70 /* AutotypeCallExpression */) {
|
5798
5788
|
return this.ofAutotypeCallExpression(analyzer, tokenOrKeyword.parent, options6);
|
5799
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5789
|
+
} else if (tokenOrKeyword.parent.kind === 77 /* PrefixUnaryExpression */) {
|
5800
5790
|
return this.ofPrefixUnaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5801
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5791
|
+
} else if (tokenOrKeyword.parent.kind === 66 /* BinaryExpression */) {
|
5802
5792
|
return this.ofBinaryExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5803
|
-
} else if (tokenOrKeyword.isToken(19 /* Caret */) && (tokenOrKeyword.parent.kind ===
|
5793
|
+
} else if (tokenOrKeyword.isToken(19 /* Caret */) && (tokenOrKeyword.parent.kind === 50 /* DereferencedVariableGetterDeclaration */ || tokenOrKeyword.parent.kind === 51 /* DereferencedVariableSetterDeclaration */)) {
|
5804
5794
|
return this.ofDereferenceOperatorDeclaration(analyzer, tokenOrKeyword.parent);
|
5805
|
-
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind ===
|
5795
|
+
} else if (tokenOrKeyword.isToken(19 /* Caret */) && tokenOrKeyword.parent.kind === 80 /* DereferenceExpression */) {
|
5806
5796
|
return this.ofDereferenceExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5807
|
-
} else if (tokenOrKeyword.parent.kind ===
|
5797
|
+
} else if (tokenOrKeyword.parent.kind === 91 /* AssignmentStatement */) {
|
5808
5798
|
return this.ofAssignmentStatementOperator(analyzer, tokenOrKeyword.parent, options6);
|
5809
|
-
} else if (tokenOrKeyword.isKeyword(30 /* Creation */) && tokenOrKeyword.parent.kind ===
|
5810
|
-
return this.
|
5811
|
-
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind ===
|
5799
|
+
} else if (tokenOrKeyword.isKeyword(30 /* Creation */) && tokenOrKeyword.parent.kind === 45 /* ConstructorDeclaration */) {
|
5800
|
+
return this.ofConstructorDeclaration(analyzer, tokenOrKeyword.parent);
|
5801
|
+
} else if (tokenOrKeyword.isToken(13 /* Asterisk */) && tokenOrKeyword.parent.kind === 90 /* DefaultMatchExpression */) {
|
5812
5802
|
return this.ofDefaultMatchExpression(analyzer, tokenOrKeyword.parent);
|
5813
|
-
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind ===
|
5803
|
+
} else if (tokenOrKeyword.isKeyword(4 /* Object */) && tokenOrKeyword.parent.kind === 86 /* ObjectExpression */) {
|
5814
5804
|
return this.ofObjectExpression(analyzer, tokenOrKeyword.parent, options6);
|
5815
|
-
} else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind ===
|
5805
|
+
} else if (tokenOrKeyword.isKeyword(56 /* Base */) && tokenOrKeyword.parent.kind === 87 /* BaseExpression */) {
|
5816
5806
|
return this.ofBaseExpression(analyzer, tokenOrKeyword.parent, options6);
|
5817
|
-
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind ===
|
5818
|
-
return this.
|
5819
|
-
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind ===
|
5807
|
+
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 49 /* IndexParameterClause */) {
|
5808
|
+
return this.ofIndexedElementAccessorDeclaration(analyzer, tokenOrKeyword.parent.parent);
|
5809
|
+
} else if ((tokenOrKeyword.isToken(45 /* OpenSquareBracket */) || tokenOrKeyword.isToken(22 /* CloseSquareBracket */)) && tokenOrKeyword.parent.kind === 71 /* IndexedAccessExpression */) {
|
5820
5810
|
return this.ofIndexedAccessExpressionOperator(analyzer, tokenOrKeyword.parent, options6);
|
5821
5811
|
}
|
5822
5812
|
return void 0;
|
@@ -5829,11 +5819,11 @@ var NodeSemanticInfoService = class {
|
|
5829
5819
|
let result;
|
5830
5820
|
const parent = node.parent;
|
5831
5821
|
switch (parent.kind) {
|
5832
|
-
case
|
5822
|
+
case 129 /* TranslationTypeParameterList */:
|
5833
5823
|
break;
|
5834
|
-
case
|
5824
|
+
case 124 /* TranslationParameterList */:
|
5835
5825
|
break;
|
5836
|
-
case
|
5826
|
+
case 145 /* Argument */: {
|
5837
5827
|
const respectiveParameter = analyzer.getRespectiveParameter(parent);
|
5838
5828
|
if (respectiveParameter !== void 0) {
|
5839
5829
|
const target = new SimpleWithLocalization(
|
@@ -5847,43 +5837,43 @@ var NodeSemanticInfoService = class {
|
|
5847
5837
|
}
|
5848
5838
|
break;
|
5849
5839
|
}
|
5850
|
-
case
|
5840
|
+
case 60 /* EnumerationVariableDeclaration */:
|
5851
5841
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofEnumerationVariableDeclaration(parent));
|
5852
5842
|
break;
|
5853
|
-
case
|
5843
|
+
case 101 /* ErrorVariableDeclaration */:
|
5854
5844
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofErrorVariableDeclaration(parent));
|
5855
5845
|
break;
|
5856
|
-
case
|
5846
|
+
case 22 /* PackageAliasTypeDeclaration */:
|
5857
5847
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageAliasTypeDeclaration(parent));
|
5858
5848
|
break;
|
5859
|
-
case
|
5860
|
-
result = new DefinitionNodeSemanticInfo(analyzer.entity.
|
5849
|
+
case 27 /* PackageFunctionDeclaration */:
|
5850
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageFunctionDeclaration(parent));
|
5861
5851
|
break;
|
5862
|
-
case
|
5863
|
-
result = new DefinitionNodeSemanticInfo(analyzer.entity.
|
5852
|
+
case 28 /* PackageFunctionTypeDeclaration */:
|
5853
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageFunctionTypeDeclaration(parent));
|
5864
5854
|
break;
|
5865
|
-
case
|
5855
|
+
case 33 /* PackageStructuredTypeDeclaration */:
|
5866
5856
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageStructuredTypeDeclaration(parent));
|
5867
5857
|
break;
|
5868
|
-
case
|
5858
|
+
case 35 /* PackageVariableDeclaration */:
|
5869
5859
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariableDeclaration(parent));
|
5870
5860
|
break;
|
5871
|
-
case
|
5861
|
+
case 38 /* PackageVariantTypeDeclaration */:
|
5872
5862
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageVariantTypeDeclaration(parent));
|
5873
5863
|
break;
|
5874
|
-
case
|
5864
|
+
case 88 /* IdentifierExpression */:
|
5875
5865
|
result = this.ofIdentifierExpression(analyzer, parent, options6);
|
5876
5866
|
break;
|
5877
|
-
case
|
5878
|
-
result = new DefinitionNodeSemanticInfo(analyzer.entity.
|
5867
|
+
case 58 /* NestedFunctionDeclaration */:
|
5868
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofNestedFunctionDeclaration(parent));
|
5879
5869
|
break;
|
5880
|
-
case
|
5870
|
+
case 59 /* LocalVariableDeclaration */:
|
5881
5871
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofLocalVariableDeclaration(parent));
|
5882
5872
|
break;
|
5883
|
-
case
|
5873
|
+
case 135 /* QualifiedName */:
|
5884
5874
|
result = this.ofQualifiedNameQualifier(analyzer, parent, node, options6);
|
5885
5875
|
break;
|
5886
|
-
case
|
5876
|
+
case 136 /* PackageVariableTranslation */: {
|
5887
5877
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5888
5878
|
const getTargetResult = translationPackage?.getPackageVariableTranslationTarget(parent);
|
5889
5879
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5903,9 +5893,9 @@ var NodeSemanticInfoService = class {
|
|
5903
5893
|
}
|
5904
5894
|
break;
|
5905
5895
|
}
|
5906
|
-
case
|
5896
|
+
case 137 /* FieldOrVariantTranslation */: {
|
5907
5897
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5908
|
-
const getTargetsResult = translationPackage?.
|
5898
|
+
const getTargetsResult = translationPackage?.getFieldOrVariantTranslationTargets(parent);
|
5909
5899
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
5910
5900
|
if (node === parent.sourceName) {
|
5911
5901
|
const targets = getTargetsResult.targets.map((t) => new SimpleWithLocalization(
|
@@ -5927,9 +5917,9 @@ var NodeSemanticInfoService = class {
|
|
5927
5917
|
}
|
5928
5918
|
break;
|
5929
5919
|
}
|
5930
|
-
case
|
5920
|
+
case 131 /* PackageFunctionTranslation */: {
|
5931
5921
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5932
|
-
const getTargetsResult = translationPackage?.
|
5922
|
+
const getTargetsResult = translationPackage?.getPackageFunctionTranslationTargets(parent);
|
5933
5923
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
5934
5924
|
if (node === parent.sourceName) {
|
5935
5925
|
const targets = getTargetsResult.targets.map((t) => new SimpleWithLocalization(
|
@@ -5951,9 +5941,9 @@ var NodeSemanticInfoService = class {
|
|
5951
5941
|
}
|
5952
5942
|
break;
|
5953
5943
|
}
|
5954
|
-
case
|
5944
|
+
case 132 /* MethodTranslation */: {
|
5955
5945
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5956
|
-
const getTargetsResult = translationPackage?.
|
5946
|
+
const getTargetsResult = translationPackage?.getMethodTranslationTargets(parent);
|
5957
5947
|
if (translationPackage !== void 0 && isNonEmptyArray(getTargetsResult?.targets)) {
|
5958
5948
|
if (node === parent.sourceName) {
|
5959
5949
|
const targets = getTargetsResult.targets.map((t) => new SimpleWithLocalization(
|
@@ -5975,7 +5965,7 @@ var NodeSemanticInfoService = class {
|
|
5975
5965
|
}
|
5976
5966
|
break;
|
5977
5967
|
}
|
5978
|
-
case
|
5968
|
+
case 139 /* TypeTranslation */: {
|
5979
5969
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
5980
5970
|
const getTargetResult = translationPackage?.getTypeTranslationTarget(parent);
|
5981
5971
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
@@ -5995,9 +5985,9 @@ var NodeSemanticInfoService = class {
|
|
5995
5985
|
}
|
5996
5986
|
break;
|
5997
5987
|
}
|
5998
|
-
case
|
5988
|
+
case 133 /* FunctionTypeTranslation */: {
|
5999
5989
|
const translationPackage = this.getContainingTranslationPackage(analyzer, node);
|
6000
|
-
const getTargetResult = translationPackage?.
|
5990
|
+
const getTargetResult = translationPackage?.getFunctionTypeTranslationTarget(parent);
|
6001
5991
|
if (translationPackage !== void 0 && getTargetResult?.target !== void 0) {
|
6002
5992
|
if (node === parent.sourceName) {
|
6003
5993
|
const target = new SimpleWithLocalization(
|
@@ -6015,40 +6005,40 @@ var NodeSemanticInfoService = class {
|
|
6015
6005
|
}
|
6016
6006
|
break;
|
6017
6007
|
}
|
6018
|
-
case
|
6008
|
+
case 144 /* ParameterDeclaration */:
|
6019
6009
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofParameterDeclaration(parent));
|
6020
6010
|
break;
|
6021
6011
|
case 8 /* PackageImport */:
|
6022
6012
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofPackageImport(parent));
|
6023
6013
|
break;
|
6024
|
-
case 9 /*
|
6014
|
+
case 9 /* PackageName */:
|
6025
6015
|
result = void 0;
|
6026
6016
|
break;
|
6027
|
-
case
|
6017
|
+
case 78 /* MemberAccessExpression */:
|
6028
6018
|
result = this.ofProperty(analyzer, parent, options6);
|
6029
6019
|
break;
|
6030
|
-
case
|
6031
|
-
result = new DefinitionNodeSemanticInfo(analyzer.entity.
|
6020
|
+
case 52 /* MethodDeclaration */:
|
6021
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofMethodDeclaration(parent));
|
6032
6022
|
break;
|
6033
|
-
case
|
6023
|
+
case 53 /* OperatorDeclaration */:
|
6034
6024
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofOperatorDeclaration(parent));
|
6035
6025
|
break;
|
6036
|
-
case
|
6037
|
-
result = new DefinitionNodeSemanticInfo(analyzer.entity.
|
6026
|
+
case 54 /* FieldDeclaration */:
|
6027
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofFieldDeclaration(parent));
|
6038
6028
|
break;
|
6039
|
-
case
|
6029
|
+
case 143 /* TypeParameterDeclaration */:
|
6040
6030
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofTypeParameterDeclaration(parent));
|
6041
6031
|
break;
|
6042
|
-
case
|
6032
|
+
case 142 /* VariantDeclaration */:
|
6043
6033
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofVariantDeclaration(parent));
|
6044
6034
|
break;
|
6045
|
-
case
|
6046
|
-
case
|
6035
|
+
case 36 /* PackageVariableGetterDeclaration */:
|
6036
|
+
case 37 /* PackageVariableSetterDeclaration */:
|
6047
6037
|
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofComputedPackageVariableDeclaration(parent));
|
6048
6038
|
break;
|
6049
|
-
case
|
6050
|
-
case
|
6051
|
-
result = new DefinitionNodeSemanticInfo(analyzer.entity.
|
6039
|
+
case 55 /* FieldGetterDeclaration */:
|
6040
|
+
case 56 /* FieldSetterDeclaration */:
|
6041
|
+
result = new DefinitionNodeSemanticInfo(analyzer.entity.ofComputedFieldDeclaration(parent));
|
6052
6042
|
break;
|
6053
6043
|
case 3 /* Keyword */:
|
6054
6044
|
break;
|
@@ -6060,14 +6050,14 @@ var NodeSemanticInfoService = class {
|
|
6060
6050
|
}
|
6061
6051
|
static ofProperty(analyzer, node, options6) {
|
6062
6052
|
let result;
|
6063
|
-
const meaning = analyzer.
|
6053
|
+
const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
|
6064
6054
|
switch (meaning.kind) {
|
6065
6055
|
case "instance-variable-access": {
|
6066
6056
|
let narrowedType;
|
6067
6057
|
if (isNarrowableReferenceExpression(node)) {
|
6068
6058
|
narrowedType = analyzer.type.ofExpression(node);
|
6069
6059
|
}
|
6070
|
-
const target = new SimpleWithLocalization(new
|
6060
|
+
const target = new SimpleWithLocalization(new FieldReferenceTarget(
|
6071
6061
|
meaning.variable.value,
|
6072
6062
|
meaning.accessKind,
|
6073
6063
|
narrowedType
|
@@ -6080,7 +6070,7 @@ var NodeSemanticInfoService = class {
|
|
6080
6070
|
if (isNarrowableReferenceExpression(node)) {
|
6081
6071
|
narrowedType = analyzer.type.ofExpression(node);
|
6082
6072
|
}
|
6083
|
-
const target = new SimpleWithLocalization(new
|
6073
|
+
const target = new SimpleWithLocalization(new FieldReferenceTarget(
|
6084
6074
|
meaning.variable.value,
|
6085
6075
|
meaning.accessKind,
|
6086
6076
|
narrowedType
|
@@ -6102,17 +6092,17 @@ var NodeSemanticInfoService = class {
|
|
6102
6092
|
break;
|
6103
6093
|
}
|
6104
6094
|
case "instance-method-access":
|
6105
|
-
if (isNonEmptyArray(meaning.
|
6106
|
-
result =
|
6095
|
+
if (isNonEmptyArray(meaning.suitableFunctions)) {
|
6096
|
+
result = createAccessedFunctionsReference(meaning.suitableFunctions, meaning.suitableFunctions.length > 1);
|
6107
6097
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
6108
|
-
result =
|
6098
|
+
result = createAccessedFunctionsReference(meaning.candidates, true);
|
6109
6099
|
}
|
6110
6100
|
break;
|
6111
6101
|
case "static-method-access":
|
6112
|
-
if (isNonEmptyArray(meaning.
|
6113
|
-
result =
|
6102
|
+
if (isNonEmptyArray(meaning.suitableFunctions)) {
|
6103
|
+
result = createAccessedFunctionsReference(meaning.suitableFunctions, meaning.suitableFunctions.length > 1);
|
6114
6104
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
6115
|
-
result =
|
6105
|
+
result = createAccessedFunctionsReference(meaning.candidates, true);
|
6116
6106
|
}
|
6117
6107
|
break;
|
6118
6108
|
case "operator-access": {
|
@@ -6123,11 +6113,11 @@ var NodeSemanticInfoService = class {
|
|
6123
6113
|
}
|
6124
6114
|
break;
|
6125
6115
|
}
|
6126
|
-
case "package-
|
6127
|
-
if (isNonEmptyArray(meaning.
|
6128
|
-
result =
|
6116
|
+
case "package-function-access":
|
6117
|
+
if (isNonEmptyArray(meaning.suitableFunctions)) {
|
6118
|
+
result = createAccessedFunctionsReference(meaning.suitableFunctions, meaning.suitableFunctions.length > 1);
|
6129
6119
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
6130
|
-
result =
|
6120
|
+
result = createAccessedFunctionsReference(meaning.candidates, true);
|
6131
6121
|
}
|
6132
6122
|
break;
|
6133
6123
|
case "package-type-access":
|
@@ -6162,8 +6152,8 @@ var NodeSemanticInfoService = class {
|
|
6162
6152
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
6163
6153
|
}
|
6164
6154
|
return result;
|
6165
|
-
function
|
6166
|
-
const targets =
|
6155
|
+
function createAccessedFunctionsReference(functions, isAmbiguous) {
|
6156
|
+
const targets = functions.map((o) => new SimpleWithLocalization(new AccessedFunctionReferenceTarget(o.value), o.localization));
|
6167
6157
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6168
6158
|
}
|
6169
6159
|
function createOperatorsReference(operators, isAmbiguous) {
|
@@ -6175,10 +6165,10 @@ var NodeSemanticInfoService = class {
|
|
6175
6165
|
switch (node.parent.kind) {
|
6176
6166
|
case 10 /* NamedTypeSpecifier */:
|
6177
6167
|
return this.ofNamedTypeSpecifierNameQualifier(analyzer, node.parent, qualifier, options6);
|
6178
|
-
case
|
6168
|
+
case 147 /* Tag */:
|
6179
6169
|
return this.ofTagNameQualifier(analyzer, node.parent, qualifier, options6);
|
6180
|
-
case
|
6181
|
-
case
|
6170
|
+
case 42 /* ExtendedTypeClause */:
|
6171
|
+
case 134 /* PackageImportTranslation */:
|
6182
6172
|
return void 0;
|
6183
6173
|
default:
|
6184
6174
|
Debug.never(node.parent);
|
@@ -6260,18 +6250,18 @@ var NodeSemanticInfoService = class {
|
|
6260
6250
|
}
|
6261
6251
|
} else {
|
6262
6252
|
if (resolutionResult.meaning.suitableConstructors.length > 0) {
|
6263
|
-
const targets = resolutionResult.meaning.suitableConstructors.map((t) => new SimpleWithLocalization(new
|
6253
|
+
const targets = resolutionResult.meaning.suitableConstructors.map((t) => new SimpleWithLocalization(new ConstructorReferenceTarget(t.value), t.localization));
|
6264
6254
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
6265
6255
|
} else if (resolutionResult.meaning.candidates.length > 0) {
|
6266
|
-
const targets = resolutionResult.meaning.candidates.map((t) => new SimpleWithLocalization(new
|
6256
|
+
const targets = resolutionResult.meaning.candidates.map((t) => new SimpleWithLocalization(new ConstructorReferenceTarget(t.value), t.localization));
|
6267
6257
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
6268
6258
|
}
|
6269
6259
|
}
|
6270
6260
|
break;
|
6271
6261
|
}
|
6272
|
-
case "
|
6273
|
-
if (resolvedQualifier.
|
6274
|
-
const targets = resolvedQualifier.
|
6262
|
+
case "function":
|
6263
|
+
if (resolvedQualifier.suitableFunctions.length > 0) {
|
6264
|
+
const targets = resolvedQualifier.suitableFunctions.map((t) => new SimpleWithLocalization(new EntityReferenceTarget(t.value, 0 /* Get */), t.localization));
|
6275
6265
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
6276
6266
|
} else if (resolvedQualifier.candidates.length > 0) {
|
6277
6267
|
const targets = resolvedQualifier.candidates.map((t) => new SimpleWithLocalization(new EntityReferenceTarget(t.value, 0 /* Get */), t.localization));
|
@@ -6338,11 +6328,11 @@ var NodeSemanticInfoService = class {
|
|
6338
6328
|
result = this.ofMaybeConstructorCallExpression(analyzer, meaning.suitableTypes, node, options6);
|
6339
6329
|
}
|
6340
6330
|
break;
|
6341
|
-
case "
|
6342
|
-
if (isNonEmptyArray(meaning.
|
6343
|
-
result =
|
6331
|
+
case "function-access":
|
6332
|
+
if (isNonEmptyArray(meaning.suitableFunctions)) {
|
6333
|
+
result = createAccessedFunctionsReference(meaning.suitableFunctions, meaning.suitableFunctions.length > 1);
|
6344
6334
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
6345
|
-
result =
|
6335
|
+
result = createAccessedFunctionsReference(meaning.candidates, true);
|
6346
6336
|
}
|
6347
6337
|
break;
|
6348
6338
|
case "operator-access": {
|
@@ -6367,7 +6357,7 @@ var NodeSemanticInfoService = class {
|
|
6367
6357
|
result = new ReferenceNodeSemanticInfo([target], false);
|
6368
6358
|
} else if (variable.value.kind === "type-member") {
|
6369
6359
|
const target = new SimpleWithLocalization(
|
6370
|
-
new
|
6360
|
+
new FieldReferenceTarget(variable.value.value, meaning.accessKind, narrowedType),
|
6371
6361
|
variable.localization
|
6372
6362
|
);
|
6373
6363
|
result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6392,7 +6382,7 @@ var NodeSemanticInfoService = class {
|
|
6392
6382
|
const targets = meaning.declarations.map((d) => {
|
6393
6383
|
let target;
|
6394
6384
|
switch (d.value.kind) {
|
6395
|
-
case "
|
6385
|
+
case "function":
|
6396
6386
|
target = new EntityReferenceTarget(d.value.value.getEntity(), 0 /* Get */);
|
6397
6387
|
break;
|
6398
6388
|
case "variable":
|
@@ -6426,8 +6416,8 @@ var NodeSemanticInfoService = class {
|
|
6426
6416
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
6427
6417
|
}
|
6428
6418
|
return result;
|
6429
|
-
function
|
6430
|
-
const targets =
|
6419
|
+
function createAccessedFunctionsReference(functions, isAmbiguous) {
|
6420
|
+
const targets = functions.map((o) => new SimpleWithLocalization(new AccessedFunctionReferenceTarget(o.value), o.localization));
|
6431
6421
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6432
6422
|
}
|
6433
6423
|
function createOperatorsReference(operators, isAmbiguous) {
|
@@ -6435,12 +6425,12 @@ var NodeSemanticInfoService = class {
|
|
6435
6425
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6436
6426
|
}
|
6437
6427
|
}
|
6438
|
-
static
|
6439
|
-
const entity = analyzer.entity.
|
6428
|
+
static ofConstructorDeclaration(analyzer, node) {
|
6429
|
+
const entity = analyzer.entity.ofConstructorDeclaration(node);
|
6440
6430
|
return new DefinitionNodeSemanticInfo(entity);
|
6441
6431
|
}
|
6442
|
-
static
|
6443
|
-
const entity = analyzer.entity.
|
6432
|
+
static ofIndexedElementAccessorDeclaration(analyzer, node) {
|
6433
|
+
const entity = analyzer.entity.ofIndexerDeclaration(node);
|
6444
6434
|
return new DefinitionNodeSemanticInfo(entity);
|
6445
6435
|
}
|
6446
6436
|
static ofIndexedAccessExpressionOperator(analyzer, node, options6) {
|
@@ -6463,7 +6453,7 @@ var NodeSemanticInfoService = class {
|
|
6463
6453
|
}
|
6464
6454
|
return void 0;
|
6465
6455
|
function createIndexersReference(indexers, accessKind, isAmbiguous) {
|
6466
|
-
const targets = indexers.map((i) => new SimpleWithLocalization(new
|
6456
|
+
const targets = indexers.map((i) => new SimpleWithLocalization(new IndexerReferenceTarget(i.value, accessKind), i.localization));
|
6467
6457
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
6468
6458
|
}
|
6469
6459
|
}
|
@@ -6519,14 +6509,14 @@ var NodeSemanticInfoService = class {
|
|
6519
6509
|
return void 0;
|
6520
6510
|
}
|
6521
6511
|
static ofDereferenceOperatorDeclaration(analyzer, node) {
|
6522
|
-
const entity = analyzer.entity.
|
6512
|
+
const entity = analyzer.entity.ofDereferenceOperatorDeclaration(node);
|
6523
6513
|
return new DefinitionNodeSemanticInfo(entity);
|
6524
6514
|
}
|
6525
6515
|
static ofDereferenceExpressionOperator(analyzer, node, options6) {
|
6526
6516
|
const meaning = analyzer.getDereferenceExpressionMeaning(node);
|
6527
6517
|
if (meaning.kind === "resolved") {
|
6528
6518
|
const target = new SimpleWithLocalization(
|
6529
|
-
new
|
6519
|
+
new DereferenceOperatorReferenceTarget(meaning.operator.value, meaning.accessKind),
|
6530
6520
|
meaning.operator.localization
|
6531
6521
|
);
|
6532
6522
|
let result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6542,10 +6532,10 @@ var NodeSemanticInfoService = class {
|
|
6542
6532
|
let result;
|
6543
6533
|
if (meaning.kind === "constructor-call") {
|
6544
6534
|
if (meaning.suitableConstructors.length > 0) {
|
6545
|
-
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new
|
6535
|
+
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6546
6536
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
6547
6537
|
} else if (meaning.candidates.length > 0) {
|
6548
|
-
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new
|
6538
|
+
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6549
6539
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
6550
6540
|
}
|
6551
6541
|
}
|
@@ -6560,10 +6550,10 @@ var NodeSemanticInfoService = class {
|
|
6560
6550
|
switch (meaning.kind) {
|
6561
6551
|
case "own-constructor-access": {
|
6562
6552
|
if (meaning.suitableConstructors.length > 0) {
|
6563
|
-
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new
|
6553
|
+
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6564
6554
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
6565
6555
|
} else if (meaning.candidates.length > 0) {
|
6566
|
-
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new
|
6556
|
+
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6567
6557
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
6568
6558
|
}
|
6569
6559
|
break;
|
@@ -6594,10 +6584,10 @@ var NodeSemanticInfoService = class {
|
|
6594
6584
|
switch (meaning.kind) {
|
6595
6585
|
case "base-constructor-access": {
|
6596
6586
|
if (meaning.suitableConstructors.length > 0) {
|
6597
|
-
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new
|
6587
|
+
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6598
6588
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
6599
6589
|
} else if (meaning.candidates.length > 0) {
|
6600
|
-
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new
|
6590
|
+
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6601
6591
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
6602
6592
|
}
|
6603
6593
|
break;
|
@@ -6614,7 +6604,7 @@ var NodeSemanticInfoService = class {
|
|
6614
6604
|
case "overridden-method-access": {
|
6615
6605
|
const locale = TreeQuery.fromNode(node).packageEntity(analyzer).getLocale();
|
6616
6606
|
const target = new SimpleWithLocalization(
|
6617
|
-
new
|
6607
|
+
new AccessedFunctionReferenceTarget(new AccessedFunction_typeMember(meaning.method)),
|
6618
6608
|
new Localization.Original(locale)
|
6619
6609
|
);
|
6620
6610
|
result = new ReferenceNodeSemanticInfo([target], false);
|
@@ -6641,8 +6631,8 @@ var NodeSemanticInfoService = class {
|
|
6641
6631
|
}
|
6642
6632
|
static ofPackageNameSegmentAccess(analyzer, packageTreeNode, node) {
|
6643
6633
|
let parent = getParentSkippingParenthesizedExpressions(node);
|
6644
|
-
while (parent.kind ===
|
6645
|
-
const meaning = analyzer.
|
6634
|
+
while (parent.kind === 78 /* MemberAccessExpression */) {
|
6635
|
+
const meaning = analyzer.resolveMemberAccessExpression(parent).meaning;
|
6646
6636
|
if (meaning.kind === "package-name-segment-access") {
|
6647
6637
|
packageTreeNode = meaning.packageTreeNode;
|
6648
6638
|
parent = getParentSkippingParenthesizedExpressions(parent);
|
@@ -6680,11 +6670,11 @@ var NodeSemanticInfoService = class {
|
|
6680
6670
|
}
|
6681
6671
|
const parent = getParentSkippingParenthesizedExpressions(typeAccessExpression);
|
6682
6672
|
let parentCallExpression;
|
6683
|
-
if (parent.kind ===
|
6673
|
+
if (parent.kind === 69 /* CallExpression */) {
|
6684
6674
|
parentCallExpression = parent;
|
6685
|
-
} else if (parent.kind ===
|
6675
|
+
} else if (parent.kind === 89 /* GenericSpecializationExpression */) {
|
6686
6676
|
const grandParent = getParentSkippingParenthesizedExpressions(parent);
|
6687
|
-
if (grandParent.kind ===
|
6677
|
+
if (grandParent.kind === 69 /* CallExpression */) {
|
6688
6678
|
parentCallExpression = grandParent;
|
6689
6679
|
}
|
6690
6680
|
}
|
@@ -6692,10 +6682,10 @@ var NodeSemanticInfoService = class {
|
|
6692
6682
|
const meaning = analyzer.getCallExpressionMeaning(parentCallExpression);
|
6693
6683
|
if (meaning.kind === "constructor-call") {
|
6694
6684
|
if (meaning.suitableConstructors.length > 0) {
|
6695
|
-
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new
|
6685
|
+
const targets = meaning.suitableConstructors.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6696
6686
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
6697
6687
|
} else if (meaning.candidates.length > 0) {
|
6698
|
-
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new
|
6688
|
+
const targets = meaning.candidates.map((c) => new SimpleWithLocalization(new ConstructorReferenceTarget(c.value), c.localization));
|
6699
6689
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
6700
6690
|
}
|
6701
6691
|
}
|
@@ -6724,7 +6714,7 @@ var NodeSemanticInfoService = class {
|
|
6724
6714
|
{
|
6725
6715
|
if (currentTarget.value.entity.subkind === "parameter") {
|
6726
6716
|
const specialVariableInfo = currentTarget.value.entity.isSpecial();
|
6727
|
-
if (specialVariableInfo?.kind === "implicit-
|
6717
|
+
if (specialVariableInfo?.kind === "implicit-function-block-parameter") {
|
6728
6718
|
betterTarget = new SimpleWithLocalization(
|
6729
6719
|
new TypeValueParameterReferenceTarget(
|
6730
6720
|
specialVariableInfo.targetTypeParameter,
|
@@ -6746,7 +6736,7 @@ var NodeSemanticInfoService = class {
|
|
6746
6736
|
);
|
6747
6737
|
}
|
6748
6738
|
}
|
6749
|
-
} else if (currentTarget.value.kind === "entity" && currentTarget.value.entity.kind === 1 /*
|
6739
|
+
} else if (currentTarget.value.kind === "entity" && currentTarget.value.entity.kind === 1 /* Function */) {
|
6750
6740
|
}
|
6751
6741
|
if (betterTarget !== void 0) {
|
6752
6742
|
result = betterTarget;
|
@@ -6791,7 +6781,7 @@ var EntityReferenceTarget = class {
|
|
6791
6781
|
this.kind = "entity";
|
6792
6782
|
}
|
6793
6783
|
};
|
6794
|
-
var
|
6784
|
+
var FieldReferenceTarget = class {
|
6795
6785
|
constructor(variable, accessKind, narrowedType) {
|
6796
6786
|
this.variable = variable;
|
6797
6787
|
this.accessKind = accessKind;
|
@@ -6806,23 +6796,23 @@ var TypeValueParameterReferenceTarget = class {
|
|
6806
6796
|
this.kind = "type-value-parameter";
|
6807
6797
|
}
|
6808
6798
|
};
|
6809
|
-
var
|
6799
|
+
var ConstructorReferenceTarget = class {
|
6810
6800
|
constructor(constructor_) {
|
6811
6801
|
this.constructor_ = constructor_;
|
6812
6802
|
this.kind = "type-constructor";
|
6813
6803
|
}
|
6814
6804
|
};
|
6815
|
-
var
|
6805
|
+
var DereferenceOperatorReferenceTarget = class {
|
6816
6806
|
constructor(operator, accessKind) {
|
6817
6807
|
this.operator = operator;
|
6818
6808
|
this.accessKind = accessKind;
|
6819
6809
|
this.kind = "type-dereference-operator";
|
6820
6810
|
}
|
6821
6811
|
};
|
6822
|
-
var
|
6823
|
-
constructor(
|
6824
|
-
this.
|
6825
|
-
this.kind = "accessed-
|
6812
|
+
var AccessedFunctionReferenceTarget = class {
|
6813
|
+
constructor(func) {
|
6814
|
+
this.func = func;
|
6815
|
+
this.kind = "accessed-function";
|
6826
6816
|
}
|
6827
6817
|
};
|
6828
6818
|
var OperatorReferenceTarget = class {
|
@@ -6857,7 +6847,7 @@ var TypeContextReferenceTarget = class {
|
|
6857
6847
|
this.kind = "type-context";
|
6858
6848
|
}
|
6859
6849
|
};
|
6860
|
-
var
|
6850
|
+
var IndexerReferenceTarget = class {
|
6861
6851
|
constructor(indexer, accessKind) {
|
6862
6852
|
this.indexer = indexer;
|
6863
6853
|
this.accessKind = accessKind;
|
@@ -6935,59 +6925,59 @@ function getEntitySourceLocations(analyzer, entity) {
|
|
6935
6925
|
const node = definition.node;
|
6936
6926
|
let range;
|
6937
6927
|
switch (node.kind) {
|
6938
|
-
case
|
6939
|
-
case
|
6940
|
-
case
|
6941
|
-
case
|
6942
|
-
case
|
6928
|
+
case 17 /* AnonymousFunctionTypeDeclaration */:
|
6929
|
+
case 18 /* AnonymousStructuredTypeDeclaration */:
|
6930
|
+
case 19 /* AnonymousVariantTypeDeclaration */:
|
6931
|
+
case 67 /* FunctionBlockLiteral */:
|
6932
|
+
case 74 /* FunctionLiteral */:
|
6943
6933
|
range = node.rangeWithoutTrivia;
|
6944
6934
|
break;
|
6945
|
-
case
|
6946
|
-
case
|
6947
|
-
case
|
6948
|
-
case
|
6949
|
-
case
|
6950
|
-
case
|
6951
|
-
case
|
6952
|
-
case
|
6953
|
-
case
|
6935
|
+
case 22 /* PackageAliasTypeDeclaration */:
|
6936
|
+
case 27 /* PackageFunctionDeclaration */:
|
6937
|
+
case 28 /* PackageFunctionTypeDeclaration */:
|
6938
|
+
case 33 /* PackageStructuredTypeDeclaration */:
|
6939
|
+
case 38 /* PackageVariantTypeDeclaration */:
|
6940
|
+
case 58 /* NestedFunctionDeclaration */:
|
6941
|
+
case 52 /* MethodDeclaration */:
|
6942
|
+
case 143 /* TypeParameterDeclaration */:
|
6943
|
+
case 53 /* OperatorDeclaration */:
|
6954
6944
|
range = node.name.rangeWithoutTrivia;
|
6955
6945
|
break;
|
6956
|
-
case
|
6946
|
+
case 45 /* ConstructorDeclaration */:
|
6957
6947
|
range = node.creationKeyword.rangeWithoutTrivia;
|
6958
6948
|
break;
|
6959
|
-
case
|
6949
|
+
case 46 /* DestructorDeclaration */:
|
6960
6950
|
range = node.destructionKeyword.rangeWithoutTrivia;
|
6961
6951
|
break;
|
6962
6952
|
case 8 /* PackageImport */:
|
6963
6953
|
Debug.assertNotNull(node.alias);
|
6964
6954
|
range = node.alias.rangeWithoutTrivia;
|
6965
6955
|
break;
|
6966
|
-
case
|
6956
|
+
case 40 /* TypeExtensionDeclaration */:
|
6967
6957
|
range = node.plusEqualsToken.rangeWithoutTrivia;
|
6968
6958
|
break;
|
6969
|
-
case
|
6959
|
+
case 36 /* PackageVariableGetterDeclaration */:
|
6970
6960
|
range = node.getKeyword.rangeWithoutTrivia;
|
6971
6961
|
break;
|
6972
|
-
case
|
6962
|
+
case 37 /* PackageVariableSetterDeclaration */:
|
6973
6963
|
range = node.setKeyword.rangeWithoutTrivia;
|
6974
6964
|
break;
|
6975
|
-
case
|
6965
|
+
case 55 /* FieldGetterDeclaration */:
|
6976
6966
|
range = node.getKeyword.rangeWithoutTrivia;
|
6977
6967
|
break;
|
6978
|
-
case
|
6968
|
+
case 56 /* FieldSetterDeclaration */:
|
6979
6969
|
range = node.setKeyword.rangeWithoutTrivia;
|
6980
6970
|
break;
|
6981
|
-
case
|
6971
|
+
case 47 /* IndexedElementGetterDeclaration */:
|
6982
6972
|
range = node.parameterClause.rangeWithoutTrivia;
|
6983
6973
|
break;
|
6984
|
-
case
|
6974
|
+
case 48 /* IndexedElementSetterDeclaration */:
|
6985
6975
|
range = node.parameterClause.rangeWithoutTrivia;
|
6986
6976
|
break;
|
6987
|
-
case
|
6977
|
+
case 50 /* DereferencedVariableGetterDeclaration */:
|
6988
6978
|
range = node.caretToken.rangeWithoutTrivia;
|
6989
6979
|
break;
|
6990
|
-
case
|
6980
|
+
case 51 /* DereferencedVariableSetterDeclaration */:
|
6991
6981
|
range = node.caretToken.rangeWithoutTrivia;
|
6992
6982
|
break;
|
6993
6983
|
default:
|
@@ -7099,8 +7089,8 @@ var DefinitionService = class {
|
|
7099
7089
|
return getEntitySourceLocations(analyzer, target.variable.getEntity());
|
7100
7090
|
case "type-constructor":
|
7101
7091
|
return getEntitySourceLocations(analyzer, target.constructor_.getEntity());
|
7102
|
-
case "accessed-
|
7103
|
-
return getEntitySourceLocations(analyzer, target.
|
7092
|
+
case "accessed-function":
|
7093
|
+
return getEntitySourceLocations(analyzer, target.func.getEntity());
|
7104
7094
|
case "operator":
|
7105
7095
|
return getEntitySourceLocations(analyzer, target.operator.getEntity());
|
7106
7096
|
case "type-dereference-operator":
|
@@ -7143,8 +7133,8 @@ var DefinitionService = class {
|
|
7143
7133
|
return target.operator.getEntity();
|
7144
7134
|
case "type-dereference-operator":
|
7145
7135
|
return target.operator.getEntity();
|
7146
|
-
case "accessed-
|
7147
|
-
return target.
|
7136
|
+
case "accessed-function":
|
7137
|
+
return target.func.getEntity();
|
7148
7138
|
case "match-result-value-parameter":
|
7149
7139
|
return target.parameter.entity;
|
7150
7140
|
case "package":
|
@@ -7232,7 +7222,7 @@ var ReferencesService = class {
|
|
7232
7222
|
}
|
7233
7223
|
}
|
7234
7224
|
if (!options6.onlyNamed) {
|
7235
|
-
if (node.kind ===
|
7225
|
+
if (node.kind === 70 /* AutotypeCallExpression */ && restrictions.canBeAutotypeCall) {
|
7236
7226
|
const semanticInfo = NodeSemanticInfoService.ofAutotypeCallExpression(analyzer, node, semanticInfoOptions);
|
7237
7227
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7238
7228
|
definition,
|
@@ -7244,7 +7234,7 @@ var ReferencesService = class {
|
|
7244
7234
|
result.push(new Reference(sourceFile2, node.autotypeKeyword.rangeWithoutTrivia, referenceKind));
|
7245
7235
|
}
|
7246
7236
|
}
|
7247
|
-
if (node.kind ===
|
7237
|
+
if (node.kind === 77 /* PrefixUnaryExpression */ && restrictions.canBePrefixUnaryOperator) {
|
7248
7238
|
const semanticInfo = NodeSemanticInfoService.ofPrefixUnaryExpressionOperator(
|
7249
7239
|
analyzer,
|
7250
7240
|
node,
|
@@ -7260,7 +7250,7 @@ var ReferencesService = class {
|
|
7260
7250
|
result.push(new Reference(sourceFile2, node.operator.rangeWithoutTrivia, referenceKind));
|
7261
7251
|
}
|
7262
7252
|
}
|
7263
|
-
if (node.kind ===
|
7253
|
+
if (node.kind === 66 /* BinaryExpression */ && restrictions.canBeBinaryExpressionOperator) {
|
7264
7254
|
const semanticInfo = NodeSemanticInfoService.ofBinaryExpressionOperator(
|
7265
7255
|
analyzer,
|
7266
7256
|
node,
|
@@ -7276,7 +7266,7 @@ var ReferencesService = class {
|
|
7276
7266
|
result.push(new Reference(sourceFile2, node.operator.rangeWithoutTrivia, referenceKind));
|
7277
7267
|
}
|
7278
7268
|
}
|
7279
|
-
if ((node.kind ===
|
7269
|
+
if ((node.kind === 50 /* DereferencedVariableGetterDeclaration */ || node.kind === 51 /* DereferencedVariableSetterDeclaration */) && restrictions.canBeDereferenceOperator) {
|
7280
7270
|
const semanticInfo = NodeSemanticInfoService.ofDereferenceOperatorDeclaration(analyzer, node);
|
7281
7271
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7282
7272
|
definition,
|
@@ -7288,7 +7278,7 @@ var ReferencesService = class {
|
|
7288
7278
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
7289
7279
|
}
|
7290
7280
|
}
|
7291
|
-
if (node.kind ===
|
7281
|
+
if (node.kind === 80 /* DereferenceExpression */ && restrictions.canBeDereferenceOperator) {
|
7292
7282
|
const semanticInfo = NodeSemanticInfoService.ofDereferenceExpressionOperator(
|
7293
7283
|
analyzer,
|
7294
7284
|
node,
|
@@ -7304,7 +7294,7 @@ var ReferencesService = class {
|
|
7304
7294
|
result.push(new Reference(sourceFile2, node.caretToken.rangeWithoutTrivia, referenceKind));
|
7305
7295
|
}
|
7306
7296
|
}
|
7307
|
-
if (node.kind ===
|
7297
|
+
if (node.kind === 91 /* AssignmentStatement */ && restrictions.canBeAssignmentStatementOperator) {
|
7308
7298
|
const semanticInfo = NodeSemanticInfoService.ofAssignmentStatementOperator(
|
7309
7299
|
analyzer,
|
7310
7300
|
node,
|
@@ -7320,8 +7310,8 @@ var ReferencesService = class {
|
|
7320
7310
|
result.push(new Reference(sourceFile2, node.operator.rangeWithoutTrivia, referenceKind));
|
7321
7311
|
}
|
7322
7312
|
}
|
7323
|
-
if (node.kind ===
|
7324
|
-
const semanticInfo = NodeSemanticInfoService.
|
7313
|
+
if (node.kind === 45 /* ConstructorDeclaration */ && restrictions.canBeConstructorDeclaration) {
|
7314
|
+
const semanticInfo = NodeSemanticInfoService.ofConstructorDeclaration(analyzer, node);
|
7325
7315
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7326
7316
|
definition,
|
7327
7317
|
semanticInfo,
|
@@ -7332,7 +7322,7 @@ var ReferencesService = class {
|
|
7332
7322
|
result.push(new Reference(sourceFile2, node.creationKeyword.rangeWithoutTrivia, referenceKind));
|
7333
7323
|
}
|
7334
7324
|
}
|
7335
|
-
if (node.kind ===
|
7325
|
+
if (node.kind === 86 /* ObjectExpression */ && restrictions.canBeObjectExpression) {
|
7336
7326
|
const semanticInfo = NodeSemanticInfoService.ofObjectExpression(analyzer, node, semanticInfoOptions);
|
7337
7327
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7338
7328
|
definition,
|
@@ -7344,7 +7334,7 @@ var ReferencesService = class {
|
|
7344
7334
|
result.push(new Reference(sourceFile2, node.keyword.rangeWithoutTrivia, referenceKind));
|
7345
7335
|
}
|
7346
7336
|
}
|
7347
|
-
if (node.kind ===
|
7337
|
+
if (node.kind === 87 /* BaseExpression */ && restrictions.canBeBaseExpression) {
|
7348
7338
|
const semanticInfo = NodeSemanticInfoService.ofBaseExpression(analyzer, node, semanticInfoOptions);
|
7349
7339
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7350
7340
|
definition,
|
@@ -7356,8 +7346,8 @@ var ReferencesService = class {
|
|
7356
7346
|
result.push(new Reference(sourceFile2, node.keyword.rangeWithoutTrivia, referenceKind));
|
7357
7347
|
}
|
7358
7348
|
}
|
7359
|
-
if ((node.kind ===
|
7360
|
-
const semanticInfo = NodeSemanticInfoService.
|
7349
|
+
if ((node.kind === 47 /* IndexedElementGetterDeclaration */ || node.kind === 48 /* IndexedElementSetterDeclaration */) && restrictions.canBeIndexer) {
|
7350
|
+
const semanticInfo = NodeSemanticInfoService.ofIndexedElementAccessorDeclaration(analyzer, node);
|
7361
7351
|
const referenceKind = this.ifReferenceToDefinitionThenKind(
|
7362
7352
|
definition,
|
7363
7353
|
semanticInfo,
|
@@ -7368,7 +7358,7 @@ var ReferencesService = class {
|
|
7368
7358
|
result.push(new Reference(sourceFile2, node.parameterClause.rangeWithoutTrivia, referenceKind));
|
7369
7359
|
}
|
7370
7360
|
}
|
7371
|
-
if (node.kind ===
|
7361
|
+
if (node.kind === 71 /* IndexedAccessExpression */ && restrictions.canBeIndexer) {
|
7372
7362
|
const semanticInfo = NodeSemanticInfoService.ofIndexedAccessExpressionOperator(
|
7373
7363
|
analyzer,
|
7374
7364
|
node,
|
@@ -7495,8 +7485,8 @@ var ReferencesService = class {
|
|
7495
7485
|
target.localization,
|
7496
7486
|
accessKindToReferenceKind(target.value.accessKind)
|
7497
7487
|
);
|
7498
|
-
case "accessed-
|
7499
|
-
return new DefinitionInfo(target.value.
|
7488
|
+
case "accessed-function":
|
7489
|
+
return new DefinitionInfo(target.value.func.getEntity(), target.localization, 0 /* Read */);
|
7500
7490
|
case "match-result-value-parameter":
|
7501
7491
|
return new DefinitionInfo(target.value.parameter.entity, target.localization, 0 /* Read */);
|
7502
7492
|
case "package":
|
@@ -7558,7 +7548,7 @@ var ReferencesService = class {
|
|
7558
7548
|
result.canBeObjectExpression = true;
|
7559
7549
|
result.canBeBaseExpression = true;
|
7560
7550
|
}
|
7561
|
-
if (definition.value.kind === 1 /*
|
7551
|
+
if (definition.value.kind === 1 /* Function */) {
|
7562
7552
|
result.canBeBaseExpression = true;
|
7563
7553
|
}
|
7564
7554
|
if (definition.value.kind === 5 /* Indexer */) {
|
@@ -7597,7 +7587,7 @@ var ReferencesService = class {
|
|
7597
7587
|
return { name: entity.getName() };
|
7598
7588
|
case 2 /* Type */: {
|
7599
7589
|
switch (entity.typeEntityKind) {
|
7600
|
-
case 0 /*
|
7590
|
+
case 0 /* Function */: {
|
7601
7591
|
const naming = entity.getNaming();
|
7602
7592
|
if (naming.kind === "named") {
|
7603
7593
|
return { name: naming.value };
|
@@ -7626,7 +7616,7 @@ var ReferencesService = class {
|
|
7626
7616
|
Debug.never(entity);
|
7627
7617
|
}
|
7628
7618
|
}
|
7629
|
-
case 1 /*
|
7619
|
+
case 1 /* Function */:
|
7630
7620
|
return { name: entity.getName() };
|
7631
7621
|
case 10 /* PackageAlias */:
|
7632
7622
|
return { name: entity.getName() };
|
@@ -7750,9 +7740,9 @@ var EvaluatableExpressionService = class {
|
|
7750
7740
|
getEvaluatableExpressionForIdentifier(node) {
|
7751
7741
|
const parent = node.parent;
|
7752
7742
|
switch (parent.kind) {
|
7753
|
-
case
|
7743
|
+
case 88 /* IdentifierExpression */:
|
7754
7744
|
return parent;
|
7755
|
-
case
|
7745
|
+
case 78 /* MemberAccessExpression */:
|
7756
7746
|
if (this.isEvaluatableReceiver(parent.expression)) {
|
7757
7747
|
return parent;
|
7758
7748
|
}
|
@@ -7773,9 +7763,9 @@ var EvaluatableExpressionService = class {
|
|
7773
7763
|
}
|
7774
7764
|
isEvaluatableReceiver(expression) {
|
7775
7765
|
switch (expression.kind) {
|
7776
|
-
case
|
7766
|
+
case 88 /* IdentifierExpression */:
|
7777
7767
|
return true;
|
7778
|
-
case
|
7768
|
+
case 78 /* MemberAccessExpression */:
|
7779
7769
|
return this.isEvaluatableReceiver(expression.expression);
|
7780
7770
|
default:
|
7781
7771
|
return false;
|
@@ -7783,35 +7773,35 @@ var EvaluatableExpressionService = class {
|
|
7783
7773
|
}
|
7784
7774
|
isNamedDeclaration(node) {
|
7785
7775
|
switch (node.kind) {
|
7786
|
-
case
|
7776
|
+
case 60 /* EnumerationVariableDeclaration */:
|
7787
7777
|
return { nameIdentifier: node.name };
|
7788
|
-
case
|
7778
|
+
case 22 /* PackageAliasTypeDeclaration */:
|
7789
7779
|
return { nameIdentifier: node.name };
|
7790
|
-
case
|
7780
|
+
case 27 /* PackageFunctionDeclaration */:
|
7791
7781
|
return { nameIdentifier: node.name };
|
7792
|
-
case
|
7782
|
+
case 28 /* PackageFunctionTypeDeclaration */:
|
7793
7783
|
return { nameIdentifier: node.name };
|
7794
|
-
case
|
7784
|
+
case 33 /* PackageStructuredTypeDeclaration */:
|
7795
7785
|
return { nameIdentifier: node.name };
|
7796
|
-
case
|
7786
|
+
case 35 /* PackageVariableDeclaration */:
|
7797
7787
|
return { nameIdentifier: node.name };
|
7798
|
-
case
|
7788
|
+
case 38 /* PackageVariantTypeDeclaration */:
|
7799
7789
|
return { nameIdentifier: node.name };
|
7800
|
-
case
|
7790
|
+
case 58 /* NestedFunctionDeclaration */:
|
7801
7791
|
return { nameIdentifier: node.name };
|
7802
|
-
case
|
7792
|
+
case 59 /* LocalVariableDeclaration */:
|
7803
7793
|
return { nameIdentifier: node.name };
|
7804
|
-
case
|
7794
|
+
case 144 /* ParameterDeclaration */:
|
7805
7795
|
return { nameIdentifier: node.name };
|
7806
|
-
case
|
7796
|
+
case 52 /* MethodDeclaration */:
|
7807
7797
|
return { nameIdentifier: node.name };
|
7808
|
-
case
|
7798
|
+
case 54 /* FieldDeclaration */:
|
7809
7799
|
return { nameIdentifier: node.name };
|
7810
|
-
case
|
7800
|
+
case 143 /* TypeParameterDeclaration */:
|
7811
7801
|
return { nameIdentifier: node.name };
|
7812
|
-
case
|
7802
|
+
case 142 /* VariantDeclaration */:
|
7813
7803
|
return { nameIdentifier: node.name };
|
7814
|
-
case
|
7804
|
+
case 101 /* ErrorVariableDeclaration */:
|
7815
7805
|
return { nameIdentifier: node.name };
|
7816
7806
|
default:
|
7817
7807
|
return void 0;
|
@@ -7965,8 +7955,8 @@ var HoverService = class {
|
|
7965
7955
|
const operator = new DereferenceOperatorDeclaration_typeMember(firstTarget.value.operator);
|
7966
7956
|
return new Hover(this._displayService.displayDereferenceOperatorDeclaration(operator), range);
|
7967
7957
|
}
|
7968
|
-
case "accessed-
|
7969
|
-
return this.
|
7958
|
+
case "accessed-function":
|
7959
|
+
return this.createHoverAtAccessedFunction(firstTarget.value.func, firstTarget.localization, range);
|
7970
7960
|
case "match-result-value-parameter": {
|
7971
7961
|
const declaration = new ValueParameterDeclaration_matchResultValueParameter(
|
7972
7962
|
firstTarget.value.parameter,
|
@@ -8009,22 +7999,22 @@ var HoverService = class {
|
|
8009
7999
|
Debug.never(firstTarget.value);
|
8010
8000
|
}
|
8011
8001
|
}
|
8012
|
-
|
8013
|
-
switch (
|
8002
|
+
createHoverAtAccessedFunction(func, localization, range) {
|
8003
|
+
switch (func.kind) {
|
8014
8004
|
case "entity": {
|
8015
|
-
const declaration = new
|
8016
|
-
return new Hover(this._displayService.
|
8005
|
+
const declaration = new FunctionDeclaration_entity(func.value, localization);
|
8006
|
+
return new Hover(this._displayService.displayFunctionDeclaration(declaration), range);
|
8017
8007
|
}
|
8018
8008
|
case "type-member": {
|
8019
|
-
const declaration = new
|
8020
|
-
return new Hover(this._displayService.
|
8009
|
+
const declaration = new FunctionDeclaration_typeMember(func.value, localization);
|
8010
|
+
return new Hover(this._displayService.displayFunctionDeclaration(declaration), range);
|
8021
8011
|
}
|
8022
|
-
case "substituted-
|
8023
|
-
const declaration = new
|
8024
|
-
return new Hover(this._displayService.
|
8012
|
+
case "substituted-function": {
|
8013
|
+
const declaration = new FunctionDeclaration_substitutedFunction(func.value, localization);
|
8014
|
+
return new Hover(this._displayService.displayFunctionDeclaration(declaration), range);
|
8025
8015
|
}
|
8026
8016
|
default:
|
8027
|
-
Debug.never(
|
8017
|
+
Debug.never(func);
|
8028
8018
|
}
|
8029
8019
|
}
|
8030
8020
|
};
|
@@ -8070,7 +8060,7 @@ var SourceFileItemsService = class {
|
|
8070
8060
|
}
|
8071
8061
|
break;
|
8072
8062
|
}
|
8073
|
-
case
|
8063
|
+
case 35 /* PackageVariableDeclaration */: {
|
8074
8064
|
result.push(
|
8075
8065
|
this.createItem(
|
8076
8066
|
1 /* PackageVariable */,
|
@@ -8082,7 +8072,7 @@ var SourceFileItemsService = class {
|
|
8082
8072
|
);
|
8083
8073
|
break;
|
8084
8074
|
}
|
8085
|
-
case
|
8075
|
+
case 36 /* PackageVariableGetterDeclaration */: {
|
8086
8076
|
result.push(
|
8087
8077
|
this.createItem(
|
8088
8078
|
2 /* PackageVariableGetter */,
|
@@ -8094,7 +8084,7 @@ var SourceFileItemsService = class {
|
|
8094
8084
|
);
|
8095
8085
|
break;
|
8096
8086
|
}
|
8097
|
-
case
|
8087
|
+
case 37 /* PackageVariableSetterDeclaration */: {
|
8098
8088
|
result.push(
|
8099
8089
|
this.createItem(
|
8100
8090
|
3 /* PackageVariableSetter */,
|
@@ -8106,10 +8096,10 @@ var SourceFileItemsService = class {
|
|
8106
8096
|
);
|
8107
8097
|
break;
|
8108
8098
|
}
|
8109
|
-
case
|
8099
|
+
case 27 /* PackageFunctionDeclaration */: {
|
8110
8100
|
result.push(
|
8111
8101
|
this.createItem(
|
8112
|
-
4 /*
|
8102
|
+
4 /* PackageFunction */,
|
8113
8103
|
node2.name.value,
|
8114
8104
|
node2.rangeWithoutTrivia,
|
8115
8105
|
node2.name.rangeWithoutTrivia,
|
@@ -8118,7 +8108,7 @@ var SourceFileItemsService = class {
|
|
8118
8108
|
);
|
8119
8109
|
break;
|
8120
8110
|
}
|
8121
|
-
case
|
8111
|
+
case 33 /* PackageStructuredTypeDeclaration */: {
|
8122
8112
|
result.push(
|
8123
8113
|
this.createItem(
|
8124
8114
|
5 /* StructuredType */,
|
@@ -8130,10 +8120,10 @@ var SourceFileItemsService = class {
|
|
8130
8120
|
);
|
8131
8121
|
break;
|
8132
8122
|
}
|
8133
|
-
case
|
8123
|
+
case 54 /* FieldDeclaration */: {
|
8134
8124
|
result.push(
|
8135
8125
|
this.createItem(
|
8136
|
-
12 /*
|
8126
|
+
12 /* Field */,
|
8137
8127
|
node2.name.value,
|
8138
8128
|
node2.rangeWithoutTrivia,
|
8139
8129
|
node2.name.rangeWithoutTrivia,
|
@@ -8142,10 +8132,10 @@ var SourceFileItemsService = class {
|
|
8142
8132
|
);
|
8143
8133
|
break;
|
8144
8134
|
}
|
8145
|
-
case
|
8135
|
+
case 55 /* FieldGetterDeclaration */: {
|
8146
8136
|
result.push(
|
8147
8137
|
this.createItem(
|
8148
|
-
13 /*
|
8138
|
+
13 /* FieldGetter */,
|
8149
8139
|
node2.name.value,
|
8150
8140
|
node2.rangeWithoutTrivia,
|
8151
8141
|
node2.name.rangeWithoutTrivia,
|
@@ -8154,10 +8144,10 @@ var SourceFileItemsService = class {
|
|
8154
8144
|
);
|
8155
8145
|
break;
|
8156
8146
|
}
|
8157
|
-
case
|
8147
|
+
case 56 /* FieldSetterDeclaration */: {
|
8158
8148
|
result.push(
|
8159
8149
|
this.createItem(
|
8160
|
-
14 /*
|
8150
|
+
14 /* FieldSetter */,
|
8161
8151
|
node2.name.value,
|
8162
8152
|
node2.rangeWithoutTrivia,
|
8163
8153
|
node2.name.rangeWithoutTrivia,
|
@@ -8166,10 +8156,10 @@ var SourceFileItemsService = class {
|
|
8166
8156
|
);
|
8167
8157
|
break;
|
8168
8158
|
}
|
8169
|
-
case
|
8159
|
+
case 52 /* MethodDeclaration */: {
|
8170
8160
|
result.push(
|
8171
8161
|
this.createItem(
|
8172
|
-
15 /*
|
8162
|
+
15 /* Method */,
|
8173
8163
|
node2.name.value,
|
8174
8164
|
node2.rangeWithoutTrivia,
|
8175
8165
|
node2.name.rangeWithoutTrivia,
|
@@ -8178,10 +8168,10 @@ var SourceFileItemsService = class {
|
|
8178
8168
|
);
|
8179
8169
|
break;
|
8180
8170
|
}
|
8181
|
-
case
|
8171
|
+
case 45 /* ConstructorDeclaration */: {
|
8182
8172
|
result.push(
|
8183
8173
|
this.createItem(
|
8184
|
-
10 /*
|
8174
|
+
10 /* Constructor */,
|
8185
8175
|
void 0,
|
8186
8176
|
node2.rangeWithoutTrivia,
|
8187
8177
|
node2.rangeWithoutTrivia,
|
@@ -8190,9 +8180,9 @@ var SourceFileItemsService = class {
|
|
8190
8180
|
);
|
8191
8181
|
break;
|
8192
8182
|
}
|
8193
|
-
case
|
8183
|
+
case 46 /* DestructorDeclaration */: {
|
8194
8184
|
result.push(this.createItem(
|
8195
|
-
11 /*
|
8185
|
+
11 /* Destructor */,
|
8196
8186
|
void 0,
|
8197
8187
|
node2.rangeWithoutTrivia,
|
8198
8188
|
node2.rangeWithoutTrivia,
|
@@ -8200,10 +8190,10 @@ var SourceFileItemsService = class {
|
|
8200
8190
|
));
|
8201
8191
|
break;
|
8202
8192
|
}
|
8203
|
-
case
|
8193
|
+
case 47 /* IndexedElementGetterDeclaration */: {
|
8204
8194
|
result.push(
|
8205
8195
|
this.createItem(
|
8206
|
-
16 /*
|
8196
|
+
16 /* IndexedElementGetter */,
|
8207
8197
|
void 0,
|
8208
8198
|
node2.rangeWithoutTrivia,
|
8209
8199
|
node2.rangeWithoutTrivia,
|
@@ -8212,10 +8202,10 @@ var SourceFileItemsService = class {
|
|
8212
8202
|
);
|
8213
8203
|
break;
|
8214
8204
|
}
|
8215
|
-
case
|
8205
|
+
case 48 /* IndexedElementSetterDeclaration */: {
|
8216
8206
|
result.push(
|
8217
8207
|
this.createItem(
|
8218
|
-
17 /*
|
8208
|
+
17 /* IndexedElementSetter */,
|
8219
8209
|
void 0,
|
8220
8210
|
node2.rangeWithoutTrivia,
|
8221
8211
|
node2.rangeWithoutTrivia,
|
@@ -8224,10 +8214,10 @@ var SourceFileItemsService = class {
|
|
8224
8214
|
);
|
8225
8215
|
break;
|
8226
8216
|
}
|
8227
|
-
case
|
8217
|
+
case 28 /* PackageFunctionTypeDeclaration */: {
|
8228
8218
|
result.push(
|
8229
8219
|
this.createItem(
|
8230
|
-
6 /*
|
8220
|
+
6 /* FunctionType */,
|
8231
8221
|
node2.name.value,
|
8232
8222
|
node2.rangeWithoutTrivia,
|
8233
8223
|
node2.name.rangeWithoutTrivia,
|
@@ -8236,7 +8226,7 @@ var SourceFileItemsService = class {
|
|
8236
8226
|
);
|
8237
8227
|
break;
|
8238
8228
|
}
|
8239
|
-
case
|
8229
|
+
case 38 /* PackageVariantTypeDeclaration */: {
|
8240
8230
|
result.push(
|
8241
8231
|
this.createItem(
|
8242
8232
|
7 /* VariantType */,
|
@@ -8248,7 +8238,7 @@ var SourceFileItemsService = class {
|
|
8248
8238
|
);
|
8249
8239
|
break;
|
8250
8240
|
}
|
8251
|
-
case
|
8241
|
+
case 142 /* VariantDeclaration */: {
|
8252
8242
|
result.push(
|
8253
8243
|
this.createItem(
|
8254
8244
|
9 /* Variant */,
|
@@ -8260,7 +8250,7 @@ var SourceFileItemsService = class {
|
|
8260
8250
|
);
|
8261
8251
|
break;
|
8262
8252
|
}
|
8263
|
-
case
|
8253
|
+
case 143 /* TypeParameterDeclaration */: {
|
8264
8254
|
result.push(
|
8265
8255
|
this.createItem(
|
8266
8256
|
18 /* TypeParameter */,
|
@@ -8272,10 +8262,10 @@ var SourceFileItemsService = class {
|
|
8272
8262
|
);
|
8273
8263
|
break;
|
8274
8264
|
}
|
8275
|
-
case
|
8265
|
+
case 58 /* NestedFunctionDeclaration */: {
|
8276
8266
|
result.push(
|
8277
8267
|
this.createItem(
|
8278
|
-
19 /*
|
8268
|
+
19 /* NestedFunction */,
|
8279
8269
|
node2.name.value,
|
8280
8270
|
node2.rangeWithoutTrivia,
|
8281
8271
|
node2.name.rangeWithoutTrivia,
|
@@ -8304,34 +8294,34 @@ var SourceFileItemsService = class {
|
|
8304
8294
|
case 0 /* PackageAlias */:
|
8305
8295
|
return name ?? `<${LocalizationHelper.localizeHelperPhrase(4 /* PackageAlias */, this.locale)}>`;
|
8306
8296
|
case 1 /* PackageVariable */:
|
8307
|
-
case 12 /*
|
8297
|
+
case 12 /* Field */:
|
8308
8298
|
return name ?? `<${LocalizationHelper.localizeHelperPhrase(6 /* Variable */, this.locale)}>`;
|
8309
|
-
case 4 /*
|
8310
|
-
case 15 /*
|
8311
|
-
case 19 /*
|
8299
|
+
case 4 /* PackageFunction */:
|
8300
|
+
case 15 /* Method */:
|
8301
|
+
case 19 /* NestedFunction */:
|
8312
8302
|
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(12 /* Function */, this.locale, this.dialect)}>`;
|
8313
8303
|
case 5 /* StructuredType */:
|
8314
|
-
case 6 /*
|
8304
|
+
case 6 /* FunctionType */:
|
8315
8305
|
case 7 /* VariantType */:
|
8316
8306
|
case 8 /* InvalidType */:
|
8317
8307
|
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(16 /* Type */, this.locale, this.dialect)}>`;
|
8318
|
-
case 10 /*
|
8308
|
+
case 10 /* Constructor */:
|
8319
8309
|
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(30 /* Creation */, this.locale, this.dialect);
|
8320
|
-
case 11 /*
|
8310
|
+
case 11 /* Destructor */:
|
8321
8311
|
return name ?? LocalizationHelper.localizeKeywordAndTakeFirst(47 /* Destruction */, this.locale, this.dialect);
|
8322
8312
|
case 9 /* Variant */:
|
8323
8313
|
return name ?? `<${LocalizationHelper.localizeKeywordAndTakeFirst(6 /* Variant */, this.locale, this.dialect)}>`;
|
8324
8314
|
case 18 /* TypeParameter */:
|
8325
8315
|
return name ?? `<${LocalizationHelper.localizeHelperPhrase(2 /* TypeParameter */, this.locale)}>`;
|
8326
8316
|
case 2 /* PackageVariableGetter */:
|
8327
|
-
case 13 /*
|
8317
|
+
case 13 /* FieldGetter */:
|
8328
8318
|
return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Get */, this.locale, this.dialect)} ${name ?? ""}`;
|
8329
8319
|
case 3 /* PackageVariableSetter */:
|
8330
|
-
case 14 /*
|
8320
|
+
case 14 /* FieldSetter */:
|
8331
8321
|
return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Set */, this.locale, this.dialect)} ${name ?? ""}`;
|
8332
|
-
case 16 /*
|
8322
|
+
case 16 /* IndexedElementGetter */:
|
8333
8323
|
return `${LocalizationHelper.localizeKeywordAndTakeFirst(58 /* Get */, this.locale, this.dialect)} []`;
|
8334
|
-
case 17 /*
|
8324
|
+
case 17 /* IndexedElementSetter */:
|
8335
8325
|
return `${LocalizationHelper.localizeKeywordAndTakeFirst(59 /* Set */, this.locale, this.dialect)} []`;
|
8336
8326
|
default:
|
8337
8327
|
Debug.never(kind);
|
@@ -8433,8 +8423,8 @@ var RenameService = class {
|
|
8433
8423
|
case "type-value-parameter":
|
8434
8424
|
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.parameter.getEntity());
|
8435
8425
|
break;
|
8436
|
-
case "accessed-
|
8437
|
-
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.
|
8426
|
+
case "accessed-function":
|
8427
|
+
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.func.getEntity());
|
8438
8428
|
break;
|
8439
8429
|
case "match-result-value-parameter":
|
8440
8430
|
canBeRenamed = this.entityCanBeRenamed(analyzer, target.value.parameter.entity);
|
@@ -8497,7 +8487,7 @@ var SelectionRangeService = class {
|
|
8497
8487
|
if (!this.nodeShouldBeSkipped(child) && !child.rangeWithoutTrivia.equals(result.range)) {
|
8498
8488
|
result = new SelectionRange(child.rangeWithoutTrivia, result);
|
8499
8489
|
}
|
8500
|
-
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 ===
|
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 === 81 /* TextTemplateLiteral */) {
|
8501
8491
|
const textContentStart = child.rangeWithoutTrivia.start + 1;
|
8502
8492
|
const textContentEnd = child.rangeWithoutTrivia.end - 1;
|
8503
8493
|
if (offset >= textContentStart && offset < textContentEnd) {
|
@@ -8528,13 +8518,13 @@ var SelectionRangeService = class {
|
|
8528
8518
|
}
|
8529
8519
|
}
|
8530
8520
|
switch (node.kind) {
|
8531
|
-
case
|
8532
|
-
case
|
8533
|
-
case
|
8534
|
-
case
|
8535
|
-
case
|
8536
|
-
case
|
8537
|
-
case
|
8521
|
+
case 156 /* TypeAnnotation */:
|
8522
|
+
case 34 /* StructuredTypeDeclarationBody */:
|
8523
|
+
case 39 /* VariantTypeDeclarationBody */:
|
8524
|
+
case 23 /* AliasTypeDeclarationBody */:
|
8525
|
+
case 29 /* FunctionTypeDeclarationBody */:
|
8526
|
+
case 83 /* TextTemplateSpan */:
|
8527
|
+
case 82 /* TextTemplateSpanList */:
|
8538
8528
|
return true;
|
8539
8529
|
default:
|
8540
8530
|
return false;
|
@@ -8572,11 +8562,11 @@ var SemanticTokensService = class {
|
|
8572
8562
|
controller.stopChildrenTraverse();
|
8573
8563
|
return;
|
8574
8564
|
}
|
8575
|
-
if (node.kind ===
|
8565
|
+
if (node.kind === 88 /* IdentifierExpression */) {
|
8576
8566
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
8577
8567
|
if (meaning.kind === "variable-access") {
|
8578
8568
|
const variable = meaning.variable.value.getEntity();
|
8579
|
-
if (variable.subkind === "
|
8569
|
+
if (variable.subkind === "field" && variable.isVariant()) {
|
8580
8570
|
result.push(
|
8581
8571
|
new SemanticToken(
|
8582
8572
|
node.rangeWithoutTrivia,
|
@@ -8593,8 +8583,8 @@ var SemanticTokensService = class {
|
|
8593
8583
|
case "value":
|
8594
8584
|
semanticTokenKind = 1 /* SpecialVariable */;
|
8595
8585
|
break;
|
8596
|
-
case "implicit-
|
8597
|
-
semanticTokenKind = 0 /*
|
8586
|
+
case "implicit-function-block-parameter":
|
8587
|
+
semanticTokenKind = 0 /* FunctionBlockLiteralParameter */;
|
8598
8588
|
break;
|
8599
8589
|
case "backing":
|
8600
8590
|
semanticTokenKind = void 0;
|
@@ -8610,13 +8600,13 @@ var SemanticTokensService = class {
|
|
8610
8600
|
}
|
8611
8601
|
}
|
8612
8602
|
}
|
8613
|
-
if (meaning.kind === "
|
8614
|
-
const
|
8603
|
+
if (meaning.kind === "function-access" && meaning.suitableFunctions.length > 0) {
|
8604
|
+
const func = meaning.suitableFunctions[0];
|
8615
8605
|
result.push(
|
8616
8606
|
new SemanticToken(
|
8617
8607
|
node.rangeWithoutTrivia,
|
8618
|
-
this.
|
8619
|
-
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(
|
8608
|
+
this.getSemanticTokenKindForFunctionEntity(func.value.getEntity()),
|
8609
|
+
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(func.value.getName()))
|
8620
8610
|
)
|
8621
8611
|
);
|
8622
8612
|
}
|
@@ -8628,11 +8618,11 @@ var SemanticTokensService = class {
|
|
8628
8618
|
));
|
8629
8619
|
}
|
8630
8620
|
}
|
8631
|
-
if (node.kind ===
|
8632
|
-
const meaning = analyzer.
|
8621
|
+
if (node.kind === 78 /* MemberAccessExpression */) {
|
8622
|
+
const meaning = analyzer.resolveMemberAccessExpression(node).meaning;
|
8633
8623
|
if (meaning.kind === "static-variable-access") {
|
8634
8624
|
const entity = meaning.variable.value.getEntity();
|
8635
|
-
if (entity.subkind === "
|
8625
|
+
if (entity.subkind === "field" && entity.isVariant()) {
|
8636
8626
|
result.push(
|
8637
8627
|
new SemanticToken(
|
8638
8628
|
node.propertyName.rangeWithoutTrivia,
|
@@ -8642,25 +8632,25 @@ var SemanticTokensService = class {
|
|
8642
8632
|
);
|
8643
8633
|
}
|
8644
8634
|
}
|
8645
|
-
let
|
8635
|
+
let suitableFunctions;
|
8646
8636
|
switch (meaning.kind) {
|
8647
|
-
case "package-
|
8648
|
-
|
8637
|
+
case "package-function-access":
|
8638
|
+
suitableFunctions = meaning.suitableFunctions.map((m) => m.value);
|
8649
8639
|
break;
|
8650
8640
|
case "static-method-access":
|
8651
|
-
|
8641
|
+
suitableFunctions = meaning.suitableFunctions.map((m) => m.value);
|
8652
8642
|
break;
|
8653
8643
|
case "instance-method-access":
|
8654
|
-
|
8644
|
+
suitableFunctions = meaning.suitableFunctions.map((m) => m.value);
|
8655
8645
|
break;
|
8656
8646
|
}
|
8657
|
-
if (
|
8658
|
-
const
|
8647
|
+
if (suitableFunctions !== void 0 && suitableFunctions.length > 0) {
|
8648
|
+
const func = suitableFunctions[0];
|
8659
8649
|
result.push(
|
8660
8650
|
new SemanticToken(
|
8661
8651
|
node.propertyName.rangeWithoutTrivia,
|
8662
|
-
this.
|
8663
|
-
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(
|
8652
|
+
this.getSemanticTokenKindForFunctionEntity(func.getEntity()),
|
8653
|
+
new SemanticTokenModifiers().setCapitalized(this.isCapitalizedName(func.getName()))
|
8664
8654
|
)
|
8665
8655
|
);
|
8666
8656
|
}
|
@@ -8672,7 +8662,7 @@ var SemanticTokensService = class {
|
|
8672
8662
|
));
|
8673
8663
|
}
|
8674
8664
|
}
|
8675
|
-
if (node.kind ===
|
8665
|
+
if (node.kind === 142 /* VariantDeclaration */) {
|
8676
8666
|
result.push(
|
8677
8667
|
new SemanticToken(
|
8678
8668
|
node.name.rangeWithoutTrivia,
|
@@ -8681,26 +8671,30 @@ var SemanticTokensService = class {
|
|
8681
8671
|
)
|
8682
8672
|
);
|
8683
8673
|
}
|
8684
|
-
if (node.kind ===
|
8674
|
+
if (node.kind === 27 /* PackageFunctionDeclaration */) {
|
8685
8675
|
result.push(
|
8686
8676
|
new SemanticToken(
|
8687
8677
|
node.name.rangeWithoutTrivia,
|
8688
|
-
4 /*
|
8678
|
+
4 /* PackageFunction */,
|
8689
8679
|
new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value))
|
8690
8680
|
)
|
8691
8681
|
);
|
8692
8682
|
}
|
8693
|
-
if (node.kind ===
|
8683
|
+
if (node.kind === 58 /* NestedFunctionDeclaration */) {
|
8694
8684
|
result.push(
|
8695
|
-
new SemanticToken(
|
8685
|
+
new SemanticToken(
|
8686
|
+
node.name.rangeWithoutTrivia,
|
8687
|
+
5 /* NestedFunction */,
|
8688
|
+
new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value))
|
8689
|
+
)
|
8696
8690
|
);
|
8697
8691
|
}
|
8698
|
-
if (node.kind ===
|
8692
|
+
if (node.kind === 52 /* MethodDeclaration */) {
|
8699
8693
|
result.push(
|
8700
|
-
new SemanticToken(node.name.rangeWithoutTrivia, 6 /*
|
8694
|
+
new SemanticToken(node.name.rangeWithoutTrivia, 6 /* Method */, new SemanticTokenModifiers().makeDeclaration().setCapitalized(this.isCapitalizedName(node.name.value)))
|
8701
8695
|
);
|
8702
8696
|
}
|
8703
|
-
if (node.kind ===
|
8697
|
+
if (node.kind === 53 /* OperatorDeclaration */) {
|
8704
8698
|
result.push(
|
8705
8699
|
new SemanticToken(node.name.rangeWithoutTrivia, 7 /* Operator */, new SemanticTokenModifiers().makeDeclaration())
|
8706
8700
|
);
|
@@ -8713,14 +8707,14 @@ var SemanticTokensService = class {
|
|
8713
8707
|
rangesOverlap(range1, range2) {
|
8714
8708
|
return range1.start < range2.end && range1.end > range2.start;
|
8715
8709
|
}
|
8716
|
-
|
8710
|
+
getSemanticTokenKindForFunctionEntity(entity) {
|
8717
8711
|
switch (entity.subkind) {
|
8718
8712
|
case "package":
|
8719
|
-
return 4 /*
|
8720
|
-
case "
|
8721
|
-
return 6 /*
|
8713
|
+
return 4 /* PackageFunction */;
|
8714
|
+
case "method":
|
8715
|
+
return 6 /* Method */;
|
8722
8716
|
case "nested":
|
8723
|
-
return 5 /*
|
8717
|
+
return 5 /* NestedFunction */;
|
8724
8718
|
default:
|
8725
8719
|
Debug.never(entity);
|
8726
8720
|
}
|
@@ -8775,13 +8769,13 @@ var SemanticTokenModifiers = class {
|
|
8775
8769
|
}
|
8776
8770
|
};
|
8777
8771
|
var supportedSemanticTokens = [
|
8778
|
-
0 /*
|
8772
|
+
0 /* FunctionBlockLiteralParameter */,
|
8779
8773
|
1 /* SpecialVariable */,
|
8780
8774
|
2 /* SpecialMethod */,
|
8781
8775
|
3 /* Variant */,
|
8782
|
-
4 /*
|
8783
|
-
5 /*
|
8784
|
-
6 /*
|
8776
|
+
4 /* PackageFunction */,
|
8777
|
+
5 /* NestedFunction */,
|
8778
|
+
6 /* Method */,
|
8785
8779
|
7 /* Operator */
|
8786
8780
|
];
|
8787
8781
|
var supportedSemanticTokenModifiers = [
|
@@ -8856,7 +8850,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8856
8850
|
}
|
8857
8851
|
let node = token.parent;
|
8858
8852
|
while (node !== void 0) {
|
8859
|
-
if (node.kind ===
|
8853
|
+
if (node.kind === 152 /* TypeArgumentClause */ && this._offset >= node.lessThanToken.rangeWithoutTrivia.end && (node.greaterThanToken.rangeWithoutTrivia.isEmpty || this._offset <= node.greaterThanToken.rangeWithoutTrivia.start)) {
|
8860
8854
|
const argumentIndex = this.getArgumentIndex(node.typeArgumentList, this._offset);
|
8861
8855
|
const argumentCount = this.countArguments(node.typeArgumentList);
|
8862
8856
|
return new NodeWithTypeArgumentsInfo(node.parent, argumentIndex, argumentCount);
|
@@ -8901,9 +8895,9 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8901
8895
|
switch (node.kind) {
|
8902
8896
|
case 10 /* NamedTypeSpecifier */:
|
8903
8897
|
return this.getSignaturesForNamedTypeSpecifier(node);
|
8904
|
-
case
|
8898
|
+
case 89 /* GenericSpecializationExpression */:
|
8905
8899
|
return this.getSignaturesForGenericSpecializationExpression(node);
|
8906
|
-
case
|
8900
|
+
case 147 /* Tag */:
|
8907
8901
|
return this.getSignaturesForTag(node);
|
8908
8902
|
default:
|
8909
8903
|
Debug.never(node);
|
@@ -8925,11 +8919,11 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8925
8919
|
const lastQualifier = resolutionResult.resolvedQualifiers[resolutionResult.resolvedQualifiers.length - 1];
|
8926
8920
|
if (lastQualifier.kind === "type") {
|
8927
8921
|
return Query.from(lastQualifier.candidates).mapAndFilter((t) => this.getSignatureForNamedType(t.value)).toArray();
|
8928
|
-
} else if (lastQualifier.kind === "
|
8929
|
-
if (resolutionResult.meaning.kind === "tag-
|
8922
|
+
} else if (lastQualifier.kind === "function") {
|
8923
|
+
if (resolutionResult.meaning.kind === "tag-function") {
|
8930
8924
|
return Query.from(resolutionResult.meaning.candidates).mapAndFilter((d) => {
|
8931
|
-
if (d.value.kind === "substituted-
|
8932
|
-
return this.
|
8925
|
+
if (d.value.kind === "substituted-function") {
|
8926
|
+
return this.getSignatureForSubstitutedFunction(d.value.value, d.localization);
|
8933
8927
|
}
|
8934
8928
|
return void 0;
|
8935
8929
|
}).toArray();
|
@@ -8942,12 +8936,12 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8942
8936
|
}
|
8943
8937
|
getSignaturesForGenericSpecializationExpression(node) {
|
8944
8938
|
const expression = unwrapParenthesizedExpressions(node.expression);
|
8945
|
-
if (expression.kind ===
|
8939
|
+
if (expression.kind === 88 /* IdentifierExpression */) {
|
8946
8940
|
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
8947
|
-
if (meaning.kind === "
|
8941
|
+
if (meaning.kind === "function-access") {
|
8948
8942
|
return Query.from(meaning.candidates).mapAndFilter((o) => {
|
8949
|
-
if (o.value.kind === "substituted-
|
8950
|
-
return this.
|
8943
|
+
if (o.value.kind === "substituted-function") {
|
8944
|
+
return this.getSignatureForSubstitutedFunction(o.value.value, o.localization);
|
8951
8945
|
}
|
8952
8946
|
return void 0;
|
8953
8947
|
}).toArray();
|
@@ -8957,20 +8951,20 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8957
8951
|
}
|
8958
8952
|
return void 0;
|
8959
8953
|
}
|
8960
|
-
if (expression.kind ===
|
8961
|
-
const meaning = this._analyzer.
|
8962
|
-
let
|
8954
|
+
if (expression.kind === 78 /* MemberAccessExpression */) {
|
8955
|
+
const meaning = this._analyzer.resolveMemberAccessExpression(expression).meaning;
|
8956
|
+
let accessedFunctions;
|
8963
8957
|
if (meaning.kind === "instance-method-access") {
|
8964
|
-
|
8958
|
+
accessedFunctions = meaning.candidates;
|
8965
8959
|
} else if (meaning.kind === "static-method-access") {
|
8966
|
-
|
8967
|
-
} else if (meaning.kind === "package-
|
8968
|
-
|
8969
|
-
}
|
8970
|
-
if (
|
8971
|
-
return Query.from(
|
8972
|
-
if (o.value.kind === "substituted-
|
8973
|
-
return this.
|
8960
|
+
accessedFunctions = meaning.candidates;
|
8961
|
+
} else if (meaning.kind === "package-function-access") {
|
8962
|
+
accessedFunctions = meaning.candidates;
|
8963
|
+
}
|
8964
|
+
if (accessedFunctions !== void 0) {
|
8965
|
+
return Query.from(accessedFunctions).mapAndFilter((o) => {
|
8966
|
+
if (o.value.kind === "substituted-function") {
|
8967
|
+
return this.getSignatureForSubstitutedFunction(o.value.value, o.localization);
|
8974
8968
|
}
|
8975
8969
|
return void 0;
|
8976
8970
|
}).toArray();
|
@@ -8982,21 +8976,21 @@ var TypeParameterSignatureHelpProvider = class {
|
|
8982
8976
|
}
|
8983
8977
|
return void 0;
|
8984
8978
|
}
|
8985
|
-
|
8979
|
+
getSignatureForSubstitutedFunction(func, localization) {
|
8986
8980
|
let result = void 0;
|
8987
|
-
switch (
|
8981
|
+
switch (func.kind) {
|
8988
8982
|
case "entity":
|
8989
|
-
if (
|
8990
|
-
result = new
|
8983
|
+
if (func.entity.getTypeParametersArity() > 0) {
|
8984
|
+
result = new FunctionEntitySignature(this.signatureContext, func.entity, localization);
|
8991
8985
|
}
|
8992
8986
|
break;
|
8993
8987
|
case "type-member":
|
8994
|
-
if (
|
8995
|
-
result = new
|
8988
|
+
if (func.method.getTypeParametersArity() > 0) {
|
8989
|
+
result = new MethodSignature(this.signatureContext, func.method, localization);
|
8996
8990
|
}
|
8997
8991
|
break;
|
8998
8992
|
default:
|
8999
|
-
Debug.never(
|
8993
|
+
Debug.never(func);
|
9000
8994
|
}
|
9001
8995
|
return result;
|
9002
8996
|
}
|
@@ -9008,9 +9002,9 @@ var TypeParameterSignatureHelpProvider = class {
|
|
9008
9002
|
result = new StructuredTypeSignature(this.signatureContext, type);
|
9009
9003
|
}
|
9010
9004
|
break;
|
9011
|
-
case 0 /*
|
9005
|
+
case 0 /* Function */:
|
9012
9006
|
if (type.getArity() > 0) {
|
9013
|
-
result = new
|
9007
|
+
result = new FunctionTypeSignature2(this.signatureContext, type);
|
9014
9008
|
}
|
9015
9009
|
break;
|
9016
9010
|
case 3 /* Variant */:
|
@@ -9038,36 +9032,36 @@ var NodeWithTypeArgumentsInfo = class {
|
|
9038
9032
|
this.argumentCount = argumentCount;
|
9039
9033
|
}
|
9040
9034
|
};
|
9041
|
-
var
|
9042
|
-
constructor(ctx,
|
9035
|
+
var FunctionEntitySignature = class {
|
9036
|
+
constructor(ctx, func, localization) {
|
9043
9037
|
this.ctx = ctx;
|
9044
|
-
this.
|
9038
|
+
this.func = func;
|
9045
9039
|
this.localization = localization;
|
9046
|
-
this.kind = "
|
9040
|
+
this.kind = "function-entity";
|
9047
9041
|
}
|
9048
9042
|
getArity() {
|
9049
|
-
return this.
|
9043
|
+
return this.func.getTypeParametersArity();
|
9050
9044
|
}
|
9051
9045
|
getDisplayParts() {
|
9052
|
-
const
|
9053
|
-
const displayParts = this.ctx.displayService.
|
9054
|
-
return this.ctx.
|
9046
|
+
const func = new FunctionDeclaration_entity(this.func, this.localization);
|
9047
|
+
const displayParts = this.ctx.displayService.getFunctionDeclarationDisplayParts(func);
|
9048
|
+
return this.ctx.convertFunctionDisplayParts(displayParts);
|
9055
9049
|
}
|
9056
9050
|
};
|
9057
|
-
var
|
9051
|
+
var MethodSignature = class {
|
9058
9052
|
constructor(ctx, method, localization) {
|
9059
9053
|
this.ctx = ctx;
|
9060
9054
|
this.method = method;
|
9061
9055
|
this.localization = localization;
|
9062
|
-
this.kind = "
|
9056
|
+
this.kind = "method";
|
9063
9057
|
}
|
9064
9058
|
getArity() {
|
9065
9059
|
return this.method.getTypeParametersArity();
|
9066
9060
|
}
|
9067
9061
|
getDisplayParts() {
|
9068
|
-
const
|
9069
|
-
const displayParts = this.ctx.displayService.
|
9070
|
-
return this.ctx.
|
9062
|
+
const func = new FunctionDeclaration_typeMember(this.method, this.localization);
|
9063
|
+
const displayParts = this.ctx.displayService.getFunctionDeclarationDisplayParts(func);
|
9064
|
+
return this.ctx.convertFunctionDisplayParts(displayParts);
|
9071
9065
|
}
|
9072
9066
|
};
|
9073
9067
|
var StructuredTypeSignature = class {
|
@@ -9100,7 +9094,7 @@ var VariantTypeSignature = class {
|
|
9100
9094
|
return this.ctx.convertNamedTypeDisplayParts(displayParts);
|
9101
9095
|
}
|
9102
9096
|
};
|
9103
|
-
var
|
9097
|
+
var FunctionTypeSignature2 = class {
|
9104
9098
|
constructor(ctx, type) {
|
9105
9099
|
this.ctx = ctx;
|
9106
9100
|
this.type = type;
|
@@ -9110,7 +9104,7 @@ var MethodTypeSignature2 = class {
|
|
9110
9104
|
return this.type.getArity();
|
9111
9105
|
}
|
9112
9106
|
getDisplayParts() {
|
9113
|
-
const type = new
|
9107
|
+
const type = new NamedType_function(this.type);
|
9114
9108
|
const displayParts = this.ctx.displayService.getNamedTypeDisplayParts(type);
|
9115
9109
|
return this.ctx.convertNamedTypeDisplayParts(displayParts);
|
9116
9110
|
}
|
@@ -9134,7 +9128,7 @@ var SignatureContext = class {
|
|
9134
9128
|
constructor(displayService) {
|
9135
9129
|
this.displayService = displayService;
|
9136
9130
|
}
|
9137
|
-
|
9131
|
+
convertFunctionDisplayParts(parts) {
|
9138
9132
|
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.whitespaceAfterFunctionKeyword + parts.container + parts.name + parts.typeParametersStart;
|
9139
9133
|
const postfix = parts.typeParametersEnd + parts.valueParametersStart + parts.valueParameters.map((p) => p.toString()).join(parts.valueParameterSeparator) + parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
9140
9134
|
return new SignatureDisplayParts(prefix, parts.typeParameters, parts.typeParameterSeparator, postfix);
|
@@ -9210,7 +9204,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
9210
9204
|
let node = token.parent;
|
9211
9205
|
while (node !== void 0) {
|
9212
9206
|
switch (node.kind) {
|
9213
|
-
case
|
9207
|
+
case 69 /* CallExpression */: {
|
9214
9208
|
if (this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && (node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
9215
9209
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfCallExpression(node);
|
9216
9210
|
const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
|
@@ -9218,7 +9212,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
9218
9212
|
}
|
9219
9213
|
break;
|
9220
9214
|
}
|
9221
|
-
case
|
9215
|
+
case 70 /* AutotypeCallExpression */: {
|
9222
9216
|
if (this._offset >= node.openParenthesisToken.rangeWithoutTrivia.end && (node.closeParenthesisToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeParenthesisToken.rangeWithoutTrivia.start)) {
|
9223
9217
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfAutotypeCallExpression(node);
|
9224
9218
|
const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
|
@@ -9226,7 +9220,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
9226
9220
|
}
|
9227
9221
|
break;
|
9228
9222
|
}
|
9229
|
-
case
|
9223
|
+
case 71 /* IndexedAccessExpression */: {
|
9230
9224
|
if (this._offset >= node.openSquareBracketToken.rangeWithoutTrivia.end && (node.closeSquareBracketToken.rangeWithoutTrivia.isEmpty || this._offset <= node.closeSquareBracketToken.rangeWithoutTrivia.start)) {
|
9231
9225
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfIndexedAccessExpression(node);
|
9232
9226
|
const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
|
@@ -9234,7 +9228,7 @@ var ValueParametersSignatureHelpProvider = class {
|
|
9234
9228
|
}
|
9235
9229
|
break;
|
9236
9230
|
}
|
9237
|
-
case
|
9231
|
+
case 147 /* Tag */: {
|
9238
9232
|
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)) {
|
9239
9233
|
const argumentIndex = this.getArgumentIndexInList(node.argumentList.elements, this._offset);
|
9240
9234
|
const valueArguments = ValueArgumentFactory.createValueArgumentsOfTag(node);
|
@@ -9262,17 +9256,17 @@ var ValueParametersSignatureHelpProvider = class {
|
|
9262
9256
|
}
|
9263
9257
|
getSignatureDisplayParts(signature) {
|
9264
9258
|
switch (signature.kind) {
|
9265
|
-
case "accessed-
|
9266
|
-
const
|
9267
|
-
signature.
|
9268
|
-
signature.
|
9259
|
+
case "accessed-function": {
|
9260
|
+
const func = new FunctionDeclaration_accessedFunction(
|
9261
|
+
signature.func.value,
|
9262
|
+
signature.func.localization
|
9269
9263
|
);
|
9270
|
-
const displayParts = this.signatureContext.displayService.
|
9271
|
-
return this.signatureContext.
|
9264
|
+
const displayParts = this.signatureContext.displayService.getFunctionDeclarationDisplayParts(func);
|
9265
|
+
return this.signatureContext.convertFunctionDisplayParts(displayParts);
|
9272
9266
|
}
|
9273
|
-
case "
|
9274
|
-
const displayParts = this.signatureContext.displayService.
|
9275
|
-
return this.signatureContext.
|
9267
|
+
case "function-type": {
|
9268
|
+
const displayParts = this.signatureContext.displayService.getFunctionTypeBodyDisplayParts(signature.functionType);
|
9269
|
+
return this.signatureContext.convertFunctionTypeBodyDisplayParts(displayParts);
|
9276
9270
|
}
|
9277
9271
|
case "constructor": {
|
9278
9272
|
const constructor = new ConstructorDeclaration_typeMember(
|
@@ -9304,13 +9298,13 @@ var SignatureContext2 = class {
|
|
9304
9298
|
constructor(displayService) {
|
9305
9299
|
this.displayService = displayService;
|
9306
9300
|
}
|
9307
|
-
|
9301
|
+
convertFunctionDisplayParts(parts) {
|
9308
9302
|
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.whitespaceAfterFunctionKeyword + parts.container + parts.name + parts.typeParametersStart + parts.typeParameters.join(parts.typeParameterSeparator) + parts.typeParametersEnd + parts.valueParametersStart;
|
9309
9303
|
const valueParameters = parts.valueParameters.map((p) => p.toString());
|
9310
9304
|
const postfix = parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
9311
9305
|
return new SignatureDisplayParts(prefix, valueParameters, parts.valueParameterSeparator, postfix);
|
9312
9306
|
}
|
9313
|
-
|
9307
|
+
convertFunctionTypeBodyDisplayParts(parts) {
|
9314
9308
|
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.valueParametersStart;
|
9315
9309
|
const valueParameters = parts.valueParameters.map((p) => p.toString());
|
9316
9310
|
const postfix = parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
@@ -11746,8 +11740,8 @@ var EntityToSyntax = class {
|
|
11746
11740
|
switch (entity.kind) {
|
11747
11741
|
case 0 /* Variable */:
|
11748
11742
|
return this.convertPackageVariable(entity);
|
11749
|
-
case 1 /*
|
11750
|
-
return this.
|
11743
|
+
case 1 /* Function */:
|
11744
|
+
return this.convertPackageFunction(entity);
|
11751
11745
|
case 2 /* Type */:
|
11752
11746
|
return this.convertPackageType(entity);
|
11753
11747
|
default:
|
@@ -11756,8 +11750,8 @@ var EntityToSyntax = class {
|
|
11756
11750
|
}
|
11757
11751
|
convertPackageType(entity) {
|
11758
11752
|
switch (entity.typeEntityKind) {
|
11759
|
-
case 0 /*
|
11760
|
-
return this.
|
11753
|
+
case 0 /* Function */:
|
11754
|
+
return this.convertPackageFunctionType(entity);
|
11761
11755
|
case 1 /* Structured */:
|
11762
11756
|
return this.convertPackageStructuredType(entity);
|
11763
11757
|
case 3 /* Variant */:
|
@@ -11809,7 +11803,7 @@ var EntityToSyntax = class {
|
|
11809
11803
|
}
|
11810
11804
|
return result;
|
11811
11805
|
}
|
11812
|
-
|
11806
|
+
convertPackageFunction(entity) {
|
11813
11807
|
const tags = this.convertTags(entity.getTags());
|
11814
11808
|
const modifiers = new Array();
|
11815
11809
|
if (entity.isAsync()) {
|
@@ -11823,7 +11817,7 @@ var EntityToSyntax = class {
|
|
11823
11817
|
const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
|
11824
11818
|
const valueParameters = this.convertValueParameters(entity.getValueParameters());
|
11825
11819
|
const returnType = this.convertType(entity.getReturnType());
|
11826
|
-
return SyntaxFactory.
|
11820
|
+
return SyntaxFactory.packageFunctionDeclaration(
|
11827
11821
|
tags,
|
11828
11822
|
modifiers,
|
11829
11823
|
name,
|
@@ -11869,7 +11863,7 @@ var EntityToSyntax = class {
|
|
11869
11863
|
const body = this.createVariantTypeDeclarationBody(entity);
|
11870
11864
|
return SyntaxFactory.packageVariantTypeDeclaration(tags, modifiers, name, typeParameters, body);
|
11871
11865
|
}
|
11872
|
-
|
11866
|
+
convertPackageFunctionType(entity) {
|
11873
11867
|
const tags = this.convertTags(entity.getTags());
|
11874
11868
|
const modifiers = new Array();
|
11875
11869
|
const isHidden = entity.isHidden();
|
@@ -11878,18 +11872,18 @@ var EntityToSyntax = class {
|
|
11878
11872
|
}
|
11879
11873
|
const name = this.getEntityName(entity);
|
11880
11874
|
const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
|
11881
|
-
const body = this.
|
11882
|
-
return SyntaxFactory.
|
11875
|
+
const body = this.createFunctionTypeDeclarationBody(entity);
|
11876
|
+
return SyntaxFactory.packageFunctionTypeDeclaration(tags, modifiers, name, typeParameters, body);
|
11883
11877
|
}
|
11884
11878
|
convertTypeEntityMembers(members) {
|
11885
|
-
const variables = members.getNamedMembers().filter((m) => m.kind === 0 /* Variable */).flatMap((m) => this.
|
11886
|
-
const methods = members.getNamedMembers().filter((m) => m.kind !== 0 /* Variable */).map((m) => this.
|
11887
|
-
const constructors = members.getConstructors().map((c) => this.
|
11888
|
-
const destructors = members.getDestructors().map((d) => this.
|
11889
|
-
const indexers = members.getIndexers().flatMap((i) => this.
|
11879
|
+
const variables = members.getNamedMembers().filter((m) => m.kind === 0 /* Variable */).flatMap((m) => this.convertField(m));
|
11880
|
+
const methods = members.getNamedMembers().filter((m) => m.kind !== 0 /* Variable */).map((m) => this.convertMethod(m));
|
11881
|
+
const constructors = members.getConstructors().map((c) => this.convertConstructor(c));
|
11882
|
+
const destructors = members.getDestructors().map((d) => this.convertDestructor(d));
|
11883
|
+
const indexers = members.getIndexers().flatMap((i) => this.convertIndexer(i));
|
11890
11884
|
return variables.concat(indexers, constructors, methods, destructors);
|
11891
11885
|
}
|
11892
|
-
|
11886
|
+
convertField(entity) {
|
11893
11887
|
if (entity.isVariant()) {
|
11894
11888
|
return this.convertVariant(entity);
|
11895
11889
|
}
|
@@ -11922,7 +11916,7 @@ var EntityToSyntax = class {
|
|
11922
11916
|
if (isHidden !== void 0) {
|
11923
11917
|
modifiers.push(this.createHidingModifier(isHidden));
|
11924
11918
|
}
|
11925
|
-
result.push(SyntaxFactory.
|
11919
|
+
result.push(SyntaxFactory.fieldGetterDeclaration(tags, modifiers, name, type, void 0));
|
11926
11920
|
}
|
11927
11921
|
const setterEntity = entity.getSetter();
|
11928
11922
|
if (setterEntity !== void 0) {
|
@@ -11932,7 +11926,7 @@ var EntityToSyntax = class {
|
|
11932
11926
|
if (isHidden !== void 0) {
|
11933
11927
|
modifiers.push(this.createHidingModifier(isHidden));
|
11934
11928
|
}
|
11935
|
-
result.push(SyntaxFactory.
|
11929
|
+
result.push(SyntaxFactory.fieldSetterDeclaration(tags, modifiers, name, void 0));
|
11936
11930
|
}
|
11937
11931
|
} else {
|
11938
11932
|
const tags = this.convertTags(entity.getTags());
|
@@ -11941,11 +11935,11 @@ var EntityToSyntax = class {
|
|
11941
11935
|
if (isHidden !== void 0) {
|
11942
11936
|
modifiers.push(this.createHidingModifier(isHidden));
|
11943
11937
|
}
|
11944
|
-
result = SyntaxFactory.
|
11938
|
+
result = SyntaxFactory.fieldDeclaration(tags, commonModifiers, name, type);
|
11945
11939
|
}
|
11946
11940
|
return result;
|
11947
11941
|
}
|
11948
|
-
|
11942
|
+
convertMethod(entity) {
|
11949
11943
|
const tags = this.convertTags(entity.getTags());
|
11950
11944
|
const modifiers = new Array();
|
11951
11945
|
const isHidden = entity.isHidden();
|
@@ -11968,9 +11962,9 @@ var EntityToSyntax = class {
|
|
11968
11962
|
const typeParameters = this.convertTypeParameters(entity.getTypeParameters());
|
11969
11963
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11970
11964
|
const returnType = this.convertType(entity.getReturnType());
|
11971
|
-
return SyntaxFactory.
|
11965
|
+
return SyntaxFactory.methodDeclaration(tags, modifiers, name, typeParameters, parameters, returnType, void 0);
|
11972
11966
|
}
|
11973
|
-
|
11967
|
+
convertConstructor(entity) {
|
11974
11968
|
const tags = this.convertTags(entity.getTags());
|
11975
11969
|
const modifiers = new Array();
|
11976
11970
|
const isHidden = entity.isHidden();
|
@@ -11981,9 +11975,9 @@ var EntityToSyntax = class {
|
|
11981
11975
|
modifiers.push(SyntaxFactory.modifier(37 /* Abstract */));
|
11982
11976
|
}
|
11983
11977
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11984
|
-
return SyntaxFactory.
|
11978
|
+
return SyntaxFactory.constructorDeclaration(tags, modifiers, parameters, void 0);
|
11985
11979
|
}
|
11986
|
-
|
11980
|
+
convertDestructor(entity) {
|
11987
11981
|
const tags = this.convertTags(entity.getTags());
|
11988
11982
|
const modifiers = new Array();
|
11989
11983
|
const isHidden = entity.isHidden();
|
@@ -11994,9 +11988,9 @@ var EntityToSyntax = class {
|
|
11994
11988
|
modifiers.push(SyntaxFactory.modifier(37 /* Abstract */));
|
11995
11989
|
}
|
11996
11990
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
11997
|
-
return SyntaxFactory.
|
11991
|
+
return SyntaxFactory.destructorDeclaration(tags, modifiers, parameters, void 0);
|
11998
11992
|
}
|
11999
|
-
|
11993
|
+
convertIndexer(entity) {
|
12000
11994
|
const commonModifiers = new Array();
|
12001
11995
|
if (entity.isStatic()) {
|
12002
11996
|
commonModifiers.push(SyntaxFactory.modifier(41 /* Static */));
|
@@ -12015,14 +12009,14 @@ var EntityToSyntax = class {
|
|
12015
12009
|
modifiers.push(this.createHidingModifier(isHidden));
|
12016
12010
|
}
|
12017
12011
|
const type = this.convertType(entity.getType());
|
12018
|
-
const declaration = SyntaxFactory.
|
12012
|
+
const declaration = SyntaxFactory.indexedElementGetterDeclaration(tags, modifiers, parameters, type, void 0);
|
12019
12013
|
result.push(declaration);
|
12020
12014
|
}
|
12021
12015
|
const setterEntity = entity.getSetter();
|
12022
12016
|
if (setterEntity !== void 0) {
|
12023
12017
|
const tags = this.convertTags(setterEntity.getTags());
|
12024
12018
|
const modifiers = Array.from(commonModifiers);
|
12025
|
-
const declaration = SyntaxFactory.
|
12019
|
+
const declaration = SyntaxFactory.indexedElementSetterDeclaration(tags, modifiers, parameters, void 0);
|
12026
12020
|
result.push(declaration);
|
12027
12021
|
}
|
12028
12022
|
return result;
|
@@ -12074,10 +12068,10 @@ var EntityToSyntax = class {
|
|
12074
12068
|
const members = this.convertTypeEntityMembers(entity.getMembers());
|
12075
12069
|
return SyntaxFactory.variantTypeDeclarationBody(members);
|
12076
12070
|
}
|
12077
|
-
|
12071
|
+
createFunctionTypeDeclarationBody(entity) {
|
12078
12072
|
const parameters = this.convertValueParameters(entity.getValueParameters());
|
12079
12073
|
const returnType = this.convertType(entity.getReturnType());
|
12080
|
-
return SyntaxFactory.
|
12074
|
+
return SyntaxFactory.functionTypeDeclarationBody(parameters, returnType);
|
12081
12075
|
}
|
12082
12076
|
convertTypeParameters(entities) {
|
12083
12077
|
if (entities.length === 0) {
|
@@ -12144,8 +12138,8 @@ var EntityToSyntax = class {
|
|
12144
12138
|
return this.convertStructuredType(type);
|
12145
12139
|
case "variant":
|
12146
12140
|
return this.convertVariantType(type);
|
12147
|
-
case "
|
12148
|
-
return this.
|
12141
|
+
case "function":
|
12142
|
+
return this.convertFunctionType(type);
|
12149
12143
|
case "alias":
|
12150
12144
|
return this.convertAliasType(type);
|
12151
12145
|
case "parameter":
|
@@ -12180,14 +12174,14 @@ var EntityToSyntax = class {
|
|
12180
12174
|
return SyntaxFactory.anonymousVariantTypeSpecifier(body);
|
12181
12175
|
}
|
12182
12176
|
}
|
12183
|
-
|
12177
|
+
convertFunctionType(type) {
|
12184
12178
|
const entity = type.getEntity();
|
12185
12179
|
if (entity.subkind === "package") {
|
12186
12180
|
const name = this.getEntityName(entity);
|
12187
12181
|
return this.createNamedTypeSpecifier(name, type.getSubstitutions());
|
12188
12182
|
} else {
|
12189
|
-
const body = this.
|
12190
|
-
return SyntaxFactory.
|
12183
|
+
const body = this.createFunctionTypeDeclarationBody(entity);
|
12184
|
+
return SyntaxFactory.anonymousFunctionTypeSpecifier(body);
|
12191
12185
|
}
|
12192
12186
|
}
|
12193
12187
|
convertAliasType(type) {
|
@@ -12378,7 +12372,7 @@ var SourceGenerationService = class extends TriggeringObject7 {
|
|
12378
12372
|
case 0 /* Variable */:
|
12379
12373
|
if (entity.subkind === "package") {
|
12380
12374
|
return true;
|
12381
|
-
} else if (entity.subkind === "
|
12375
|
+
} else if (entity.subkind === "field") {
|
12382
12376
|
return this.checkIfEntityOfKindIsPresentInGeneratedCode(entity.getContainer().getEntity());
|
12383
12377
|
} else if (entity.subkind === "parameter") {
|
12384
12378
|
const container = entity.getContainer();
|
@@ -12386,10 +12380,10 @@ var SourceGenerationService = class extends TriggeringObject7 {
|
|
12386
12380
|
} else {
|
12387
12381
|
return false;
|
12388
12382
|
}
|
12389
|
-
case 1 /*
|
12383
|
+
case 1 /* Function */:
|
12390
12384
|
if (entity.subkind === "package") {
|
12391
12385
|
return true;
|
12392
|
-
} else if (entity.subkind === "
|
12386
|
+
} else if (entity.subkind === "method") {
|
12393
12387
|
return this.checkIfEntityOfKindIsPresentInGeneratedCode(entity.getContainer().getEntity());
|
12394
12388
|
} else {
|
12395
12389
|
return false;
|
@@ -12398,7 +12392,7 @@ var SourceGenerationService = class extends TriggeringObject7 {
|
|
12398
12392
|
switch (entity.typeEntityKind) {
|
12399
12393
|
case 1 /* Structured */:
|
12400
12394
|
case 3 /* Variant */:
|
12401
|
-
case 0 /*
|
12395
|
+
case 0 /* Function */: {
|
12402
12396
|
if (entity.subkind === "package") {
|
12403
12397
|
return true;
|
12404
12398
|
}
|
@@ -12467,13 +12461,13 @@ var EntityFinder = class {
|
|
12467
12461
|
switch (entity.kind) {
|
12468
12462
|
case 0 /* Variable */:
|
12469
12463
|
return this.findVariableEntity(entity);
|
12470
|
-
case 1 /*
|
12471
|
-
return this.
|
12464
|
+
case 1 /* Function */:
|
12465
|
+
return this.findFunctionEntity(entity);
|
12472
12466
|
case 2 /* Type */:
|
12473
12467
|
switch (entity.typeEntityKind) {
|
12474
12468
|
case 3 /* Variant */:
|
12475
12469
|
case 1 /* Structured */:
|
12476
|
-
case 0 /*
|
12470
|
+
case 0 /* Function */: {
|
12477
12471
|
if (entity.subkind === "package") {
|
12478
12472
|
return this.findPackageTypeEntityByNameAndArity(this.getEntityName(entity), entity.getArity());
|
12479
12473
|
}
|
@@ -12509,7 +12503,7 @@ var EntityFinder = class {
|
|
12509
12503
|
findVariableEntity(entity) {
|
12510
12504
|
if (entity.subkind === "package") {
|
12511
12505
|
return this._packageEntity.getMembers().getNamedMembersByName(this.getEntityName(entity)).at(0);
|
12512
|
-
} else if (entity.subkind === "
|
12506
|
+
} else if (entity.subkind === "field") {
|
12513
12507
|
const containingType = this.findEntity(entity.getContainer().getEntity());
|
12514
12508
|
if (containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType)) {
|
12515
12509
|
return containingType.getMembers().getNamedMembersByName(this.getEntityName(entity))[0];
|
@@ -12526,10 +12520,10 @@ var EntityFinder = class {
|
|
12526
12520
|
}
|
12527
12521
|
return void 0;
|
12528
12522
|
}
|
12529
|
-
|
12523
|
+
findFunctionEntity(entity) {
|
12530
12524
|
switch (entity.subkind) {
|
12531
12525
|
case "package": {
|
12532
|
-
const members = this._packageEntity.getMembers().getNamedMembersByName(this.getEntityName(entity)).filter((m) => m.kind === 1 /*
|
12526
|
+
const members = this._packageEntity.getMembers().getNamedMembersByName(this.getEntityName(entity)).filter((m) => m.kind === 1 /* Function */);
|
12533
12527
|
if (members.length === 0) {
|
12534
12528
|
return void 0;
|
12535
12529
|
} else if (members.length === 1) {
|
@@ -12544,12 +12538,12 @@ var EntityFinder = class {
|
|
12544
12538
|
return index >= 0 ? members[index] : void 0;
|
12545
12539
|
}
|
12546
12540
|
}
|
12547
|
-
case "
|
12541
|
+
case "method": {
|
12548
12542
|
const containingType = this.findEntity(entity.getContainer().getEntity());
|
12549
12543
|
if (!(containingType !== void 0 && isTypeEntity(containingType) && isTypeEntityWithMembers(containingType))) {
|
12550
12544
|
return void 0;
|
12551
12545
|
}
|
12552
|
-
const members = containingType.getMembers().getNamedMembersByName(this.getEntityName(entity)).filter((m) => m.kind === 1 /*
|
12546
|
+
const members = containingType.getMembers().getNamedMembersByName(this.getEntityName(entity)).filter((m) => m.kind === 1 /* Function */);
|
12553
12547
|
if (members.length === 0) {
|
12554
12548
|
return void 0;
|
12555
12549
|
} else if (members.length === 1) {
|
@@ -12666,7 +12660,7 @@ var EntityFinder = class {
|
|
12666
12660
|
}
|
12667
12661
|
ifEntityWithParametersThenParameters(entity) {
|
12668
12662
|
switch (entity.kind) {
|
12669
|
-
case 1 /*
|
12663
|
+
case 1 /* Function */:
|
12670
12664
|
return entity.getValueParameters();
|
12671
12665
|
case 5 /* Indexer */:
|
12672
12666
|
return entity.getValueParameters();
|
@@ -12675,7 +12669,7 @@ var EntityFinder = class {
|
|
12675
12669
|
case 8 /* Destructor */:
|
12676
12670
|
return entity.getValueParameters();
|
12677
12671
|
case 2 /* Type */: {
|
12678
|
-
if (entity.typeEntityKind === 0 /*
|
12672
|
+
if (entity.typeEntityKind === 0 /* Function */) {
|
12679
12673
|
return entity.getValueParameters();
|
12680
12674
|
}
|
12681
12675
|
return void 0;
|
@@ -12696,7 +12690,7 @@ var EntityFinder = class {
|
|
12696
12690
|
}
|
12697
12691
|
ifEntityWithTypeParametersThenParameters(entity) {
|
12698
12692
|
switch (entity.kind) {
|
12699
|
-
case 1 /*
|
12693
|
+
case 1 /* Function */:
|
12700
12694
|
return entity.getTypeParameters();
|
12701
12695
|
case 2 /* Type */: {
|
12702
12696
|
if (entity.typeEntityKind !== 2 /* Parameter */) {
|
@@ -13290,7 +13284,7 @@ var LanguageServer = class {
|
|
13290
13284
|
}
|
13291
13285
|
convertSourceFileItemKind(kind) {
|
13292
13286
|
switch (kind) {
|
13293
|
-
case 4 /*
|
13287
|
+
case 4 /* PackageFunction */:
|
13294
13288
|
return ls3.SymbolKind.Function;
|
13295
13289
|
case 1 /* PackageVariable */:
|
13296
13290
|
case 2 /* PackageVariableGetter */:
|
@@ -13298,23 +13292,23 @@ var LanguageServer = class {
|
|
13298
13292
|
return ls3.SymbolKind.Variable;
|
13299
13293
|
case 5 /* StructuredType */:
|
13300
13294
|
return ls3.SymbolKind.Class;
|
13301
|
-
case 12 /*
|
13295
|
+
case 12 /* Field */:
|
13302
13296
|
return ls3.SymbolKind.Field;
|
13303
|
-
case 13 /*
|
13304
|
-
case 14 /*
|
13297
|
+
case 13 /* FieldGetter */:
|
13298
|
+
case 14 /* FieldSetter */:
|
13305
13299
|
return ls3.SymbolKind.Property;
|
13306
|
-
case 15 /*
|
13300
|
+
case 15 /* Method */:
|
13307
13301
|
return ls3.SymbolKind.Method;
|
13308
|
-
case 10 /*
|
13302
|
+
case 10 /* Constructor */:
|
13309
13303
|
return ls3.SymbolKind.Constructor;
|
13310
|
-
case 11 /*
|
13304
|
+
case 11 /* Destructor */:
|
13311
13305
|
return ls3.SymbolKind.Method;
|
13312
|
-
case 16 /*
|
13313
|
-
case 17 /*
|
13306
|
+
case 16 /* IndexedElementGetter */:
|
13307
|
+
case 17 /* IndexedElementSetter */:
|
13314
13308
|
return ls3.SymbolKind.Property;
|
13315
13309
|
case 18 /* TypeParameter */:
|
13316
13310
|
return ls3.SymbolKind.TypeParameter;
|
13317
|
-
case 19 /*
|
13311
|
+
case 19 /* NestedFunction */:
|
13318
13312
|
return ls3.SymbolKind.Function;
|
13319
13313
|
case 7 /* VariantType */:
|
13320
13314
|
return ls3.SymbolKind.Enum;
|
@@ -13322,7 +13316,7 @@ var LanguageServer = class {
|
|
13322
13316
|
return ls3.SymbolKind.EnumMember;
|
13323
13317
|
case 8 /* InvalidType */:
|
13324
13318
|
return ls3.SymbolKind.Class;
|
13325
|
-
case 6 /*
|
13319
|
+
case 6 /* FunctionType */:
|
13326
13320
|
return ls3.SymbolKind.Class;
|
13327
13321
|
case 0 /* PackageAlias */:
|
13328
13322
|
return ls3.SymbolKind.Module;
|
@@ -13398,7 +13392,7 @@ var LanguageServer = class {
|
|
13398
13392
|
const sourceFileContext = yield this.getSourceFileContext(uri, token);
|
13399
13393
|
if (sourceFileContext !== void 0) {
|
13400
13394
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
13401
|
-
if (node?.kind ===
|
13395
|
+
if (node?.kind === 91 /* AssignmentStatement */) {
|
13402
13396
|
const sourceFileEdit = this._addPropertyAssignmentService.createEditWithAssignment(
|
13403
13397
|
sourceFileContext.sourceFile,
|
13404
13398
|
node,
|
@@ -13435,7 +13429,7 @@ var LanguageServer = class {
|
|
13435
13429
|
const node = NodePath.parse(uri.fragment).getNode(sourceFileContext.sourceFile.getSyntaxNode());
|
13436
13430
|
if (node !== void 0) {
|
13437
13431
|
let nodeForRange = node;
|
13438
|
-
if (node.kind ===
|
13432
|
+
if (node.kind === 91 /* AssignmentStatement */) {
|
13439
13433
|
nodeForRange = node.right;
|
13440
13434
|
}
|
13441
13435
|
result = this.convertSourceFileRange(sourceFileContext.sourceFile, nodeForRange.rangeWithoutTrivia);
|
@@ -13630,25 +13624,25 @@ ${e}`);
|
|
13630
13624
|
return ls3.CompletionItemKind.Module;
|
13631
13625
|
case 1 /* PackageAlias */:
|
13632
13626
|
return ls3.CompletionItemKind.Module;
|
13633
|
-
case 2 /*
|
13627
|
+
case 2 /* Field */:
|
13634
13628
|
return ls3.CompletionItemKind.Property;
|
13635
|
-
case 3 /*
|
13629
|
+
case 3 /* Method */:
|
13636
13630
|
return ls3.CompletionItemKind.Method;
|
13637
|
-
case 5 /*
|
13631
|
+
case 5 /* Indexer */:
|
13638
13632
|
return ls3.CompletionItemKind.Property;
|
13639
|
-
case 6 /*
|
13633
|
+
case 6 /* Constructor */:
|
13640
13634
|
return ls3.CompletionItemKind.Constructor;
|
13641
13635
|
case 12 /* Variant */:
|
13642
13636
|
return ls3.CompletionItemKind.EnumMember;
|
13643
13637
|
case 7 /* PackageVariable */:
|
13644
13638
|
return ls3.CompletionItemKind.Variable;
|
13645
|
-
case 8 /*
|
13639
|
+
case 8 /* PackageFunction */:
|
13646
13640
|
return ls3.CompletionItemKind.Function;
|
13647
13641
|
case 9 /* LocalVariable */:
|
13648
13642
|
return ls3.CompletionItemKind.Variable;
|
13649
13643
|
case 10 /* ParameterVariable */:
|
13650
13644
|
return ls3.CompletionItemKind.Variable;
|
13651
|
-
case 11 /*
|
13645
|
+
case 11 /* NestedFunction */:
|
13652
13646
|
return ls3.CompletionItemKind.Function;
|
13653
13647
|
case 13 /* RefObjectType */:
|
13654
13648
|
return ls3.CompletionItemKind.Class;
|
@@ -13660,7 +13654,7 @@ ${e}`);
|
|
13660
13654
|
return ls3.CompletionItemKind.Enum;
|
13661
13655
|
case 17 /* TypeParameter */:
|
13662
13656
|
return ls3.CompletionItemKind.TypeParameter;
|
13663
|
-
case 18 /*
|
13657
|
+
case 18 /* FunctionType */:
|
13664
13658
|
return ls3.CompletionItemKind.Function;
|
13665
13659
|
case 19 /* AliasType */:
|
13666
13660
|
return ls3.CompletionItemKind.Class;
|
@@ -13746,7 +13740,7 @@ ${e}`);
|
|
13746
13740
|
}
|
13747
13741
|
convertSemanticTokenKind(kind) {
|
13748
13742
|
switch (kind) {
|
13749
|
-
case 0 /*
|
13743
|
+
case 0 /* FunctionBlockLiteralParameter */:
|
13750
13744
|
return "keyword.art";
|
13751
13745
|
case 1 /* SpecialVariable */:
|
13752
13746
|
return "keyword.art";
|
@@ -13754,11 +13748,11 @@ ${e}`);
|
|
13754
13748
|
return "keyword.art";
|
13755
13749
|
case 3 /* Variant */:
|
13756
13750
|
return ls3.SemanticTokenTypes.enumMember;
|
13757
|
-
case 4 /*
|
13751
|
+
case 4 /* PackageFunction */:
|
13758
13752
|
return ls3.SemanticTokenTypes.function;
|
13759
|
-
case 5 /*
|
13753
|
+
case 5 /* NestedFunction */:
|
13760
13754
|
return ls3.SemanticTokenTypes.function;
|
13761
|
-
case 6 /*
|
13755
|
+
case 6 /* Method */:
|
13762
13756
|
return ls3.SemanticTokenTypes.method;
|
13763
13757
|
case 7 /* Operator */:
|
13764
13758
|
return ls3.SemanticTokenTypes.operator;
|