@artel/artc 0.6.25223 → 0.6.25224
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 +6 -2
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +627 -498
- package/build/{chunk-DZNNWICP.js → chunk-24QZJOMF.js} +4575 -3937
- package/build/{chunk-AX3LQ2CF.js → chunk-62KHK23H.js} +2 -2
- package/build/{chunk-LG4Z4SWO.js → chunk-Y6DODJCG.js} +1 -1
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +1 -0
- package/build/types/analysis/Analyzer.d.ts +11 -5
- package/build/types/analysis/DiagnosticCollector.d.ts +1 -1
- package/build/types/analysis/ImportedPackageNameTree.d.ts +1 -0
- package/build/types/analysis/NamedTypeResolver.d.ts +5 -1
- package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +4 -1
- package/build/types/analysis/PropertyAccessExpressionMeaning.d.ts +8 -2
- package/build/types/analysis/TagMeaning.d.ts +4 -1
- package/build/types/analysis/TypeNarrower.d.ts +21 -21
- package/build/types/analysis/Utils.d.ts +12 -0
- package/build/types/analysis/control-flow/GraphBuilder.d.ts +43 -0
- package/build/types/analysis/{ControlFlowGraphVisualizer.d.ts → control-flow/GraphVisualizer.d.ts} +3 -3
- package/build/types/analysis/control-flow/NarrowableExpression.d.ts +5 -0
- package/build/types/analysis/control-flow/Nodes.d.ts +91 -0
- package/build/types/analysis/control-flow/index.d.ts +4 -0
- package/build/types/common/HelperPhrases.d.ts +3 -2
- package/build/types/diagnostic/DiagnosticCode.d.ts +5 -5
- package/build/types/emitter/Entities.d.ts +5 -4
- package/build/types/emitter/ir/Nodes.d.ts +2 -2
- package/build/types/services/CompletionService.d.ts +0 -1
- package/build/types/services/DisplayService.d.ts +11 -8
- package/build/types/services/NodeSemanticInfo.d.ts +11 -6
- package/build/types/services/source-generation/EntityToSyntax.d.ts +1 -0
- package/build/types/tree/NodeKind.d.ts +146 -144
- package/build/types/tree/green/Nodes.d.ts +24 -5
- package/build/types/tree/green/SyntaxFactory.d.ts +1 -0
- package/build/types/tree/green/SyntaxToCode.d.ts +5 -1
- package/build/types/tree/red/Nodes.d.ts +30 -5
- package/build/types/ts-interop/TsInteropContext.d.ts +1 -0
- package/build/types/types/IntersectionType.d.ts +20 -0
- package/build/types/types/ParameterType.d.ts +6 -3
- package/build/types/types/Type.d.ts +2 -1
- package/build/types/types/TypeFactory.d.ts +4 -1
- package/build/types/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/build/types/analysis/ControlFlowGraphBuilder.d.ts +0 -129
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
Compiler
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-Y6DODJCG.js";
|
4
4
|
import {
|
5
5
|
ArtelVersion,
|
6
6
|
Cached,
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
__async,
|
15
15
|
performanceMeasurementStageNames,
|
16
16
|
performanceMeasurementStages
|
17
|
-
} from "./chunk-
|
17
|
+
} from "./chunk-24QZJOMF.js";
|
18
18
|
|
19
19
|
// source/executor/FileSystemUri.ts
|
20
20
|
import { platform } from "os";
|
@@ -60,6 +60,7 @@ export declare class AnalyzedTranslationPackage {
|
|
60
60
|
private createTranslatedTypeSignature;
|
61
61
|
private enumerateTranslationsDeclarations;
|
62
62
|
private findTypeTranslation;
|
63
|
+
private createAmbiguousAccessDiagnostic;
|
63
64
|
}
|
64
65
|
export declare class TranslatedPackageMembers {
|
65
66
|
private readonly _namedMembers;
|
@@ -21,7 +21,6 @@ import * as autotypeCallExpressionMeaning from './AutotypeCallExpressionMeaning.
|
|
21
21
|
import * as baseExpressionMeaning from './BaseExpressionMeaning.js';
|
22
22
|
import * as callExpressionMeaning from './CallExpressionMeaning.js';
|
23
23
|
import * as constructorOverloadResolver from './ConstructorOverloadResolver.js';
|
24
|
-
import { ControlFlowGraphBuildResult } from './ControlFlowGraphBuilder.js';
|
25
24
|
import { DeclarationsUsageCountResult } from './DeclarationsUsageCounter.js';
|
26
25
|
import * as dereferenceExpressionMeaning from './DereferenceExpressionMeaning.js';
|
27
26
|
import { FoundAnonymousDeclaration } from './FoundDeclaration.js';
|
@@ -43,6 +42,7 @@ import * as tagMeaning from './TagMeaning.js';
|
|
43
42
|
import * as tags from './Tags.js';
|
44
43
|
import { TargetTypeHint } from './TargetTypeHint.js';
|
45
44
|
import * as typeOverloadResolver from './TypeOverloadResolver.js';
|
45
|
+
import * as controlFlow from './control-flow/index.js';
|
46
46
|
import { WellKnownDeclarations } from './index.js';
|
47
47
|
export declare class Analyzer {
|
48
48
|
static readonly enumeratorMethodName = "\u043F\u0435\u0440\u0435\u0431\u043E\u0440";
|
@@ -161,7 +161,7 @@ export declare class Analyzer {
|
|
161
161
|
*/
|
162
162
|
isExpressionOptionalChainingSyntactically(node: tree.Expression): boolean;
|
163
163
|
isExpressionValidOutermostOptionalChaining(node: tree.Expression): boolean;
|
164
|
-
|
164
|
+
includeNoneToTypeIfExpressionValidOutermostOptionalChaining(type: types.Type, node: tree.Expression): types.Type;
|
165
165
|
checkIdentifierNameIsReserved(name: string, locale: PackageLocale): ReservedIdentifierKind | undefined;
|
166
166
|
getReservedIdentifierName(reservedIdentifierKind: ReservedIdentifierKind, locale: PackageLocale): string;
|
167
167
|
createNameFromIdentifier(node: tree.Identifier): Name;
|
@@ -223,7 +223,7 @@ export declare class Analyzer {
|
|
223
223
|
* - Т: Объект? -> (Т: Объект?) | Пусто (см. метод isNoneAssignableToType)
|
224
224
|
* - Т: Объект -> (Т: Объект) | Пусто
|
225
225
|
*/
|
226
|
-
|
226
|
+
includeNoneToType(type: types.Type): types.Type;
|
227
227
|
/**
|
228
228
|
* Отвечает на вопрос "Совместим ли тип `Пусто` с данным типом?" (Можно ли присвоить `пусто` в переменную с данным типом?).
|
229
229
|
* @example Для следующих типов метод вернёт:
|
@@ -241,7 +241,7 @@ export declare class Analyzer {
|
|
241
241
|
getAnalyzedTranslationPackageIfTargetResolved(package_: project.TranslationPackage): AnalyzedTranslationPackage | undefined;
|
242
242
|
getAnalyzedTranslationPackageForPackage(entity: e.PackageEntity, locale: PackageLocale): AnalyzedTranslationPackage | undefined;
|
243
243
|
enumerateAnalyzedTranslationPackages(): Iterable<AnalyzedTranslationPackage>;
|
244
|
-
getCommonObjectAndAspectTypesOfUnion(
|
244
|
+
getCommonObjectAndAspectTypesOfUnion(unionType: types.UnionType): readonly types.StructuredType[];
|
245
245
|
getLinkedMultiPlatformPackagesByPlatform(entity: e.PackageEntity): ReadonlyMap<PlatformKind, LinkedMultiPlatformPackage> | undefined;
|
246
246
|
getLinkedMultiPlatformPackage(entity: e.PackageEntity, platform: PlatformKind): LinkedMultiPlatformPackage | undefined;
|
247
247
|
createPackageMembers(pkg: SourcePackage): OriginalPackageMembers;
|
@@ -263,7 +263,11 @@ export declare class Analyzer {
|
|
263
263
|
checkBodyOfRedefinableAliasTypeMethod(node: tree.TypeMethodDeclaration, diagnostics?: DiagnosticAcceptor): {
|
264
264
|
redefinableMethodOfOriginalType: e.TypeMethodEntity;
|
265
265
|
} | undefined;
|
266
|
-
getControlFlowGraph(sourceFile: project.SourceFile):
|
266
|
+
getControlFlowGraph(sourceFile: project.SourceFile): controlFlow.GraphBuildResult;
|
267
|
+
createAmbiguousEntityAccessDiagnostic(entities: readonly WithLocalization<e.Entity>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
|
268
|
+
createAmbiguousMethodAccessDiagnostic(methods: readonly WithLocalization<AccessedMethod>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
|
269
|
+
createAmbiguousTypeMemberAccessDiagnostic(members: readonly WithLocalization<types.TypeMember>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
|
270
|
+
createAmbiguousNamedScopeDeclarationAccessDiagnostic(declarations: readonly WithLocalization<scope.NamedDeclaration>[], lctx: LocalizationContext, node: tree.Node): Diagnostic;
|
267
271
|
private createTsInterop;
|
268
272
|
}
|
269
273
|
export declare class TsInteropInputs {
|
@@ -292,6 +296,7 @@ export declare const enum SyntacticAccessKind {
|
|
292
296
|
declare class Type {
|
293
297
|
private readonly _analyzer;
|
294
298
|
private readonly _unionTypeSpecifierTypes;
|
299
|
+
private readonly _intersectionTypeSpecifierTypes;
|
295
300
|
private readonly _methodLiteralTypes;
|
296
301
|
private readonly _methodBlockLiteralTypes;
|
297
302
|
constructor(_analyzer: Analyzer);
|
@@ -330,6 +335,7 @@ declare class Type {
|
|
330
335
|
private ofParenthesizedTypeSpecifier;
|
331
336
|
private ofNullableTypeSpecifier;
|
332
337
|
private ofUnionTypeSpecifier;
|
338
|
+
private ofIntersectionTypeSpecifier;
|
333
339
|
private ofInvalidTypeSpecifier;
|
334
340
|
private getTargetlessMethodBlockLiteralType;
|
335
341
|
private inferMethodLiteralTypeFromNodeWithFallbackToTargetType;
|
@@ -68,7 +68,7 @@ export declare class DiagnosticCollector {
|
|
68
68
|
private checkTypeSpecialization;
|
69
69
|
private checkSpecializationOfDeclarationWithParameters;
|
70
70
|
/**
|
71
|
-
* @returns `true` если
|
71
|
+
* @returns `true` если не было ошибки, иначе `false`.
|
72
72
|
*/
|
73
73
|
private checkTypeArgumentCount;
|
74
74
|
private checkParameterDeclaration;
|
@@ -11,6 +11,7 @@ export declare class ImportedPackageNameTree {
|
|
11
11
|
export interface PackageNameTreeNode {
|
12
12
|
readonly name: Name;
|
13
13
|
readonly package: ImportedPackage | undefined;
|
14
|
+
readonly parent: PackageNameTreeNode | undefined;
|
14
15
|
getChild(name: Name): PackageNameTreeNode | undefined;
|
15
16
|
hasChild(name: Name): boolean;
|
16
17
|
getChildren(): Iterable<PackageNameTreeNode>;
|
@@ -4,6 +4,8 @@ import { QualifiedName } from '../tree/index.js';
|
|
4
4
|
import { Analyzer } from './Analyzer.js';
|
5
5
|
import { FoundNamedDeclaration } from './FoundDeclaration.js';
|
6
6
|
import { PackageNameTreeNode } from './ImportedPackageNameTree.js';
|
7
|
+
import { WithLocalization } from './Localization.js';
|
8
|
+
import { EntityOrPackageNameTreeNode } from './Utils.js';
|
7
9
|
export declare class NamedTypeResolver {
|
8
10
|
private readonly _analyzer;
|
9
11
|
private readonly _node;
|
@@ -16,12 +18,14 @@ export declare class NamedTypeResolver {
|
|
16
18
|
private findTypesOrContainersWithTypesInPackageAccessedViaAlias;
|
17
19
|
private findTypesOrContainersWithTypesInPackageNameSegment;
|
18
20
|
private convertPackageMember;
|
21
|
+
private createAmbiguousAccessDiagnostic;
|
19
22
|
}
|
20
23
|
export declare class NamedTypeResolutionResult {
|
21
24
|
readonly types: readonly FoundNamedDeclaration<NamedTypeEntity>[];
|
22
25
|
readonly resolvedQualifiers: readonly ResolvedQualifier[];
|
23
26
|
readonly diagnostics: readonly Diagnostic[];
|
24
|
-
|
27
|
+
readonly ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined;
|
28
|
+
constructor(types: readonly FoundNamedDeclaration<NamedTypeEntity>[], resolvedQualifiers: readonly ResolvedQualifier[], diagnostics: readonly Diagnostic[], ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
|
25
29
|
}
|
26
30
|
export type ResolvedQualifier = ResolvedQualifier_packageNameSegment | ResolvedQualifier_packageAlias | ResolvedQualifier_type;
|
27
31
|
export declare class ResolvedQualifier_packageNameSegment {
|
@@ -3,7 +3,9 @@ import { NamedTypeSpecifier } from '../tree/index.js';
|
|
3
3
|
import * as types from '../types/index.js';
|
4
4
|
import { Analyzer } from './Analyzer.js';
|
5
5
|
import { FoundNamedDeclaration } from './FoundDeclaration.js';
|
6
|
+
import { WithLocalization } from './Localization.js';
|
6
7
|
import { ResolvedQualifier } from './NamedTypeResolver.js';
|
8
|
+
import { EntityOrPackageNameTreeNode } from './Utils.js';
|
7
9
|
export declare class NamedTypeSpecifierResolver {
|
8
10
|
private readonly _analyzer;
|
9
11
|
private readonly _node;
|
@@ -15,5 +17,6 @@ export declare class NamedTypeSpecifierResolutionResult {
|
|
15
17
|
readonly type: FoundNamedDeclaration<types.Type> | undefined;
|
16
18
|
readonly resolvedQualifiers: readonly ResolvedQualifier[];
|
17
19
|
readonly diagnostics: readonly Diagnostic[];
|
18
|
-
|
20
|
+
readonly ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined;
|
21
|
+
constructor(type: FoundNamedDeclaration<types.Type> | undefined, resolvedQualifiers: readonly ResolvedQualifier[], diagnostics: readonly Diagnostic[], ambiguousDeclarations: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
|
19
22
|
}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { AccessKind } from '../common/index.js';
|
2
2
|
import { Diagnostic } from '../diagnostic/Diagnostic.js';
|
3
|
-
import { PackageTypeEntity, PackageVariableEntity } from '../entities/index.js';
|
3
|
+
import { Entity, PackageTypeEntity, PackageVariableEntity } from '../entities/index.js';
|
4
4
|
import * as tree from '../tree/index.js';
|
5
5
|
import * as types from '../types/index.js';
|
6
6
|
import { AccessedMethod } from './AccessedMethod.js';
|
7
7
|
import { FoundAnonymousDeclaration, FoundNamedDeclaration } from './FoundDeclaration.js';
|
8
8
|
import { PackageNameTreeNode } from './ImportedPackageNameTree.js';
|
9
|
+
import { WithLocalization } from './Localization.js';
|
9
10
|
import { Analyzer, TargetTypeHint } from './index.js';
|
10
11
|
export declare class Resolver {
|
11
12
|
private readonly _semanticContext;
|
@@ -41,7 +42,7 @@ export declare class ResolutionResult {
|
|
41
42
|
*/
|
42
43
|
dependsOnTargetType?: boolean);
|
43
44
|
}
|
44
|
-
export type Meaning = Meaning_packageVariableAccess | Meaning_packageMethodAccess | Meaning_packageTypeAccess | Meaning_packageNameSegmentAccess | Meaning_staticVariableAccess | Meaning_staticMethodAccess | Meaning_instanceVariableAccess | Meaning_instanceMethodAccess | Meaning_operatorAccess | Meaning_unresolved;
|
45
|
+
export type Meaning = Meaning_packageVariableAccess | Meaning_packageMethodAccess | Meaning_packageTypeAccess | Meaning_packageNameSegmentAccess | Meaning_staticVariableAccess | Meaning_staticMethodAccess | Meaning_instanceVariableAccess | Meaning_instanceMethodAccess | Meaning_operatorAccess | Meaning_mixedAmbiguousAccess | Meaning_unresolved;
|
45
46
|
declare class Meaning_packageVariableAccess {
|
46
47
|
readonly variable: FoundNamedDeclaration<PackageVariableEntity>;
|
47
48
|
readonly accessKind: AccessKind;
|
@@ -102,6 +103,11 @@ declare class Meaning_operatorAccess {
|
|
102
103
|
get singleSuitableOperator(): FoundAnonymousDeclaration<types.Operator> | undefined;
|
103
104
|
constructor(candidates: readonly FoundAnonymousDeclaration<types.Operator>[], suitableOperators: readonly FoundAnonymousDeclaration<types.Operator>[]);
|
104
105
|
}
|
106
|
+
declare class Meaning_mixedAmbiguousAccess {
|
107
|
+
readonly entities: readonly WithLocalization<Entity>[];
|
108
|
+
readonly kind = "mixed-ambiguous-access";
|
109
|
+
constructor(entities: readonly WithLocalization<Entity>[]);
|
110
|
+
}
|
105
111
|
declare class Meaning_unresolved {
|
106
112
|
readonly kind = "unresolved";
|
107
113
|
}
|
@@ -6,6 +6,8 @@ import { AccessedMethod } from './AccessedMethod.js';
|
|
6
6
|
import { FoundAnonymousDeclaration, FoundNamedDeclaration } from './FoundDeclaration.js';
|
7
7
|
import { PackageNameTreeNode } from './ImportedPackageNameTree.js';
|
8
8
|
import { Analyzer } from './index.js';
|
9
|
+
import { WithLocalization } from './Localization.js';
|
10
|
+
import { EntityOrPackageNameTreeNode } from './Utils.js';
|
9
11
|
export declare class Resolver {
|
10
12
|
private readonly _analyzer;
|
11
13
|
private readonly _node;
|
@@ -25,7 +27,8 @@ export declare class ResolutionResult {
|
|
25
27
|
readonly meaning: Meaning;
|
26
28
|
readonly resolvedQualifiers: readonly ResolvedQualifier[];
|
27
29
|
readonly diagnostic?: Diagnostic | undefined;
|
28
|
-
|
30
|
+
readonly ambiguousDeclarations?: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined;
|
31
|
+
constructor(meaning: Meaning, resolvedQualifiers: readonly ResolvedQualifier[], diagnostic?: Diagnostic | undefined, ambiguousDeclarations?: readonly WithLocalization<EntityOrPackageNameTreeNode>[] | undefined);
|
29
32
|
}
|
30
33
|
export type Meaning = Meaning_tagType | Meaning_tagMethod | Meaning_unresolved;
|
31
34
|
declare class Meaning_tagType {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LocalVariableEntity, PackageVariableEntity, ParameterVariableEntity } from '../entities/VariableEntity.js';
|
2
2
|
import * as types from '../types/index.js';
|
3
3
|
import { Analyzer } from './Analyzer.js';
|
4
|
-
import
|
4
|
+
import * as controlFlow from './control-flow/index.js';
|
5
5
|
export declare class TypeNarrower {
|
6
6
|
private readonly _analyzer;
|
7
7
|
private readonly _referenceExpression;
|
@@ -10,7 +10,7 @@ export declare class TypeNarrower {
|
|
10
10
|
private _reference;
|
11
11
|
private readonly _typeByNode;
|
12
12
|
private readonly _isVariableAssignedInLoopCheckResults;
|
13
|
-
constructor(analyzer: Analyzer, referenceExpression: NarrowableReferenceExpression, initialType: types.Type, controlFlowNode:
|
13
|
+
constructor(analyzer: Analyzer, referenceExpression: controlFlow.NarrowableReferenceExpression, initialType: types.Type, controlFlowNode: controlFlow.Node);
|
14
14
|
getType(): types.Type;
|
15
15
|
private getTypeAtControlFlowNode;
|
16
16
|
private getTypeAtCondition;
|
@@ -30,7 +30,7 @@ export declare class TypeNarrower {
|
|
30
30
|
private getReferenceAtNode;
|
31
31
|
private getReferenceAtLocalVariableDeclaration;
|
32
32
|
}
|
33
|
-
export type NarrowableReference = NarrowableReference.LocalVariable | NarrowableReference.PackageVariable | NarrowableReference.
|
33
|
+
export type NarrowableReference = NarrowableReference.LocalVariable | NarrowableReference.PackageVariable | NarrowableReference.ObjectField | NarrowableReference.StaticField | NarrowableReference.ObjectAutoVariable;
|
34
34
|
export declare namespace NarrowableReference {
|
35
35
|
export class LocalVariable implements INarrowableReference {
|
36
36
|
private readonly _analyzer;
|
@@ -39,8 +39,8 @@ export declare namespace NarrowableReference {
|
|
39
39
|
constructor(_analyzer: Analyzer, entity: LocalVariableEntity | ParameterVariableEntity);
|
40
40
|
equals(other: NarrowableReference): boolean;
|
41
41
|
contains(_other: NarrowableReference): boolean;
|
42
|
-
equalsExpression(expression: NarrowableReferenceExpression): boolean;
|
43
|
-
containsExpression(_expression: NarrowableReferenceExpression): boolean;
|
42
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
43
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
44
44
|
}
|
45
45
|
export class PackageVariable implements INarrowableReference {
|
46
46
|
private readonly _analyzer;
|
@@ -49,36 +49,36 @@ export declare namespace NarrowableReference {
|
|
49
49
|
constructor(_analyzer: Analyzer, entity: PackageVariableEntity);
|
50
50
|
equals(other: NarrowableReference): boolean;
|
51
51
|
contains(_other: NarrowableReference): boolean;
|
52
|
-
equalsExpression(expression: NarrowableReferenceExpression): boolean;
|
53
|
-
containsExpression(_expression: NarrowableReferenceExpression): boolean;
|
52
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
53
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
54
54
|
}
|
55
|
-
export class
|
55
|
+
export class ObjectField implements INarrowableReference {
|
56
56
|
private readonly _analyzer;
|
57
57
|
readonly variable: types.Variable;
|
58
58
|
readonly receiver: NarrowableReference;
|
59
|
-
readonly kind = "
|
59
|
+
readonly kind = "object-field";
|
60
60
|
constructor(_analyzer: Analyzer, variable: types.Variable, receiver: NarrowableReference);
|
61
61
|
equals(other: NarrowableReference): boolean;
|
62
62
|
contains(other: NarrowableReference): boolean;
|
63
|
-
equalsExpression(expression: NarrowableReferenceExpression): boolean;
|
64
|
-
containsExpression(expression: NarrowableReferenceExpression): boolean;
|
63
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
64
|
+
containsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
65
65
|
}
|
66
|
-
export class
|
66
|
+
export class StaticField implements INarrowableReference {
|
67
67
|
private readonly _analyzer;
|
68
68
|
readonly variable: types.Variable;
|
69
|
-
readonly kind = "static-
|
69
|
+
readonly kind = "static-field";
|
70
70
|
constructor(_analyzer: Analyzer, variable: types.Variable);
|
71
71
|
equals(other: NarrowableReference): boolean;
|
72
72
|
contains(_other: NarrowableReference): boolean;
|
73
|
-
equalsExpression(expression: NarrowableReferenceExpression): boolean;
|
74
|
-
containsExpression(_expression: NarrowableReferenceExpression): boolean;
|
73
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
74
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
75
75
|
}
|
76
|
-
export class
|
77
|
-
readonly kind = "object";
|
76
|
+
export class ObjectAutoVariable implements INarrowableReference {
|
77
|
+
readonly kind = "object-auto-variable";
|
78
78
|
equals(other: NarrowableReference): boolean;
|
79
79
|
contains(_other: NarrowableReference): boolean;
|
80
|
-
equalsExpression(expression: NarrowableReferenceExpression): boolean;
|
81
|
-
containsExpression(_expression: NarrowableReferenceExpression): boolean;
|
80
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
81
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
82
82
|
}
|
83
83
|
interface INarrowableReference {
|
84
84
|
equals(other: NarrowableReference): boolean;
|
@@ -90,8 +90,8 @@ export declare namespace NarrowableReference {
|
|
90
90
|
* связывание для имени `б` выполняться не будет. Такое поведение необходимо при анализе циклов,
|
91
91
|
* чтобы избежать рекурсии.
|
92
92
|
*/
|
93
|
-
equalsExpression(expression: NarrowableReferenceExpression): boolean;
|
94
|
-
containsExpression(expression: NarrowableReferenceExpression): boolean;
|
93
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
94
|
+
containsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
95
95
|
}
|
96
96
|
export {};
|
97
97
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Entity, MethodEntity, PackageEntity, StructuredTypeEntity, TypeParameterEntity, VariableEntity } from '../entities/index.js';
|
2
2
|
import * as tree from '../tree/index.js';
|
3
3
|
import * as types from '../types/index.js';
|
4
|
+
import { PackageNameTreeNode } from './ImportedPackageNameTree.js';
|
4
5
|
import { Tag, TagMethod, TagType } from './Tags.js';
|
5
6
|
type TextToken = tree.Token<tree.TokenKind.TextLiteral> | tree.Token<tree.TokenKind.TextTemplateHead> | tree.Token<tree.TokenKind.TextTemplatePart> | tree.Token<tree.TokenKind.TextTemplateTail>;
|
6
7
|
export declare function getUnescapedTextFromTextToken(token: TextToken): string;
|
@@ -15,4 +16,15 @@ export declare function getRequiredTypeParameterCount(typeParameters: readonly T
|
|
15
16
|
export declare function flattenPackageMemberDeclarationList(list: tree.PackageMemberDeclarationList): Iterable<Exclude<tree.PackageMemberDeclaration, tree.PackageMemberGroupDeclaration>>;
|
16
17
|
export declare function flattenTypeMemberDeclarationList(list: tree.TypeMemberDeclarationList): Iterable<Exclude<tree.TypeMemberDeclaration, tree.TypeMemberGroupDeclaration>>;
|
17
18
|
export declare function isComputedVariableEntity(entity: VariableEntity): boolean;
|
19
|
+
export type EntityOrPackageNameTreeNode = EntityOrPackageNameTreeNode_entity | EntityOrPackageNameTreeNode_node;
|
20
|
+
export declare class EntityOrPackageNameTreeNode_entity {
|
21
|
+
readonly entity: Entity;
|
22
|
+
readonly kind = "entity";
|
23
|
+
constructor(entity: Entity);
|
24
|
+
}
|
25
|
+
export declare class EntityOrPackageNameTreeNode_node {
|
26
|
+
readonly node: PackageNameTreeNode;
|
27
|
+
readonly kind = "node";
|
28
|
+
constructor(node: PackageNameTreeNode);
|
29
|
+
}
|
18
30
|
export {};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { Diagnostic } from '../../diagnostic/Diagnostic.js';
|
2
|
+
import { SourceFile } from '../../project/SourceFile.js';
|
3
|
+
import { NarrowableReferenceExpression } from './NarrowableExpression.js';
|
4
|
+
import { Node } from './Nodes.js';
|
5
|
+
export declare class GraphBuilder {
|
6
|
+
private readonly _sourceFile;
|
7
|
+
private readonly _controlFlowNodeByReference;
|
8
|
+
private readonly _unreachableCodeDiagnostics;
|
9
|
+
private _isInRebuildingFinallyClauseGraphMode;
|
10
|
+
private _currentPredecessor;
|
11
|
+
private _currentContinueLoopTarget;
|
12
|
+
private _currentBreakLoopTarget;
|
13
|
+
private _currentErrorTarget;
|
14
|
+
private _currentReturnTarget;
|
15
|
+
constructor(sourceFile: SourceFile);
|
16
|
+
build(): GraphBuildResult;
|
17
|
+
private visitNode;
|
18
|
+
private visitAssignmentStatement;
|
19
|
+
private visitIfStatement;
|
20
|
+
private visitWhileStatement;
|
21
|
+
private visitLoopStatement;
|
22
|
+
private visitForStatement;
|
23
|
+
private visitContinueLoopStatement;
|
24
|
+
private visitBreakLoopStatement;
|
25
|
+
private visitSwitchStatement;
|
26
|
+
private visitTryStatement;
|
27
|
+
private visitReturnStatement;
|
28
|
+
private visitErrorStatement;
|
29
|
+
private visitLocalVariableDeclaration;
|
30
|
+
private visitWhenTernaryExpression;
|
31
|
+
private visitCondition;
|
32
|
+
private visitBinaryExpression;
|
33
|
+
private visitPrefixUnaryExpressionInCondition;
|
34
|
+
private visitIsExpressionInCondition;
|
35
|
+
private setAssignmentAsCurrentPredecessor;
|
36
|
+
private visitChildren;
|
37
|
+
private addUnreachableCodeDiagnostic;
|
38
|
+
}
|
39
|
+
export declare class GraphBuildResult {
|
40
|
+
readonly controlFlowNodeByReference: ReadonlyMap<NarrowableReferenceExpression, Node>;
|
41
|
+
readonly unreachableCodeDiagnostics: readonly Diagnostic[];
|
42
|
+
constructor(controlFlowNodeByReference: ReadonlyMap<NarrowableReferenceExpression, Node>, unreachableCodeDiagnostics: readonly Diagnostic[]);
|
43
|
+
}
|
package/build/types/analysis/{ControlFlowGraphVisualizer.d.ts → control-flow/GraphVisualizer.d.ts}
RENAMED
@@ -1,12 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
export declare class
|
1
|
+
import { Node } from './Nodes.js';
|
2
|
+
export declare class GraphVisualizer {
|
3
3
|
/**
|
4
4
|
* Создаёт описание графа на языке Dot.
|
5
5
|
*
|
6
6
|
* Визуализацию графа можно посмотреть по этой ссылке:
|
7
7
|
* https://dreampuf.github.io/GraphvizOnline/?engine=dot#digraph%20%7B%20%7D
|
8
8
|
*/
|
9
|
-
static generateGraphDescriptionInDotLanguage(startNode:
|
9
|
+
static generateGraphDescriptionInDotLanguage(startNode: Node): string;
|
10
10
|
private static getLabel;
|
11
11
|
private static createGetIdFunction;
|
12
12
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import * as tree from '../../tree/index.js';
|
2
|
+
export declare function isNarrowableExpression(node: tree.Node): node is tree.Expression;
|
3
|
+
export type NarrowableReferenceExpression = tree.IdentifierExpression | tree.PropertyAccessExpression | tree.ObjectExpression;
|
4
|
+
export declare function isNarrowableReferenceExpression(node: tree.Node): node is NarrowableReferenceExpression;
|
5
|
+
export declare function unwrapExpressionForNarrowableReferenceCheck(node: tree.Expression): tree.Expression;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import * as tree from '../../tree/index.js';
|
2
|
+
export type Node = StartNode | ConditionNode | AssignmentNode | LocalVariableDeclarationNode | SplitNode | LoopNode | UnreachableNode;
|
3
|
+
declare abstract class ControlFlowNodeBase {
|
4
|
+
protected abstract thisAsNode: Node;
|
5
|
+
/**
|
6
|
+
* Для отладочных целей.
|
7
|
+
*/
|
8
|
+
generateVisualizationCode(): string;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* Начальный узел, не имеющий предшественников. Создаётся в начале функций, а также для переменных пакета и полей
|
12
|
+
* объекта с начальным значением, поскольку выражение-инициализатор может иметь собственный граф потока управления
|
13
|
+
* (например, если начальное значение - это трёхместная операция `когда` с проверкой на `пусто`).
|
14
|
+
*/
|
15
|
+
export declare class StartNode extends ControlFlowNodeBase {
|
16
|
+
readonly kind = "start";
|
17
|
+
get debuggerDisplay(): string;
|
18
|
+
protected get thisAsNode(): Node;
|
19
|
+
}
|
20
|
+
export type ConditionExpression = tree.BinaryExpression | tree.IsExpression;
|
21
|
+
/**
|
22
|
+
* Хранит информацию об истинности некоторого условия. Например, если условие `а != пусто` истинно, то из типа
|
23
|
+
* переменной `а` необходимо исключить тип `Пусто`.
|
24
|
+
*/
|
25
|
+
export declare class ConditionNode extends ControlFlowNodeBase {
|
26
|
+
readonly predecessor: Node;
|
27
|
+
readonly syntaxNode: ConditionExpression;
|
28
|
+
readonly isTrue: boolean;
|
29
|
+
readonly kind = "condition";
|
30
|
+
get debuggerDisplay(): string;
|
31
|
+
protected get thisAsNode(): Node;
|
32
|
+
constructor(predecessor: Node, syntaxNode: ConditionExpression, isTrue: boolean);
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Создаётся в местах присваивания значений в переменную. После присваивания тип переменной меняется на тип выражения
|
36
|
+
* справа от равно.
|
37
|
+
*/
|
38
|
+
export declare class AssignmentNode extends ControlFlowNodeBase {
|
39
|
+
readonly predecessor: Node;
|
40
|
+
readonly syntaxNode: tree.AssignmentStatement;
|
41
|
+
readonly kind = "assignment";
|
42
|
+
get debuggerDisplay(): string;
|
43
|
+
protected get thisAsNode(): Node;
|
44
|
+
constructor(predecessor: Node, syntaxNode: tree.AssignmentStatement);
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Создаётся в местах объявления локальных переменных. Если переменной присваивается начальное значение, её тип будет
|
48
|
+
* заменён на тип присваиваемого выражения.
|
49
|
+
*/
|
50
|
+
export declare class LocalVariableDeclarationNode extends ControlFlowNodeBase {
|
51
|
+
readonly predecessor: Node;
|
52
|
+
readonly syntaxNode: tree.LocalVariableDeclaration;
|
53
|
+
readonly kind = "local-variable-declaration";
|
54
|
+
get debuggerDisplay(): string;
|
55
|
+
protected get thisAsNode(): Node;
|
56
|
+
constructor(predecessor: Node, syntaxNode: tree.LocalVariableDeclaration);
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Вспомогательный узел, использующийся в местах, где происходит разветвление графа потока управления. Тип переменной
|
60
|
+
* для этого узла определяется как союзный тип из типов переменных в предшествующих узлах.
|
61
|
+
*/
|
62
|
+
export declare class SplitNode extends ControlFlowNodeBase {
|
63
|
+
readonly predecessors: readonly Node[];
|
64
|
+
readonly kind = "split";
|
65
|
+
get debuggerDisplay(): string;
|
66
|
+
protected get thisAsNode(): Node;
|
67
|
+
constructor(predecessors: readonly Node[]);
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Используется для циклов (пока, цикл - повтор пока, для-из). Отличается от узла {@link SplitNode} тем, что предшествующие
|
71
|
+
* узлы, указанные в массиве {@link loopingPredecessors}, образуют циклы в графе потока управления.
|
72
|
+
*/
|
73
|
+
export declare abstract class LoopNode extends ControlFlowNodeBase {
|
74
|
+
readonly kind = "loop";
|
75
|
+
get debuggerDisplay(): string;
|
76
|
+
protected get thisAsNode(): Node;
|
77
|
+
abstract predecessor: Node;
|
78
|
+
abstract loopingPredecessors: readonly Node[];
|
79
|
+
}
|
80
|
+
/**
|
81
|
+
* Обозначает недостижимый код. Соответствующая диагностика добавляется в
|
82
|
+
* {@link GraphBuildResult.unreachableCodeDiagnostics}. Класс {@link GraphBuilder} создаёт эти
|
83
|
+
* узлы для кода, недостижимость которого можно определить анализируя только синтаксическое дерево и не использую
|
84
|
+
* семантическую информацию. Например, инструкции, находящиеся после инструкции `возврат`, помечаются как недостижимые.
|
85
|
+
*/
|
86
|
+
export declare class UnreachableNode extends ControlFlowNodeBase {
|
87
|
+
readonly kind = "unreachable";
|
88
|
+
get debuggerDisplay(): string;
|
89
|
+
protected get thisAsNode(): Node;
|
90
|
+
}
|
91
|
+
export {};
|
@@ -5,7 +5,8 @@ export declare const enum HelperPhraseKind {
|
|
5
5
|
TypeParameter = 2,
|
6
6
|
Package = 3,
|
7
7
|
PackageAlias = 4,
|
8
|
-
|
9
|
-
|
8
|
+
PackageNameSegment = 5,
|
9
|
+
Variable = 6,
|
10
|
+
Overloads = 7
|
10
11
|
}
|
11
12
|
export declare function getHelperPhrase(kind: HelperPhraseKind, locale: PackageLocale): string;
|
@@ -66,7 +66,7 @@ export declare enum DiagnosticCode {
|
|
66
66
|
ParameterForPositionalArgumentNotFound = 64,
|
67
67
|
CannotDetermineTargetTypeToCallTheConstructor = 65,
|
68
68
|
AmbiguousAccess = 66,
|
69
|
-
|
69
|
+
AmbiguousAccess0 = 67,
|
70
70
|
CanNotAssignValueToContextVariable = 68,
|
71
71
|
ExpectedPackageNameOrAliasButFoundType = 69,
|
72
72
|
TypeExpected = 70,
|
@@ -110,10 +110,10 @@ export declare enum DiagnosticCode {
|
|
110
110
|
IncorrectBodyOfRedefinableAliasTypeMethod = 108,
|
111
111
|
TheFollowingDeclarationsAreNotTranslated0 = 109,
|
112
112
|
TheFollowingDeclarationAreNotTranslated0And1More = 110,
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
OperatorFunctionMustNotBeStatic = 111,
|
114
|
+
OperatorFunction0MustNotHaveParameters = 112,
|
115
|
+
OperatorFunction0MustHaveOneParameter = 113,
|
116
|
+
OperatorFunction0MustHaveNoMoreThanOneParameter = 114,
|
117
117
|
CorrespondingRedefinableTypeMemberNotFound = 115,
|
118
118
|
ConstructorCanNotBeRedefinable = 116,
|
119
119
|
ConstructorCanNotBeRedefined = 117,
|
@@ -136,7 +136,7 @@ export declare class PackageEntityDetails {
|
|
136
136
|
isSource: boolean;
|
137
137
|
isPackageWithMainMethod: boolean;
|
138
138
|
}
|
139
|
-
export type Type = SimpleType |
|
139
|
+
export type Type = SimpleType | UnionOrIntersectionType;
|
140
140
|
export declare class SimpleType {
|
141
141
|
readonly entity: TypeOrExtensionEntity;
|
142
142
|
readonly typeArguments: readonly Type[];
|
@@ -144,10 +144,11 @@ export declare class SimpleType {
|
|
144
144
|
constructor(entity: TypeOrExtensionEntity, typeArguments: readonly Type[]);
|
145
145
|
equals(other: Type): boolean;
|
146
146
|
}
|
147
|
-
export declare class
|
147
|
+
export declare class UnionOrIntersectionType {
|
148
148
|
readonly types: readonly Type[];
|
149
|
-
readonly
|
150
|
-
|
149
|
+
readonly isUnion: boolean;
|
150
|
+
readonly kind = "union-or-intersection";
|
151
|
+
constructor(types: readonly Type[], isUnion: boolean);
|
151
152
|
equals(other: Type): boolean;
|
152
153
|
}
|
153
154
|
export type Entity = VariableEntity | MethodEntity | TypeOrExtensionEntity | PackageEntity;
|
@@ -205,10 +205,10 @@ export declare class EmptyStatement {
|
|
205
205
|
clone(): EmptyStatement;
|
206
206
|
}
|
207
207
|
export declare class ErrorStatement {
|
208
|
-
expression: Expression
|
208
|
+
expression: Expression;
|
209
209
|
sourceLocation: SourceLocation | undefined;
|
210
210
|
readonly kind = NodeKind.ErrorStatement;
|
211
|
-
constructor(expression: Expression
|
211
|
+
constructor(expression: Expression, sourceLocation: SourceLocation | undefined);
|
212
212
|
clone(): ErrorStatement;
|
213
213
|
}
|
214
214
|
export declare class ImportantStatement {
|
@@ -34,7 +34,6 @@ export declare class CompletionService {
|
|
34
34
|
private getCompletionItemInfosForTargetSignaturesValueParameters;
|
35
35
|
private getScopeCompletionItemInfos;
|
36
36
|
private getTypeCompletionItemInfos;
|
37
|
-
private getEntityFromType;
|
38
37
|
private getTypeCompletionItemInfosFromPackage;
|
39
38
|
private getTypeCompletionItemInfosFromPackageNameSegment;
|
40
39
|
private getTypeCompletionItemInfosFromScope;
|