@artel/artc 0.6.25225 → 0.6.25227

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.
Files changed (60) hide show
  1. package/build/Cli.js +3 -3
  2. package/build/api/Api.js +10 -56
  3. package/build/api/ApiNodeJS.js +3 -3
  4. package/build/api/ApiServices.js +397 -316
  5. package/build/{chunk-Z6TZA6SN.js → chunk-74TFH7TE.js} +3 -3
  6. package/build/{chunk-TFTCV5R5.js → chunk-NOECPQMV.js} +6157 -5620
  7. package/build/{chunk-UB6LHKS5.js → chunk-VD6OPILI.js} +3 -3
  8. package/build/types/analysis/Analyzer.d.ts +24 -70
  9. package/build/types/analysis/AssignmentChecker.d.ts +11 -0
  10. package/build/types/analysis/CallExpressionMeaning.d.ts +2 -0
  11. package/build/types/analysis/DiagnosticCollector.d.ts +6 -3
  12. package/build/types/analysis/IdentifierExpressionMeaning.d.ts +6 -6
  13. package/build/types/analysis/IndexedAccessExpressionMeaning.d.ts +3 -3
  14. package/build/types/analysis/MemberAccessExpressionMeaning.d.ts +9 -9
  15. package/build/types/analysis/NamedTypeResolver.d.ts +3 -2
  16. package/build/types/analysis/NamedTypeSpecifierResolver.d.ts +3 -2
  17. package/build/types/analysis/NodeTypeUtils.d.ts +3 -2
  18. package/build/types/analysis/TagMeaning.d.ts +3 -2
  19. package/build/types/analysis/TypeMemberLookup.d.ts +11 -11
  20. package/build/types/analysis/TypeNarrower.d.ts +0 -69
  21. package/build/types/analysis/control-flow/GraphBuilder.d.ts +1 -0
  22. package/build/types/analysis/control-flow/NarrowableReference.d.ts +73 -0
  23. package/build/types/analysis/control-flow/Nodes.d.ts +9 -0
  24. package/build/types/analysis/control-flow/index.d.ts +1 -0
  25. package/build/types/analysis/semantic-context/Declarations.d.ts +117 -0
  26. package/build/types/analysis/semantic-context/FieldWithInitializerSemanticContext.d.ts +22 -0
  27. package/build/types/analysis/semantic-context/SemanticContext.d.ts +13 -0
  28. package/build/types/analysis/semantic-context/SemanticContextBase.d.ts +168 -0
  29. package/build/types/analysis/semantic-context/SemanticContextBasedEntityHidingMatcher.d.ts +14 -0
  30. package/build/types/analysis/semantic-context/SemanticContextBuilder.d.ts +84 -0
  31. package/build/types/analysis/semantic-context/SemanticContextValidatingNameConflicts.d.ts +124 -0
  32. package/build/types/analysis/semantic-context/SemanticContextWithParent.d.ts +9 -0
  33. package/build/types/analysis/semantic-context/SourceFileSemanticContext.d.ts +42 -0
  34. package/build/types/analysis/semantic-context/SpecialLocalDeclarationsBuilder.d.ts +23 -0
  35. package/build/types/analysis/semantic-context/SubprogramSemanticContext.d.ts +122 -0
  36. package/build/types/analysis/semantic-context/TypeSemanticContext.d.ts +109 -0
  37. package/build/types/analysis/semantic-context/index.d.ts +9 -0
  38. package/build/types/api/Api.d.ts +3 -5
  39. package/build/types/common/Errors.d.ts +2 -0
  40. package/build/types/common/Lazy.d.ts +4 -0
  41. package/build/types/common/Query.d.ts +2 -1
  42. package/build/types/common/WithDiagnostics.d.ts +4 -3
  43. package/build/types/common/index.d.ts +1 -0
  44. package/build/types/diagnostic/DiagnosticCode.d.ts +105 -99
  45. package/build/types/emitter/IrBuilder.d.ts +1 -0
  46. package/build/types/emitter/Transformer.d.ts +1 -1
  47. package/build/types/entities/FunctionEntity.d.ts +2 -2
  48. package/build/types/entities/VariableEntity.d.ts +35 -19
  49. package/build/types/services/DefinitionService.d.ts +3 -0
  50. package/build/types/tree/KeywordKind.d.ts +31 -30
  51. package/build/types/tree/NodeKind.d.ts +81 -80
  52. package/build/types/tree/green/Nodes.d.ts +40 -18
  53. package/build/types/tree/red/Nodes.d.ts +31 -15
  54. package/build/types/types/TypeFactory.d.ts +0 -2
  55. package/package.json +1 -1
  56. package/build/types/analysis/Lookup.d.ts +0 -28
  57. package/build/types/analysis/Scope.d.ts +0 -205
  58. package/build/types/analysis/SemanticContext.d.ts +0 -367
  59. package/build/types/analysis/SemanticContextBuilder.d.ts +0 -59
  60. package/build/types/analysis/StatementBlockScopeBuilder.d.ts +0 -26
