@artel/artc 0.6.25222 → 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 +12 -2
- package/build/api/ApiNodeJS.js +3 -3
- package/build/api/ApiServices.js +635 -532
- package/build/{chunk-ODWG5ZXF.js → chunk-24QZJOMF.js} +4477 -3240
- package/build/{chunk-MBMOAUK7.js → chunk-62KHK23H.js} +2 -2
- package/build/{chunk-UZK7JCND.js → chunk-Y6DODJCG.js} +1 -1
- package/build/types/analysis/AnalyzedTranslationPackage.d.ts +1 -0
- package/build/types/analysis/Analyzer.d.ts +17 -11
- package/build/types/analysis/DiagnosticCollector.d.ts +1 -1
- package/build/types/analysis/ImportedPackageNameTree.d.ts +1 -0
- package/build/types/analysis/LocalizationContext.d.ts +2 -2
- package/build/types/analysis/Lookup.d.ts +4 -4
- 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 +9 -3
- package/build/types/analysis/Scope.d.ts +21 -44
- package/build/types/analysis/SemanticContext.d.ts +14 -1
- package/build/types/analysis/SemanticContextBuilder.d.ts +1 -0
- package/build/types/analysis/StatementBlockScopeBuilder.d.ts +1 -0
- package/build/types/analysis/TagMeaning.d.ts +4 -1
- package/build/types/analysis/TypeMemberLookup.d.ts +39 -11
- package/build/types/analysis/TypeNarrower.d.ts +49 -14
- 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/entities/index.d.ts +3 -0
- package/build/types/parser/Scanner.d.ts +1 -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 +28 -10
- 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 +33 -8
- 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/TypeMembers.d.ts +5 -0
- package/build/types/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/build/types/analysis/ControlFlowGraphBuilder.d.ts +0 -121
@@ -1,7 +1,7 @@
|
|
1
|
-
import { LocalVariableEntity, ParameterVariableEntity } from '../entities/VariableEntity.js';
|
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;
|
@@ -9,54 +9,89 @@ export declare class TypeNarrower {
|
|
9
9
|
private readonly _controlFlowNode;
|
10
10
|
private _reference;
|
11
11
|
private readonly _typeByNode;
|
12
|
-
|
12
|
+
private readonly _isVariableAssignedInLoopCheckResults;
|
13
|
+
constructor(analyzer: Analyzer, referenceExpression: controlFlow.NarrowableReferenceExpression, initialType: types.Type, controlFlowNode: controlFlow.Node);
|
13
14
|
getType(): types.Type;
|
14
15
|
private getTypeAtControlFlowNode;
|
15
16
|
private getTypeAtCondition;
|
16
17
|
private getTypeAtAssignment;
|
18
|
+
private getTypeAtLocalVariableDeclaration;
|
17
19
|
private getTypeAtSplit;
|
18
20
|
private getTypeAtLoop;
|
21
|
+
private getTypeAtAssignmentWithImplicitConversion;
|
19
22
|
private getTypeAtComparisonWithNone;
|
20
23
|
private getTypeAtIsExpression;
|
24
|
+
private getTypeAtAssignmentOrDeclaration;
|
21
25
|
private addTypeIfUnique;
|
26
|
+
private checkIfVariableIsAssignedInLoop;
|
27
|
+
private checkIfVariableIsAssignedAtNode;
|
22
28
|
private isSameReferenceAsNarrowedExpression;
|
23
|
-
private unwrapExpression;
|
24
29
|
private getReferenceAtNodeIfNarrowable;
|
25
30
|
private getReferenceAtNode;
|
26
31
|
private getReferenceAtLocalVariableDeclaration;
|
27
32
|
}
|
28
|
-
export type NarrowableReference = NarrowableReference.LocalVariable | NarrowableReference.
|
33
|
+
export type NarrowableReference = NarrowableReference.LocalVariable | NarrowableReference.PackageVariable | NarrowableReference.ObjectField | NarrowableReference.StaticField | NarrowableReference.ObjectAutoVariable;
|
29
34
|
export declare namespace NarrowableReference {
|
30
35
|
export class LocalVariable implements INarrowableReference {
|
36
|
+
private readonly _analyzer;
|
31
37
|
readonly entity: LocalVariableEntity | ParameterVariableEntity;
|
32
38
|
readonly kind = "local-variable";
|
33
|
-
constructor(entity: LocalVariableEntity | ParameterVariableEntity);
|
39
|
+
constructor(_analyzer: Analyzer, entity: LocalVariableEntity | ParameterVariableEntity);
|
34
40
|
equals(other: NarrowableReference): boolean;
|
35
41
|
contains(_other: NarrowableReference): boolean;
|
42
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
43
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
36
44
|
}
|
37
|
-
export class
|
45
|
+
export class PackageVariable implements INarrowableReference {
|
46
|
+
private readonly _analyzer;
|
47
|
+
readonly entity: PackageVariableEntity;
|
48
|
+
readonly kind = "package-variable";
|
49
|
+
constructor(_analyzer: Analyzer, entity: PackageVariableEntity);
|
50
|
+
equals(other: NarrowableReference): boolean;
|
51
|
+
contains(_other: NarrowableReference): boolean;
|
52
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
53
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
54
|
+
}
|
55
|
+
export class ObjectField implements INarrowableReference {
|
56
|
+
private readonly _analyzer;
|
38
57
|
readonly variable: types.Variable;
|
39
58
|
readonly receiver: NarrowableReference;
|
40
|
-
readonly kind = "
|
41
|
-
constructor(variable: types.Variable, receiver: NarrowableReference);
|
59
|
+
readonly kind = "object-field";
|
60
|
+
constructor(_analyzer: Analyzer, variable: types.Variable, receiver: NarrowableReference);
|
42
61
|
equals(other: NarrowableReference): boolean;
|
43
62
|
contains(other: NarrowableReference): boolean;
|
63
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
64
|
+
containsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
44
65
|
}
|
45
|
-
export class
|
66
|
+
export class StaticField implements INarrowableReference {
|
67
|
+
private readonly _analyzer;
|
46
68
|
readonly variable: types.Variable;
|
47
|
-
readonly kind = "static-
|
48
|
-
constructor(variable: types.Variable);
|
69
|
+
readonly kind = "static-field";
|
70
|
+
constructor(_analyzer: Analyzer, variable: types.Variable);
|
49
71
|
equals(other: NarrowableReference): boolean;
|
50
72
|
contains(_other: NarrowableReference): boolean;
|
73
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
74
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
51
75
|
}
|
52
|
-
export class
|
53
|
-
readonly kind = "object";
|
76
|
+
export class ObjectAutoVariable implements INarrowableReference {
|
77
|
+
readonly kind = "object-auto-variable";
|
54
78
|
equals(other: NarrowableReference): boolean;
|
55
79
|
contains(_other: NarrowableReference): boolean;
|
80
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
81
|
+
containsExpression(_expression: controlFlow.NarrowableReferenceExpression): boolean;
|
56
82
|
}
|
57
83
|
interface INarrowableReference {
|
58
84
|
equals(other: NarrowableReference): boolean;
|
59
85
|
contains(other: NarrowableReference): boolean;
|
86
|
+
/**
|
87
|
+
* Отличается от метода `equals` тем, что выполняет сравнение лениво. Например, при сравнении с выражением
|
88
|
+
* `а.б` сперва будут сравнены части слева от точки (выражение `а` с `receiver`), и только при равенстве будет
|
89
|
+
* связано и сравнено имя `б`. Если выражение `а` не равно `receiver`, то сразу будет возвращено `false` и
|
90
|
+
* связывание для имени `б` выполняться не будет. Такое поведение необходимо при анализе циклов,
|
91
|
+
* чтобы избежать рекурсии.
|
92
|
+
*/
|
93
|
+
equalsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
94
|
+
containsExpression(expression: controlFlow.NarrowableReferenceExpression): boolean;
|
60
95
|
}
|
61
96
|
export {};
|
62
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 {
|
@@ -65,6 +65,9 @@ export declare function isPackageTypeEntity(entity: TypeEntity): entity is Packa
|
|
65
65
|
export type NamedTypeEntity = PackageMethodTypeEntity | PackageStructuredTypeEntity | PackageVariantTypeEntity | AliasTypeEntity | TypeParameterEntity;
|
66
66
|
export type TypeEntityWithMembers = MethodTypeEntity | StructuredTypeEntity | VariantTypeEntity | AliasTypeEntity;
|
67
67
|
export declare function isTypeEntityWithMembers(entity: TypeEntity): entity is TypeEntityWithMembers;
|
68
|
+
export type TypeOrExtensionEntity = TypeEntity | TypeExtensionEntity;
|
69
|
+
export type TypeWithMembersOrExtensionEntity = TypeEntityWithMembers | TypeExtensionEntity;
|
70
|
+
export declare function isTypeWithMembersOrExtensionEntity(entity: Entity): entity is TypeWithMembersOrExtensionEntity;
|
68
71
|
export declare function isTypeEntity(entity: Entity): entity is TypeEntity;
|
69
72
|
export declare function isNamedTypeEntity(entity: TypeEntity): entity is NamedTypeEntity;
|
70
73
|
export type PackageMemberEntity = PackageVariableEntity | PackageMethodEntity | PackageTypeEntity | TypeExtensionEntity;
|
@@ -23,9 +23,8 @@ export declare class Scanner {
|
|
23
23
|
constructor(text: string, options?: ScannerOptions);
|
24
24
|
getToken(): Token;
|
25
25
|
lookAhead(callback: () => boolean): boolean;
|
26
|
-
tryScan(callback: () =>
|
26
|
+
tryScan<T>(callback: () => T): T | undefined;
|
27
27
|
nextToken(): Token;
|
28
|
-
private tryScanOrLookAhead;
|
29
28
|
private isCloseBraceEndingTextTemplate;
|
30
29
|
private scanCharOrTextOrTextTemplateElement;
|
31
30
|
private isSingleCharOrEscapedChar;
|
@@ -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;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { AccessedMethod } from '../analysis/AccessedMethod.js';
|
2
|
+
import { PackageNameTreeNode } from '../analysis/ImportedPackageNameTree.js';
|
2
3
|
import { Localization } from '../analysis/Localization.js';
|
3
4
|
import { LocalizationContext, NamedEntity } from '../analysis/LocalizationContext.js';
|
4
5
|
import { SubstitutedMethod } from '../analysis/SubstitutedMethod.js';
|
@@ -19,6 +20,7 @@ export declare class DisplayService {
|
|
19
20
|
getNamedTypeDisplayParts(type: NamedType): NamedTypeDisplayParts;
|
20
21
|
displayPackageAliasEntity(entity: e.PackageAliasEntity): string;
|
21
22
|
displayPackage(package_: e.PackageEntity): string;
|
23
|
+
displayPackageNameTreeNode(node: PackageNameTreeNode): string;
|
22
24
|
displayValueParameterDeclaration(parameter: ValueParameterDeclaration, typeDisplayOptions?: TypeDisplayOptions): string;
|
23
25
|
getValueParameterDeclarationDisplayParts(parameter: ValueParameterDeclaration, typeDisplayOptions?: TypeDisplayOptions): ValueParameterDeclarationDisplayParts;
|
24
26
|
displayMethodDeclaration(method: MethodDeclaration): string;
|
@@ -52,11 +54,11 @@ export declare class DisplayService {
|
|
52
54
|
private displayMethodTypeUsage;
|
53
55
|
private displayParameterTypeUsage;
|
54
56
|
private displayAliasTypeUsage;
|
55
|
-
private
|
57
|
+
private displayUnionOrIntersectionTypeUsage;
|
56
58
|
private displayUnresolvedTypeUsage;
|
57
59
|
private displayTypeInternal;
|
58
60
|
private displayTypeUsageInternal;
|
59
|
-
private
|
61
|
+
private displayUnionOrIntersectionTypeTypes;
|
60
62
|
private displayDeclarationContainer;
|
61
63
|
private getEntityName;
|
62
64
|
}
|
@@ -614,7 +616,7 @@ interface IOperatorDeclaration {
|
|
614
616
|
getReturnType(): types.Type;
|
615
617
|
getContainer(analyzer: Analyzer | undefined): DeclarationContainer | undefined;
|
616
618
|
}
|
617
|
-
export type TypeUsage = StructuredTypeUsage | VariantTypeUsage | MethodTypeUsage | AliasTypeUsage | ParameterTypeUsage |
|
619
|
+
export type TypeUsage = StructuredTypeUsage | VariantTypeUsage | MethodTypeUsage | AliasTypeUsage | ParameterTypeUsage | UnionOrIntersectionTypeUsage | UnresolvedTypeUsage;
|
618
620
|
export type StructuredTypeUsage = StructuredTypeUsage_type | StructuredTypeUsage_entity;
|
619
621
|
export declare class StructuredTypeUsage_type implements IStructuredTypeUsage {
|
620
622
|
readonly type: types.StructuredType;
|
@@ -740,11 +742,12 @@ interface IParameterTypeUsage {
|
|
740
742
|
getEntity(): e.NamedTypeEntity;
|
741
743
|
isNoneExcluded(): boolean;
|
742
744
|
}
|
743
|
-
type
|
744
|
-
declare class
|
745
|
-
readonly type: types.UnionType;
|
746
|
-
readonly kind = "union";
|
747
|
-
constructor(type: types.UnionType);
|
745
|
+
type UnionOrIntersectionTypeUsage = UnionOrIntersectionTypeUsage_type;
|
746
|
+
declare class UnionOrIntersectionTypeUsage_type {
|
747
|
+
readonly type: types.UnionType | types.IntersectionType;
|
748
|
+
readonly kind = "union-or-intersection";
|
749
|
+
constructor(type: types.UnionType | types.IntersectionType);
|
750
|
+
isUnionType(): boolean;
|
748
751
|
getOriginalTypes(): readonly types.Type[];
|
749
752
|
getUnaliasedFlattenedTypes(): readonly types.Type[];
|
750
753
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import { AccessedMethod } from '../analysis/AccessedMethod.js';
|
2
2
|
import { MatchResultValueParameter } from '../analysis/ArgumentToParameterMatchResult.js';
|
3
|
+
import { PackageNameTreeNode } from '../analysis/ImportedPackageNameTree.js';
|
4
|
+
import { Analyzer } from '../analysis/index.js';
|
3
5
|
import { Translation, WithLocalization } from '../analysis/Localization.js';
|
4
6
|
import { TypeIndexedAccessorDeclaration } from '../analysis/NodeTypeUtils.js';
|
5
|
-
import { Analyzer } from '../analysis/index.js';
|
6
7
|
import { AccessKind, ReadonlyNonEmptyArray } from '../common/index.js';
|
7
|
-
import { AliasTypeEntity, Entity, MethodEntity, MethodTypeEntity,
|
8
|
+
import { AliasTypeEntity, Entity, MethodEntity, MethodTypeEntity, PackageEntity, StructuredTypeEntity, TypeParameterEntity, VariableEntity, VariantTypeEntity } from '../entities/index.js';
|
8
9
|
import * as tree from '../tree/index.js';
|
9
10
|
import * as types from '../types/index.js';
|
10
11
|
import { TokenOrKeyword } from './TreeUtils.js';
|
@@ -53,15 +54,14 @@ export declare class ReferenceNodeSemanticInfo {
|
|
53
54
|
get firstBetterTargetWithFallback(): WithLocalization<ReferenceTarget>;
|
54
55
|
constructor(targets: ReadonlyNonEmptyArray<WithLocalization<ReferenceTarget>>, isAmbiguous: boolean, betterTargets?: ReadonlyNonEmptyArray<WithLocalization<ReferenceTarget>> | undefined);
|
55
56
|
}
|
56
|
-
export type ReferenceTarget = EntityReferenceTarget | TypeVariableReferenceTarget | TypeValueParameterReferenceTarget | TypeConstructorReferenceTarget | OperatorReferenceTarget | TypeDereferenceOperatorReferenceTarget | AccessedMethodReferenceTarget | TypeIndexerReferenceTarget | MatchResultValueParameterReferenceTarget | PackageReferenceTarget | TypeContextReferenceTarget;
|
57
|
+
export type ReferenceTarget = EntityReferenceTarget | TypeVariableReferenceTarget | TypeValueParameterReferenceTarget | TypeConstructorReferenceTarget | OperatorReferenceTarget | TypeDereferenceOperatorReferenceTarget | AccessedMethodReferenceTarget | TypeIndexerReferenceTarget | MatchResultValueParameterReferenceTarget | PackageReferenceTarget | PackageNameTreeNodeReferenceTarget | TypeContextReferenceTarget;
|
57
58
|
export declare class EntityReferenceTarget {
|
58
|
-
readonly entity:
|
59
|
+
readonly entity: Entity;
|
59
60
|
readonly accessKind: AccessKind;
|
60
61
|
readonly narrowedType?: types.Type | undefined;
|
61
62
|
readonly kind = "entity";
|
62
|
-
constructor(entity:
|
63
|
+
constructor(entity: Entity, accessKind: AccessKind, narrowedType?: types.Type | undefined);
|
63
64
|
}
|
64
|
-
export type ReferencedEntity = VariableEntity | VariantTypeEntity | MethodEntity | TypeParameterEntity | MethodTypeEntity | StructuredTypeEntity | PackageAliasEntity | AliasTypeEntity;
|
65
65
|
export declare class TypeVariableReferenceTarget {
|
66
66
|
readonly variable: types.Variable;
|
67
67
|
readonly accessKind: AccessKind;
|
@@ -107,6 +107,11 @@ export declare class PackageReferenceTarget {
|
|
107
107
|
readonly kind = "package";
|
108
108
|
constructor(package_: PackageEntity);
|
109
109
|
}
|
110
|
+
export declare class PackageNameTreeNodeReferenceTarget {
|
111
|
+
readonly node: PackageNameTreeNode;
|
112
|
+
readonly kind = "package-name-tree-node";
|
113
|
+
constructor(node: PackageNameTreeNode);
|
114
|
+
}
|
110
115
|
export declare class TypeContextReferenceTarget {
|
111
116
|
readonly type: types.Type;
|
112
117
|
readonly typeContextKind: 'object' | 'base';
|