@artel/artc 0.6.25281 → 0.6.25283
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 +18 -16
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +1182 -979
- package/build/{chunk-TIWNEKIS.js → chunk-2Q4QKW7T.js} +9266 -8683
- package/build/{chunk-7OXU5662.js → chunk-7RAZAZE6.js} +3 -3
- package/build/{chunk-NVHCHE3R.js → chunk-MJ2ZVHII.js} +3 -3
- package/build/types/analysis/AccessedFunction.d.ts +4 -0
- package/build/types/analysis/Analyzer.d.ts +68 -109
- package/build/types/analysis/AutotypeCallExpressionMeaning.d.ts +5 -5
- package/build/types/analysis/BaseExpressionMeaning.d.ts +8 -18
- package/build/types/analysis/CallExpressionMeaning.d.ts +4 -9
- package/build/types/analysis/DereferenceExpressionMeaning.d.ts +3 -4
- package/build/types/analysis/IdentifierExpressionMeaning.d.ts +8 -16
- package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +4 -8
- package/build/types/analysis/MemberAccessExpressionMeaning.d.ts +8 -16
- package/build/types/analysis/NamedTypeResolver.d.ts +4 -4
- package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +4 -4
- package/build/types/analysis/NodeTypeUtils.d.ts +1 -1
- package/build/types/analysis/ObjectExpressionMeaning.d.ts +4 -9
- package/build/types/analysis/PackageMemberConflictsValidator.d.ts +1 -1
- package/build/types/analysis/ResolvedImplementationPackage.d.ts +48 -0
- package/build/types/analysis/SourceFileAnalyzer.d.ts +1 -0
- package/build/types/analysis/SubstitutedFunction.d.ts +3 -0
- package/build/types/analysis/TagMeaning.d.ts +4 -4
- package/build/types/analysis/UserDefinableBinaryOperatorResolver.d.ts +4 -3
- package/build/types/analysis/UserDefinableUnaryOperatorResolver.d.ts +4 -3
- package/build/types/analysis/Utils.d.ts +1 -0
- package/build/types/analysis/semantic-context/FieldWithInitializerSemanticContext.d.ts +4 -5
- package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +4 -4
- package/build/types/analysis/semantic-context/SemanticContextValidatingNameConflicts.d.ts +4 -5
- package/build/types/analysis/semantic-context/SourceFileSemanticContext.d.ts +11 -7
- package/build/types/analysis/semantic-context/SubprogramSemanticContext.d.ts +4 -5
- package/build/types/analysis/semantic-context/TypeSemanticContext.d.ts +8 -8
- package/build/types/api/Api.d.ts +4 -5
- package/build/types/common/ArrayUtils.d.ts +3 -1
- package/build/types/common/Displayable.d.ts +4 -4
- package/build/types/common/FormatString.d.ts +1 -1
- package/build/types/common/HelperPhrases.d.ts +2 -1
- package/build/types/common/LocalizationHelper.d.ts +6 -4
- package/build/types/common/index.d.ts +3 -0
- package/build/types/diagnostic/DiagnosticCode.d.ts +248 -238
- package/build/types/diagnostic/DiagnosticData.d.ts +2 -2
- package/build/types/emitter/EntityMap.d.ts +1 -1
- package/build/types/emitter/IrBuilder.d.ts +3 -1
- package/build/types/emitter/IrFactory.d.ts +2 -2
- package/build/types/emitter/Transformer.d.ts +3 -3
- package/build/types/emitter/ir/Nodes.d.ts +17 -8
- package/build/types/emitter/ir/types.d.ts +2 -2
- package/build/types/entities/Entity.d.ts +0 -12
- package/build/types/entities/EntityLocalizationContext.d.ts +1 -2
- package/build/types/entities/IEntity.d.ts +2 -1
- package/build/types/entities/OperatorKind.d.ts +6 -3
- package/build/types/entities/{PackageMembers.d.ts → PackageEntityMembers.d.ts} +1 -1
- package/build/types/entities/TypeEntity.d.ts +4 -4
- package/build/types/entities/index.d.ts +1 -1
- package/build/types/entities/interfaces/AliasTypeEntity.d.ts +3 -8
- package/build/types/entities/interfaces/ConstructorEntity.d.ts +0 -4
- package/build/types/entities/interfaces/DereferenceOperatorEntity.d.ts +0 -4
- package/build/types/entities/interfaces/DestructorEntity.d.ts +0 -4
- package/build/types/entities/interfaces/FunctionEntity.d.ts +1 -8
- package/build/types/entities/interfaces/FunctionTypeEntity.d.ts +0 -8
- package/build/types/entities/interfaces/GetterEntity.d.ts +0 -4
- package/build/types/entities/interfaces/IndexerEntity.d.ts +0 -4
- package/build/types/entities/interfaces/OperatorEntity.d.ts +0 -4
- package/build/types/entities/interfaces/PackageAliasEntity.d.ts +0 -5
- package/build/types/entities/interfaces/PackageEntity.d.ts +2 -11
- package/build/types/entities/interfaces/SetterEntity.d.ts +0 -4
- package/build/types/entities/interfaces/StructuredTypeEntity.d.ts +0 -8
- package/build/types/entities/interfaces/TextTranslationEntity.d.ts +1 -0
- package/build/types/entities/interfaces/TypeExtensionEntity.d.ts +1 -7
- package/build/types/entities/interfaces/TypeParameterEntity.d.ts +0 -2
- package/build/types/entities/interfaces/VariableEntity.d.ts +2 -12
- package/build/types/entities/interfaces/VariantTypeEntity.d.ts +1 -8
- package/build/types/entities/intrinsic/IntrinsicFunctionTypeEntity.d.ts +3 -3
- package/build/types/entities/intrinsic/IntrinsicStructuredTypeEntity.d.ts +3 -3
- package/build/types/entities/intrinsic/IntrinsicTypeParameterEntity.d.ts +2 -4
- package/build/types/entities/source/SourceAliasTypeEntity.d.ts +1 -2
- package/build/types/entities/source/SourceFunctionTypeEntity.d.ts +1 -3
- package/build/types/entities/source/SourcePackageEntity.d.ts +1 -2
- package/build/types/entities/source/SourceStructuredTypeEntity.d.ts +1 -3
- package/build/types/entities/source/SourceTextTranslationEntity.d.ts +1 -0
- package/build/types/entities/source/SourceTypeExtensionEntity.d.ts +1 -2
- package/build/types/entities/source/SourceTypeParameterEntity.d.ts +1 -2
- package/build/types/entities/source/SourceVariableEntity.d.ts +2 -2
- package/build/types/entities/source/SourceVariantTypeEntity.d.ts +1 -3
- package/build/types/entities/translated/TranslatedAliasTypeEntity.d.ts +1 -3
- package/build/types/entities/translated/TranslatedFunctionTypeEntity.d.ts +1 -5
- package/build/types/entities/translated/TranslatedPackageEntity.d.ts +2 -3
- package/build/types/entities/translated/TranslatedStructuredTypeEntity.d.ts +1 -5
- package/build/types/entities/translated/TranslatedTypeExtensionEntity.d.ts +1 -3
- package/build/types/entities/translated/TranslatedTypeParameterEntity.d.ts +1 -3
- package/build/types/entities/translated/TranslatedVariantTypeEntity.d.ts +1 -5
- package/build/types/parser/KeywordDictionary.d.ts +10 -2
- package/build/types/parser/TokenKind.d.ts +46 -44
- package/build/types/services/CustomRequests.d.ts +24 -4
- package/build/types/services/DisplayService.d.ts +10 -3
- package/build/types/services/LanguageServer.d.ts +4 -3
- package/build/types/services/ScriptEditingService.d.ts +25 -0
- package/build/types/services/SourceFileItemsService.d.ts +1 -1
- package/build/types/services/Types.d.ts +6 -0
- package/build/types/services/source-generation/EntityToSyntax.d.ts +12 -0
- package/build/types/tree/BaseNode.d.ts +56 -2
- package/build/types/tree/KeywordFlags.d.ts +28 -0
- package/build/types/tree/KeywordKind.d.ts +3 -1
- package/build/types/tree/NodeKind.d.ts +1 -1
- package/build/types/tree/Nodes.d.ts +10 -24
- package/build/types/tree/NodesDebug.d.ts +9 -0
- package/build/types/tree/OperatorKind.d.ts +6 -3
- package/build/types/tree/SyntaxFactory.d.ts +31 -29
- package/build/types/tree/SyntaxToCode.d.ts +4 -1
- package/build/types/tree/TokenFlags.d.ts +15 -0
- package/build/types/tree/TokenKind.d.ts +63 -51
- package/build/types/tree/Utils.d.ts +2 -2
- package/build/types/tree/index.d.ts +2 -1
- package/build/types/ts-interop/Entities.d.ts +1 -11
- package/build/types/ts-interop/TsInteropContext.d.ts +1 -2
- package/build/types/types/AliasType.d.ts +1 -2
- package/build/types/types/FunctionType.d.ts +2 -3
- package/build/types/types/IntersectionType.d.ts +1 -2
- package/build/types/types/ParameterType.d.ts +1 -2
- package/build/types/types/StructuredType.d.ts +1 -2
- package/build/types/types/SubstitutionStubType.d.ts +21 -0
- package/build/types/types/Substitutions.d.ts +1 -1
- package/build/types/types/Type.d.ts +5 -7
- package/build/types/types/TypeFactory.d.ts +2 -1
- package/build/types/types/TypeMembers.d.ts +8 -8
- package/build/types/types/UnionType.d.ts +1 -2
- package/build/types/types/UnresolvedType.d.ts +0 -1
- package/build/types/types/VariantType.d.ts +1 -2
- package/build/types/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/build/types/analysis/SourceFileMembers.d.ts +0 -29
- package/build/types/services/AssignFieldService.d.ts +0 -10
- package/build/types/services/DeleteBlockFromScriptService.d.ts +0 -6
- package/build/types/tree/Token.d.ts +0 -57
- /package/build/types/services/{ProjectItemsService.d.ts → WorkspaceItemsService.d.ts} +0 -0
|
@@ -27,48 +27,50 @@ export declare enum TokenKind {
|
|
|
27
27
|
BackQuote = 25,
|
|
28
28
|
Bar = 26,
|
|
29
29
|
BarBar = 27,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
30
|
+
BarEquals = 28,
|
|
31
|
+
BarBarEquals = 29,
|
|
32
|
+
Caret = 30,
|
|
33
|
+
RightBrace = 31,
|
|
34
|
+
RightParenthesis = 32,
|
|
35
|
+
RightSquareBracket = 33,
|
|
36
|
+
Colon = 34,
|
|
37
|
+
Comma = 35,
|
|
38
|
+
CommercialAt = 36,
|
|
39
|
+
Dot = 37,
|
|
40
|
+
DoublePeriod = 38,
|
|
41
|
+
Ellipsis = 39,
|
|
42
|
+
EqualsEquals = 40,
|
|
43
|
+
Exclamation = 41,
|
|
44
|
+
ExclamationEquals = 42,
|
|
45
|
+
RightAngle = 43,
|
|
46
|
+
RightAngleRightAngle = 44,
|
|
47
|
+
RightAngleRightAngleRightAngle = 45,
|
|
48
|
+
HashSign = 46,
|
|
49
|
+
LeftAngle = 47,
|
|
50
|
+
LeftAngleLeftAngle = 48,
|
|
51
|
+
LeftAngleMinus = 49,
|
|
52
|
+
Minus = 50,
|
|
53
|
+
MinusMinus = 51,
|
|
54
|
+
MinusEquals = 52,
|
|
55
|
+
MinusRightAngle = 53,
|
|
56
|
+
LeftBrace = 54,
|
|
57
|
+
LeftParenthesis = 55,
|
|
58
|
+
LeftSquareBracket = 56,
|
|
59
|
+
Plus = 57,
|
|
60
|
+
PlusPlus = 58,
|
|
61
|
+
PlusEquals = 59,
|
|
62
|
+
Question = 60,
|
|
63
|
+
QuestionQuestion = 61,
|
|
64
|
+
Semicolon = 62,
|
|
65
|
+
Slash = 63,
|
|
66
|
+
SlashEquals = 64,
|
|
67
|
+
Tilde = 65,
|
|
68
|
+
TildeTilde = 66,
|
|
69
|
+
Underscore = 67,
|
|
70
|
+
Equals = 68,
|
|
71
|
+
Percent = 69,
|
|
72
|
+
PercentPercent = 70,
|
|
73
|
+
BackSlash = 71,
|
|
74
|
+
BackSlashEquals = 72,
|
|
75
|
+
BackSlashBackSlash = 73
|
|
74
76
|
}
|
|
@@ -12,7 +12,9 @@ export declare const customRequests: {
|
|
|
12
12
|
deleteSourceFile: CustomRequestType<DeleteSourceFileParams, void>;
|
|
13
13
|
getNodeRange: CustomRequestType<GetNodeRangeParams, ls.Range | null>;
|
|
14
14
|
assignField: CustomRequestType<AssignFieldParams, void>;
|
|
15
|
-
|
|
15
|
+
addBlocksToScript: CustomRequestType<AddBlocksToScriptParams, void>;
|
|
16
|
+
canDeleteBlocksFromScript: CustomRequestType<CanDeleteBlocksFromScriptParams, boolean>;
|
|
17
|
+
deleteBlocksFromScript: CustomRequestType<DeleteBlocksFromScriptParams, void>;
|
|
16
18
|
};
|
|
17
19
|
export type GetLocalesAvailableForTranslationParams = {
|
|
18
20
|
textDocument: ls.TextDocumentIdentifier;
|
|
@@ -73,7 +75,7 @@ export type AssignFieldParams = {
|
|
|
73
75
|
/**
|
|
74
76
|
* Путь к узлу функции, в котором нужно расположить присваивание.
|
|
75
77
|
*/
|
|
76
|
-
|
|
78
|
+
scriptFunctionUri: SyntaxNodeUri;
|
|
77
79
|
/**
|
|
78
80
|
* Имя поля.
|
|
79
81
|
*/
|
|
@@ -89,7 +91,25 @@ export type AssignFieldParams = {
|
|
|
89
91
|
*/
|
|
90
92
|
lastAssignmentNodeUri?: SyntaxNodeUri;
|
|
91
93
|
};
|
|
92
|
-
export type
|
|
93
|
-
|
|
94
|
+
export type AddBlocksToScriptParams = ScriptBlocksAddedToOuterScript[];
|
|
95
|
+
export type ScriptBlocksAddedToOuterScript = {
|
|
96
|
+
outerScriptFunctionUri: SyntaxNodeUri;
|
|
97
|
+
values: AddedScriptBlock[];
|
|
98
|
+
};
|
|
99
|
+
export type AddedScriptBlock = {
|
|
100
|
+
name: string;
|
|
101
|
+
key: string;
|
|
102
|
+
areaIndex?: string;
|
|
103
|
+
elementProperties?: {
|
|
104
|
+
[T in string]: string;
|
|
105
|
+
};
|
|
106
|
+
nestedBlocks?: AddedScriptBlock[];
|
|
107
|
+
};
|
|
108
|
+
export type CanDeleteBlocksFromScriptParams = {
|
|
109
|
+
outerScriptFunctionUri: SyntaxNodeUri;
|
|
110
|
+
scriptFunctionUris: SyntaxNodeUri[];
|
|
111
|
+
};
|
|
112
|
+
export type DeleteBlocksFromScriptParams = {
|
|
113
|
+
scriptFunctionUris: SyntaxNodeUri[];
|
|
94
114
|
};
|
|
95
115
|
export {};
|
|
@@ -2,8 +2,7 @@ import { AccessedFunction } from '../analysis/AccessedFunction.js';
|
|
|
2
2
|
import { PackageNameTreeNode } from '../analysis/ImportedPackageNameTree.js';
|
|
3
3
|
import { SubstitutedFunction } from '../analysis/SubstitutedFunction.js';
|
|
4
4
|
import { Analyzer } from '../analysis/index.js';
|
|
5
|
-
import { HelperPhraseKind } from '../common/
|
|
6
|
-
import { Name, PackageDialect, PackageLocale } from '../common/index.js';
|
|
5
|
+
import { HelperPhraseKind, Name, PackageDialect, PackageLocale } from '../common/index.js';
|
|
7
6
|
import * as e from '../entities/index.js';
|
|
8
7
|
import { NamedEntity, StructuredTypeKind } from '../entities/index.js';
|
|
9
8
|
import { SourceFile } from '../project/index.js';
|
|
@@ -62,6 +61,7 @@ export declare class DisplayService {
|
|
|
62
61
|
private displayAliasTypeUsage;
|
|
63
62
|
private displayUnionOrIntersectionTypeUsage;
|
|
64
63
|
private displayUnresolvedTypeUsage;
|
|
64
|
+
private displaySubstitutionStubTypeUsage;
|
|
65
65
|
private displayTypeInternal;
|
|
66
66
|
private displayTypeUsageInternal;
|
|
67
67
|
private displayUnionOrIntersectionTypeTypes;
|
|
@@ -541,7 +541,7 @@ interface IOperatorDeclaration {
|
|
|
541
541
|
getReturnType(): types.Type;
|
|
542
542
|
getContainer(analyzer: Analyzer | undefined): DeclarationContainer | undefined;
|
|
543
543
|
}
|
|
544
|
-
export type TypeUsage = StructuredTypeUsage | VariantTypeUsage | FunctionTypeUsage | AliasTypeUsage | ParameterTypeUsage | UnionOrIntersectionTypeUsage | UnresolvedTypeUsage;
|
|
544
|
+
export type TypeUsage = StructuredTypeUsage | VariantTypeUsage | FunctionTypeUsage | AliasTypeUsage | ParameterTypeUsage | UnionOrIntersectionTypeUsage | UnresolvedTypeUsage | SubstitutionStubTypeUsage;
|
|
545
545
|
export type StructuredTypeUsage = StructuredTypeUsage_type | StructuredTypeUsage_entity;
|
|
546
546
|
export declare class StructuredTypeUsage_type implements IStructuredTypeUsage {
|
|
547
547
|
readonly type: types.StructuredType;
|
|
@@ -679,6 +679,13 @@ type UnresolvedTypeUsage = UnresolvedTypeUsage_type;
|
|
|
679
679
|
declare class UnresolvedTypeUsage_type {
|
|
680
680
|
readonly kind = "unresolved";
|
|
681
681
|
}
|
|
682
|
+
type SubstitutionStubTypeUsage = SubstitutionStubTypeUsage_type;
|
|
683
|
+
declare class SubstitutionStubTypeUsage_type {
|
|
684
|
+
readonly type: types.SubstitutionStubType;
|
|
685
|
+
readonly kind = "substitution-stub";
|
|
686
|
+
constructor(type: types.SubstitutionStubType);
|
|
687
|
+
getIndex(): number;
|
|
688
|
+
}
|
|
682
689
|
type TypeMemberDeclarationContainer = DeclarationContainer.Type | DeclarationContainer.TypeExtension;
|
|
683
690
|
type DeclarationContainer = DeclarationContainer.Type | DeclarationContainer.TypeExtension | DeclarationContainer.Package;
|
|
684
691
|
declare namespace DeclarationContainer {
|
|
@@ -32,8 +32,7 @@ export declare class LanguageServer {
|
|
|
32
32
|
private readonly signatureHelpService;
|
|
33
33
|
private readonly fileSystemTreeDisplayService;
|
|
34
34
|
private readonly selectionRangeService;
|
|
35
|
-
private readonly
|
|
36
|
-
private readonly deleteBlockFromScriptService;
|
|
35
|
+
private readonly scriptEditingService;
|
|
37
36
|
private readonly codeActionsService;
|
|
38
37
|
constructor(config: LanguageServerConfig);
|
|
39
38
|
start(): void;
|
|
@@ -61,7 +60,9 @@ export declare class LanguageServer {
|
|
|
61
60
|
private convertSourceFileItemKind;
|
|
62
61
|
private convertDiagnostic;
|
|
63
62
|
private onAssignField;
|
|
64
|
-
private
|
|
63
|
+
private onAddBlocksToScript;
|
|
64
|
+
private onCanDeleteBlocksFromScript;
|
|
65
|
+
private onDeleteBlocksFromScript;
|
|
65
66
|
private convertSourceFileEdit;
|
|
66
67
|
private convertSourceFileEditsToWorkspaceEdit;
|
|
67
68
|
private onGetNodeRange;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Analyzer } from '../analysis/Analyzer.js';
|
|
2
|
+
import { SubprogramDeclarationOrLiteral } from '../analysis/NodeTypeUtils.js';
|
|
3
|
+
import { SourceFile } from '../project/index.js';
|
|
4
|
+
import { NodeLocation, SourceFileEdit } from './Types.js';
|
|
5
|
+
export declare class ScriptEditingService {
|
|
6
|
+
private static readonly indentationStep;
|
|
7
|
+
private static readonly elementParameterNameText;
|
|
8
|
+
private static readonly elementParameterName;
|
|
9
|
+
createEditWithFieldAssignment(analyzer: Analyzer, sourceFile: SourceFile, scriptDeclaration: SubprogramDeclarationOrLiteral, fieldName: string, value: string): SourceFileEdit | undefined;
|
|
10
|
+
createEditAddingBlocks(sourceFile: SourceFile, scriptDeclaration: SubprogramDeclarationOrLiteral, addedBlockInfos: readonly AddedScriptBlockInfo[]): SourceFileEdit | undefined;
|
|
11
|
+
canDeleteBlocks(outerScriptFunctionLocation: NodeLocation, scriptFunctionLocations: readonly NodeLocation[]): boolean;
|
|
12
|
+
createEditDeletingBlock(sourceFile: SourceFile, scriptDeclaration: SubprogramDeclarationOrLiteral): SourceFileEdit | undefined;
|
|
13
|
+
private findLastAssignmentToField;
|
|
14
|
+
private createScriptBlockText;
|
|
15
|
+
private detectNewLine;
|
|
16
|
+
}
|
|
17
|
+
export interface AddedScriptBlockInfo {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly areaIndex: string | undefined;
|
|
21
|
+
readonly elementProperties: {
|
|
22
|
+
readonly [T in string]: string;
|
|
23
|
+
};
|
|
24
|
+
readonly nestedBlocks: readonly AddedScriptBlockInfo[];
|
|
25
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as ls from 'vscode-languageserver';
|
|
2
2
|
import { Range, Uri } from '../common/index.js';
|
|
3
3
|
import { SourceFile } from '../project/index.js';
|
|
4
|
+
import * as tree from '../tree/index.js';
|
|
4
5
|
export type RangeLocation = {
|
|
5
6
|
uri: Uri;
|
|
6
7
|
range: Range;
|
|
@@ -30,3 +31,8 @@ export declare class SourceFileEdit {
|
|
|
30
31
|
readonly text: string;
|
|
31
32
|
constructor(sourceFile: SourceFile, range: Range, text: string);
|
|
32
33
|
}
|
|
34
|
+
export declare class NodeLocation {
|
|
35
|
+
readonly sourceFile: SourceFile;
|
|
36
|
+
readonly path: tree.NodePath;
|
|
37
|
+
constructor(sourceFile: SourceFile, path: tree.NodePath);
|
|
38
|
+
}
|
|
@@ -10,17 +10,28 @@ export declare class EntityToSyntax {
|
|
|
10
10
|
private convertNamedPackageMember;
|
|
11
11
|
private convertPackageType;
|
|
12
12
|
private convertPackageVariable;
|
|
13
|
+
private convertPackageVariableModifiers;
|
|
13
14
|
private convertPackageFunction;
|
|
15
|
+
private convertPackageFunctionModifiers;
|
|
14
16
|
private convertPackageStructuredType;
|
|
17
|
+
private convertPackageStructuredTypeModifiers;
|
|
15
18
|
private convertPackageAliasType;
|
|
19
|
+
private convertPackageAliasTypeModifiers;
|
|
16
20
|
private convertPackageVariantType;
|
|
21
|
+
private convertPackageVariantTypeModifiers;
|
|
17
22
|
private convertPackageFunctionType;
|
|
23
|
+
private convertPackageFunctionTypeModifiers;
|
|
18
24
|
private convertTypeEntityMembers;
|
|
19
25
|
private convertField;
|
|
26
|
+
private convertFieldModifiers;
|
|
20
27
|
private convertMethod;
|
|
28
|
+
private convertMethodModifiers;
|
|
21
29
|
private convertConstructor;
|
|
30
|
+
private convertConstructorModifiers;
|
|
22
31
|
private convertDestructor;
|
|
32
|
+
private convertDestructorModifiers;
|
|
23
33
|
private convertIndexer;
|
|
34
|
+
private convertIndexerModifiers;
|
|
24
35
|
private convertVariant;
|
|
25
36
|
private createStructuredTypeDeclarationBody;
|
|
26
37
|
private createAliasTypeDeclarationBody;
|
|
@@ -42,5 +53,6 @@ export declare class EntityToSyntax {
|
|
|
42
53
|
private convertUnionType;
|
|
43
54
|
private convertIntersectionType;
|
|
44
55
|
private convertUnresolvedType;
|
|
56
|
+
private convertSubstitutionStubType;
|
|
45
57
|
private createNamedTypeSpecifier;
|
|
46
58
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { PackageDialect, PackageLocale, Range } from '../common/index.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { NodeKind } from './NodeKind.js';
|
|
3
|
+
import { TokenKind } from './TokenKind.js';
|
|
4
|
+
import { TriviaKind } from './TriviaKind.js';
|
|
5
|
+
import { OperatorKind } from './OperatorKind.js';
|
|
6
|
+
import { KeywordKind } from './KeywordKind.js';
|
|
7
|
+
import { TokenFlags } from './TokenFlags.js';
|
|
8
|
+
import { KeywordFlags } from './KeywordFlags.js';
|
|
9
|
+
import { Node, Identifier, SourceFile } from './Nodes.js';
|
|
4
10
|
export declare abstract class BaseNode {
|
|
5
11
|
protected static readonly emptyChildren_: [];
|
|
6
12
|
abstract readonly children: readonly (Node | undefined)[];
|
|
@@ -38,4 +44,52 @@ export declare abstract class BaseNode {
|
|
|
38
44
|
private countDescendants;
|
|
39
45
|
private countTokens;
|
|
40
46
|
}
|
|
47
|
+
export declare class Token<TKind extends TokenKind = TokenKind> extends BaseNode {
|
|
48
|
+
readonly kind = NodeKind.Token;
|
|
49
|
+
readonly tokenKind: TKind;
|
|
50
|
+
readonly value: string;
|
|
51
|
+
readonly leadingTrivia: readonly Trivia[];
|
|
52
|
+
readonly trailingTrivia: readonly Trivia[];
|
|
53
|
+
readonly flags: TokenFlags;
|
|
54
|
+
readonly operatorKind: OperatorKind | undefined;
|
|
55
|
+
get children(): readonly [];
|
|
56
|
+
get parent(): Node;
|
|
57
|
+
get isMissing(): boolean;
|
|
58
|
+
protected get thisAsNode(): Node;
|
|
59
|
+
constructor(tokenKind: TKind, value: string, leadingTrivia: readonly Trivia[], trailingTrivia: readonly Trivia[], flags: TokenFlags, operatorKind: OperatorKind | undefined, rangeWithTrivia: Range | undefined);
|
|
60
|
+
get rangeWithoutTrivia(): Range;
|
|
61
|
+
getTextWithTrivia(): string;
|
|
62
|
+
hasTrailingLineBreak(): boolean;
|
|
63
|
+
getTriviaAt(position: number): TokenTrivia | undefined;
|
|
64
|
+
selectLeadingTrivia(condition: (trivia: Trivia, rangeStart: number, rangeEnd: number) => boolean): TokenTrivia[];
|
|
65
|
+
selectTrailingTrivia(condition: (trivia: Trivia, rangeStart: number, rangeEnd: number) => boolean): TokenTrivia[];
|
|
66
|
+
protected getLengthWithTrivia(): number;
|
|
67
|
+
}
|
|
68
|
+
export declare class Trivia {
|
|
69
|
+
readonly kind: TriviaKind;
|
|
70
|
+
readonly value: string;
|
|
71
|
+
get rangeLength(): number;
|
|
72
|
+
constructor(kind: TriviaKind, value: string);
|
|
73
|
+
}
|
|
74
|
+
export declare class TokenTrivia {
|
|
75
|
+
readonly trivia: Trivia;
|
|
76
|
+
readonly token: Token<TokenKind>;
|
|
77
|
+
readonly isTrailing: boolean;
|
|
78
|
+
readonly index: number;
|
|
79
|
+
readonly range: Range;
|
|
80
|
+
get kind(): TriviaKind;
|
|
81
|
+
get value(): string;
|
|
82
|
+
constructor(token: Token<TokenKind>, trivia: Trivia, isTrailing: boolean, index: number, range: Range);
|
|
83
|
+
}
|
|
84
|
+
export declare class Keyword<TKind extends KeywordKind = KeywordKind> extends BaseNode {
|
|
85
|
+
readonly kind = NodeKind.Keyword;
|
|
86
|
+
readonly children: readonly Identifier[];
|
|
87
|
+
readonly keywordKind: TKind;
|
|
88
|
+
readonly flags: KeywordFlags;
|
|
89
|
+
get parent(): Node;
|
|
90
|
+
get tokens(): readonly Identifier[];
|
|
91
|
+
get isMissing(): boolean;
|
|
92
|
+
protected get thisAsNode(): Node;
|
|
93
|
+
constructor(tokens: readonly Identifier[], keywordKind: TKind, flags: KeywordFlags | undefined, rangeWithTrivia: Range | undefined);
|
|
94
|
+
}
|
|
41
95
|
export declare function toSourceCode(node: Node, lengthLimit?: number, excludeTrivia?: boolean): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const enum KeywordFlags {
|
|
2
|
+
None = 0,
|
|
3
|
+
Missing = 1,
|
|
4
|
+
Noun = 2,
|
|
5
|
+
Verb = 4,
|
|
6
|
+
Adjective = 8,
|
|
7
|
+
Adverb = 16,
|
|
8
|
+
Pronoun = 32,
|
|
9
|
+
Preposition = 64,
|
|
10
|
+
Particle = 128,
|
|
11
|
+
Conjunction = 256,
|
|
12
|
+
Numeral = 512,
|
|
13
|
+
MasculineGender = 1024,
|
|
14
|
+
FeminineGender = 2048,
|
|
15
|
+
NeuterGender = 4096,
|
|
16
|
+
Singular = 8192,
|
|
17
|
+
Plural = 16384,
|
|
18
|
+
NeuNoun = 4098,
|
|
19
|
+
PluralNoun = 16386,
|
|
20
|
+
SingularMasNoun = 9218,
|
|
21
|
+
SingularFemNoun = 10242,
|
|
22
|
+
SingularNeuNoun = 12290,
|
|
23
|
+
ComAdjective = 7176,
|
|
24
|
+
SingularMasAdjective = 9224,
|
|
25
|
+
SingularFemAdjective = 10248,
|
|
26
|
+
SingularNeuAdjective = 12296,
|
|
27
|
+
PluralAdjective = 16392
|
|
28
|
+
}
|
|
@@ -146,7 +146,7 @@ export declare enum NodeKind {
|
|
|
146
146
|
TranslationTextTemplateSpanList = 144,
|
|
147
147
|
TranslationTextTemplateSpan = 145,
|
|
148
148
|
TranslationTextTemplateParameter = 146,
|
|
149
|
-
|
|
149
|
+
VariantValueDeclaration = 147,
|
|
150
150
|
TypeParameterDeclaration = 148,
|
|
151
151
|
ParameterDeclaration = 149,
|
|
152
152
|
Argument = 150,
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
import { PackageDialect, PackageLocale, Query, Range } from '../common/index.js';
|
|
2
2
|
import { ParserDiagnostic } from '../parser/ParserDiagnostic.js';
|
|
3
|
-
import { BaseNode } from './BaseNode.js';
|
|
3
|
+
import { BaseNode, Keyword, Token } from './BaseNode.js';
|
|
4
4
|
import { KeywordKind } from './KeywordKind.js';
|
|
5
5
|
import { NodeKind } from './NodeKind.js';
|
|
6
6
|
import { OperatorKind } from './OperatorKind.js';
|
|
7
|
-
import { Token } from './Token.js';
|
|
8
7
|
import { TokenKind } from './TokenKind.js';
|
|
8
|
+
import { NodesWithChild } from './NodesDebug.js';
|
|
9
9
|
export type Comma = Token<TokenKind.Comma>;
|
|
10
10
|
export type Semicolon = Token<TokenKind.Semicolon>;
|
|
11
11
|
export type Identifier = Token<TokenKind.Identifier>;
|
|
12
12
|
export type IdentifierParent = NodesWithChild<Identifier>;
|
|
13
13
|
export type IdentifierListElement = Identifier | Comma;
|
|
14
|
-
export declare class Keyword<TKind extends KeywordKind = KeywordKind> extends BaseNode {
|
|
15
|
-
readonly kind = NodeKind.Keyword;
|
|
16
|
-
readonly children: readonly Identifier[];
|
|
17
|
-
readonly keywordKind: TKind;
|
|
18
|
-
readonly isMissing: boolean;
|
|
19
|
-
get parent(): Node;
|
|
20
|
-
get tokens(): readonly Identifier[];
|
|
21
|
-
protected get thisAsNode(): Node;
|
|
22
|
-
constructor(tokens: readonly Identifier[], keywordKind: TKind, isMissing: boolean | undefined, rangeWithTrivia: Range | undefined);
|
|
23
|
-
}
|
|
24
14
|
export declare class SourceFile extends BaseNode {
|
|
25
15
|
readonly kind = NodeKind.SourceFile;
|
|
26
16
|
readonly children: readonly [
|
|
@@ -608,7 +598,7 @@ export declare class MissingPackageMemberDeclaration extends BaseNode {
|
|
|
608
598
|
protected get thisAsNode(): Node;
|
|
609
599
|
constructor(tagList: TagList, modifierList: ModifierList, rangeWithTrivia: Range | undefined);
|
|
610
600
|
}
|
|
611
|
-
export type TypeMemberDeclaration = FieldDeclaration | FieldGetterDeclaration | FieldSetterDeclaration |
|
|
601
|
+
export type TypeMemberDeclaration = FieldDeclaration | FieldGetterDeclaration | FieldSetterDeclaration | VariantValueDeclaration | MethodDeclaration | OperatorDeclaration | ConstructorDeclaration | DestructorDeclaration | IndexedElementGetterDeclaration | IndexedElementSetterDeclaration | DereferencedVariableGetterDeclaration | DereferencedVariableSetterDeclaration | TypeMemberGroupDeclaration | MissingTypeMemberDeclaration;
|
|
612
602
|
export declare class TypeMemberGroupDeclaration extends BaseNode {
|
|
613
603
|
readonly kind = NodeKind.TypeMemberGroupDeclaration;
|
|
614
604
|
readonly children: readonly [
|
|
@@ -918,7 +908,7 @@ export declare class ForStatementVariableDeclaration extends BaseNode {
|
|
|
918
908
|
constructor(name: Identifier, rangeWithTrivia: Range | undefined);
|
|
919
909
|
}
|
|
920
910
|
export type Expression = ArrayLiteral | AsExpression | AssertionExpression | AssumptionExpression | BinaryExpression | FunctionLiteral | FunctionBlockLiteral | CallExpression | IdentifierExpression | AutotypeCallExpression | IndexedAccessExpression | MissingExpression | IsExpression | ParenthesizedExpression | ConditionalExpression | PrefixUnaryExpression | MemberAccessExpression | ReferenceExpression | DereferenceExpression | TextLiteral | LocalizableTextLiteral | TextTemplateLiteral | LocalizableTextTemplateLiteral | GenericSpecializationExpression | DefaultMatchExpression | TokenExpression | KeywordExpression | ObjectExpression | BaseExpression;
|
|
921
|
-
export type ExpressionParent = ArrayLiteralElementList | AsExpression | AssertionExpression | AssumptionExpression | AssignmentStatement | BinaryExpression | Argument | CallExpression | DisposeStatement | ErrorStatement | ImportantStatement | ExpressionStatement | ForStatement | PackageVariableDeclaration | IfStatement | IndexedAccessExpression | IsExpression | LocalVariableDeclaration | MatchExpressionList | ParameterDeclaration | ParenthesizedExpression | ConditionalExpression | PrefixUnaryExpression | MemberAccessExpression | ReferenceExpression | DereferenceExpression | LoopStatement | ReturnStatement | TextTemplateSpan | FieldDeclaration | SwitchStatement |
|
|
911
|
+
export type ExpressionParent = ArrayLiteralElementList | AsExpression | AssertionExpression | AssumptionExpression | AssignmentStatement | BinaryExpression | Argument | CallExpression | DisposeStatement | ErrorStatement | ImportantStatement | ExpressionStatement | ForStatement | PackageVariableDeclaration | IfStatement | IndexedAccessExpression | IsExpression | LocalVariableDeclaration | MatchExpressionList | ParameterDeclaration | ParenthesizedExpression | ConditionalExpression | PrefixUnaryExpression | MemberAccessExpression | ReferenceExpression | DereferenceExpression | LoopStatement | ReturnStatement | TextTemplateSpan | FieldDeclaration | SwitchStatement | VariantValueDeclaration | WhileStatement | YieldStatement | GenericSpecializationExpression | ElseIfClause | TextTranslationDeclaration | FunctionBlock;
|
|
922
912
|
export type ExpressionListElement = Expression | Comma;
|
|
923
913
|
export declare class ArrayLiteral extends BaseNode {
|
|
924
914
|
readonly kind = NodeKind.ArrayLiteral;
|
|
@@ -995,7 +985,7 @@ export declare class BinaryExpression extends BaseNode {
|
|
|
995
985
|
protected get thisAsNode(): Node;
|
|
996
986
|
constructor(left: Expression, operator: BinaryExpressionOperator, right: Expression, rangeWithTrivia: Range | undefined);
|
|
997
987
|
}
|
|
998
|
-
export type BinaryExpressionOperator = Token<TokenKind.Plus> | Token<TokenKind.Minus> | Token<TokenKind.Asterisk> | Token<TokenKind.Slash> | Token<TokenKind.Backslash> | Token<TokenKind.BackslashBackslash> | Token<TokenKind.EqualsEquals> | Token<TokenKind.ExclamationEquals> | Token<TokenKind.LessThan> | Token<TokenKind.GreaterThan> | Token<TokenKind.LessThanOrEqual> | Token<TokenKind.GreaterThanOrEqual> | Token<TokenKind.QuestionQuestion> | Keyword<KeywordKind.Or> | Keyword<KeywordKind.And> | Keyword<KeywordKind.Xor> | Token<TokenKind.Ampersand> | Token<TokenKind.Bar> | Token<TokenKind.BarBar>;
|
|
988
|
+
export type BinaryExpressionOperator = Token<TokenKind.Plus> | Token<TokenKind.Minus> | Token<TokenKind.Asterisk> | Token<TokenKind.Slash> | Token<TokenKind.Backslash> | Token<TokenKind.BackslashBackslash> | Token<TokenKind.EqualsEquals> | Token<TokenKind.ExclamationEquals> | Token<TokenKind.LessThan> | Token<TokenKind.GreaterThan> | Token<TokenKind.LessThanOrEqual> | Token<TokenKind.GreaterThanOrEqual> | Token<TokenKind.QuestionQuestion> | Keyword<KeywordKind.Or> | Keyword<KeywordKind.And> | Keyword<KeywordKind.Xor> | Token<TokenKind.Ampersand> | Token<TokenKind.Bar> | Token<TokenKind.BarBar> | Token<TokenKind.LessThanLessThan> | Token<TokenKind.GreaterThanGreaterThan> | Token<TokenKind.GreaterThanGreaterThanGreaterThan>;
|
|
999
989
|
export declare class FunctionLiteral extends BaseNode {
|
|
1000
990
|
readonly kind = NodeKind.FunctionLiteral;
|
|
1001
991
|
readonly children: readonly [
|
|
@@ -1257,7 +1247,7 @@ export declare class TokenExpression extends BaseNode {
|
|
|
1257
1247
|
protected get thisAsNode(): Node;
|
|
1258
1248
|
constructor(token: TokenExpressionToken, rangeWithTrivia: Range | undefined);
|
|
1259
1249
|
}
|
|
1260
|
-
export type TokenExpressionToken = Token<TokenKind.
|
|
1250
|
+
export type TokenExpressionToken = Token<TokenKind.IntegerLiteral> | Token<TokenKind.RealLiteral> | Token<TokenKind.MeasureLiteral>;
|
|
1261
1251
|
export declare class TextLiteral extends BaseNode {
|
|
1262
1252
|
readonly kind = NodeKind.TextLiteral;
|
|
1263
1253
|
readonly children: readonly [
|
|
@@ -1358,7 +1348,7 @@ export declare class AssignmentStatement extends BaseNode {
|
|
|
1358
1348
|
protected get thisAsNode(): Node;
|
|
1359
1349
|
constructor(left: Expression, operator: AssignmentStatementOperator, right: Expression, rangeWithTrivia: Range | undefined);
|
|
1360
1350
|
}
|
|
1361
|
-
export type AssignmentStatementOperator = Token<TokenKind.Equals> | Token<TokenKind.PlusEquals> | Token<TokenKind.MinusEquals> | Token<TokenKind.AsteriskEquals> | Token<TokenKind.SlashEquals> | Token<TokenKind.BackslashEquals>;
|
|
1351
|
+
export type AssignmentStatementOperator = Token<TokenKind.Equals> | Token<TokenKind.PlusEquals> | Token<TokenKind.MinusEquals> | Token<TokenKind.AsteriskEquals> | Token<TokenKind.SlashEquals> | Token<TokenKind.BackslashEquals> | Token<TokenKind.AmpersandEquals> | Token<TokenKind.BarEquals> | Token<TokenKind.BarBarEquals> | Token<TokenKind.LessThanLessThanEquals> | Token<TokenKind.GreaterThanGreaterThanEquals> | Token<TokenKind.GreaterThanGreaterThanGreaterThanEquals>;
|
|
1362
1352
|
export type StatementListParent = FunctionBlock | StatementBlock;
|
|
1363
1353
|
export type StatementListElement = Statement | Semicolon;
|
|
1364
1354
|
export declare class StatementList extends BaseNode {
|
|
@@ -2094,8 +2084,8 @@ export declare class TranslationTextTemplateParameter extends BaseNode {
|
|
|
2094
2084
|
protected get thisAsNode(): Node;
|
|
2095
2085
|
constructor(name: Identifier, typeAnnotation: TypeAnnotation | undefined, rangeWithTrivia: Range | undefined);
|
|
2096
2086
|
}
|
|
2097
|
-
export declare class
|
|
2098
|
-
readonly kind = NodeKind.
|
|
2087
|
+
export declare class VariantValueDeclaration extends BaseNode {
|
|
2088
|
+
readonly kind = NodeKind.VariantValueDeclaration;
|
|
2099
2089
|
readonly children: readonly [
|
|
2100
2090
|
TagList,
|
|
2101
2091
|
ModifierList,
|
|
@@ -2308,8 +2298,4 @@ export declare class TypeAnnotation extends BaseNode {
|
|
|
2308
2298
|
protected get thisAsNode(): Node;
|
|
2309
2299
|
constructor(colonToken: Token<TokenKind.Colon>, typeSpecifier: TypeSpecifier, rangeWithTrivia: Range | undefined);
|
|
2310
2300
|
}
|
|
2311
|
-
export type Node = Token | Keyword | SourceFile | PackageMemberDeclarationList | PackageImportDirectiveList | SinglePackageImportDirective | PackageGroupImportDirective | PackageImportList | PackageImport | PackageName | NamedTypeSpecifier | UnionTypeSpecifier | IntersectionTypeSpecifier | ParenthesizedTypeSpecifier | NullableTypeSpecifier | AnonymousTypeSpecifier | MissingTypeSpecifier | AnonymousFunctionTypeDeclaration | AnonymousStructuredTypeDeclaration | AnonymousVariantTypeDeclaration | PackageAliasTypeDeclaration | AliasTypeDeclarationBody | PackageMemberGroupDeclaration | PackageConstructorDeclaration | PackageEntryPointDeclaration | PackageFunctionDeclaration | PackageFunctionTypeDeclaration | FunctionTypeDeclarationBody | BaseTypeList | TypeMemberDeclarationList | TypeMemberDeclarationBlock | PackageStructuredTypeDeclaration | StructuredTypeDeclarationBody | PackageVariableDeclaration | PackageVariableGetterDeclaration | PackageVariableSetterDeclaration | PackageVariantTypeDeclaration | VariantTypeDeclarationBody | TypeExtensionDeclaration | ExtendedTypeClauseCommaList | ExtendedTypeClause | MissingPackageMemberDeclaration | TypeMemberGroupDeclaration | ConstructorDeclaration | DestructorDeclaration | IndexedElementGetterDeclaration | IndexedElementSetterDeclaration | IndexParameterClause | DereferencedVariableGetterDeclaration | DereferencedVariableSetterDeclaration | MethodDeclaration | OperatorDeclaration | FieldDeclaration | FieldGetterDeclaration | FieldSetterDeclaration | MissingTypeMemberDeclaration | NestedFunctionDeclaration | LocalVariableDeclaration | ForStatementVariableDeclaration | ArrayLiteral | ArrayLiteralElementList | AssertionExpression | AssumptionExpression | AsExpression | BinaryExpression | FunctionLiteral | FunctionBlockLiteral | ArgumentList | CallExpression | AutotypeCallExpression | IndexedAccessExpression | MissingExpression | IsExpression | ParenthesizedExpression | ConditionalExpression | PrefixUnaryExpression | MemberAccessExpression | ReferenceExpression | DereferenceExpression | TextTemplateLiteral | LocalizableTextTemplateLiteral | TextTemplateSpanList | TextTemplateSpan | TokenExpression | TextLiteral | LocalizableTextLiteral | KeywordExpression | ObjectExpression | BaseExpression | IdentifierExpression | GenericSpecializationExpression | DefaultMatchExpression | AssignmentStatement | StatementList | StatementBlock | FunctionBlock | BreakLoopStatement | ContinueLoopStatement | DisposeStatement | RunStatement | TryStatement | CatchClause | ErrorVariableDeclaration | FinallyClause | ErrorStatement | ImportantStatement | ExpressionStatement | ForStatement | IfStatement | ElseIfClauseList | ElseIfClause | ElseClause | MissingStatement | NestedFunctionDeclarationStatement | LocalVariableDeclarationStatement | LoopStatement | ReturnStatement | CaseClauseList | SwitchStatement | MatchExpressionList | CaseClause | WhileStatement | YieldStatement | TranslationsDeclaration | TopLevelTranslationList | TranslationParameterList | TranslationParameterClause | ConstructorTranslation | IndexParameterTranslationClause | IndexerTranslation | TranslationTypeParameterList | TranslationTypeParameterClause | PackageFunctionTranslationDeclaration | MethodTranslation | FunctionTypeTranslationDeclaration | QualifiedName | PackageVariableTranslationDeclaration | FieldOrVariantTranslation | TypeMemberTranslationList | TypeTranslationDeclaration | TextTranslationDeclaration | TextTranslationFunctionDeclaration | TranslationTextLiteral | TranslationTextTemplate | TranslationTextTemplateSpanList | TranslationTextTemplateSpan | TranslationTextTemplateParameter |
|
|
2312
|
-
type NodesWithChild<Child, Nodes = Node> = Nodes extends {
|
|
2313
|
-
children: readonly (infer C)[];
|
|
2314
|
-
} ? Child extends C ? Nodes : never : never;
|
|
2315
|
-
export {};
|
|
2301
|
+
export type Node = Token | Keyword | SourceFile | PackageMemberDeclarationList | PackageImportDirectiveList | SinglePackageImportDirective | PackageGroupImportDirective | PackageImportList | PackageImport | PackageName | NamedTypeSpecifier | UnionTypeSpecifier | IntersectionTypeSpecifier | ParenthesizedTypeSpecifier | NullableTypeSpecifier | AnonymousTypeSpecifier | MissingTypeSpecifier | AnonymousFunctionTypeDeclaration | AnonymousStructuredTypeDeclaration | AnonymousVariantTypeDeclaration | PackageAliasTypeDeclaration | AliasTypeDeclarationBody | PackageMemberGroupDeclaration | PackageConstructorDeclaration | PackageEntryPointDeclaration | PackageFunctionDeclaration | PackageFunctionTypeDeclaration | FunctionTypeDeclarationBody | BaseTypeList | TypeMemberDeclarationList | TypeMemberDeclarationBlock | PackageStructuredTypeDeclaration | StructuredTypeDeclarationBody | PackageVariableDeclaration | PackageVariableGetterDeclaration | PackageVariableSetterDeclaration | PackageVariantTypeDeclaration | VariantTypeDeclarationBody | TypeExtensionDeclaration | ExtendedTypeClauseCommaList | ExtendedTypeClause | MissingPackageMemberDeclaration | TypeMemberGroupDeclaration | ConstructorDeclaration | DestructorDeclaration | IndexedElementGetterDeclaration | IndexedElementSetterDeclaration | IndexParameterClause | DereferencedVariableGetterDeclaration | DereferencedVariableSetterDeclaration | MethodDeclaration | OperatorDeclaration | FieldDeclaration | FieldGetterDeclaration | FieldSetterDeclaration | MissingTypeMemberDeclaration | NestedFunctionDeclaration | LocalVariableDeclaration | ForStatementVariableDeclaration | ArrayLiteral | ArrayLiteralElementList | AssertionExpression | AssumptionExpression | AsExpression | BinaryExpression | FunctionLiteral | FunctionBlockLiteral | ArgumentList | CallExpression | AutotypeCallExpression | IndexedAccessExpression | MissingExpression | IsExpression | ParenthesizedExpression | ConditionalExpression | PrefixUnaryExpression | MemberAccessExpression | ReferenceExpression | DereferenceExpression | TextTemplateLiteral | LocalizableTextTemplateLiteral | TextTemplateSpanList | TextTemplateSpan | TokenExpression | TextLiteral | LocalizableTextLiteral | KeywordExpression | ObjectExpression | BaseExpression | IdentifierExpression | GenericSpecializationExpression | DefaultMatchExpression | AssignmentStatement | StatementList | StatementBlock | FunctionBlock | BreakLoopStatement | ContinueLoopStatement | DisposeStatement | RunStatement | TryStatement | CatchClause | ErrorVariableDeclaration | FinallyClause | ErrorStatement | ImportantStatement | ExpressionStatement | ForStatement | IfStatement | ElseIfClauseList | ElseIfClause | ElseClause | MissingStatement | NestedFunctionDeclarationStatement | LocalVariableDeclarationStatement | LoopStatement | ReturnStatement | CaseClauseList | SwitchStatement | MatchExpressionList | CaseClause | WhileStatement | YieldStatement | TranslationsDeclaration | TopLevelTranslationList | TranslationParameterList | TranslationParameterClause | ConstructorTranslation | IndexParameterTranslationClause | IndexerTranslation | TranslationTypeParameterList | TranslationTypeParameterClause | PackageFunctionTranslationDeclaration | MethodTranslation | FunctionTypeTranslationDeclaration | QualifiedName | PackageVariableTranslationDeclaration | FieldOrVariantTranslation | TypeMemberTranslationList | TypeTranslationDeclaration | TextTranslationDeclaration | TextTranslationFunctionDeclaration | TranslationTextLiteral | TranslationTextTemplate | TranslationTextTemplateSpanList | TranslationTextTemplateSpan | TranslationTextTemplateParameter | VariantValueDeclaration | TypeParameterDeclaration | ParameterDeclaration | Argument | TagList | Tag | ModifierList | Modifier | ParameterClause | ParameterList | TypeArgumentClause | TypeArgumentList | TypeParameterClause | TypeParameterList | TypeAnnotation;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node } from './Nodes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Проверяет, что тип узла совместим с типом родительского узла всех дочерних узлов.
|
|
4
|
+
*/
|
|
5
|
+
export type IsCorrectParent<Parent, Children> = Children extends readonly [infer FirstChild, ...infer RemainingChildren] ? (FirstChild extends Node ? (IsAssignableTo<Parent, FirstChild['parent']> extends true ? IsCorrectParent<Parent, RemainingChildren> : IsAssignableTo<Parent, FirstChild['parent']>) : FirstChild extends undefined ? true : 'Ожидалось, что типом FirstChild будет Node или undefined.') : Children extends readonly (infer ListElement)[] ? (ListElement extends Node ? IsAssignableTo<Parent, ListElement['parent']> : ListElement extends undefined ? true : 'Ожидалось, что типом ListElement будет Node или undefined.') : Children extends readonly [] ? true : 'Ожидался пустой кортеж.';
|
|
6
|
+
export type IsAssignableTo<Source, Target> = Source extends Target ? true : ['Тип', Source, 'не совместим с типом', Target];
|
|
7
|
+
export type NodesWithChild<Child, Nodes = Node> = Nodes extends {
|
|
8
|
+
children: readonly (infer C)[];
|
|
9
|
+
} ? Child extends C ? Nodes : never : never;
|
|
@@ -16,13 +16,16 @@ export declare enum OperatorKind {
|
|
|
16
16
|
Xor = 13,
|
|
17
17
|
BitwiseAnd = 14,
|
|
18
18
|
BitwiseOr = 15,
|
|
19
|
-
BitwiseXor = 16
|
|
19
|
+
BitwiseXor = 16,
|
|
20
|
+
LeftShift = 17,
|
|
21
|
+
SignedRightShift = 18,
|
|
22
|
+
UnsignedRightShift = 19
|
|
20
23
|
}
|
|
21
|
-
export declare const operatorKinds: readonly [OperatorKind.Plus, OperatorKind.Minus, OperatorKind.Not, OperatorKind.Multiply, OperatorKind.Divide, OperatorKind.IntegerDivide, OperatorKind.Modulo, OperatorKind.LessThan, OperatorKind.GreaterThan, OperatorKind.LessThanOrEqual, OperatorKind.GreaterThanOrEqual, OperatorKind.Or, OperatorKind.And, OperatorKind.Xor, OperatorKind.BitwiseAnd, OperatorKind.BitwiseOr, OperatorKind.BitwiseXor];
|
|
24
|
+
export declare const operatorKinds: readonly [OperatorKind.Plus, OperatorKind.Minus, OperatorKind.Not, OperatorKind.Multiply, OperatorKind.Divide, OperatorKind.IntegerDivide, OperatorKind.Modulo, OperatorKind.LessThan, OperatorKind.GreaterThan, OperatorKind.LessThanOrEqual, OperatorKind.GreaterThanOrEqual, OperatorKind.Or, OperatorKind.And, OperatorKind.Xor, OperatorKind.BitwiseAnd, OperatorKind.BitwiseOr, OperatorKind.BitwiseXor, OperatorKind.LeftShift, OperatorKind.SignedRightShift, OperatorKind.UnsignedRightShift];
|
|
22
25
|
/**
|
|
23
26
|
* Виды операторов, задаваемых токенами (`+`, `-`, `*=` и др.).
|
|
24
27
|
*/
|
|
25
|
-
export type KindOfOperatorDefinedByToken = OperatorKind.Plus | OperatorKind.Minus | OperatorKind.Multiply | OperatorKind.Divide | OperatorKind.IntegerDivide | OperatorKind.Modulo | OperatorKind.LessThan | OperatorKind.GreaterThan | OperatorKind.LessThanOrEqual | OperatorKind.GreaterThanOrEqual | OperatorKind.BitwiseAnd | OperatorKind.BitwiseOr | OperatorKind.BitwiseXor;
|
|
28
|
+
export type KindOfOperatorDefinedByToken = OperatorKind.Plus | OperatorKind.Minus | OperatorKind.Multiply | OperatorKind.Divide | OperatorKind.IntegerDivide | OperatorKind.Modulo | OperatorKind.LessThan | OperatorKind.GreaterThan | OperatorKind.LessThanOrEqual | OperatorKind.GreaterThanOrEqual | OperatorKind.BitwiseAnd | OperatorKind.BitwiseOr | OperatorKind.BitwiseXor | OperatorKind.LeftShift | OperatorKind.SignedRightShift | OperatorKind.UnsignedRightShift;
|
|
26
29
|
export declare function isOperatorDefinedByToken(kind: OperatorKind): kind is KindOfOperatorDefinedByToken;
|
|
27
30
|
/**
|
|
28
31
|
* Виды операторов, задаваемых ключевыми словами (`и`, `или`, `не` и др.)
|