@@ -0,0 +1,73 @@
1
+ import { LocalVariableEntity, PackageVariableEntity, ParameterVariableEntity } from '../../entities/VariableEntity.js';
2
+ import * as tree from '../../tree/index.js';
3
+ import * as types from '../../types/index.js';
4
+ import { Analyzer } from '../Analyzer.js';
5
+ import { NarrowableReferenceExpression } from '../control-flow/NarrowableExpression.js';
6
+ export type NarrowableReference = NarrowableReference.LocalVariable | NarrowableReference.PackageVariable | NarrowableReference.InstanceField | NarrowableReference.StaticField | NarrowableReference.ObjectAutoVariable;
7
+ export declare namespace NarrowableReference {
8
+ export class LocalVariable implements INarrowableReference {
9
+ private readonly _analyzer;
10
+ readonly entity: LocalVariableEntity | ParameterVariableEntity;
11
+ readonly kind = "local-variable";
12
+ constructor(_analyzer: Analyzer, entity: LocalVariableEntity | ParameterVariableEntity);
13
+ equals(other: NarrowableReference): boolean;
14
+ contains(_other: NarrowableReference): boolean;
15
+ equalsExpression(expression: NarrowableReferenceExpression): boolean;
16
+ containsExpression(_expression: NarrowableReferenceExpression): boolean;
17
+ }
18
+ export class PackageVariable implements INarrowableReference {
19
+ private readonly _analyzer;
20
+ readonly entity: PackageVariableEntity;
21
+ readonly kind = "package-variable";
22
+ constructor(_analyzer: Analyzer, entity: PackageVariableEntity);
23
+ equals(other: NarrowableReference): boolean;
24
+ contains(_other: NarrowableReference): boolean;
25
+ equalsExpression(expression: NarrowableReferenceExpression): boolean;
26
+ containsExpression(_expression: NarrowableReferenceExpression): boolean;
27
+ }
28
+ export class InstanceField implements INarrowableReference {
29
+ private readonly _analyzer;
30
+ readonly variable: types.Variable;
31
+ readonly receiver: NarrowableReference;
32
+ readonly kind = "instance-field";
33
+ constructor(_analyzer: Analyzer, variable: types.Variable, receiver: NarrowableReference);
34
+ equals(other: NarrowableReference): boolean;
35
+ contains(other: NarrowableReference): boolean;
36
+ equalsExpression(expression: NarrowableReferenceExpression): boolean;
37
+ containsExpression(expression: NarrowableReferenceExpression): boolean;
38
+ }
39
+ export class StaticField implements INarrowableReference {
40
+ private readonly _analyzer;
41
+ readonly variable: types.Variable;
42
+ readonly kind = "static-field";
43
+ constructor(_analyzer: Analyzer, variable: types.Variable);
44
+ equals(other: NarrowableReference): boolean;
45
+ contains(_other: NarrowableReference): boolean;
46
+ equalsExpression(expression: NarrowableReferenceExpression): boolean;
47
+ containsExpression(_expression: NarrowableReferenceExpression): boolean;
48
+ }
49
+ export class ObjectAutoVariable implements INarrowableReference {
50
+ readonly kind = "object-auto-variable";
51
+ equals(other: NarrowableReference): boolean;
52
+ contains(_other: NarrowableReference): boolean;
53
+ equalsExpression(expression: NarrowableReferenceExpression): boolean;
54
+ containsExpression(_expression: NarrowableReferenceExpression): boolean;
55
+ }
56
+ interface INarrowableReference {
57
+ equals(other: NarrowableReference): boolean;
58
+ contains(other: NarrowableReference): boolean;
59
+ /**
60
+ * Отличается от метода `equals` тем, что выполняет сравнение лениво. Например, при сравнении с выражением
61
+ * `а.б` сперва будут сравнены части слева от точки (выражение `а` с `receiver`), и только при равенстве будет
62
+ * связано и сравнено имя `б`. Если выражение `а` не равно `receiver`, то сразу будет возвращено `false` и
63
+ * связывание для имени `б` выполняться не будет. Такое поведение необходимо при анализе циклов,
64
+ * чтобы избежать рекурсии.
65
+ */
66
+ equalsExpression(expression: NarrowableReferenceExpression): boolean;
67
+ containsExpression(expression: NarrowableReferenceExpression): boolean;
68
+ }
69
+ export {};
70
+ }
71
+ export declare function getReferenceAtNarrowableExpression(analyzer: Analyzer, node: NarrowableReferenceExpression): NarrowableReference | undefined;
72
+ export declare function getReferenceAtExpressionIfNarrowable(analyzer: Analyzer, node: tree.Expression): NarrowableReference | undefined;
73
+ export declare function getNarrowableReferenceAtLocalVariableDeclaration(analyzer: Analyzer, node: tree.LocalVariableDeclaration): NarrowableReference;
@@ -74,7 +74,16 @@ export declare abstract class LoopNode extends ControlFlowNodeBase {
74
74
  readonly kind = "loop";
75
75
  get debuggerDisplay(): string;
76
76
  protected get thisAsNode(): Node;
77
+ /**
78
+ * Предшествующий узел, не образующий цикл в графе потока управления. Любой цикл имеет ровно один такой узел.
79
+ */
77
80
  abstract predecessor: Node;
81
+ /**
82
+ * Предшествующие узлы, образующие цикл в графе управление. В простейшем случае имеет один элемент, поскольку
83
+ * управление в конце цикла возвращается в его начало (т.е. началу цикла предшествует его конец). Может иметь
84
+ * несколько элементов, если в теле цикла используются инструкции `следующий цикл`, или не иметь ни одного элемента,
85
+ * если это бесконечный цикл, содержащий инструкцию `прервать цикл`, или любую другую, прерывающую поток управления.
86
+ */
78
87
  abstract loopingPredecessors: readonly Node[];
79
88
  }
