@artel/artc 0.6.25254 → 0.6.25255
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 +12 -6
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +568 -365
- package/build/{chunk-JTDPRR7O.js → chunk-R2AFVF7W.js} +2 -2
- package/build/{chunk-JV2EK6MS.js → chunk-SSG7MY2R.js} +1 -1
- package/build/{chunk-3JS4YG6N.js → chunk-Y23FSWAN.js} +13016 -14906
- package/build/types/analysis/AccessedFunction.d.ts +11 -5
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +2 -1
- package/build/types/analysis/Analyzer.d.ts +116 -40
- package/build/types/analysis/ArgumentToParameterMatchResult.d.ts +1 -4
- package/build/types/analysis/ArgumentsToParametersMatcher.d.ts +9 -15
- package/build/types/analysis/AutotypeCallExpressionMeaning.d.ts +12 -6
- package/build/types/analysis/BaseExpressionMeaning.d.ts +43 -15
- package/build/types/analysis/CallExpressionMeaning.d.ts +41 -22
- package/build/types/analysis/ConstructorCallResolver.d.ts +22 -0
- package/build/types/analysis/DiagnosticCollector.d.ts +5 -9
- package/build/types/analysis/FunctionAccessResolver.d.ts +15 -0
- package/build/types/analysis/IdentifierExpressionMeaning.d.ts +56 -22
- package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +3 -2
- package/build/types/analysis/MemberAccessExpressionMeaning.d.ts +76 -27
- package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +0 -1
- package/build/types/analysis/NodeTypeUtils.d.ts +1 -0
- package/build/types/analysis/ObjectExpressionMeaning.d.ts +1 -0
- package/build/types/analysis/OperatorAccessResolver.d.ts +9 -0
- package/build/types/analysis/OverloadResolver.d.ts +91 -5
- package/build/types/analysis/ReturnTypeInferrer.d.ts +13 -0
- package/build/types/analysis/SubstitutedFunction.d.ts +10 -4
- package/build/types/analysis/TagMeaning.d.ts +16 -15
- package/build/types/analysis/TypeArgumentInferrer.d.ts +49 -0
- package/build/types/analysis/TypeNarrower.d.ts +6 -4
- package/build/types/analysis/TypeOverloadResolver.d.ts +4 -2
- package/build/types/analysis/UserDefinableBinaryOperatorResolver.d.ts +2 -6
- package/build/types/analysis/UserDefinableUnaryOperatorResolver.d.ts +2 -2
- package/build/types/analysis/Utils.d.ts +2 -0
- package/build/types/analysis/index.d.ts +0 -2
- package/build/types/analysis/semantic-context/Declarations.d.ts +4 -4
- package/build/types/analysis/semantic-context/SemanticContextBuilder.d.ts +1 -0
- package/build/types/api/Api.d.ts +0 -2
- package/build/types/common/ArrayUtils.d.ts +3 -2
- package/build/types/common/Cached.d.ts +2 -0
- package/build/types/common/Query.d.ts +1 -1
- package/build/types/common/TreeQuery.d.ts +1 -2
- package/build/types/diagnostic/Diagnostic.d.ts +7 -0
- package/build/types/diagnostic/DiagnosticCode.d.ts +180 -173
- package/build/types/entities/AliasTypeEntity.d.ts +1 -0
- package/build/types/entities/AliasedType.d.ts +2 -2
- package/build/types/entities/FunctionEntity.d.ts +6 -3
- package/build/types/entities/FunctionTypeEntity.d.ts +2 -1
- package/build/types/entities/PackageAliasEntity.d.ts +2 -2
- package/build/types/entities/StructuredTypeEntity.d.ts +1 -0
- package/build/types/entities/TypeParameterEntity.d.ts +1 -0
- package/build/types/entities/VariableEntity.d.ts +23 -11
- package/build/types/entities/VariantTypeEntity.d.ts +1 -0
- package/build/types/entities/index.d.ts +2 -1
- package/build/types/parser/CharacterCodes.d.ts +0 -8
- package/build/types/parser/Parser.d.ts +2 -2
- package/build/types/parser/TriviaInterner.d.ts +8 -0
- package/build/types/services/AddPropertyAssignmentService.d.ts +0 -7
- package/build/types/services/NodeSemanticInfo.d.ts +3 -1
- package/build/types/services/TreeUtils.d.ts +1 -1
- package/build/types/services/signature-help/SignatureWithValueParameters.d.ts +9 -1
- package/build/types/services/signature-help/TypeParameterSignatureHelpProvider.d.ts +1 -1
- package/build/types/services/source-generation/EntityToSyntax.d.ts +1 -1
- package/build/types/tree/BaseNode.d.ts +26 -0
- package/build/types/tree/{green/Nodes.d.ts → Nodes.d.ts} +408 -356
- package/build/types/tree/{green/SyntaxToCode.d.ts → SyntaxToCode.d.ts} +1 -1
- package/build/types/tree/{green/Token.d.ts → Token.d.ts} +26 -10
- package/build/types/tree/{red/Utils.d.ts → Utils.d.ts} +4 -3
- package/build/types/tree/index.d.ts +10 -1
- package/build/types/ts-interop/Entities.d.ts +14 -0
- package/build/types/types/AliasType.d.ts +2 -2
- package/build/types/types/FunctionType.d.ts +2 -2
- package/build/types/types/IntersectionType.d.ts +2 -2
- package/build/types/types/ParameterType.d.ts +2 -2
- package/build/types/types/StructuredType.d.ts +2 -2
- package/build/types/types/Substitutions.d.ts +2 -2
- package/build/types/types/Type.d.ts +3 -3
- package/build/types/types/TypeMembers.d.ts +1 -0
- package/build/types/types/UnionType.d.ts +2 -2
- package/build/types/types/UnresolvedType.d.ts +2 -2
- package/build/types/types/VariantType.d.ts +2 -2
- package/package.json +1 -1
- package/build/types/analysis/ConstructorOverloadResolver.d.ts +0 -31
- package/build/types/analysis/FunctionOverloadResolver.d.ts +0 -21
- package/build/types/analysis/TargetTypeHint.d.ts +0 -5
- package/build/types/tree/green/BaseNode.d.ts +0 -14
- package/build/types/tree/green/Utils.d.ts +0 -2
- package/build/types/tree/green/index.d.ts +0 -8
- package/build/types/tree/red/BaseNode.d.ts +0 -16
- package/build/types/tree/red/Internal.d.ts +0 -2
- package/build/types/tree/red/Nodes.d.ts +0 -2271
- package/build/types/tree/red/Token.d.ts +0 -30
- package/build/types/tree/red/index.d.ts +0 -10
- /package/build/types/tree/{red/NodePath.d.ts → NodePath.d.ts} +0 -0
- /package/build/types/tree/{green/SyntaxFactory.d.ts → SyntaxFactory.d.ts} +0 -0
package/build/api/ApiServices.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AccessedFunction_entity,
|
|
2
3
|
AccessedFunction_typeMember,
|
|
3
4
|
AliasTypeDeclarationBody,
|
|
4
5
|
Analyzer,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
ConfigurationConverter,
|
|
15
16
|
ConfigurationDirectoryNameSet,
|
|
16
17
|
ConfigurationFileParser,
|
|
18
|
+
Constructor,
|
|
17
19
|
ConstructorDeclaration,
|
|
18
20
|
ConstructorDeclaration_entity,
|
|
19
21
|
ConstructorDeclaration_typeMember,
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
IndexerDeclaration_entity,
|
|
50
52
|
IndexerDeclaration_typeMember,
|
|
51
53
|
IndexerTranslation,
|
|
54
|
+
InferenceOptions,
|
|
52
55
|
IntersectionTypeSpecifier,
|
|
53
56
|
JavaScriptInterfacePackageImplementationConfig,
|
|
54
57
|
JsonConfigurationFileNameSet,
|
|
@@ -105,10 +108,10 @@ import {
|
|
|
105
108
|
StatementBlock,
|
|
106
109
|
StatementList,
|
|
107
110
|
StructuredTypeDeclarationBody,
|
|
111
|
+
Substitutions,
|
|
108
112
|
Tag,
|
|
109
113
|
TagList,
|
|
110
114
|
TargetPlatformConfig,
|
|
111
|
-
TargetTypeHint,
|
|
112
115
|
Token,
|
|
113
116
|
TokenExpression,
|
|
114
117
|
TopLevelTranslationList,
|
|
@@ -178,7 +181,7 @@ import {
|
|
|
178
181
|
unwrapParenthesizedExpressions,
|
|
179
182
|
visitChildren,
|
|
180
183
|
yieldExecution
|
|
181
|
-
} from "../chunk-
|
|
184
|
+
} from "../chunk-Y23FSWAN.js";
|
|
182
185
|
|
|
183
186
|
// source/services/CustomCommand.ts
|
|
184
187
|
import * as ls from "vscode-languageserver";
|
|
@@ -295,7 +298,6 @@ var SourceFileEdit = class {
|
|
|
295
298
|
// source/services/AddPropertyAssignmentService.ts
|
|
296
299
|
var AddPropertyAssignmentService = class {
|
|
297
300
|
createEditWithAssignment(sourceFile, assignmentNode, value, propertyName) {
|
|
298
|
-
let result;
|
|
299
301
|
let leftValueText;
|
|
300
302
|
if (propertyName !== void 0) {
|
|
301
303
|
if (assignmentNode.left.kind !== 76 /* MemberAccessExpression */) {
|
|
@@ -313,51 +315,28 @@ var AddPropertyAssignmentService = class {
|
|
|
313
315
|
);
|
|
314
316
|
}
|
|
315
317
|
const reassignmentText = `${leftValueText} = ${value}`;
|
|
316
|
-
const subprogramBody = this.
|
|
317
|
-
if (subprogramBody
|
|
318
|
-
|
|
319
|
-
let editRangeStart;
|
|
320
|
-
let indentationText;
|
|
321
|
-
if (lastStatement !== void 0) {
|
|
322
|
-
editRangeStart = lastStatement.rangeWithoutTrivia.end;
|
|
323
|
-
const statementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
|
|
324
|
-
const newLine = this.detectNewLine(sourceFile.getSourceText());
|
|
325
|
-
indentationText = `${newLine}${" ".repeat(statementStartCharacter)}`;
|
|
326
|
-
} else {
|
|
327
|
-
editRangeStart = subprogramBody.openBraceToken.rangeWithoutTrivia.end;
|
|
328
|
-
indentationText = "";
|
|
329
|
-
}
|
|
330
|
-
const editText = `${indentationText}${reassignmentText}`;
|
|
331
|
-
result = new SourceFileEdit(sourceFile, Range.empty(editRangeStart), editText);
|
|
332
|
-
} else {
|
|
333
|
-
const assignmentStartPosition = sourceFile.getPositionAt(assignmentNode.rangeWithoutTrivia.start);
|
|
334
|
-
const newLine = this.detectNewLine(sourceFile.getSourceText());
|
|
335
|
-
const indentationText = `${newLine}${" ".repeat(assignmentStartPosition.character)}`;
|
|
336
|
-
const editText = `${indentationText}${reassignmentText}`;
|
|
337
|
-
result = new SourceFileEdit(sourceFile, Range.empty(assignmentNode.rangeWithoutTrivia.end), editText);
|
|
318
|
+
const subprogramBody = this.getContainingSubprogram(assignmentNode)?.block;
|
|
319
|
+
if (subprogramBody === void 0) {
|
|
320
|
+
return void 0;
|
|
338
321
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
case 94 /* StatementBlock */:
|
|
351
|
-
return this.getContainingSubprogram(parent)?.block;
|
|
352
|
-
case 95 /* FunctionBlock */:
|
|
353
|
-
return void 0;
|
|
354
|
-
default:
|
|
355
|
-
Debug.never(parent);
|
|
322
|
+
const lastStatement = subprogramBody.expressionOrStatementList.kind === 93 /* StatementList */ ? subprogramBody.expressionOrStatementList?.statements.last() : subprogramBody.expressionOrStatementList;
|
|
323
|
+
let editRangeStart;
|
|
324
|
+
let indentationText;
|
|
325
|
+
if (lastStatement !== void 0) {
|
|
326
|
+
editRangeStart = lastStatement.rangeWithoutTrivia.end;
|
|
327
|
+
const statementStartCharacter = sourceFile.getPositionAt(lastStatement.rangeWithoutTrivia.start).character;
|
|
328
|
+
const newLine = this.detectNewLine(sourceFile.getSourceText());
|
|
329
|
+
indentationText = `${newLine}${" ".repeat(statementStartCharacter)}`;
|
|
330
|
+
} else {
|
|
331
|
+
editRangeStart = subprogramBody.openBraceToken.rangeWithoutTrivia.end;
|
|
332
|
+
indentationText = "";
|
|
356
333
|
}
|
|
334
|
+
const editText = `${indentationText}${reassignmentText}`;
|
|
335
|
+
return new SourceFileEdit(sourceFile, Range.empty(editRangeStart), editText);
|
|
357
336
|
}
|
|
358
337
|
getContainingSubprogram(node) {
|
|
359
338
|
let parent = node.parent;
|
|
360
|
-
while (parent !== void 0 && !
|
|
339
|
+
while (parent !== void 0 && !NodeTypeUtils.isSubprogramDeclarationOrLiteral(parent)) {
|
|
361
340
|
parent = parent.parent;
|
|
362
341
|
}
|
|
363
342
|
return parent;
|
|
@@ -366,40 +345,14 @@ var AddPropertyAssignmentService = class {
|
|
|
366
345
|
return text.includes("\r\n") ? "\r\n" : "\n";
|
|
367
346
|
}
|
|
368
347
|
};
|
|
369
|
-
function isSubprogramDeclaration(node) {
|
|
370
|
-
switch (node.kind) {
|
|
371
|
-
case 23 /* PackageConstructorDeclaration */:
|
|
372
|
-
case 24 /* PackageEntryPointDeclaration */:
|
|
373
|
-
case 25 /* PackageFunctionDeclaration */:
|
|
374
|
-
case 34 /* PackageVariableGetterDeclaration */:
|
|
375
|
-
case 35 /* PackageVariableSetterDeclaration */:
|
|
376
|
-
case 43 /* ConstructorDeclaration */:
|
|
377
|
-
case 44 /* DestructorDeclaration */:
|
|
378
|
-
case 45 /* IndexedElementGetterDeclaration */:
|
|
379
|
-
case 46 /* IndexedElementSetterDeclaration */:
|
|
380
|
-
case 48 /* DereferencedVariableGetterDeclaration */:
|
|
381
|
-
case 49 /* DereferencedVariableSetterDeclaration */:
|
|
382
|
-
case 50 /* MethodDeclaration */:
|
|
383
|
-
case 53 /* FieldGetterDeclaration */:
|
|
384
|
-
case 54 /* FieldSetterDeclaration */:
|
|
385
|
-
case 56 /* NestedFunctionDeclaration */:
|
|
386
|
-
case 66 /* FunctionBlockLiteral */:
|
|
387
|
-
case 65 /* FunctionLiteral */:
|
|
388
|
-
return true;
|
|
389
|
-
default:
|
|
390
|
-
Debug.typeIsAssignableTo();
|
|
391
|
-
Debug.typeIsAssignableTo();
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
348
|
|
|
396
|
-
// source/tree/
|
|
349
|
+
// source/tree/SyntaxFactory.ts
|
|
397
350
|
var SyntaxFactory = class {
|
|
398
351
|
static sourceFile(packageImportDirectives, declarations) {
|
|
399
|
-
const packageImportDirectiveList = new PackageImportDirectiveList(packageImportDirectives);
|
|
400
|
-
const declarationList = new PackageMemberDeclarationList(declarations);
|
|
352
|
+
const packageImportDirectiveList = new PackageImportDirectiveList(packageImportDirectives, void 0);
|
|
353
|
+
const declarationList = new PackageMemberDeclarationList(declarations, void 0);
|
|
401
354
|
const endOfFileToken = this.token(1 /* EndOfFile */);
|
|
402
|
-
return new SourceFile(packageImportDirectiveList, declarationList, endOfFileToken, []);
|
|
355
|
+
return new SourceFile(packageImportDirectiveList, declarationList, endOfFileToken, [], void 0);
|
|
403
356
|
}
|
|
404
357
|
static singlePackageImportDirective(alias, pathSegments) {
|
|
405
358
|
let aliasIdentifier;
|
|
@@ -409,18 +362,18 @@ var SyntaxFactory = class {
|
|
|
409
362
|
equalsToken = this.token(58 /* Equals */);
|
|
410
363
|
}
|
|
411
364
|
const packageName = this.packageName(pathSegments);
|
|
412
|
-
const packageImport = new PackageImport(aliasIdentifier, equalsToken, packageName);
|
|
365
|
+
const packageImport = new PackageImport(aliasIdentifier, equalsToken, packageName, void 0);
|
|
413
366
|
const importKeyword = this.keyword(18 /* Import */);
|
|
414
|
-
return new SinglePackageImportDirective(importKeyword, packageImport);
|
|
367
|
+
return new SinglePackageImportDirective(importKeyword, packageImport, void 0);
|
|
415
368
|
}
|
|
416
369
|
static packageName(segments) {
|
|
417
370
|
const segmentIdentifiers = segments.map((s) => this.createIdentifier(s));
|
|
418
371
|
const packageNameParts = this.createTokenSeparatedElements(segmentIdentifiers, 27 /* Dot */);
|
|
419
|
-
return new PackageName(packageNameParts);
|
|
372
|
+
return new PackageName(packageNameParts, void 0);
|
|
420
373
|
}
|
|
421
374
|
static packageAliasTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
|
422
|
-
const tagList = new TagList(tags);
|
|
423
|
-
const modifierList = new ModifierList(modifiers);
|
|
375
|
+
const tagList = new TagList(tags, void 0);
|
|
376
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
424
377
|
const typeKeyword = this.keyword(16 /* Type */);
|
|
425
378
|
const nameIdentifier = this.createIdentifier(name);
|
|
426
379
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
|
@@ -432,28 +385,30 @@ var SyntaxFactory = class {
|
|
|
432
385
|
nameIdentifier,
|
|
433
386
|
typeParameterClause,
|
|
434
387
|
equalsToken,
|
|
435
|
-
body
|
|
388
|
+
body,
|
|
389
|
+
void 0
|
|
436
390
|
);
|
|
437
391
|
}
|
|
438
392
|
static aliasTypeDeclarationBody(aliasedTypeSpecifier, members) {
|
|
439
393
|
const memberBlock = members !== void 0 ? this.typeMemberDeclarationBlock(members) : void 0;
|
|
440
|
-
return new AliasTypeDeclarationBody(aliasedTypeSpecifier, memberBlock);
|
|
394
|
+
return new AliasTypeDeclarationBody(aliasedTypeSpecifier, memberBlock, void 0);
|
|
441
395
|
}
|
|
442
396
|
static packageMemberGroupDeclaration(tags, modifiers, declarations) {
|
|
443
|
-
const tagList = new TagList(tags);
|
|
444
|
-
const modifierList = new ModifierList(modifiers);
|
|
445
|
-
const declarationList = new PackageMemberDeclarationList(declarations);
|
|
397
|
+
const tagList = new TagList(tags, void 0);
|
|
398
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
399
|
+
const declarationList = new PackageMemberDeclarationList(declarations, void 0);
|
|
446
400
|
return new PackageMemberGroupDeclaration(
|
|
447
401
|
tagList,
|
|
448
402
|
modifierList,
|
|
449
403
|
this.token(44 /* OpenBrace */),
|
|
450
404
|
declarationList,
|
|
451
|
-
this.token(21 /* CloseBrace */)
|
|
405
|
+
this.token(21 /* CloseBrace */),
|
|
406
|
+
void 0
|
|
452
407
|
);
|
|
453
408
|
}
|
|
454
409
|
static packageFunctionDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
|
|
455
|
-
const tagList = new TagList(tags);
|
|
456
|
-
const modifierList = new ModifierList(modifiers);
|
|
410
|
+
const tagList = new TagList(tags, void 0);
|
|
411
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
457
412
|
const functionKeyword = this.keyword(12 /* Function */);
|
|
458
413
|
const nameIdentifier = this.createIdentifier(name);
|
|
459
414
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
|
@@ -467,12 +422,13 @@ var SyntaxFactory = class {
|
|
|
467
422
|
typeParameterClause,
|
|
468
423
|
parameterClause,
|
|
469
424
|
returnTypeAnnotation,
|
|
470
|
-
body
|
|
425
|
+
body,
|
|
426
|
+
void 0
|
|
471
427
|
);
|
|
472
428
|
}
|
|
473
429
|
static packageFunctionTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
|
474
|
-
const tagList = new TagList(tags);
|
|
475
|
-
const modifierList = new ModifierList(modifiers);
|
|
430
|
+
const tagList = new TagList(tags, void 0);
|
|
431
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
476
432
|
const typeKeyword = this.keyword(16 /* Type */);
|
|
477
433
|
const nameIdentifier = this.createIdentifier(name);
|
|
478
434
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
|
@@ -484,18 +440,25 @@ var SyntaxFactory = class {
|
|
|
484
440
|
nameIdentifier,
|
|
485
441
|
typeParameterClause,
|
|
486
442
|
equalsToken,
|
|
487
|
-
body
|
|
443
|
+
body,
|
|
444
|
+
void 0
|
|
488
445
|
);
|
|
489
446
|
}
|
|
490
447
|
static functionTypeDeclarationBody(parameters, returnTypeSpecifier) {
|
|
491
448
|
const functionKeyword = this.keyword(12 /* Function */);
|
|
492
449
|
const parameterClause = this.parameterClause(parameters);
|
|
493
450
|
const returnTypeAnnotation = this.createTypeAnnotation(returnTypeSpecifier);
|
|
494
|
-
return new FunctionTypeDeclarationBody(
|
|
451
|
+
return new FunctionTypeDeclarationBody(
|
|
452
|
+
void 0,
|
|
453
|
+
functionKeyword,
|
|
454
|
+
parameterClause,
|
|
455
|
+
returnTypeAnnotation,
|
|
456
|
+
void 0
|
|
457
|
+
);
|
|
495
458
|
}
|
|
496
459
|
static packageStructuredTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
|
497
|
-
const tagList = new TagList(tags);
|
|
498
|
-
const modifierList = new ModifierList(modifiers);
|
|
460
|
+
const tagList = new TagList(tags, void 0);
|
|
461
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
499
462
|
const typeKeyword = this.keyword(16 /* Type */);
|
|
500
463
|
const nameIdentifier = this.createIdentifier(name);
|
|
501
464
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
|
@@ -507,22 +470,24 @@ var SyntaxFactory = class {
|
|
|
507
470
|
nameIdentifier,
|
|
508
471
|
typeParameterClause,
|
|
509
472
|
equalsToken,
|
|
510
|
-
body
|
|
473
|
+
body,
|
|
474
|
+
void 0
|
|
511
475
|
);
|
|
512
476
|
}
|
|
513
477
|
static structuredTypeDeclarationBody(structuredTypeKind, baseTypes, members) {
|
|
514
478
|
const structuredTypeKindKeyword = this.keyword(structuredTypeKind);
|
|
515
|
-
const baseTypeList = baseTypes !== void 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */)) : void 0;
|
|
479
|
+
const baseTypeList = baseTypes !== void 0 ? new BaseTypeList(this.createTokenSeparatedElements(baseTypes, 25 /* Comma */), void 0) : void 0;
|
|
516
480
|
const memberBlock = this.typeMemberDeclarationBlock(members);
|
|
517
481
|
return new StructuredTypeDeclarationBody(
|
|
518
482
|
structuredTypeKindKeyword,
|
|
519
483
|
baseTypeList,
|
|
520
|
-
memberBlock
|
|
484
|
+
memberBlock,
|
|
485
|
+
void 0
|
|
521
486
|
);
|
|
522
487
|
}
|
|
523
488
|
static packageVariableDeclaration(tags, modifiers, name, typeSpecifier, initializer) {
|
|
524
|
-
const tagList = new TagList(tags);
|
|
525
|
-
const modifierList = new ModifierList(modifiers);
|
|
489
|
+
const tagList = new TagList(tags, void 0);
|
|
490
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
526
491
|
const nameIdentifier = this.createIdentifier(name);
|
|
527
492
|
const typeAnnotation = this.createTypeAnnotation(typeSpecifier);
|
|
528
493
|
let equalsToken;
|
|
@@ -535,12 +500,13 @@ var SyntaxFactory = class {
|
|
|
535
500
|
nameIdentifier,
|
|
536
501
|
typeAnnotation,
|
|
537
502
|
equalsToken,
|
|
538
|
-
initializer
|
|
503
|
+
initializer,
|
|
504
|
+
void 0
|
|
539
505
|
);
|
|
540
506
|
}
|
|
541
507
|
static packageVariableGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
|
542
|
-
const tagList = new TagList(tags);
|
|
543
|
-
const modifierList = new ModifierList(modifiers);
|
|
508
|
+
const tagList = new TagList(tags, void 0);
|
|
509
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
544
510
|
const getKeyword = this.keyword(58 /* Get */);
|
|
545
511
|
const nameIdentifier = this.createIdentifier(name);
|
|
546
512
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
|
@@ -550,19 +516,20 @@ var SyntaxFactory = class {
|
|
|
550
516
|
getKeyword,
|
|
551
517
|
nameIdentifier,
|
|
552
518
|
typeAnnotation,
|
|
553
|
-
body
|
|
519
|
+
body,
|
|
520
|
+
void 0
|
|
554
521
|
);
|
|
555
522
|
}
|
|
556
523
|
static packageVariableSetterDeclaration(tags, modifiers, name, body) {
|
|
557
|
-
const tagList = new TagList(tags);
|
|
558
|
-
const modifierList = new ModifierList(modifiers);
|
|
524
|
+
const tagList = new TagList(tags, void 0);
|
|
525
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
559
526
|
const setKeyword = this.keyword(59 /* Set */);
|
|
560
527
|
const nameIdentifier = this.createIdentifier(name);
|
|
561
|
-
return new PackageVariableSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body);
|
|
528
|
+
return new PackageVariableSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body, void 0);
|
|
562
529
|
}
|
|
563
530
|
static packageVariantTypeDeclaration(tags, modifiers, name, typeParameters, body) {
|
|
564
|
-
const tagList = new TagList(tags);
|
|
565
|
-
const modifierList = new ModifierList(modifiers);
|
|
531
|
+
const tagList = new TagList(tags, void 0);
|
|
532
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
566
533
|
const typeKeyword = this.keyword(16 /* Type */);
|
|
567
534
|
const nameIdentifier = this.createIdentifier(name);
|
|
568
535
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
|
@@ -574,17 +541,18 @@ var SyntaxFactory = class {
|
|
|
574
541
|
nameIdentifier,
|
|
575
542
|
typeParameterClause,
|
|
576
543
|
equalsToken,
|
|
577
|
-
body
|
|
544
|
+
body,
|
|
545
|
+
void 0
|
|
578
546
|
);
|
|
579
547
|
}
|
|
580
548
|
static variantTypeDeclarationBody(members) {
|
|
581
549
|
const variantKeyword = this.keyword(6 /* Variant */);
|
|
582
550
|
const memberBlock = this.typeMemberDeclarationBlock(members);
|
|
583
|
-
return new VariantTypeDeclarationBody(variantKeyword, void 0, memberBlock);
|
|
551
|
+
return new VariantTypeDeclarationBody(variantKeyword, void 0, memberBlock, void 0);
|
|
584
552
|
}
|
|
585
553
|
static fieldDeclaration(tags, modifiers, name, typeSpecifier, initializer) {
|
|
586
|
-
const tagList = new TagList(tags);
|
|
587
|
-
const modifierList = new ModifierList(modifiers);
|
|
554
|
+
const tagList = new TagList(tags, void 0);
|
|
555
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
588
556
|
const nameIdentifier = this.createIdentifier(name);
|
|
589
557
|
const typeAnnotation = this.createTypeAnnotation(typeSpecifier);
|
|
590
558
|
let equalsToken;
|
|
@@ -597,12 +565,13 @@ var SyntaxFactory = class {
|
|
|
597
565
|
nameIdentifier,
|
|
598
566
|
typeAnnotation,
|
|
599
567
|
equalsToken,
|
|
600
|
-
initializer
|
|
568
|
+
initializer,
|
|
569
|
+
void 0
|
|
601
570
|
);
|
|
602
571
|
}
|
|
603
572
|
static fieldGetterDeclaration(tags, modifiers, name, typeSpecifier, body) {
|
|
604
|
-
const tagList = new TagList(tags);
|
|
605
|
-
const modifierList = new ModifierList(modifiers);
|
|
573
|
+
const tagList = new TagList(tags, void 0);
|
|
574
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
606
575
|
const getKeyword = this.keyword(58 /* Get */);
|
|
607
576
|
const nameIdentifier = this.createIdentifier(name);
|
|
608
577
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
|
@@ -612,19 +581,20 @@ var SyntaxFactory = class {
|
|
|
612
581
|
getKeyword,
|
|
613
582
|
nameIdentifier,
|
|
614
583
|
typeAnnotation,
|
|
615
|
-
body
|
|
584
|
+
body,
|
|
585
|
+
void 0
|
|
616
586
|
);
|
|
617
587
|
}
|
|
618
588
|
static fieldSetterDeclaration(tags, modifiers, name, body) {
|
|
619
|
-
const tagList = new TagList(tags);
|
|
620
|
-
const modifierList = new ModifierList(modifiers);
|
|
589
|
+
const tagList = new TagList(tags, void 0);
|
|
590
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
621
591
|
const setKeyword = this.keyword(59 /* Set */);
|
|
622
592
|
const nameIdentifier = this.createIdentifier(name);
|
|
623
|
-
return new FieldSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body);
|
|
593
|
+
return new FieldSetterDeclaration(tagList, modifierList, setKeyword, nameIdentifier, body, void 0);
|
|
624
594
|
}
|
|
625
595
|
static methodDeclaration(tags, modifiers, name, typeParameters, parameters, returnTypeSpecifier, body) {
|
|
626
|
-
const tagList = new TagList(tags);
|
|
627
|
-
const modifierList = new ModifierList(modifiers);
|
|
596
|
+
const tagList = new TagList(tags, void 0);
|
|
597
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
628
598
|
const functionKeyword = this.keyword(12 /* Function */);
|
|
629
599
|
const nameIdentifier = this.createIdentifier(name);
|
|
630
600
|
const typeParameterClause = this.createTypeParameterClause(typeParameters);
|
|
@@ -638,26 +608,27 @@ var SyntaxFactory = class {
|
|
|
638
608
|
typeParameterClause,
|
|
639
609
|
parameterClause,
|
|
640
610
|
returnTypeAnnotation,
|
|
641
|
-
body
|
|
611
|
+
body,
|
|
612
|
+
void 0
|
|
642
613
|
);
|
|
643
614
|
}
|
|
644
615
|
static constructorDeclaration(tags, modifiers, parameters, body) {
|
|
645
|
-
const tagList = new TagList(tags);
|
|
646
|
-
const modifierList = new ModifierList(modifiers);
|
|
616
|
+
const tagList = new TagList(tags, void 0);
|
|
617
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
647
618
|
const creationKeyword = this.keyword(31 /* Creation */);
|
|
648
619
|
const parameterClause = this.parameterClause(parameters);
|
|
649
|
-
return new ConstructorDeclaration(tagList, modifierList, creationKeyword, parameterClause, body);
|
|
620
|
+
return new ConstructorDeclaration(tagList, modifierList, creationKeyword, parameterClause, body, void 0);
|
|
650
621
|
}
|
|
651
622
|
static destructorDeclaration(tags, modifiers, parameters, body) {
|
|
652
|
-
const tagList = new TagList(tags);
|
|
653
|
-
const modifierList = new ModifierList(modifiers);
|
|
623
|
+
const tagList = new TagList(tags, void 0);
|
|
624
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
654
625
|
const destructionKeyword = this.keyword(47 /* Destruction */);
|
|
655
626
|
const parameterClause = this.parameterClause(parameters);
|
|
656
|
-
return new DestructorDeclaration(tagList, modifierList, destructionKeyword, parameterClause, body);
|
|
627
|
+
return new DestructorDeclaration(tagList, modifierList, destructionKeyword, parameterClause, body, void 0);
|
|
657
628
|
}
|
|
658
629
|
static indexedElementGetterDeclaration(tags, modifiers, parameters, typeSpecifier, body) {
|
|
659
|
-
const tagList = new TagList(tags);
|
|
660
|
-
const modifierList = new ModifierList(modifiers);
|
|
630
|
+
const tagList = new TagList(tags, void 0);
|
|
631
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
661
632
|
const getKeyword = this.keyword(58 /* Get */);
|
|
662
633
|
const parameterClause = this.indexParameterClause(parameters);
|
|
663
634
|
const typeAnnotation = this.typeAnnotation(typeSpecifier);
|
|
@@ -667,90 +638,95 @@ var SyntaxFactory = class {
|
|
|
667
638
|
getKeyword,
|
|
668
639
|
parameterClause,
|
|
669
640
|
typeAnnotation,
|
|
670
|
-
body
|
|
641
|
+
body,
|
|
642
|
+
void 0
|
|
671
643
|
);
|
|
672
644
|
}
|
|
673
645
|
static indexedElementSetterDeclaration(tags, modifiers, parameters, body) {
|
|
674
|
-
const tagList = new TagList(tags);
|
|
675
|
-
const modifierList = new ModifierList(modifiers);
|
|
646
|
+
const tagList = new TagList(tags, void 0);
|
|
647
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
676
648
|
const getKeyword = this.keyword(59 /* Set */);
|
|
677
649
|
const parameterClause = this.indexParameterClause(parameters);
|
|
678
|
-
return new IndexedElementSetterDeclaration(tagList, modifierList, getKeyword, parameterClause, body);
|
|
650
|
+
return new IndexedElementSetterDeclaration(tagList, modifierList, getKeyword, parameterClause, body, void 0);
|
|
679
651
|
}
|
|
680
652
|
static typeMemberGroupDeclaration(tags, modifiers, members) {
|
|
681
|
-
const tagList = new TagList(tags);
|
|
682
|
-
const modifierList = new ModifierList(modifiers);
|
|
653
|
+
const tagList = new TagList(tags, void 0);
|
|
654
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
683
655
|
const memberBlock = this.typeMemberDeclarationBlock(members);
|
|
684
|
-
return new TypeMemberGroupDeclaration(tagList, modifierList, memberBlock);
|
|
656
|
+
return new TypeMemberGroupDeclaration(tagList, modifierList, memberBlock, void 0);
|
|
685
657
|
}
|
|
686
658
|
static typeMemberDeclarationBlock(members) {
|
|
687
659
|
return new TypeMemberDeclarationBlock(
|
|
688
660
|
this.token(44 /* OpenBrace */),
|
|
689
|
-
new TypeMemberDeclarationList(members),
|
|
690
|
-
this.token(21 /* CloseBrace */)
|
|
661
|
+
new TypeMemberDeclarationList(members, void 0),
|
|
662
|
+
this.token(21 /* CloseBrace */),
|
|
663
|
+
void 0
|
|
691
664
|
);
|
|
692
665
|
}
|
|
693
666
|
static variantDeclaration(tags, modifiers, name, value) {
|
|
694
|
-
const tagList = new TagList(tags);
|
|
695
|
-
const modifierList = new ModifierList(modifiers);
|
|
667
|
+
const tagList = new TagList(tags, void 0);
|
|
668
|
+
const modifierList = new ModifierList(modifiers, void 0);
|
|
696
669
|
const nameIdentifier = this.createIdentifier(name);
|
|
697
670
|
let equalsToken;
|
|
698
671
|
if (value !== void 0) {
|
|
699
672
|
equalsToken = this.token(58 /* Equals */);
|
|
700
673
|
}
|
|
701
|
-
return new VariantDeclaration(tagList, modifierList, nameIdentifier, equalsToken, value);
|
|
674
|
+
return new VariantDeclaration(tagList, modifierList, nameIdentifier, equalsToken, value, void 0);
|
|
702
675
|
}
|
|
703
676
|
static parameterClause(parameters) {
|
|
704
677
|
return new ParameterClause(
|
|
705
678
|
this.token(45 /* OpenParenthesis */),
|
|
706
|
-
new ParameterList(this.createTokenSeparatedElements(parameters, 25 /* Comma */)),
|
|
707
|
-
this.token(22 /* CloseParenthesis */)
|
|
679
|
+
new ParameterList(this.createTokenSeparatedElements(parameters, 25 /* Comma */), void 0),
|
|
680
|
+
this.token(22 /* CloseParenthesis */),
|
|
681
|
+
void 0
|
|
708
682
|
);
|
|
709
683
|
}
|
|
710
684
|
static indexParameterClause(indexParameters) {
|
|
711
685
|
return new IndexParameterClause(
|
|
712
686
|
this.token(46 /* OpenSquareBracket */),
|
|
713
|
-
new ParameterList(this.createTokenSeparatedElements(indexParameters, 25 /* Comma */)),
|
|
714
|
-
this.token(23 /* CloseSquareBracket */)
|
|
687
|
+
new ParameterList(this.createTokenSeparatedElements(indexParameters, 25 /* Comma */), void 0),
|
|
688
|
+
this.token(23 /* CloseSquareBracket */),
|
|
689
|
+
void 0
|
|
715
690
|
);
|
|
716
691
|
}
|
|
717
692
|
static namedTypeSpecifier(name, typeArguments) {
|
|
718
693
|
const qualifiedNameIdentifiers = typeof name === "string" ? [this.createIdentifier(name)] : name.map((s) => this.createIdentifier(s));
|
|
719
694
|
const qualifiedName = new QualifiedName(
|
|
720
|
-
this.createTokenSeparatedElements(qualifiedNameIdentifiers, 27 /* Dot */)
|
|
695
|
+
this.createTokenSeparatedElements(qualifiedNameIdentifiers, 27 /* Dot */),
|
|
696
|
+
void 0
|
|
721
697
|
);
|
|
722
698
|
let typeArgumentClause;
|
|
723
699
|
if (typeArguments !== void 0) {
|
|
724
700
|
typeArgumentClause = this.typeArgumentClause(typeArguments);
|
|
725
701
|
}
|
|
726
|
-
return new NamedTypeSpecifier(qualifiedName, typeArgumentClause);
|
|
702
|
+
return new NamedTypeSpecifier(qualifiedName, typeArgumentClause, void 0);
|
|
727
703
|
}
|
|
728
704
|
static unionTypeSpecifier(typeSpecifiers) {
|
|
729
|
-
return new UnionTypeSpecifier(this.createTokenSeparatedElements(typeSpecifiers, 18 /* Bar */));
|
|
705
|
+
return new UnionTypeSpecifier(this.createTokenSeparatedElements(typeSpecifiers, 18 /* Bar */), void 0);
|
|
730
706
|
}
|
|
731
707
|
static intersectionTypeSpecifier(typeSpecifiers) {
|
|
732
708
|
return new IntersectionTypeSpecifier(this.createTokenSeparatedElements(
|
|
733
709
|
typeSpecifiers,
|
|
734
710
|
11 /* Ampersand */
|
|
735
|
-
));
|
|
711
|
+
), void 0);
|
|
736
712
|
}
|
|
737
713
|
static nullableTypeSpecifier(typeSpecifier) {
|
|
738
714
|
const questionToken = this.token(50 /* Question */);
|
|
739
|
-
return new NullableTypeSpecifier(typeSpecifier, questionToken);
|
|
715
|
+
return new NullableTypeSpecifier(typeSpecifier, questionToken, void 0);
|
|
740
716
|
}
|
|
741
717
|
static parenthesizedTypeSpecifier(typeSpecifier) {
|
|
742
718
|
const openParenthesisToken = this.token(45 /* OpenParenthesis */);
|
|
743
719
|
const closeParenthesisToken = this.token(22 /* CloseParenthesis */);
|
|
744
|
-
return new ParenthesizedTypeSpecifier(openParenthesisToken, typeSpecifier, closeParenthesisToken);
|
|
720
|
+
return new ParenthesizedTypeSpecifier(openParenthesisToken, typeSpecifier, closeParenthesisToken, void 0);
|
|
745
721
|
}
|
|
746
722
|
static anonymousStructuredTypeSpecifier(body) {
|
|
747
|
-
return new AnonymousTypeSpecifier(new AnonymousStructuredTypeDeclaration(body));
|
|
723
|
+
return new AnonymousTypeSpecifier(new AnonymousStructuredTypeDeclaration(body, void 0), void 0);
|
|
748
724
|
}
|
|
749
725
|
static anonymousFunctionTypeSpecifier(body) {
|
|
750
|
-
return new AnonymousTypeSpecifier(new AnonymousFunctionTypeDeclaration(body));
|
|
726
|
+
return new AnonymousTypeSpecifier(new AnonymousFunctionTypeDeclaration(body, void 0), void 0);
|
|
751
727
|
}
|
|
752
728
|
static anonymousVariantTypeSpecifier(body) {
|
|
753
|
-
return new AnonymousTypeSpecifier(new AnonymousVariantTypeDeclaration(body));
|
|
729
|
+
return new AnonymousTypeSpecifier(new AnonymousVariantTypeDeclaration(body, void 0), void 0);
|
|
754
730
|
}
|
|
755
731
|
static typeParameterDeclaration(name, constraint, defaultType) {
|
|
756
732
|
const nameIdentifier = this.createIdentifier(name);
|
|
@@ -762,23 +738,31 @@ var SyntaxFactory = class {
|
|
|
762
738
|
if (defaultType !== void 0) {
|
|
763
739
|
equalsToken = this.token(58 /* Equals */);
|
|
764
740
|
}
|
|
765
|
-
return new TypeParameterDeclaration(
|
|
741
|
+
return new TypeParameterDeclaration(
|
|
742
|
+
nameIdentifier,
|
|
743
|
+
colonToken,
|
|
744
|
+
constraint,
|
|
745
|
+
equalsToken,
|
|
746
|
+
defaultType,
|
|
747
|
+
void 0
|
|
748
|
+
);
|
|
766
749
|
}
|
|
767
750
|
static parameterDeclaration(tags, name, typeSpecifier, defaultValue) {
|
|
768
|
-
const tagList = new TagList(tags);
|
|
751
|
+
const tagList = new TagList(tags, void 0);
|
|
769
752
|
const nameIdentifier = this.createIdentifier(name);
|
|
770
753
|
const typeAnnotation = this.createTypeAnnotation(typeSpecifier);
|
|
771
754
|
let equalsToken;
|
|
772
755
|
if (defaultValue !== void 0) {
|
|
773
756
|
equalsToken = this.token(58 /* Equals */);
|
|
774
757
|
}
|
|
775
|
-
return new ParameterDeclaration(tagList, nameIdentifier, typeAnnotation, equalsToken, defaultValue);
|
|
758
|
+
return new ParameterDeclaration(tagList, nameIdentifier, typeAnnotation, equalsToken, defaultValue, void 0);
|
|
776
759
|
}
|
|
777
760
|
static tag(name, typeArguments, args) {
|
|
778
761
|
const hashSignToken = this.token(36 /* HashSign */);
|
|
779
762
|
const qualifiedNameIdentifiers = typeof name === "string" ? [this.createIdentifier(name)] : name.map((s) => this.createIdentifier(s));
|
|
780
763
|
const qualifiedName = new QualifiedName(
|
|
781
|
-
this.createTokenSeparatedElements(qualifiedNameIdentifiers, 27 /* Dot */)
|
|
764
|
+
this.createTokenSeparatedElements(qualifiedNameIdentifiers, 27 /* Dot */),
|
|
765
|
+
void 0
|
|
782
766
|
);
|
|
783
767
|
const typeArgumentClause = typeArguments !== void 0 ? this.typeArgumentClause(typeArguments) : void 0;
|
|
784
768
|
let openParenthesisToken;
|
|
@@ -787,7 +771,8 @@ var SyntaxFactory = class {
|
|
|
787
771
|
if (args !== void 0) {
|
|
788
772
|
openParenthesisToken = this.token(45 /* OpenParenthesis */);
|
|
789
773
|
argumentList = new ArgumentList(
|
|
790
|
-
this.createTokenSeparatedElements(args, 25 /* Comma */)
|
|
774
|
+
this.createTokenSeparatedElements(args, 25 /* Comma */),
|
|
775
|
+
void 0
|
|
791
776
|
);
|
|
792
777
|
closeParenthesisToken = this.token(22 /* CloseParenthesis */);
|
|
793
778
|
}
|
|
@@ -797,7 +782,8 @@ var SyntaxFactory = class {
|
|
|
797
782
|
typeArgumentClause,
|
|
798
783
|
openParenthesisToken,
|
|
799
784
|
argumentList,
|
|
800
|
-
closeParenthesisToken
|
|
785
|
+
closeParenthesisToken,
|
|
786
|
+
void 0
|
|
801
787
|
);
|
|
802
788
|
}
|
|
803
789
|
static modifier(value, level) {
|
|
@@ -810,48 +796,49 @@ var SyntaxFactory = class {
|
|
|
810
796
|
levelKeyword = this.keyword(level);
|
|
811
797
|
closeParenthesisToken = this.token(22 /* CloseParenthesis */);
|
|
812
798
|
}
|
|
813
|
-
return new Modifier(valueKeyword, openParenthesisToken, levelKeyword, closeParenthesisToken);
|
|
799
|
+
return new Modifier(valueKeyword, openParenthesisToken, levelKeyword, closeParenthesisToken, void 0);
|
|
814
800
|
}
|
|
815
801
|
static typeArgumentClause(typeArguments) {
|
|
816
802
|
const lessThanToken = this.token(37 /* LessThan */);
|
|
817
803
|
const typeArgumentList = new TypeArgumentList(
|
|
818
|
-
this.createTokenSeparatedElements(typeArguments, 25 /* Comma */)
|
|
804
|
+
this.createTokenSeparatedElements(typeArguments, 25 /* Comma */),
|
|
805
|
+
void 0
|
|
819
806
|
);
|
|
820
807
|
const greaterThanToken = this.token(34 /* GreaterThan */);
|
|
821
|
-
return new TypeArgumentClause(lessThanToken, typeArgumentList, greaterThanToken);
|
|
808
|
+
return new TypeArgumentClause(lessThanToken, typeArgumentList, greaterThanToken, void 0);
|
|
822
809
|
}
|
|
823
810
|
static typeAnnotation(typeSpecifier) {
|
|
824
|
-
return new TypeAnnotation(this.token(24 /* Colon */), typeSpecifier);
|
|
811
|
+
return new TypeAnnotation(this.token(24 /* Colon */), typeSpecifier, void 0);
|
|
825
812
|
}
|
|
826
813
|
static statementBlock(statements) {
|
|
827
814
|
const openBraceToken = this.token(44 /* OpenBrace */);
|
|
828
|
-
const statementList = new StatementList(statements);
|
|
815
|
+
const statementList = new StatementList(statements, void 0);
|
|
829
816
|
const closeBraceToken = this.token(21 /* CloseBrace */);
|
|
830
|
-
return new StatementBlock(openBraceToken, statementList, closeBraceToken);
|
|
817
|
+
return new StatementBlock(openBraceToken, statementList, closeBraceToken, void 0);
|
|
831
818
|
}
|
|
832
819
|
static functionExpressionBlock(expression) {
|
|
833
820
|
const openBraceToken = this.token(44 /* OpenBrace */);
|
|
834
821
|
const closeBraceToken = this.token(21 /* CloseBrace */);
|
|
835
|
-
return new FunctionBlock(openBraceToken, expression, closeBraceToken);
|
|
822
|
+
return new FunctionBlock(openBraceToken, expression, closeBraceToken, void 0);
|
|
836
823
|
}
|
|
837
824
|
static functionStatementBlock(statements) {
|
|
838
825
|
const openBraceToken = this.token(44 /* OpenBrace */);
|
|
839
|
-
const statementList = new StatementList(statements);
|
|
826
|
+
const statementList = new StatementList(statements, void 0);
|
|
840
827
|
const closeBraceToken = this.token(21 /* CloseBrace */);
|
|
841
|
-
return new FunctionBlock(openBraceToken, statementList, closeBraceToken);
|
|
828
|
+
return new FunctionBlock(openBraceToken, statementList, closeBraceToken, void 0);
|
|
842
829
|
}
|
|
843
830
|
static nullLiteral() {
|
|
844
|
-
return new KeywordExpression(this.keyword(57 /* Null */));
|
|
831
|
+
return new KeywordExpression(this.keyword(57 /* Null */), void 0);
|
|
845
832
|
}
|
|
846
833
|
static integerLiteral(value) {
|
|
847
|
-
return new TokenExpression(this.token(2 /* IntegerLiteral */, value.toString()));
|
|
834
|
+
return new TokenExpression(this.token(2 /* IntegerLiteral */, value.toString()), void 0);
|
|
848
835
|
}
|
|
849
836
|
static translationsDeclaration(translations) {
|
|
850
|
-
const tagList = new TagList([]);
|
|
851
|
-
const modifierList = new ModifierList([]);
|
|
837
|
+
const tagList = new TagList([], void 0);
|
|
838
|
+
const modifierList = new ModifierList([], void 0);
|
|
852
839
|
const translationsKeyword = this.keyword(55 /* Translations */);
|
|
853
840
|
const openBraceToken = this.token(44 /* OpenBrace */);
|
|
854
|
-
const translationList = new TopLevelTranslationList(translations);
|
|
841
|
+
const translationList = new TopLevelTranslationList(translations, void 0);
|
|
855
842
|
const closeBraceToken = this.token(21 /* CloseBrace */);
|
|
856
843
|
return new TranslationsDeclaration(
|
|
857
844
|
tagList,
|
|
@@ -859,14 +846,20 @@ var SyntaxFactory = class {
|
|
|
859
846
|
translationsKeyword,
|
|
860
847
|
openBraceToken,
|
|
861
848
|
translationList,
|
|
862
|
-
closeBraceToken
|
|
849
|
+
closeBraceToken,
|
|
850
|
+
void 0
|
|
863
851
|
);
|
|
864
852
|
}
|
|
865
853
|
static packageVariableTranslation(sourceName, translatedName) {
|
|
866
854
|
const sourceNameIdentifier = this.createIdentifier(sourceName);
|
|
867
855
|
const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
|
|
868
856
|
const translatedNameIdentifier = this.createIdentifier(translatedName);
|
|
869
|
-
return new PackageVariableTranslationDeclaration(
|
|
857
|
+
return new PackageVariableTranslationDeclaration(
|
|
858
|
+
sourceNameIdentifier,
|
|
859
|
+
minusGreaterThanToken,
|
|
860
|
+
translatedNameIdentifier,
|
|
861
|
+
void 0
|
|
862
|
+
);
|
|
870
863
|
}
|
|
871
864
|
static packageFunctionTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
|
872
865
|
const functionKeyword = this.keyword(12 /* Function */);
|
|
@@ -885,7 +878,8 @@ var SyntaxFactory = class {
|
|
|
885
878
|
minusGreaterThanToken,
|
|
886
879
|
translatedNameIdentifier,
|
|
887
880
|
translatedTypeParameterClause,
|
|
888
|
-
translatedParameterClause
|
|
881
|
+
translatedParameterClause,
|
|
882
|
+
void 0
|
|
889
883
|
);
|
|
890
884
|
}
|
|
891
885
|
static typeTranslation(sourceName, sourceTypeParameters, translatedName, translatedTypeParameters, members) {
|
|
@@ -900,7 +894,7 @@ var SyntaxFactory = class {
|
|
|
900
894
|
let closeBraceToken;
|
|
901
895
|
if (members !== void 0) {
|
|
902
896
|
openBraceToken = this.token(44 /* OpenBrace */);
|
|
903
|
-
memberList = new TypeMemberTranslationList(members);
|
|
897
|
+
memberList = new TypeMemberTranslationList(members, void 0);
|
|
904
898
|
closeBraceToken = this.token(21 /* CloseBrace */);
|
|
905
899
|
}
|
|
906
900
|
return new TypeTranslationDeclaration(
|
|
@@ -912,7 +906,8 @@ var SyntaxFactory = class {
|
|
|
912
906
|
translatedTypeParameterClause,
|
|
913
907
|
openBraceToken,
|
|
914
908
|
memberList,
|
|
915
|
-
closeBraceToken
|
|
909
|
+
closeBraceToken,
|
|
910
|
+
void 0
|
|
916
911
|
);
|
|
917
912
|
}
|
|
918
913
|
static functionTypeTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
|
@@ -932,7 +927,8 @@ var SyntaxFactory = class {
|
|
|
932
927
|
minusGreaterThanToken,
|
|
933
928
|
translatedNameIdentifier,
|
|
934
929
|
translatedTypeParameterClause,
|
|
935
|
-
translatedParameterClause
|
|
930
|
+
translatedParameterClause,
|
|
931
|
+
void 0
|
|
936
932
|
);
|
|
937
933
|
}
|
|
938
934
|
static fieldOrVariantTranslation(sourceName, translatedName) {
|
|
@@ -942,7 +938,8 @@ var SyntaxFactory = class {
|
|
|
942
938
|
return new FieldOrVariantTranslation(
|
|
943
939
|
sourceNameIdentifier,
|
|
944
940
|
minusGreaterThanToken,
|
|
945
|
-
translatedNameIdentifier
|
|
941
|
+
translatedNameIdentifier,
|
|
942
|
+
void 0
|
|
946
943
|
);
|
|
947
944
|
}
|
|
948
945
|
static methodTranslation(sourceName, sourceTypeParameters, sourceParameters, translatedName, translatedTypeParameters, translatedParameters) {
|
|
@@ -962,7 +959,8 @@ var SyntaxFactory = class {
|
|
|
962
959
|
minusGreaterThanToken,
|
|
963
960
|
translatedNameIdentifier,
|
|
964
961
|
translatedTypeParameterClause,
|
|
965
|
-
translatedParameterClause
|
|
962
|
+
translatedParameterClause,
|
|
963
|
+
void 0
|
|
966
964
|
);
|
|
967
965
|
}
|
|
968
966
|
static constructorTranslation(sourceParameters, translatedParameters) {
|
|
@@ -974,37 +972,50 @@ var SyntaxFactory = class {
|
|
|
974
972
|
creationKeyword,
|
|
975
973
|
sourceParameterClause,
|
|
976
974
|
minusGreaterThanToken,
|
|
977
|
-
translatedParameterClause
|
|
975
|
+
translatedParameterClause,
|
|
976
|
+
void 0
|
|
978
977
|
);
|
|
979
978
|
}
|
|
980
979
|
static indexerTranslation(sourceParameters, translatedParameters) {
|
|
981
980
|
const sourceParameterClause = this.indexParameterTranslationClause(sourceParameters);
|
|
982
981
|
const minusGreaterThanToken = this.token(43 /* MinusGreaterThan */);
|
|
983
982
|
const translatedParameterClause = this.indexParameterTranslationClause(translatedParameters);
|
|
984
|
-
return new IndexerTranslation(
|
|
983
|
+
return new IndexerTranslation(
|
|
984
|
+
sourceParameterClause,
|
|
985
|
+
minusGreaterThanToken,
|
|
986
|
+
translatedParameterClause,
|
|
987
|
+
void 0
|
|
988
|
+
);
|
|
985
989
|
}
|
|
986
990
|
static translationParameterClause(parameters) {
|
|
987
991
|
const openParenthesisToken = this.token(45 /* OpenParenthesis */);
|
|
988
992
|
const parameterList = new TranslationParameterList(
|
|
989
|
-
this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 25 /* Comma */)
|
|
993
|
+
this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 25 /* Comma */),
|
|
994
|
+
void 0
|
|
990
995
|
);
|
|
991
996
|
const closeParenthesisToken = this.token(22 /* CloseParenthesis */);
|
|
992
|
-
return new TranslationParameterClause(openParenthesisToken, parameterList, closeParenthesisToken);
|
|
997
|
+
return new TranslationParameterClause(openParenthesisToken, parameterList, closeParenthesisToken, void 0);
|
|
993
998
|
}
|
|
994
999
|
static indexParameterTranslationClause(parameters) {
|
|
995
1000
|
const openSquareBracketToken = this.token(46 /* OpenSquareBracket */);
|
|
996
1001
|
const parameterList = new TranslationParameterList(
|
|
997
|
-
this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 25 /* Comma */)
|
|
1002
|
+
this.createTokenSeparatedElements(parameters.map((p) => this.createIdentifier(p)), 25 /* Comma */),
|
|
1003
|
+
void 0
|
|
998
1004
|
);
|
|
999
1005
|
const closeSquareBracketToken = this.token(23 /* CloseSquareBracket */);
|
|
1000
|
-
return new IndexParameterTranslationClause(
|
|
1006
|
+
return new IndexParameterTranslationClause(
|
|
1007
|
+
openSquareBracketToken,
|
|
1008
|
+
parameterList,
|
|
1009
|
+
closeSquareBracketToken,
|
|
1010
|
+
void 0
|
|
1011
|
+
);
|
|
1001
1012
|
}
|
|
1002
1013
|
static token(kind, value) {
|
|
1003
1014
|
const flags = value === void 0 ? 1 /* Missing */ : 0 /* None */;
|
|
1004
|
-
return new Token(kind, value ?? "", [], flags, void 0);
|
|
1015
|
+
return new Token(kind, value ?? "", [], [], flags, void 0, void 0);
|
|
1005
1016
|
}
|
|
1006
1017
|
static keyword(kind) {
|
|
1007
|
-
return new Keyword([], kind, true);
|
|
1018
|
+
return new Keyword([], kind, true, void 0);
|
|
1008
1019
|
}
|
|
1009
1020
|
static createTypeParameterClause(typeParameters) {
|
|
1010
1021
|
if (typeParameters === void 0) {
|
|
@@ -1012,8 +1023,9 @@ var SyntaxFactory = class {
|
|
|
1012
1023
|
}
|
|
1013
1024
|
return new TypeParameterClause(
|
|
1014
1025
|
this.token(37 /* LessThan */),
|
|
1015
|
-
new TypeParameterList(this.createTokenSeparatedElements(typeParameters, 25 /* Comma */)),
|
|
1016
|
-
this.token(34 /* GreaterThan */)
|
|
1026
|
+
new TypeParameterList(this.createTokenSeparatedElements(typeParameters, 25 /* Comma */), void 0),
|
|
1027
|
+
this.token(34 /* GreaterThan */),
|
|
1028
|
+
void 0
|
|
1017
1029
|
);
|
|
1018
1030
|
}
|
|
1019
1031
|
static createTranslationTypeParameterClause(typeParameters) {
|
|
@@ -1023,20 +1035,22 @@ var SyntaxFactory = class {
|
|
|
1023
1035
|
return new TranslationTypeParameterClause(
|
|
1024
1036
|
this.token(37 /* LessThan */),
|
|
1025
1037
|
new TranslationTypeParameterList(
|
|
1026
|
-
this.createTokenSeparatedElements(typeParameters.map((p) => this.createIdentifier(p)), 25 /* Comma */)
|
|
1038
|
+
this.createTokenSeparatedElements(typeParameters.map((p) => this.createIdentifier(p)), 25 /* Comma */),
|
|
1039
|
+
void 0
|
|
1027
1040
|
),
|
|
1028
|
-
this.token(34 /* GreaterThan */)
|
|
1041
|
+
this.token(34 /* GreaterThan */),
|
|
1042
|
+
void 0
|
|
1029
1043
|
);
|
|
1030
1044
|
}
|
|
1031
1045
|
static createTypeAnnotation(typeSpecifier) {
|
|
1032
1046
|
if (typeSpecifier === void 0) {
|
|
1033
1047
|
return void 0;
|
|
1034
1048
|
}
|
|
1035
|
-
return new TypeAnnotation(this.token(24 /* Colon */), typeSpecifier);
|
|
1049
|
+
return new TypeAnnotation(this.token(24 /* Colon */), typeSpecifier, void 0);
|
|
1036
1050
|
}
|
|
1037
1051
|
static createIdentifier(value) {
|
|
1038
1052
|
if (typeof value === "string") {
|
|
1039
|
-
return new Token(10 /* Identifier */, value, [], 0 /* None */, void 0);
|
|
1053
|
+
return new Token(10 /* Identifier */, value, [], [], 0 /* None */, void 0, void 0);
|
|
1040
1054
|
}
|
|
1041
1055
|
return value;
|
|
1042
1056
|
}
|
|
@@ -1054,7 +1068,7 @@ var SyntaxFactory = class {
|
|
|
1054
1068
|
}
|
|
1055
1069
|
};
|
|
1056
1070
|
|
|
1057
|
-
// source/tree/
|
|
1071
|
+
// source/tree/SyntaxToCode.ts
|
|
1058
1072
|
var SyntaxToCode = class _SyntaxToCode {
|
|
1059
1073
|
constructor(node, options6) {
|
|
1060
1074
|
this._code = "";
|
|
@@ -2318,14 +2332,7 @@ var TokenOrKeywordsTouchingOffset_two = class {
|
|
|
2318
2332
|
};
|
|
2319
2333
|
function getTriviaAtOffset(sourceFile, offset) {
|
|
2320
2334
|
const token = getTokenAtOffset(sourceFile, offset, true);
|
|
2321
|
-
|
|
2322
|
-
for (const trivia of token.getLeadingTrivia()) {
|
|
2323
|
-
if (trivia.range.includes(offset)) {
|
|
2324
|
-
return trivia;
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
return void 0;
|
|
2335
|
+
return token?.getTriviaAt(offset);
|
|
2329
2336
|
}
|
|
2330
2337
|
|
|
2331
2338
|
// source/services/TranslationsGenerationService.ts
|
|
@@ -2346,6 +2353,7 @@ var TranslationsGenerationService = class {
|
|
|
2346
2353
|
analyzer,
|
|
2347
2354
|
sourceFile,
|
|
2348
2355
|
translationPackage,
|
|
2356
|
+
sourceFile.package.locale,
|
|
2349
2357
|
sourceFile.package.dialect
|
|
2350
2358
|
);
|
|
2351
2359
|
result = generator.generateMissingTypeMemberTranslations(tokenOrKeyword.parent);
|
|
@@ -2358,6 +2366,7 @@ var TranslationsGenerationService = class {
|
|
|
2358
2366
|
analyzer,
|
|
2359
2367
|
sourceFile,
|
|
2360
2368
|
translationPackage,
|
|
2369
|
+
sourceFile.package.locale,
|
|
2361
2370
|
sourceFile.package.dialect
|
|
2362
2371
|
);
|
|
2363
2372
|
if (onlyTypeMembers) {
|
|
@@ -2384,15 +2393,22 @@ var TranslationsGenerationService = class {
|
|
|
2384
2393
|
if (translationPackage === void 0) {
|
|
2385
2394
|
return false;
|
|
2386
2395
|
}
|
|
2387
|
-
const generator = new TranslationsGenerator(
|
|
2396
|
+
const generator = new TranslationsGenerator(
|
|
2397
|
+
analyzer,
|
|
2398
|
+
sourceFile,
|
|
2399
|
+
translationPackage,
|
|
2400
|
+
sourceFile.package.locale,
|
|
2401
|
+
sourceFile.package.dialect
|
|
2402
|
+
);
|
|
2388
2403
|
return Query.from(tokenOrKeyword.parent.translationList.translationDeclarations).filter((t) => t.kind === 142 /* TypeTranslationDeclaration */).mapAndFilter((t) => translationPackage.getTypeTranslationTarget(t).target).any((t) => generator.collectNotTranslatedTypeMembers(t).length > 0);
|
|
2389
2404
|
}
|
|
2390
2405
|
};
|
|
2391
2406
|
var TranslationsGenerator = class _TranslationsGenerator {
|
|
2392
|
-
constructor(_analyzer, _sourceFile, _translationPackage, _dialect) {
|
|
2407
|
+
constructor(_analyzer, _sourceFile, _translationPackage, _locale, _dialect) {
|
|
2393
2408
|
this._analyzer = _analyzer;
|
|
2394
2409
|
this._sourceFile = _sourceFile;
|
|
2395
2410
|
this._translationPackage = _translationPackage;
|
|
2411
|
+
this._locale = _locale;
|
|
2396
2412
|
this._dialect = _dialect;
|
|
2397
2413
|
}
|
|
2398
2414
|
static {
|
|
@@ -2404,7 +2420,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2404
2420
|
if (memberEntities.length > 0) {
|
|
2405
2421
|
const newLine = this.detectNewLine();
|
|
2406
2422
|
const syntaxToCodeOptions = {
|
|
2407
|
-
keywordsLocale: this.
|
|
2423
|
+
keywordsLocale: this._locale,
|
|
2408
2424
|
keywordsDialect: this._dialect,
|
|
2409
2425
|
initialIndentation: this.detectIndentationForPackageMemberTranslations(translationsDeclaration),
|
|
2410
2426
|
indentationStep: this.detectIndentationStepForTypeMemberTranslations(translationsDeclaration),
|
|
@@ -2464,7 +2480,7 @@ var TranslationsGenerator = class _TranslationsGenerator {
|
|
|
2464
2480
|
}
|
|
2465
2481
|
const newLine = this.detectNewLine();
|
|
2466
2482
|
const syntaxToCodeOptions = {
|
|
2467
|
-
keywordsLocale: this.
|
|
2483
|
+
keywordsLocale: this._locale,
|
|
2468
2484
|
keywordsDialect: this._dialect,
|
|
2469
2485
|
initialIndentation: this.detectIndentationForTypeMemberTranslations(typeTranslation),
|
|
2470
2486
|
indentationStep: this.detectIndentationStepForTypeMemberTranslations(typeTranslation),
|
|
@@ -2721,7 +2737,7 @@ var CodeActionsService = class {
|
|
|
2721
2737
|
}
|
|
2722
2738
|
const result = new Array();
|
|
2723
2739
|
const diagnosticCodeSet = new Set(diagnosticCodes);
|
|
2724
|
-
if (diagnosticCodeSet.has(
|
|
2740
|
+
if (diagnosticCodeSet.has(281 /* TheFollowingDeclarationsAreNotTranslated0 */) || diagnosticCodeSet.has(282 /* TheFollowingDeclarationAreNotTranslated0And1More */)) {
|
|
2725
2741
|
const data = { onlyTypeMembers: false };
|
|
2726
2742
|
result.push(CodeAction.unresolved(
|
|
2727
2743
|
"\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.",
|
|
@@ -2833,38 +2849,92 @@ var SignatureForNode = class _SignatureForNode {
|
|
|
2833
2849
|
}
|
|
2834
2850
|
}
|
|
2835
2851
|
static getSignaturesForCallExpression(analyzer, node) {
|
|
2836
|
-
const meaning = analyzer.
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2852
|
+
const meaning = analyzer.resolveCallExpression(node).meaning;
|
|
2853
|
+
switch (meaning.kind) {
|
|
2854
|
+
case "function-call": {
|
|
2855
|
+
let suitableSignatureIndex;
|
|
2856
|
+
let functions;
|
|
2857
|
+
if (meaning.singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
2858
|
+
functions = [meaning.singleNotSuitableSubstitutedCandidate];
|
|
2859
|
+
} else {
|
|
2860
|
+
const singleFunction = meaning.singleSuitableFunction;
|
|
2861
|
+
if (singleFunction !== void 0) {
|
|
2862
|
+
suitableSignatureIndex = meaning.candidates.findIndex((f) => f.getEntity().getOriginalEntity() === singleFunction.getEntity().getOriginalEntity());
|
|
2863
|
+
}
|
|
2864
|
+
functions = [];
|
|
2865
|
+
for (const candidate of meaning.candidates) {
|
|
2866
|
+
const suitableFunction = meaning.suitableFunctions.find((s) => s.getEntity().getOriginalEntity() === candidate.getEntity().getOriginalEntity());
|
|
2867
|
+
functions.push(suitableFunction ?? candidate);
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
const signatures = functions.map((f) => {
|
|
2871
|
+
if (f.kind === "substituted-function") {
|
|
2872
|
+
const substitutions = f.value.getSubstitutions();
|
|
2873
|
+
if (substitutions.size > 0 && Query.from(substitutions.getTypes()).all((t) => t.kind === "unresolved")) {
|
|
2874
|
+
switch (f.value.kind) {
|
|
2875
|
+
case "entity":
|
|
2876
|
+
f = new AccessedFunction_entity(f.value.entity);
|
|
2877
|
+
break;
|
|
2878
|
+
case "type-member":
|
|
2879
|
+
f = new AccessedFunction_typeMember(f.value.method);
|
|
2880
|
+
break;
|
|
2881
|
+
default:
|
|
2882
|
+
Debug.never(f.value);
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return new AccessedFunctionSignature(f);
|
|
2887
|
+
});
|
|
2888
|
+
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
2841
2889
|
}
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2890
|
+
case "operator-call": {
|
|
2891
|
+
let suitableSignatureIndex;
|
|
2892
|
+
const singleOperator = meaning.singleOperator;
|
|
2893
|
+
if (singleOperator !== void 0) {
|
|
2894
|
+
suitableSignatureIndex = meaning.candidates.findIndex((c) => c.equals(singleOperator));
|
|
2895
|
+
}
|
|
2896
|
+
const signatures = meaning.candidates.map((c) => new OperatorSignature(c));
|
|
2897
|
+
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
2850
2898
|
}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2899
|
+
case "object-function-call": {
|
|
2900
|
+
const signature = new FunctionTypeSignature(meaning.type);
|
|
2901
|
+
return new SignaturesWithSingleSuitable([signature], 0);
|
|
2902
|
+
}
|
|
2903
|
+
case "constructor-call": {
|
|
2904
|
+
let suitableSignatureIndex;
|
|
2905
|
+
let constructors;
|
|
2906
|
+
if (meaning.singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
2907
|
+
constructors = [meaning.singleNotSuitableSubstitutedCandidate];
|
|
2908
|
+
} else {
|
|
2909
|
+
const singleConstructor = meaning.singleSuitableConstructor;
|
|
2910
|
+
if (singleConstructor !== void 0) {
|
|
2911
|
+
suitableSignatureIndex = meaning.candidates.findIndex((f) => f.getEntity().getOriginalEntity() === singleConstructor.getEntity().getOriginalEntity());
|
|
2912
|
+
}
|
|
2913
|
+
constructors = [];
|
|
2914
|
+
for (const candidate of meaning.candidates) {
|
|
2915
|
+
const suitableConstructor = meaning.suitableConstructors.find((s) => s.getEntity().getOriginalEntity() === candidate.getEntity().getOriginalEntity());
|
|
2916
|
+
constructors.push(suitableConstructor ?? candidate);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
const signatures = this.getSignaturesOfConstructors(analyzer, constructors);
|
|
2920
|
+
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
2921
|
+
}
|
|
2922
|
+
case "unresolved": {
|
|
2923
|
+
return void 0;
|
|
2924
|
+
}
|
|
2925
|
+
default:
|
|
2926
|
+
Debug.never(meaning);
|
|
2857
2927
|
}
|
|
2858
|
-
return void 0;
|
|
2859
2928
|
}
|
|
2860
2929
|
static getSignaturesForAutotypeCallExpression(analyzer, node) {
|
|
2861
|
-
const meaning = analyzer.
|
|
2930
|
+
const meaning = analyzer.resolveAutotypeCallExpression(node).meaning;
|
|
2862
2931
|
if (meaning.kind === "constructor-call") {
|
|
2863
2932
|
let suitableSignatureIndex;
|
|
2864
|
-
|
|
2865
|
-
|
|
2933
|
+
const singleConstructor = meaning.singleConstructor;
|
|
2934
|
+
if (singleConstructor !== void 0) {
|
|
2935
|
+
suitableSignatureIndex = meaning.candidates.findIndex((c) => c.equals(singleConstructor));
|
|
2866
2936
|
}
|
|
2867
|
-
const signatures = meaning.candidates
|
|
2937
|
+
const signatures = this.getSignaturesOfConstructors(analyzer, meaning.candidates);
|
|
2868
2938
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
2869
2939
|
}
|
|
2870
2940
|
return void 0;
|
|
@@ -2874,8 +2944,9 @@ var SignatureForNode = class _SignatureForNode {
|
|
|
2874
2944
|
switch (meaning.kind) {
|
|
2875
2945
|
case "resolved": {
|
|
2876
2946
|
let suitableSignatureIndex;
|
|
2877
|
-
|
|
2878
|
-
|
|
2947
|
+
const singleIndexer = meaning.singleIndexer;
|
|
2948
|
+
if (singleIndexer !== void 0) {
|
|
2949
|
+
suitableSignatureIndex = meaning.candidates.findIndex((i) => i.equals(singleIndexer));
|
|
2879
2950
|
}
|
|
2880
2951
|
const signatures = meaning.candidates.map((i) => new IndexerSignature(i));
|
|
2881
2952
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
@@ -2890,16 +2961,18 @@ var SignatureForNode = class _SignatureForNode {
|
|
|
2890
2961
|
const meaning = analyzer.resolveTag(node).meaning;
|
|
2891
2962
|
if (meaning.kind === "tag-type") {
|
|
2892
2963
|
let suitableSignatureIndex;
|
|
2893
|
-
|
|
2894
|
-
|
|
2964
|
+
const singleConstructor = meaning.singleConstructor;
|
|
2965
|
+
if (singleConstructor !== void 0) {
|
|
2966
|
+
suitableSignatureIndex = meaning.candidates.findIndex((c) => c.equals(singleConstructor));
|
|
2895
2967
|
}
|
|
2896
|
-
const signatures = meaning.candidates
|
|
2968
|
+
const signatures = this.getSignaturesOfConstructors(analyzer, meaning.candidates);
|
|
2897
2969
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
2898
2970
|
}
|
|
2899
2971
|
if (meaning.kind === "tag-function") {
|
|
2900
2972
|
let suitableSignatureIndex;
|
|
2901
|
-
|
|
2902
|
-
|
|
2973
|
+
const singleFunction = meaning.singleFunction;
|
|
2974
|
+
if (singleFunction !== void 0) {
|
|
2975
|
+
suitableSignatureIndex = meaning.candidates.findIndex((f) => f.getEntity().getOriginalEntity() === singleFunction.getEntity().getOriginalEntity());
|
|
2903
2976
|
}
|
|
2904
2977
|
const signatures = meaning.candidates.map((c) => new AccessedFunctionSignature(c));
|
|
2905
2978
|
return new SignaturesWithSingleSuitable(signatures, suitableSignatureIndex);
|
|
@@ -2909,6 +2982,16 @@ var SignatureForNode = class _SignatureForNode {
|
|
|
2909
2982
|
}
|
|
2910
2983
|
Debug.never(meaning);
|
|
2911
2984
|
}
|
|
2985
|
+
static getSignaturesOfConstructors(analyzer, constructors) {
|
|
2986
|
+
return constructors.map((c) => {
|
|
2987
|
+
const substitutions = c.getSubstitutions();
|
|
2988
|
+
if (substitutions.size > 0 && Query.from(substitutions.getTypes()).all((t) => t.kind === "unresolved")) {
|
|
2989
|
+
const identitySubstitutions = Substitutions.identity(analyzer, Array.from(substitutions.getParameters()));
|
|
2990
|
+
c = new Constructor(analyzer, c.getEntity(), identitySubstitutions);
|
|
2991
|
+
}
|
|
2992
|
+
return new ConstructorSignature(c);
|
|
2993
|
+
});
|
|
2994
|
+
}
|
|
2912
2995
|
};
|
|
2913
2996
|
var SimplifiedArgumentToParameterMatcher = class {
|
|
2914
2997
|
static match(analyzer, arguments_, signature) {
|
|
@@ -2968,7 +3051,10 @@ var SimplifiedOverloadResolver = class _SimplifiedOverloadResolver {
|
|
|
2968
3051
|
continue;
|
|
2969
3052
|
}
|
|
2970
3053
|
const targetParameterType = targetParameter.getType();
|
|
2971
|
-
const argumentType = analyzer.type.ofExpression(
|
|
3054
|
+
const argumentType = analyzer.type.ofExpression(
|
|
3055
|
+
argument.expression,
|
|
3056
|
+
new InferenceOptions(targetParameterType, false, false)
|
|
3057
|
+
);
|
|
2972
3058
|
if (analyzer.isTypeAssignableTo(argumentType, targetParameterType)) {
|
|
2973
3059
|
continue;
|
|
2974
3060
|
}
|
|
@@ -3022,6 +3108,16 @@ var AccessedFunctionSignature = class {
|
|
|
3022
3108
|
return this._valueParameters.getOrInsertWith(() => this.func.getValueParameters().map((p) => new UniversalValueParameter(p.type, p.entity)));
|
|
3023
3109
|
}
|
|
3024
3110
|
};
|
|
3111
|
+
var OperatorSignature = class {
|
|
3112
|
+
constructor(operator) {
|
|
3113
|
+
this.kind = "operator";
|
|
3114
|
+
this._valueParameters = new Cached();
|
|
3115
|
+
this.operator = operator;
|
|
3116
|
+
}
|
|
3117
|
+
getValueParameters() {
|
|
3118
|
+
return this._valueParameters.getOrInsertWith(() => this.operator.getValueParameters().map((p) => new UniversalValueParameter(p.getType(), p.getEntity())));
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3025
3121
|
var FunctionTypeSignature = class {
|
|
3026
3122
|
constructor(functionType) {
|
|
3027
3123
|
this.kind = "function-type";
|
|
@@ -3172,7 +3268,7 @@ var CompletionService = class {
|
|
|
3172
3268
|
}
|
|
3173
3269
|
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 9 /* PackageName */) {
|
|
3174
3270
|
const packageImport = tokenOrKeyword.parent.parent;
|
|
3175
|
-
const precedingSegmentNames = packageImport.packageName.segments.takeWhile((s) => s.
|
|
3271
|
+
const precedingSegmentNames = packageImport.packageName.segments.takeWhile((s) => s.rangeWithTrivia.start < tokenOrKeyword.value.rangeWithTrivia.start).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
|
3176
3272
|
return new PackageImportCompletionContext(precedingSegmentNames, void 0);
|
|
3177
3273
|
}
|
|
3178
3274
|
if (tokenOrKeyword.isToken(44 /* OpenBrace */) && tokenOrKeyword.parent.kind === 6 /* PackageGroupImportDirective */ || this.tokenOrKeywordIsPackageImportListChild(tokenOrKeyword)) {
|
|
@@ -3363,7 +3459,7 @@ var CompletionService = class {
|
|
|
3363
3459
|
if (tokenOrKeyword.isToken(27 /* Dot */) && tokenOrKeyword.parent.kind === 138 /* QualifiedName */) {
|
|
3364
3460
|
const qualifiedName = tokenOrKeyword.parent;
|
|
3365
3461
|
if (qualifiedName.parent.kind === 137 /* PackageImportTranslationDeclaration */ && qualifiedName === qualifiedName.parent.sourceName) {
|
|
3366
|
-
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.
|
|
3462
|
+
const precedingSegmentNames = qualifiedName.qualifiers.takeWhile((s) => s.rangeWithTrivia.start < tokenOrKeyword.value.rangeWithTrivia.start).map((p) => this._analyzer.createNameFromIdentifier(p)).toArray();
|
|
3367
3463
|
const sourceLocale = translationPackage.getTargetPackage().getLocale();
|
|
3368
3464
|
return new PackageImportCompletionContext(precedingSegmentNames, { sourceLocale });
|
|
3369
3465
|
}
|
|
@@ -4255,7 +4351,7 @@ function isInvalidNode(node) {
|
|
|
4255
4351
|
case 0 /* Token */:
|
|
4256
4352
|
return node.isMissing;
|
|
4257
4353
|
case 3 /* Keyword */:
|
|
4258
|
-
return node.
|
|
4354
|
+
return node.isMissing;
|
|
4259
4355
|
default:
|
|
4260
4356
|
return false;
|
|
4261
4357
|
}
|
|
@@ -5351,12 +5447,12 @@ var SyntaxContextFactory = class {
|
|
|
5351
5447
|
trivia = getTriviaAtOffset(sourceFile.getSyntaxNode(), offset - 1);
|
|
5352
5448
|
}
|
|
5353
5449
|
if (trivia?.kind === 1 /* NewLine */) {
|
|
5354
|
-
const previousTrivia = getTriviaAtOffset(sourceFile.getSyntaxNode(), trivia.range.
|
|
5355
|
-
if (previousTrivia?.kind === 2 /* SingleLineComment */) {
|
|
5450
|
+
const previousTrivia = getTriviaAtOffset(sourceFile.getSyntaxNode(), offset - trivia.range.length);
|
|
5451
|
+
if (previousTrivia?.trivia.kind === 2 /* SingleLineComment */) {
|
|
5356
5452
|
trivia = previousTrivia;
|
|
5357
5453
|
}
|
|
5358
5454
|
}
|
|
5359
|
-
return trivia !== void 0 && offset > trivia.
|
|
5455
|
+
return trivia !== void 0 && offset > trivia.range.start && (trivia.kind === 2 /* SingleLineComment */ || trivia.kind === 3 /* MultiLineComment */);
|
|
5360
5456
|
}
|
|
5361
5457
|
static isInStringOrChar(sourceFile, offset) {
|
|
5362
5458
|
let token = getTokenAtOffset(sourceFile.getSyntaxNode(), offset, false);
|
|
@@ -5891,20 +5987,34 @@ var NodeSemanticInfoService = class {
|
|
|
5891
5987
|
result = new ReferenceNodeSemanticInfo([target], false);
|
|
5892
5988
|
break;
|
|
5893
5989
|
}
|
|
5894
|
-
case "instance-method-access":
|
|
5895
|
-
|
|
5896
|
-
|
|
5990
|
+
case "instance-method-access": {
|
|
5991
|
+
let functions;
|
|
5992
|
+
if (meaning.singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
5993
|
+
functions = [meaning.singleNotSuitableSubstitutedCandidate];
|
|
5994
|
+
} else if (isNonEmptyArray(meaning.suitableFunctions)) {
|
|
5995
|
+
functions = meaning.suitableFunctions;
|
|
5897
5996
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
|
5898
|
-
|
|
5997
|
+
functions = meaning.candidates;
|
|
5998
|
+
}
|
|
5999
|
+
if (functions !== void 0) {
|
|
6000
|
+
result = this.ofAccessedFunctions(functions);
|
|
5899
6001
|
}
|
|
5900
6002
|
break;
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
6003
|
+
}
|
|
6004
|
+
case "static-method-access": {
|
|
6005
|
+
let functions;
|
|
6006
|
+
if (meaning.singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
6007
|
+
functions = [meaning.singleNotSuitableSubstitutedCandidate];
|
|
6008
|
+
} else if (isNonEmptyArray(meaning.suitableFunctions)) {
|
|
6009
|
+
functions = meaning.suitableFunctions;
|
|
5904
6010
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
|
5905
|
-
|
|
6011
|
+
functions = meaning.candidates;
|
|
6012
|
+
}
|
|
6013
|
+
if (functions !== void 0) {
|
|
6014
|
+
result = this.ofAccessedFunctions(functions);
|
|
5906
6015
|
}
|
|
5907
6016
|
break;
|
|
6017
|
+
}
|
|
5908
6018
|
case "operator-access": {
|
|
5909
6019
|
if (isNonEmptyArray(meaning.suitableOperators)) {
|
|
5910
6020
|
result = createOperatorsReference(meaning.suitableOperators, meaning.suitableOperators.length > 1);
|
|
@@ -5913,21 +6023,49 @@ var NodeSemanticInfoService = class {
|
|
|
5913
6023
|
}
|
|
5914
6024
|
break;
|
|
5915
6025
|
}
|
|
5916
|
-
case "package-function-access":
|
|
5917
|
-
|
|
5918
|
-
|
|
6026
|
+
case "package-function-access": {
|
|
6027
|
+
let functions;
|
|
6028
|
+
if (meaning.singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
6029
|
+
functions = [meaning.singleNotSuitableSubstitutedCandidate];
|
|
6030
|
+
} else if (isNonEmptyArray(meaning.suitableFunctions)) {
|
|
6031
|
+
functions = meaning.suitableFunctions;
|
|
5919
6032
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
|
5920
|
-
|
|
6033
|
+
functions = meaning.candidates;
|
|
6034
|
+
}
|
|
6035
|
+
if (functions !== void 0) {
|
|
6036
|
+
result = this.ofAccessedFunctions(functions);
|
|
5921
6037
|
}
|
|
5922
6038
|
break;
|
|
6039
|
+
}
|
|
5923
6040
|
case "package-type-access":
|
|
5924
|
-
if (meaning.suitableTypes.length
|
|
6041
|
+
if (meaning.suitableTypes.length > 0) {
|
|
6042
|
+
const targets = meaning.suitableTypes.map((c) => {
|
|
6043
|
+
const entity = c.getEntity();
|
|
6044
|
+
if (entity !== void 0) {
|
|
6045
|
+
return new EntityReferenceTarget(entity, 0 /* Get */);
|
|
6046
|
+
} else {
|
|
6047
|
+
return void 0;
|
|
6048
|
+
}
|
|
6049
|
+
}).filter((t) => t !== void 0);
|
|
6050
|
+
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableTypes.length > 1);
|
|
6051
|
+
} else if (meaning.candidates.length > 0) {
|
|
5925
6052
|
const targets = meaning.candidates.map((c) => new EntityReferenceTarget(c, 0 /* Get */));
|
|
5926
6053
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
|
5927
|
-
} else {
|
|
5928
|
-
result = this.ofMaybeConstructorCallExpression(analyzer, meaning.suitableTypes, node, options6);
|
|
5929
6054
|
}
|
|
5930
6055
|
break;
|
|
6056
|
+
case "constructor-access": {
|
|
6057
|
+
const callExpressionMeaning = meaning.callExpressionMeaning;
|
|
6058
|
+
result = this.ofConstructorCallWithTypeAccess(
|
|
6059
|
+
analyzer,
|
|
6060
|
+
callExpressionMeaning.typeEntity,
|
|
6061
|
+
meaning.typeCandidates,
|
|
6062
|
+
callExpressionMeaning.singleNotSuitableSubstitutedCandidate,
|
|
6063
|
+
callExpressionMeaning.suitableConstructors,
|
|
6064
|
+
callExpressionMeaning.candidates,
|
|
6065
|
+
options6
|
|
6066
|
+
);
|
|
6067
|
+
break;
|
|
6068
|
+
}
|
|
5931
6069
|
case "package-name-segment-access":
|
|
5932
6070
|
result = this.ofPackageNameSegmentAccess(analyzer, meaning.packageTreeNode, node);
|
|
5933
6071
|
break;
|
|
@@ -5947,10 +6085,6 @@ var NodeSemanticInfoService = class {
|
|
|
5947
6085
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
5948
6086
|
}
|
|
5949
6087
|
return result;
|
|
5950
|
-
function createAccessedFunctionsReference(functions, isAmbiguous) {
|
|
5951
|
-
const targets = functions.map((o) => new AccessedFunctionReferenceTarget(o));
|
|
5952
|
-
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
5953
|
-
}
|
|
5954
6088
|
function createOperatorsReference(operators, isAmbiguous) {
|
|
5955
6089
|
const targets = operators.map((o) => new OperatorReferenceTarget(o));
|
|
5956
6090
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
@@ -6029,7 +6163,7 @@ var NodeSemanticInfoService = class {
|
|
|
6029
6163
|
const resolvedQualifier = resolutionResult.resolvedQualifiers[qualifierIndex];
|
|
6030
6164
|
switch (resolvedQualifier.kind) {
|
|
6031
6165
|
case "type": {
|
|
6032
|
-
if (
|
|
6166
|
+
if (resolutionResult.meaning.kind !== "tag-type") {
|
|
6033
6167
|
if (resolvedQualifier.suitableTypes.length > 0) {
|
|
6034
6168
|
const targets = resolvedQualifier.suitableTypes.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6035
6169
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
@@ -6038,25 +6172,31 @@ var NodeSemanticInfoService = class {
|
|
|
6038
6172
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
|
6039
6173
|
}
|
|
6040
6174
|
} else {
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6175
|
+
const typeEntity = resolvedQualifier.suitableTypes.length === 1 ? resolvedQualifier.suitableTypes[0] : void 0;
|
|
6176
|
+
result = this.ofConstructorCallWithTypeAccess(
|
|
6177
|
+
analyzer,
|
|
6178
|
+
typeEntity,
|
|
6179
|
+
resolvedQualifier.candidates,
|
|
6180
|
+
resolutionResult.meaning.singleNotSuitableSubstitutedCandidate,
|
|
6181
|
+
resolutionResult.meaning.suitableConstructors,
|
|
6182
|
+
resolutionResult.meaning.candidates,
|
|
6183
|
+
options6
|
|
6184
|
+
);
|
|
6048
6185
|
}
|
|
6049
6186
|
break;
|
|
6050
6187
|
}
|
|
6051
|
-
case "function":
|
|
6188
|
+
case "function": {
|
|
6189
|
+
let functions;
|
|
6052
6190
|
if (resolvedQualifier.suitableFunctions.length > 0) {
|
|
6053
|
-
|
|
6054
|
-
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6191
|
+
functions = resolvedQualifier.suitableFunctions;
|
|
6055
6192
|
} else if (resolvedQualifier.candidates.length > 0) {
|
|
6056
|
-
|
|
6057
|
-
|
|
6193
|
+
functions = resolvedQualifier.candidates;
|
|
6194
|
+
}
|
|
6195
|
+
if (functions !== void 0) {
|
|
6196
|
+
result = this.ofAccessedFunctions(functions);
|
|
6058
6197
|
}
|
|
6059
6198
|
break;
|
|
6199
|
+
}
|
|
6060
6200
|
case "package-name-segment": {
|
|
6061
6201
|
let currentIndex = qualifierIndex;
|
|
6062
6202
|
while (currentIndex + 1 < resolutionResult.resolvedQualifiers.length && resolutionResult.resolvedQualifiers[currentIndex + 1].kind === "package-name-segment") {
|
|
@@ -6104,20 +6244,48 @@ var NodeSemanticInfoService = class {
|
|
|
6104
6244
|
const meaning = analyzer.resolveIdentifierExpression(node).meaning;
|
|
6105
6245
|
switch (meaning.kind) {
|
|
6106
6246
|
case "type-access":
|
|
6107
|
-
if (meaning.suitableTypes.length
|
|
6247
|
+
if (meaning.suitableTypes.length > 0) {
|
|
6248
|
+
const targets = meaning.suitableTypes.map((c) => {
|
|
6249
|
+
const entity = c.getEntity();
|
|
6250
|
+
if (entity !== void 0) {
|
|
6251
|
+
return new EntityReferenceTarget(entity, 0 /* Get */);
|
|
6252
|
+
} else {
|
|
6253
|
+
return void 0;
|
|
6254
|
+
}
|
|
6255
|
+
}).filter((t) => t !== void 0);
|
|
6256
|
+
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableTypes.length > 1);
|
|
6257
|
+
} else if (meaning.candidates.length > 0) {
|
|
6108
6258
|
const targets = meaning.candidates.map((c) => new EntityReferenceTarget(c, 0 /* Get */));
|
|
6109
6259
|
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
|
6110
|
-
} else {
|
|
6111
|
-
result = this.ofMaybeConstructorCallExpression(analyzer, meaning.suitableTypes, node, options6);
|
|
6112
6260
|
}
|
|
6113
6261
|
break;
|
|
6114
|
-
case "
|
|
6115
|
-
|
|
6116
|
-
|
|
6262
|
+
case "constructor-access": {
|
|
6263
|
+
const callExpressionMeaning = meaning.callExpressionMeaning;
|
|
6264
|
+
result = this.ofConstructorCallWithTypeAccess(
|
|
6265
|
+
analyzer,
|
|
6266
|
+
callExpressionMeaning.typeEntity,
|
|
6267
|
+
meaning.typeCandidates,
|
|
6268
|
+
callExpressionMeaning.singleNotSuitableSubstitutedCandidate,
|
|
6269
|
+
callExpressionMeaning.suitableConstructors,
|
|
6270
|
+
callExpressionMeaning.candidates,
|
|
6271
|
+
options6
|
|
6272
|
+
);
|
|
6273
|
+
break;
|
|
6274
|
+
}
|
|
6275
|
+
case "function-access": {
|
|
6276
|
+
let functions;
|
|
6277
|
+
if (meaning.singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
6278
|
+
functions = [meaning.singleNotSuitableSubstitutedCandidate];
|
|
6279
|
+
} else if (isNonEmptyArray(meaning.suitableFunctions)) {
|
|
6280
|
+
functions = meaning.suitableFunctions;
|
|
6117
6281
|
} else if (isNonEmptyArray(meaning.candidates)) {
|
|
6118
|
-
|
|
6282
|
+
functions = meaning.candidates;
|
|
6283
|
+
}
|
|
6284
|
+
if (functions !== void 0) {
|
|
6285
|
+
result = this.ofAccessedFunctions(functions);
|
|
6119
6286
|
}
|
|
6120
6287
|
break;
|
|
6288
|
+
}
|
|
6121
6289
|
case "operator-access": {
|
|
6122
6290
|
if (isNonEmptyArray(meaning.suitableOperators)) {
|
|
6123
6291
|
result = createOperatorsReference(meaning.suitableOperators, meaning.suitableOperators.length > 1);
|
|
@@ -6183,10 +6351,6 @@ var NodeSemanticInfoService = class {
|
|
|
6183
6351
|
result = this.getBetterReferenceTargetsOrPreserve(result);
|
|
6184
6352
|
}
|
|
6185
6353
|
return result;
|
|
6186
|
-
function createAccessedFunctionsReference(functions, isAmbiguous) {
|
|
6187
|
-
const targets = functions.map((o) => new AccessedFunctionReferenceTarget(o));
|
|
6188
|
-
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
6189
|
-
}
|
|
6190
6354
|
function createOperatorsReference(operators, isAmbiguous) {
|
|
6191
6355
|
const targets = operators.map((o) => new OperatorReferenceTarget(o));
|
|
6192
6356
|
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), isAmbiguous);
|
|
@@ -6283,15 +6447,17 @@ var NodeSemanticInfoService = class {
|
|
|
6283
6447
|
return void 0;
|
|
6284
6448
|
}
|
|
6285
6449
|
static ofAutotypeCallExpression(analyzer, node, options6) {
|
|
6286
|
-
const meaning = analyzer.
|
|
6450
|
+
const meaning = analyzer.resolveAutotypeCallExpression(node).meaning;
|
|
6287
6451
|
let result;
|
|
6288
6452
|
if (meaning.kind === "constructor-call") {
|
|
6453
|
+
let constructors;
|
|
6289
6454
|
if (meaning.suitableConstructors.length > 0) {
|
|
6290
|
-
|
|
6291
|
-
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
|
6455
|
+
constructors = meaning.suitableConstructors;
|
|
6292
6456
|
} else if (meaning.candidates.length > 0) {
|
|
6293
|
-
|
|
6294
|
-
|
|
6457
|
+
constructors = meaning.candidates;
|
|
6458
|
+
}
|
|
6459
|
+
if (constructors !== void 0) {
|
|
6460
|
+
result = this.ofConstructors(analyzer, constructors);
|
|
6295
6461
|
}
|
|
6296
6462
|
}
|
|
6297
6463
|
if (result !== void 0 && options6.includeBetterReferenceTargets) {
|
|
@@ -6304,12 +6470,14 @@ var NodeSemanticInfoService = class {
|
|
|
6304
6470
|
let result;
|
|
6305
6471
|
switch (meaning.kind) {
|
|
6306
6472
|
case "own-constructor-access": {
|
|
6473
|
+
let constructors;
|
|
6307
6474
|
if (meaning.suitableConstructors.length > 0) {
|
|
6308
|
-
|
|
6309
|
-
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
|
6475
|
+
constructors = meaning.suitableConstructors;
|
|
6310
6476
|
} else if (meaning.candidates.length > 0) {
|
|
6311
|
-
|
|
6312
|
-
|
|
6477
|
+
constructors = meaning.candidates;
|
|
6478
|
+
}
|
|
6479
|
+
if (constructors !== void 0) {
|
|
6480
|
+
result = this.ofConstructors(analyzer, constructors);
|
|
6313
6481
|
}
|
|
6314
6482
|
break;
|
|
6315
6483
|
}
|
|
@@ -6334,12 +6502,14 @@ var NodeSemanticInfoService = class {
|
|
|
6334
6502
|
let result;
|
|
6335
6503
|
switch (meaning.kind) {
|
|
6336
6504
|
case "base-constructor-access": {
|
|
6505
|
+
let constructors;
|
|
6337
6506
|
if (meaning.suitableConstructors.length > 0) {
|
|
6338
|
-
|
|
6339
|
-
result = new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
|
6507
|
+
constructors = meaning.suitableConstructors;
|
|
6340
6508
|
} else if (meaning.candidates.length > 0) {
|
|
6341
|
-
|
|
6342
|
-
|
|
6509
|
+
constructors = meaning.candidates;
|
|
6510
|
+
}
|
|
6511
|
+
if (constructors !== void 0) {
|
|
6512
|
+
result = this.ofConstructors(analyzer, constructors);
|
|
6343
6513
|
}
|
|
6344
6514
|
break;
|
|
6345
6515
|
}
|
|
@@ -6349,9 +6519,7 @@ var NodeSemanticInfoService = class {
|
|
|
6349
6519
|
break;
|
|
6350
6520
|
}
|
|
6351
6521
|
case "overridden-method-access": {
|
|
6352
|
-
|
|
6353
|
-
result = new ReferenceNodeSemanticInfo([target], false);
|
|
6354
|
-
break;
|
|
6522
|
+
return this.ofAccessedFunctions([meaning.method]);
|
|
6355
6523
|
}
|
|
6356
6524
|
case "overridden-operator-access": {
|
|
6357
6525
|
const target = new OperatorReferenceTarget(meaning.operator);
|
|
@@ -6384,42 +6552,24 @@ var NodeSemanticInfoService = class {
|
|
|
6384
6552
|
}
|
|
6385
6553
|
return new ReferenceNodeSemanticInfo([new PackageReferenceTarget(packageTreeNode.package)], false);
|
|
6386
6554
|
}
|
|
6387
|
-
static
|
|
6388
|
-
if (
|
|
6389
|
-
|
|
6555
|
+
static ofConstructorCallWithTypeAccess(analyzer, suitableType, typeCandidates, singleNotSuitableSubstitutedCandidate, suitableConstructors, candidates, options6) {
|
|
6556
|
+
if (options6.preferredTargetOfExplicitConstructorCall === "type-declaration") {
|
|
6557
|
+
const targets2 = suitableType !== void 0 ? [new EntityReferenceTarget(suitableType, 0 /* Get */)] : typeCandidates.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6558
|
+
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets2), targets2.length > 1);
|
|
6390
6559
|
}
|
|
6391
|
-
|
|
6392
|
-
if (
|
|
6393
|
-
|
|
6394
|
-
|
|
6560
|
+
let constructors;
|
|
6561
|
+
if (singleNotSuitableSubstitutedCandidate !== void 0) {
|
|
6562
|
+
constructors = [singleNotSuitableSubstitutedCandidate];
|
|
6563
|
+
} else if (suitableConstructors.length > 0) {
|
|
6564
|
+
constructors = suitableConstructors;
|
|
6565
|
+
} else if (candidates.length > 0) {
|
|
6566
|
+
constructors = candidates;
|
|
6395
6567
|
}
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
if (parent.kind === 68 /* CallExpression */) {
|
|
6399
|
-
parentCallExpression = parent;
|
|
6400
|
-
} else if (parent.kind === 90 /* GenericSpecializationExpression */) {
|
|
6401
|
-
const grandParent = getParentSkippingParenthesizedExpressions(parent);
|
|
6402
|
-
if (grandParent.kind === 68 /* CallExpression */) {
|
|
6403
|
-
parentCallExpression = grandParent;
|
|
6404
|
-
}
|
|
6568
|
+
if (constructors !== void 0) {
|
|
6569
|
+
return this.ofConstructors(analyzer, constructors);
|
|
6405
6570
|
}
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
if (meaning.kind === "constructor-call") {
|
|
6409
|
-
if (meaning.suitableConstructors.length > 0) {
|
|
6410
|
-
const targets = meaning.suitableConstructors.map((c) => new ConstructorReferenceTarget(c));
|
|
6411
|
-
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), meaning.suitableConstructors.length > 1);
|
|
6412
|
-
} else if (meaning.candidates.length > 0) {
|
|
6413
|
-
const targets = meaning.candidates.map((c) => new ConstructorReferenceTarget(c));
|
|
6414
|
-
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), true);
|
|
6415
|
-
}
|
|
6416
|
-
}
|
|
6417
|
-
}
|
|
6418
|
-
if (typeEntities.length > 0) {
|
|
6419
|
-
const targets = typeEntities.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6420
|
-
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6421
|
-
}
|
|
6422
|
-
return void 0;
|
|
6571
|
+
const targets = suitableType !== void 0 ? [new EntityReferenceTarget(suitableType, 0 /* Get */)] : typeCandidates.map((t) => new EntityReferenceTarget(t, 0 /* Get */));
|
|
6572
|
+
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6423
6573
|
}
|
|
6424
6574
|
static getBetterReferenceTargetsOrPreserve(info) {
|
|
6425
6575
|
const currentTargets = info.betterTargets ?? info.targets;
|
|
@@ -6476,6 +6626,38 @@ var NodeSemanticInfoService = class {
|
|
|
6476
6626
|
}
|
|
6477
6627
|
return void 0;
|
|
6478
6628
|
}
|
|
6629
|
+
static ofAccessedFunctions(functions) {
|
|
6630
|
+
functions = functions.map((f) => {
|
|
6631
|
+
if (f.kind === "substituted-function") {
|
|
6632
|
+
const substitutions = f.value.getSubstitutions();
|
|
6633
|
+
if (substitutions.size > 0 && Query.from(substitutions.getTypes()).all((t) => t.kind === "unresolved")) {
|
|
6634
|
+
switch (f.value.kind) {
|
|
6635
|
+
case "entity":
|
|
6636
|
+
return new AccessedFunction_entity(f.value.entity);
|
|
6637
|
+
case "type-member":
|
|
6638
|
+
return new AccessedFunction_typeMember(f.value.method);
|
|
6639
|
+
default:
|
|
6640
|
+
Debug.never(f.value);
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
}
|
|
6644
|
+
return f;
|
|
6645
|
+
});
|
|
6646
|
+
const targets = functions.map((f) => new AccessedFunctionReferenceTarget(f));
|
|
6647
|
+
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6648
|
+
}
|
|
6649
|
+
static ofConstructors(analyzer, constructors) {
|
|
6650
|
+
constructors = constructors.map((c) => {
|
|
6651
|
+
const substitutions = c.getSubstitutions();
|
|
6652
|
+
if (substitutions.size > 0 && Query.from(substitutions.getTypes()).all((t) => t.kind === "unresolved")) {
|
|
6653
|
+
const identitySubstitutions = Substitutions.identity(analyzer, Array.from(substitutions.getParameters()));
|
|
6654
|
+
return new Constructor(analyzer, c.getEntity(), identitySubstitutions);
|
|
6655
|
+
}
|
|
6656
|
+
return c;
|
|
6657
|
+
});
|
|
6658
|
+
const targets = constructors.map((c) => new ConstructorReferenceTarget(c));
|
|
6659
|
+
return new ReferenceNodeSemanticInfo(createNonEmptyArray(targets), targets.length > 1);
|
|
6660
|
+
}
|
|
6479
6661
|
};
|
|
6480
6662
|
var DefinitionNodeSemanticInfo = class {
|
|
6481
6663
|
constructor(entity) {
|
|
@@ -8224,8 +8406,10 @@ var SelectionRangeService = class {
|
|
|
8224
8406
|
const child = nodeWithChildren.children.find((c) => c !== void 0 && this.nodeContainsOffset(c, offset, false));
|
|
8225
8407
|
if (child === void 0) {
|
|
8226
8408
|
const trivia = getTriviaAtOffset(sourceFile.getSyntaxNode(), offset);
|
|
8227
|
-
if (trivia
|
|
8228
|
-
|
|
8409
|
+
if (trivia !== void 0) {
|
|
8410
|
+
if (trivia.kind === 3 /* MultiLineComment */ || trivia.kind === 2 /* SingleLineComment */) {
|
|
8411
|
+
result = new SelectionRange(trivia.range, result);
|
|
8412
|
+
}
|
|
8229
8413
|
}
|
|
8230
8414
|
break;
|
|
8231
8415
|
}
|
|
@@ -8659,12 +8843,7 @@ var TypeParameterSignatureHelpProvider = class {
|
|
|
8659
8843
|
return Query.from(lastQualifier.candidates).mapAndFilter((t) => this.getSignatureForNamedType(t)).toArray();
|
|
8660
8844
|
} else if (lastQualifier.kind === "function") {
|
|
8661
8845
|
if (resolutionResult.meaning.kind === "tag-function") {
|
|
8662
|
-
return Query.from(resolutionResult.meaning.candidates).mapAndFilter((
|
|
8663
|
-
if (d.kind === "substituted-function") {
|
|
8664
|
-
return this.getSignatureForSubstitutedFunction(d.value);
|
|
8665
|
-
}
|
|
8666
|
-
return void 0;
|
|
8667
|
-
}).toArray();
|
|
8846
|
+
return Query.from(resolutionResult.meaning.candidates).mapAndFilter((f) => this.getSignatureForAccessedFunction(f)).toArray();
|
|
8668
8847
|
} else {
|
|
8669
8848
|
return void 0;
|
|
8670
8849
|
}
|
|
@@ -8677,16 +8856,14 @@ var TypeParameterSignatureHelpProvider = class {
|
|
|
8677
8856
|
if (expression.kind === 89 /* IdentifierExpression */) {
|
|
8678
8857
|
const meaning = this._analyzer.resolveIdentifierExpression(expression).meaning;
|
|
8679
8858
|
if (meaning.kind === "function-access") {
|
|
8680
|
-
return Query.from(meaning.candidates).mapAndFilter((
|
|
8681
|
-
if (o.kind === "substituted-function") {
|
|
8682
|
-
return this.getSignatureForSubstitutedFunction(o.value);
|
|
8683
|
-
}
|
|
8684
|
-
return void 0;
|
|
8685
|
-
}).toArray();
|
|
8859
|
+
return Query.from(meaning.candidates).mapAndFilter((f) => this.getSignatureForAccessedFunction(f)).toArray();
|
|
8686
8860
|
}
|
|
8687
8861
|
if (meaning.kind === "type-access") {
|
|
8688
8862
|
return Query.from(meaning.candidates).mapAndFilter((t) => this.getSignatureForNamedType(t)).toArray();
|
|
8689
8863
|
}
|
|
8864
|
+
if (meaning.kind === "constructor-access") {
|
|
8865
|
+
return Query.from(meaning.typeCandidates).mapAndFilter((t) => this.getSignatureForNamedType(t)).toArray();
|
|
8866
|
+
}
|
|
8690
8867
|
return void 0;
|
|
8691
8868
|
}
|
|
8692
8869
|
if (expression.kind === 76 /* MemberAccessExpression */) {
|
|
@@ -8700,33 +8877,48 @@ var TypeParameterSignatureHelpProvider = class {
|
|
|
8700
8877
|
accessedFunctions = meaning.candidates;
|
|
8701
8878
|
}
|
|
8702
8879
|
if (accessedFunctions !== void 0) {
|
|
8703
|
-
return Query.from(accessedFunctions).mapAndFilter((
|
|
8704
|
-
if (o.kind === "substituted-function") {
|
|
8705
|
-
return this.getSignatureForSubstitutedFunction(o.value);
|
|
8706
|
-
}
|
|
8707
|
-
return void 0;
|
|
8708
|
-
}).toArray();
|
|
8880
|
+
return Query.from(accessedFunctions).mapAndFilter((f) => this.getSignatureForAccessedFunction(f)).toArray();
|
|
8709
8881
|
}
|
|
8710
8882
|
if (meaning.kind === "package-type-access") {
|
|
8711
8883
|
return Query.from(meaning.candidates).mapAndFilter((t) => this.getSignatureForNamedType(t)).toArray();
|
|
8712
8884
|
}
|
|
8885
|
+
if (meaning.kind === "constructor-access") {
|
|
8886
|
+
return Query.from(meaning.typeCandidates).mapAndFilter((t) => this.getSignatureForNamedType(t)).toArray();
|
|
8887
|
+
}
|
|
8713
8888
|
return void 0;
|
|
8714
8889
|
}
|
|
8715
8890
|
return void 0;
|
|
8716
8891
|
}
|
|
8717
|
-
|
|
8892
|
+
getSignatureForAccessedFunction(func) {
|
|
8718
8893
|
let result = void 0;
|
|
8719
8894
|
switch (func.kind) {
|
|
8720
8895
|
case "entity":
|
|
8721
|
-
if (func.
|
|
8722
|
-
result = new FunctionEntitySignature(this.signatureContext, func.
|
|
8896
|
+
if (func.getTypeParameters().length > 0) {
|
|
8897
|
+
result = new FunctionEntitySignature(this.signatureContext, func.value);
|
|
8723
8898
|
}
|
|
8724
8899
|
break;
|
|
8725
8900
|
case "type-member":
|
|
8726
|
-
if (func.
|
|
8727
|
-
result = new MethodSignature(this.signatureContext, func.
|
|
8901
|
+
if (func.getTypeParameters().length > 0) {
|
|
8902
|
+
result = new MethodSignature(this.signatureContext, func.value);
|
|
8728
8903
|
}
|
|
8729
8904
|
break;
|
|
8905
|
+
case "substituted-function": {
|
|
8906
|
+
switch (func.value.kind) {
|
|
8907
|
+
case "entity":
|
|
8908
|
+
if (func.getTypeParameters().length > 0) {
|
|
8909
|
+
result = new FunctionEntitySignature(this.signatureContext, func.value.entity);
|
|
8910
|
+
}
|
|
8911
|
+
break;
|
|
8912
|
+
case "type-member":
|
|
8913
|
+
if (func.getTypeParameters().length > 0) {
|
|
8914
|
+
result = new MethodSignature(this.signatureContext, func.value.method);
|
|
8915
|
+
}
|
|
8916
|
+
break;
|
|
8917
|
+
default:
|
|
8918
|
+
Debug.never(func.value);
|
|
8919
|
+
}
|
|
8920
|
+
break;
|
|
8921
|
+
}
|
|
8730
8922
|
default:
|
|
8731
8923
|
Debug.never(func);
|
|
8732
8924
|
}
|
|
@@ -8993,6 +9185,11 @@ var ValueParametersSignatureHelpProvider = class {
|
|
|
8993
9185
|
const displayParts = this.signatureContext.displayService.getFunctionDeclarationDisplayParts(func);
|
|
8994
9186
|
return this.signatureContext.convertFunctionDisplayParts(displayParts);
|
|
8995
9187
|
}
|
|
9188
|
+
case "operator": {
|
|
9189
|
+
const operator = new OperatorDeclaration_typeMember(signature.operator);
|
|
9190
|
+
const displayParts = this.signatureContext.displayService.getOperatorDeclarationDisplayParts(operator);
|
|
9191
|
+
return this.signatureContext.convertOperatorDisplayParts(displayParts);
|
|
9192
|
+
}
|
|
8996
9193
|
case "function-type": {
|
|
8997
9194
|
const displayParts = this.signatureContext.displayService.getFunctionTypeBodyDisplayParts(signature.functionType);
|
|
8998
9195
|
return this.signatureContext.convertFunctionTypeBodyDisplayParts(displayParts);
|
|
@@ -9027,6 +9224,12 @@ var SignatureContext2 = class {
|
|
|
9027
9224
|
const postfix = parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
|
9028
9225
|
return new SignatureDisplayParts(prefix, valueParameters, parts.valueParameterSeparator, postfix);
|
|
9029
9226
|
}
|
|
9227
|
+
convertOperatorDisplayParts(parts) {
|
|
9228
|
+
const prefix = parts.functionKeyword + parts.whitespaceAfterFunctionKeyword + parts.container + parts.name + parts.valueParametersStart;
|
|
9229
|
+
const valueParameters = parts.valueParameters.map((p) => p.toString());
|
|
9230
|
+
const postfix = parts.valueParametersEnd + parts.returnTypeAnnotationColon + parts.returnType;
|
|
9231
|
+
return new SignatureDisplayParts(prefix, valueParameters, parts.valueParameterSeparator, postfix);
|
|
9232
|
+
}
|
|
9030
9233
|
convertFunctionTypeBodyDisplayParts(parts) {
|
|
9031
9234
|
const prefix = parts.asyncKeywordWithWhitespace + parts.functionKeyword + parts.valueParametersStart;
|
|
9032
9235
|
const valueParameters = parts.valueParameters.map((p) => p.toString());
|