80
89
  /**
@@ -1,4 +1,5 @@
1
1
  export * from './GraphBuilder.js';
2
2
  export * from './GraphVisualizer.js';
3
3
  export * from './NarrowableExpression.js';
4
+ export * from './NarrowableReference.js';
4
5
  export * from './Nodes.js';
@@ -0,0 +1,117 @@
1
+ import { Name } from '../../common/index.js';
2
+ import { EntityHidingLevel, FunctionEntity, NamedTypeEntity, PackageAliasEntity, VariableEntity } from '../../entities/index.js';
3
+ import * as types from '../../types/index.js';
4
+ import { PackageNameTreeNode } from '../ImportedPackageNameTree.js';
5
+ export type TypeOrContainerWithTypes = NamedDeclaration_type | NamedDeclaration_packageAlias | NamedDeclaration_packageNameSegment;
6
+ export type NamedDeclaration = NamedDeclaration_function | NamedDeclaration_variable | NamedDeclaration_type | NamedDeclaration_packageAlias | NamedDeclaration_packageNameSegment;
7
+ export declare class NamedDeclaration_function implements INamedDeclaration {
8
+ readonly value: NamedDeclarationFunction;
9
+ readonly kind = "function";
10
+ constructor(value: NamedDeclarationFunction);
11
+ getName(): Name;
12
+ isHidden(): EntityHidingLevel | undefined;
13
+ }
14
+ export type NamedDeclarationFunction = NamedDeclarationFunction_entity | NamedDeclarationFunction_typeMember;
15
+ export declare class NamedDeclarationFunction_entity implements INamedDeclarationFunction {
16
+ readonly kind = "entity";
17
+ private readonly _valueParameters;
18
+ readonly value: FunctionEntity;
19
+ constructor(value: FunctionEntity);
20
+ getName(): Name;
21
+ getEntity(): FunctionEntity;
22
+ getTypeParameterArity(): number;
23
+ isHidden(): EntityHidingLevel | undefined;
24
+ getValueParameters(): readonly ValueParameter[];
25
+ }
26
+ export declare class NamedDeclarationFunction_typeMember implements INamedDeclarationFunction {
27
+ readonly kind = "type-member";
28
+ private readonly _valueParameters;
29
+ readonly value: types.Method;
30
+ constructor(value: types.Method);
31
+ getName(): Name;
32
+ getEntity(): FunctionEntity;
33
+ getTypeParameterArity(): number;
34
+ isHidden(): EntityHidingLevel | undefined;
35
+ getValueParameters(): readonly ValueParameter[];
36
+ }
37
+ interface INamedDeclarationFunction {
38
+ getName(): Name;
39
+ getEntity(): FunctionEntity;
40
+ getTypeParameterArity(): number;
41
+ isHidden(): EntityHidingLevel | undefined;
42
+ getValueParameters(): readonly ValueParameter[];
43
+ }
44
+ export type ValueParameter = ValueParameter_entity | ValueParameter_typeMember;
45
+ export declare class ValueParameter_entity implements IValueParameter {
46
+ readonly value: VariableEntity;
47
+ readonly kind = "entity";
48
+ constructor(value: VariableEntity);
49
+ getName(): Name;
50
+ getType(): types.Type;
51
+ }
52
+ export declare class ValueParameter_typeMember implements IValueParameter {
53
+ readonly value: types.ValueParameter;
54
+ readonly kind = "type-member";
55
+ constructor(value: types.ValueParameter);
56
+ getName(): Name;
57
+ getType(): types.Type;
58
+ }
59
+ interface IValueParameter {
60
+ getName(): Name;
61
+ getType(): types.Type;
62
+ }
63
+ export declare class NamedDeclaration_variable implements INamedDeclaration {
64
+ readonly value: NamedDeclarationVariable;
65
+ readonly kind = "variable";
66
+ constructor(value: NamedDeclarationVariable);
67
+ getName(): Name;
68
+ isHidden(): EntityHidingLevel | undefined;
69
+ }
70
+ export type NamedDeclarationVariable = NamedDeclarationVariable_entity | NamedDeclarationVariable_typeMember;
71
+ export declare class NamedDeclarationVariable_entity implements INamedDeclarationVariable {
72
+ readonly value: VariableEntity;
73
+ readonly kind = "entity";
74
+ constructor(value: VariableEntity);
75
+ getName(): Name;
76
+ getEntity(): VariableEntity;
77
+ isHidden(): EntityHidingLevel | undefined;
78
+ }
79
+ export declare class NamedDeclarationVariable_typeMember implements INamedDeclarationVariable {
80
+ readonly value: types.Variable;
81
+ readonly kind = "type-member";
82
+ constructor(value: types.Variable);
83
+ getName(): Name;
84
+ getEntity(): VariableEntity;
85
+ isHidden(): EntityHidingLevel | undefined;
86
+ }
87
+ interface INamedDeclarationVariable {
88
+ getName(): Name;
89
+ getEntity(): VariableEntity;
90
+ isHidden(): EntityHidingLevel | undefined;
91
+ }
92
+ export declare class NamedDeclaration_type implements INamedDeclaration {
93
+ readonly value: NamedTypeEntity;
94
+ readonly kind = "type";
95
+ constructor(value: NamedTypeEntity);
96
+ getName(): Name;
97
+ isHidden(): EntityHidingLevel | undefined;
98
+ }
99
+ export declare class NamedDeclaration_packageAlias implements INamedDeclaration {
100
+ readonly value: PackageAliasEntity;
101
+ readonly kind = "package-alias";
102
+ constructor(value: PackageAliasEntity);
103
+ getName(): Name;
104
+ isHidden(): EntityHidingLevel | undefined;
105
+ }
106
+ export declare class NamedDeclaration_packageNameSegment implements INamedDeclaration {
107
+ readonly value: PackageNameTreeNode;
108
+ readonly kind = "package-name-segment";
109
+ constructor(value: PackageNameTreeNode);
110
+ getName(): Name;
111
+ isHidden(): EntityHidingLevel | undefined;
112
+ }
113
+ interface INamedDeclaration {
114
+ getName(): Name;
115
+ isHidden(): EntityHidingLevel | undefined;
116
+ }
117
+ export {};
@@ -0,0 +1,22 @@
1
+ import { SearchName } from '../../common/index.js';
2
+ import { IEntityHidingMatcher } from '../../entities/EntityHiding.js';
3
+ import * as tree from '../../tree/index.js';
4
+ import { Analyzer } from '../Analyzer.js';
5
+ import { FoundNamedDeclaration } from '../FoundDeclaration.js';
6
+ import { NamedDeclaration, TypeOrContainerWithTypes } from './Declarations.js';
7
+ import { SemanticContext } from './SemanticContext.js';
8
+ import { SemanticContextWithParent } from './SemanticContextWithParent.js';
9
+ import { SemanticContextContainingTypeMember } from './TypeSemanticContext.js';
10
+ export declare class FieldWithInitializerSemanticContext extends SemanticContextWithParent {
11
+ readonly kind = "field-initializer";
12
+ readonly outer: SemanticContextContainingTypeMember;
13
+ protected readonly asContext: SemanticContext;
14
+ private readonly _analyzer;
15
+ private readonly _node;
16
+ constructor(analyzer: Analyzer, node: tree.FieldDeclaration, outer: SemanticContextContainingTypeMember);
17
+ isStatic(): boolean;
18
+ getOwnTypesOrContainersWithTypes(_hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
19
+ getOwnTypesOrContainersWithTypesByName(_name: SearchName, _hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
20
+ getOwnNamedDeclarations(_noInstanceMembers?: boolean, _hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<NamedDeclaration>[];
21
+ getOwnNamedDeclarationsByName(_name: SearchName, _noInstanceMembers?: boolean, _hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<NamedDeclaration>[];
22
+ }
@@ -0,0 +1,13 @@
1
+ import { FieldWithInitializerSemanticContext } from './FieldWithInitializerSemanticContext.js';
2
+ import { CatchClauseSemanticContext, ForStatementSemanticContext, FunctionBlockSemanticContext, SpecialLocalDeclarationSemanticContext, StatementBlockSemanticContext, SubprogramParameterSemanticContext, SubprogramTypeParameterSemanticContext } from './SemanticContextValidatingNameConflicts.js';
3
+ import { SourceFileSemanticContext } from './SourceFileSemanticContext.js';
4
+ import { OutermostSemanticContextOfSubprogram } from './SubprogramSemanticContext.js';
5
+ import { OutermostSemanticContextOfType, ParametersOfFunctionTypeSemanticContext, TypeBodySemanticContext, TypeExtensionBodySemanticContext, TypeParametersOfTypeSemanticContext } from './TypeSemanticContext.js';
6
+ /**
7
+ * Позволяет получить информацию, общую для определённой области
8
+ * исходного кода (блока инструкций, списка членов типа и др.) с учётом
9
+ * всех вышестоящих (родительских) контекстов.
10
+ * Чтобы получить семантический контекст, в котором находится определённый узел,
11
+ * используйте `analyzer.semanticContext.containing(node)`.
12
+ */
13
+ export type SemanticContext = SourceFileSemanticContext | OutermostSemanticContextOfType | TypeParametersOfTypeSemanticContext | TypeBodySemanticContext | TypeExtensionBodySemanticContext | ParametersOfFunctionTypeSemanticContext | OutermostSemanticContextOfSubprogram | SubprogramTypeParameterSemanticContext | SubprogramParameterSemanticContext | SpecialLocalDeclarationSemanticContext | StatementBlockSemanticContext | FunctionBlockSemanticContext | FieldWithInitializerSemanticContext | ForStatementSemanticContext | CatchClauseSemanticContext;
@@ -0,0 +1,168 @@
1
+ import { SearchName } from '../../common/SearchName.js';
2
+ import { IEntityHidingMatcher } from '../../entities/EntityHiding.js';
3
+ import { ConstructorEntity, OperatorKind, PackageEntity, TypeEntity, TypeEntityWithMembers, TypeExtensionEntity } from '../../entities/index.js';
4
+ import { SourceFile } from '../../project/SourceFile.js';
5
+ import * as tree from '../../tree/index.js';
6
+ import * as types from '../../types/index.js';
7
+ import { Analyzer } from '../Analyzer.js';
8
+ import { FoundAnonymousDeclaration, FoundNamedDeclaration } from '../FoundDeclaration.js';
9
+ import { LocalizationContext } from '../LocalizationContext.js';
10
+ import { FunctionDeclaration, GetterDeclaration, RegularOrBlockFunctionLiteral, SetterDeclaration, SubprogramDeclarationOrLiteral } from '../NodeTypeUtils.js';
11
+ import { NamedDeclaration, TypeOrContainerWithTypes } from './Declarations.js';
12
+ import { SemanticContext } from './SemanticContext.js';
13
+ export declare abstract class SemanticContextBase {
14
+ abstract readonly outer: SemanticContext | undefined;
15
+ protected abstract readonly asContext: SemanticContext;
16
+ abstract getContainingSubprogram(): SubprogramInfo | undefined;
17
+ abstract getContainingTypeOrTypeExtension(): TypeOrTypeExtension | undefined;
18
+ abstract getTryStatementContext(): TryStatementContextKind | undefined;
19
+ abstract isStatic(): boolean;
20
+ abstract getOwnTypesOrContainersWithTypes(hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
21
+ abstract getOwnTypesOrContainersWithTypesByName(name: SearchName, hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
22
+ abstract getOwnNamedDeclarations(noInstanceMembers?: boolean, hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<NamedDeclaration>[];
23
+ abstract getOwnNamedDeclarationsByName(name: SearchName, noInstanceMembers?: boolean, hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<NamedDeclaration>[];
24
+ getLocalizationContext(): LocalizationContext;
25
+ getContainingSourceFile(): SourceFile;
26
+ getContainingPackage(): PackageEntity;
27
+ getHidingMatcher(): IEntityHidingMatcher;
28
+ getTypesOrContainersWithTypes(): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
29
+ getTypesOrContainersWithTypesByName(name: SearchName): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
30
+ getNamedDeclarations(noInstanceMembers?: boolean): readonly FoundNamedDeclaration<NamedDeclaration>[];
31
+ getNamedDeclarationsByName(name: SearchName, noInstanceMembers?: boolean): readonly FoundNamedDeclaration<NamedDeclaration>[];
32
+ getOperators(noInstanceMembers?: boolean): readonly FoundAnonymousDeclaration<types.Operator>[];
33
+ getOperatorsByKind(kind: OperatorKind, noInstanceMembers?: boolean): readonly FoundAnonymousDeclaration<types.Operator>[];
34
+ getTypeExtensionsByType(type: TypeEntity): readonly TypeExtensionEntity[];
35
+ private enumerateSemanticContexts;
36
+ private getSourceFileContext;
37
+ }
38
+ export type SubprogramInfo = SubprogramInfo.Function | SubprogramInfo.Operator | SubprogramInfo.Constructor | SubprogramInfo.Destructor | SubprogramInfo.Getter | SubprogramInfo.Setter | SubprogramInfo.PackageConstructor | SubprogramInfo.PackageEntryPoint | SubprogramInfo.FunctionLiteral;
39
+ export declare namespace SubprogramInfo {
40
+ export class Function implements ISubprogramInfo {
41
+ readonly kind = "function";
42
+ private readonly _analyzer;
43
+ private readonly _node;
44
+ constructor(analyzer: Analyzer, node: FunctionDeclaration);
45
+ getReturnType(): types.Type | undefined;
46
+ isGenerator(): boolean;
47
+ allowsAsyncCalls(): boolean;
48
+ getNode(): FunctionDeclaration;
49
+ private getEntity;
50
+ }
51
+ export class Operator implements ISubprogramInfo {
52
+ readonly kind = "operator";
53
+ private readonly _analyzer;
54
+ private readonly _node;
55
+ constructor(analyzer: Analyzer, node: tree.OperatorDeclaration);
56
+ getReturnType(): types.Type | undefined;
57
+ isGenerator(): boolean;
58
+ allowsAsyncCalls(): boolean;
59
+ getNode(): tree.OperatorDeclaration;
60
+ }
61
+ export class Constructor implements ISubprogramInfo {
62
+ readonly kind = "constructor";
63
+ private readonly _analyzer;
64
+ private readonly _node;
65
+ constructor(analyzer: Analyzer, node: tree.ConstructorDeclaration);
66
+ getReturnType(): types.Type | undefined;
67
+ isGenerator(): boolean;
68
+ allowsAsyncCalls(): boolean;
69
+ getEntity(): ConstructorEntity;
70
+ getNode(): tree.ConstructorDeclaration;
71
+ }
72
+ export class Destructor implements ISubprogramInfo {
73
+ readonly kind = "destructor";
74
+ private readonly _analyzer;
75
+ private readonly _node;
76
+ constructor(analyzer: Analyzer, node: tree.DestructorDeclaration);
77
+ getReturnType(): types.Type | undefined;
78
+ isGenerator(): boolean;
79
+ allowsAsyncCalls(): boolean;
80
+ getNode(): tree.DestructorDeclaration;
81
+ }
82
+ export class Getter implements ISubprogramInfo {
83
+ readonly kind = "getter";
84
+ private readonly _analyzer;
85
+ private readonly _node;
86
+ constructor(analyzer: Analyzer, node: GetterDeclaration);
87
+ getReturnType(): types.Type | undefined;
88
+ isGenerator(): boolean;
89
+ allowsAsyncCalls(): boolean;
90
+ getNode(): GetterDeclaration;
91
+ }
92
+ export class Setter implements ISubprogramInfo {
93
+ readonly kind = "setter";
94
+ private readonly _analyzer;
95
+ private readonly _node;
96
+ constructor(analyzer: Analyzer, node: SetterDeclaration);
97
+ getReturnType(): types.Type | undefined;
98
+ isGenerator(): boolean;
99
+ allowsAsyncCalls(): boolean;
100
+ getNode(): SetterDeclaration;
101
+ }
102
+ export class PackageConstructor implements ISubprogramInfo {
103
+ readonly kind = "package-constructor";
104
+ private readonly _analyzer;
105
+ private readonly _node;
106
+ constructor(analyzer: Analyzer, node: tree.PackageConstructorDeclaration);
107
+ getReturnType(): types.Type | undefined;
108
+ isGenerator(): boolean;
109
+ allowsAsyncCalls(): boolean;
110
+ getPackageEntity(): PackageEntity;
111
+ getNode(): tree.PackageConstructorDeclaration;
112
+ }
113
+ export class PackageEntryPoint implements ISubprogramInfo {
114
+ readonly kind = "package-entry-point";
115
+ private readonly _analyzer;
116
+ private readonly _node;
117
+ constructor(analyzer: Analyzer, node: tree.PackageEntryPointDeclaration);
118
+ getReturnType(): types.Type | undefined;
119
+ isGenerator(): boolean;
120
+ allowsAsyncCalls(): boolean;
121
+ getPackageEntity(): PackageEntity;
122
+ getNode(): tree.PackageEntryPointDeclaration;
123
+ }
124
+ export class FunctionLiteral implements ISubprogramInfo {
125
+ readonly kind = "function-literal";
126
+ private readonly _analyzer;
127
+ private readonly _node;
128
+ constructor(analyzer: Analyzer, node: RegularOrBlockFunctionLiteral);
129
+ getReturnType(): types.Type | undefined;
130
+ isGenerator(): boolean;
131
+ allowsAsyncCalls(): boolean;
132
+ getNode(): RegularOrBlockFunctionLiteral;
133
+ private getSignatureType;
134
+ }
135
+ interface ISubprogramInfo {
136
+ getReturnType(): types.Type | undefined;
137
+ isGenerator(): boolean;
138
+ allowsAsyncCalls(): boolean;
139
+ getNode(): SubprogramDeclarationOrLiteral;
140
+ }
141
+ export {};
142
+ }
143
+ export type TypeOrTypeExtension = TypeOrTypeExtension.Type | TypeOrTypeExtension.TypeExtension;
144
+ export declare namespace TypeOrTypeExtension {
145
+ export class Type implements ITypeOrTypeExtension {
146
+ readonly value: TypeEntityWithMembers;
147
+ readonly kind = "type";
148
+ constructor(value: TypeEntityWithMembers);
149
+ getContextualTypeEntity(): TypeEntity | undefined;
150
+ getEntity(): TypeEntityWithMembers;
151
+ }
152
+ export class TypeExtension implements ITypeOrTypeExtension {
153
+ readonly value: TypeExtensionEntity;
154
+ readonly kind = "type-extension";
155
+ constructor(value: TypeExtensionEntity);
156
+ getContextualTypeEntity(): TypeEntity | undefined;
157
+ getEntity(): TypeExtensionEntity;
158
+ }
159
+ interface ITypeOrTypeExtension {
160
+ getContextualTypeEntity(): TypeEntity | undefined;
161
+ getEntity(): TypeEntityWithMembers | TypeExtensionEntity;
162
+ }
163
+ export {};
164
+ }
165
+ export declare enum TryStatementContextKind {
166
+ InTryBlockWithCatchClause = 0,
167
+ InFinallyBlock = 1
168
+ }
@@ -0,0 +1,14 @@
1
+ import { EntityHidingLevel, IEntityHidingMatcher } from '../../entities/EntityHiding.js';
2
+ import { SemanticContext } from './SemanticContext.js';
3
+ export declare class SemanticContextBasedEntityHidingMatcher implements IEntityHidingMatcher {
4
+ private readonly _semanticContext;
5
+ private readonly _sourceFile;
6
+ private readonly _type;
7
+ private readonly _package;
8
+ private get sourceFile();
9
+ private get package();
10
+ private get type();
11
+ constructor(semanticContext: SemanticContext);
12
+ matches(hiding: EntityHidingLevel): boolean;
13
+ private collectBaseTypesRecursively;
14
+ }
@@ -0,0 +1,84 @@
1
+ import * as tree from '../../tree/index.js';
2
+ import { Analyzer } from '../Analyzer.js';
3
+ import { FunctionDeclaration, IndexedElementAccessorDeclaration, PackageTypeDeclaration, RegularOrBlockFunctionLiteral, SubprogramDeclarationOrLiteral } from '../NodeTypeUtils.js';
4
+ import { BlockSemanticContext, CatchClauseSemanticContext, ConstructorSemanticContext, DestructorSemanticContext, ForStatementSemanticContext, FunctionBlockSemanticContext, FunctionLiteralSemanticContext, FunctionSemanticContext, IndexedElementAccessorSemanticContext, OperatorSemanticContext, OutermostSemanticContextOfSubprogram, OutermostSemanticContextOfType, PackageConstructorSemanticContext, PackageEntryPointSemanticContext, ParametersOfFunctionTypeSemanticContext, SemanticContext, SemanticContextContainingTypeMember, SourceFileSemanticContext, SpecialLocalDeclarationSemanticContext, StatementBlockSemanticContext, SubprogramParameterSemanticContext, SubprogramTypeParameterSemanticContext, TypeBodySemanticContext, TypeDeclarationCreatingSemanticContext, TypeDeclarationWithMembersBody, TypeExtensionBodySemanticContext, TypeParametersOfTypeSemanticContext, VariableAccessorDeclaration, VariableAccessorSemanticContext } from '../semantic-context/index.js';
5
+ export declare class SemanticContextBuilder {
6
+ private readonly _analyzer;
7
+ private readonly _sourceFileContexts;
8
+ private readonly _indexedElementAccessorContexts;
9
+ private readonly _operatorContexts;
10
+ private readonly _fieldWithInitializerContexts;
11
+ private readonly _forStatementContexts;
12
+ private readonly _catchClauseSemanticContexts;
13
+ private readonly _destructorContexts;
14
+ private readonly _constructorContexts;
15
+ private readonly _functionLiteralContexts;
16
+ private readonly _packageEntryPointContexts;
17
+ private readonly _packageConstructorContexts;
18
+ private readonly _variableAccessorContexts;
19
+ private readonly _typeDeclarationTypeParameterContexts;
20
+ private readonly _typeDeclarationBodyContexts;
21
+ private readonly _parametersOfFunctionTypeContext;
22
+ private readonly _statementBlockContexts;
23
+ private readonly _functionBlockContexts;
24
+ private readonly _specialLocalDeclarationContexts;
25
+ private readonly _subprogramTypeParameterContexts;
26
+ private readonly _subprogramParameterContexts;
27
+ private readonly _outermostContextsOfFunctionDeclaration;
28
+ private readonly _outermostContextsOfTypeDeclaration;
29
+ private readonly _typeExtensionDeclarationBodyContexts;
30
+ constructor(analyzer: Analyzer);
31
+ /**
32
+ * Возвращает контекст, содержащий узел. Если в качестве узла передан исходный файл,
33
+ * будет возвращён контекст исходного файла.
34
+ */
35
+ containing(node: tree.Node): SemanticContext;
36
+ containingWithOffset(node: tree.Node, offset: number): SemanticContext;
37
+ ofSourceFile(node: tree.SourceFile): SourceFileSemanticContext;
38
+ ofFunctionDeclarationParameters(node: FunctionDeclaration): SubprogramParameterSemanticContext;
39
+ ofFunctionDeclarationTypeParameters(node: FunctionDeclaration, typeParameterClause: tree.TypeParameterClause): SubprogramTypeParameterSemanticContext;
40
+ outermostSemanticContextOfFunctionDeclaration(node: FunctionDeclaration): FunctionSemanticContext;
41
+ ofOperatorDeclarationParameters(node: tree.OperatorDeclaration): SubprogramParameterSemanticContext;
42
+ outermostSemanticContextOfOperatorDeclaration(node: tree.OperatorDeclaration): OperatorSemanticContext;
43
+ ofTypeDeclarationBody(node: TypeDeclarationWithMembersBody): TypeBodySemanticContext;
44
+ ofFunctionTypeDeclarationParameters(node: tree.FunctionTypeDeclarationBody): ParametersOfFunctionTypeSemanticContext;
45
+ outermostSemanticContextOfTypeDeclaration(node: TypeDeclarationCreatingSemanticContext): OutermostSemanticContextOfType;
46
+ ofTypeDeclarationTypeParameters(node: PackageTypeDeclaration, typeParameterClause: tree.TypeParameterClause): TypeParametersOfTypeSemanticContext;
47
+ ofTypeExtensionDeclarationBody(node: tree.TypeExtensionDeclaration): TypeExtensionBodySemanticContext;
48
+ ofVariableAccessorDeclaration(node: VariableAccessorDeclaration): VariableAccessorSemanticContext;
49
+ ofPackageConstructorDeclaration(node: tree.PackageConstructorDeclaration): PackageConstructorSemanticContext;
50
+ ofPackageEntryPointDeclaration(node: tree.PackageEntryPointDeclaration): PackageEntryPointSemanticContext;
51
+ ofRegularOrBlockFunctionLiteralParameters(node: RegularOrBlockFunctionLiteral): SubprogramParameterSemanticContext;
52
+ outermostSemanticContextOfRegularOrBlockFunctionLiteral(node: RegularOrBlockFunctionLiteral): FunctionLiteralSemanticContext;
53
+ ofForStatement(node: tree.ForStatement): ForStatementSemanticContext;
54
+ ofStatementBlock(node: tree.StatementBlock): StatementBlockSemanticContext;
55
+ ofFunctionBlock(node: tree.FunctionBlock): FunctionBlockSemanticContext;
56
+ withSpecialLocalDeclarations(node: tree.FunctionBlock): SpecialLocalDeclarationSemanticContext;
57
+ ofStatementBlockOrFunctionBlock(node: tree.StatementBlock | tree.FunctionBlock): BlockSemanticContext;
58
+ ofConstructorDeclarationParameters(node: tree.ConstructorDeclaration): SubprogramParameterSemanticContext;
59
+ outermostSemanticContextOfConstructorDeclaration(node: tree.ConstructorDeclaration): ConstructorSemanticContext;
60
+ ofDestructorDeclarationParameters(node: tree.DestructorDeclaration): SubprogramParameterSemanticContext;
61
+ outermostSemanticContextOfDestructorDeclaration(node: tree.DestructorDeclaration): DestructorSemanticContext;
62
+ ofIndexedElementAccessorDeclarationParameters(node: IndexedElementAccessorDeclaration): SubprogramParameterSemanticContext;
63
+ outermostSemanticContextOfIndexedElementAccessorDeclaration(node: IndexedElementAccessorDeclaration): IndexedElementAccessorSemanticContext;
64
+ ofCatchClause(node: tree.CatchClause): CatchClauseSemanticContext;
65
+ ofFieldDeclarationWithInitializer(node: tree.FieldDeclaration): SemanticContext;
66
+ ofSubprogram(node: SubprogramDeclarationOrLiteral): OutermostSemanticContextOfSubprogram;
67
+ containingTypeMember(node: tree.TypeMemberDeclaration): SemanticContextContainingTypeMember;
68
+ containingPackageMember(node: tree.PackageMemberDeclaration): SourceFileSemanticContext;
69
+ private containingInternal;
70
+ private ofChildOfFunctionDeclaration;
71
+ private ofChildOfTypeDeclarationWithMemberBlock;
72
+ private ofChildOfTypeDeclarationBodyWithMemberBlock;
73
+ private ofChildOfFunctionTypeDeclarationBody;
74
+ private ofChildOfFunctionLiteral;
75
+ private ofOperatorDeclarationChild;
76
+ private ofConstructorDeclarationChild;
77
+ private ofDestructorDeclarationChild;
78
+ private ofIndexedElementGetterDeclarationChild;
79
+ private ofIndexedElementSetterDeclarationChild;
80
+ private ofChildOfTypeExtensionDeclaration;
81
+ private isOffsetBetweenNodes;
82
+ private isOffsetInsideStatementBlock;
83
+ private isOffsetInsideFunctionBlock;
84
+ }
@@ -0,0 +1,124 @@
1
+ import { SearchName } from '../../common/index.js';
2
+ import { DiagnosticAcceptor } from '../../diagnostic/Diagnostic.js';
3
+ import { IEntityHidingMatcher } from '../../entities/EntityHiding.js';
4
+ import { LocalVariableEntity, NestedFunctionEntity, ParameterVariableEntity, TypeParameterEntity } from '../../entities/index.js';
5
+ import * as tree from '../../tree/index.js';
6
+ import { Analyzer } from '../Analyzer.js';
7
+ import { FoundNamedDeclaration } from '../FoundDeclaration.js';
8
+ import { NamedDeclaration, TypeOrContainerWithTypes } from './Declarations.js';
9
+ import { SemanticContext } from './SemanticContext.js';
10
+ import { TryStatementContextKind } from './SemanticContextBase.js';
11
+ import { SemanticContextWithParent } from './SemanticContextWithParent.js';
12
+ import { OutermostSemanticContextOfSubprogram } from './SubprogramSemanticContext.js';
13
+ export declare abstract class SemanticContextValidatingNameConflictsBase extends SemanticContextWithParent implements ISemanticContextValidatingNameConflicts {
14
+ abstract readonly outer: SemanticContext;
15
+ abstract readonly node: tree.Node;
16
+ protected readonly _analyzer: Analyzer;
17
+ private readonly _memberEntities;
18
+ private _memberEntitiesByNameKey;
19
+ private readonly _namedDeclarations;
20
+ private readonly _typesOrContainerWithTypes;
21
+ private readonly _namedDeclarationsByName;
22
+ private readonly _typesOrContainerWithTypesByName;
23
+ private get memberEntities();
24
+ private get namedDeclarations();
25
+ private get typesOrContainerWithTypes();
26
+ private get namedDeclarationsByName();
27
+ private get typesOrContainerWithTypesByName();
28
+ constructor(analyzer: Analyzer);
29
+ protected abstract createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
30
+ protected abstract createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
31
+ getOwnTypesOrContainersWithTypes(_hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
32
+ getOwnTypesOrContainersWithTypesByName(name: SearchName, _hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<TypeOrContainerWithTypes>[];
33
+ getOwnNamedDeclarations(_noInstanceMembers?: boolean, _hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<NamedDeclaration>[];
34
+ getOwnNamedDeclarationsByName(name: SearchName, _noInstanceMembers?: boolean, _hidingMatcher?: IEntityHidingMatcher): readonly FoundNamedDeclaration<NamedDeclaration>[];
35
+ validateNameConflicts(diagnostics: DiagnosticAcceptor): void;
36
+ getMemberEntityDictionary(): ReadonlyMap<string, readonly MemberOfSemanticContextValidatingNameConflicts[]>;
37
+ private validateNestedFunctionsConflicts;
38
+ private areNestedFunctionSignaturesEqual;
39
+ private createNamedDeclarations;
40
+ private createTypesOrContainerWithTypes;
41
+ }
42
+ export type SubprogramTypeParameterSemanticContextParent = OutermostSemanticContextOfSubprogram;
43
+ export declare class SubprogramTypeParameterSemanticContext extends SemanticContextValidatingNameConflictsBase {
44
+ readonly kind = "subprogram-type-parameter";
45
+ readonly outer: SubprogramTypeParameterSemanticContextParent;
46
+ readonly node: tree.TypeParameterClause;
47
+ protected readonly asContext: SemanticContext;
48
+ constructor(analyzer: Analyzer, node: tree.TypeParameterClause, outer: SubprogramTypeParameterSemanticContextParent);
49
+ validateNameConflicts(diagnostics: DiagnosticAcceptor): void;
50
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
51
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
52
+ }
53
+ export type SubprogramParameterSemanticContextParent = SubprogramTypeParameterSemanticContext | OutermostSemanticContextOfSubprogram;
54
+ export declare abstract class SubprogramParameterSemanticContext extends SemanticContextValidatingNameConflictsBase {
55
+ readonly kind = "subprogram-parameter";
56
+ readonly outer: SubprogramParameterSemanticContextParent;
57
+ constructor(analyzer: Analyzer, outer: SubprogramParameterSemanticContextParent);
58
+ }
59
+ export declare class ExplicitSubprogramParameterSemanticContext extends SubprogramParameterSemanticContext {
60
+ readonly node: tree.ParameterList;
61
+ protected readonly asContext: SemanticContext;
62
+ constructor(analyzer: Analyzer, node: tree.ParameterList, outer: SubprogramParameterSemanticContextParent);
63
+ validateNameConflicts(diagnostics: DiagnosticAcceptor): void;
64
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
65
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
66
+ }
67
+ export type BlockSemanticContext = StatementBlockSemanticContext | FunctionBlockSemanticContext;
68
+ export type StatementBlockSemanticContextParent = StatementBlockSemanticContext | FunctionBlockSemanticContext | ForStatementSemanticContext | CatchClauseSemanticContext;
69
+ export declare class StatementBlockSemanticContext extends SemanticContextValidatingNameConflictsBase {
70
+ readonly kind = "statement-block";
71
+ readonly outer: StatementBlockSemanticContextParent;
72
+ readonly node: tree.StatementBlock;
73
+ protected readonly asContext: SemanticContext;
74
+ constructor(analyzer: Analyzer, node: tree.StatementBlock, outer: StatementBlockSemanticContextParent);
75
+ getTryStatementContext(): TryStatementContextKind | undefined;
76
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
77
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
78
+ }
79
+ export type FunctionBlockSemanticContextParent = SubprogramParameterSemanticContext | OutermostSemanticContextOfSubprogram | SpecialLocalDeclarationSemanticContext;
80
+ export declare class FunctionBlockSemanticContext extends SemanticContextValidatingNameConflictsBase {
81
+ readonly kind = "function-block";
82
+ readonly outer: FunctionBlockSemanticContextParent;
83
+ readonly node: tree.FunctionBlock;
84
+ protected readonly asContext: SemanticContext;
85
+ constructor(analyzer: Analyzer, node: tree.FunctionBlock, outer: FunctionBlockSemanticContextParent);
86
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
87
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
88
+ }
89
+ export type SpecialLocalDeclarationSemanticContextParent = SubprogramParameterSemanticContext | OutermostSemanticContextOfSubprogram;
90
+ export declare class SpecialLocalDeclarationSemanticContext extends SemanticContextValidatingNameConflictsBase {
91
+ readonly kind = "special-local-declaration";
92
+ readonly outer: SpecialLocalDeclarationSemanticContextParent;
93
+ readonly node: tree.FunctionBlock;
94
+ protected readonly asContext: SemanticContext;
95
+ constructor(analyzer: Analyzer, node: tree.FunctionBlock, outer: SpecialLocalDeclarationSemanticContextParent);
96
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
97
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
98
+ }
99
+ export declare class ForStatementSemanticContext extends SemanticContextValidatingNameConflictsBase {
100
+ readonly kind = "for-statement";
101
+ readonly outer: BlockSemanticContext;
102
+ readonly node: tree.ForStatement;
103
+ protected readonly asContext: SemanticContext;
104
+ constructor(analyzer: Analyzer, node: tree.ForStatement, outer: BlockSemanticContext);
105
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
106
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
107
+ }
108
+ export declare class CatchClauseSemanticContext extends SemanticContextValidatingNameConflictsBase {
109
+ readonly kind = "catch-clause";
110
+ readonly outer: BlockSemanticContext;
111
+ readonly node: tree.CatchClause;
112
+ protected readonly asContext: SemanticContext;
113
+ constructor(analyzer: Analyzer, node: tree.CatchClause, outer: BlockSemanticContext);
114
+ protected createMemberEntities(): readonly MemberOfSemanticContextValidatingNameConflicts[];
115
+ protected createMemberEntitiesForTypeLookup(): readonly MemberOfSemanticContextValidatingNameConflictsForTypeLookup[];
116
+ }
117
+ export type SemanticContextValidatingNameConflicts = StatementBlockSemanticContext | ForStatementSemanticContext | CatchClauseSemanticContext | SpecialLocalDeclarationSemanticContext | SubprogramParameterSemanticContext | SubprogramTypeParameterSemanticContext;
118
+ interface ISemanticContextValidatingNameConflicts {
119
+ validateNameConflicts(diagnostics: DiagnosticAcceptor): void;
120
+ getMemberEntityDictionary(): ReadonlyMap<string, readonly MemberOfSemanticContextValidatingNameConflicts[]>;
121
+ }
122
+ export type MemberOfSemanticContextValidatingNameConflicts = LocalVariableEntity | ParameterVariableEntity | NestedFunctionEntity | TypeParameterEntity;
123
+ export type MemberOfSemanticContextValidatingNameConflictsForTypeLookup = TypeParameterEntity;
124
+ export {};