Class DeclarationFact
What the static pass found out about a declaration.
public sealed record DeclarationFact : IEquatable<DeclarationFact>
- Inheritance
-
DeclarationFact
- Implements
- Inherited Members
Remarks
A fact is stated only when it is true. The code the pass analyzed is every module of the project, so a declaration that another module can refer to is counted over all of them.
Some declarations are referred to by code the pass did not analyze, or by code that does not name them:
- a declaration that the projects referencing this one can refer to: a
Publicmember of a standard module withoutOption Private Module, or of a class that another project can use; - a declaration called by convention or through the object it is a member of: an event handler, a member that implements an interface;
- a declaration named in a string, or reached by a member access that is bound only when the code runs.
Their references are not counted: References is then null, which says the references are not known and not that there are none.
Constructors
DeclarationFact(SemanticId, string, DeclarationKind, AccessModifier, bool, SourceLocation, DeclarationReferences?)
What the static pass found out about a declaration.
public DeclarationFact(SemanticId Symbol, string Name, DeclarationKind Kind, AccessModifier Access, bool IsImplicit, SourceLocation Location, DeclarationReferences? References)
Parameters
SymbolSemanticIdThe identity of the declared symbol.
NamestringThe name it is declared with.
KindDeclarationKindWhat it declares.
AccessAccessModifierWho can refer to it besides the module's own code.
IsImplicitboolWhether it was never declared: it came into being because something referred to it, which is legal and worth reporting.
LocationSourceLocationWhere it is declared.
ReferencesDeclarationReferences?Every reference to it, when every reference to it is in the code that was analyzed and was analyzed completely; null otherwise.
Remarks
A fact is stated only when it is true. The code the pass analyzed is every module of the project, so a declaration that another module can refer to is counted over all of them.
Some declarations are referred to by code the pass did not analyze, or by code that does not name them:
- a declaration that the projects referencing this one can refer to: a
Publicmember of a standard module withoutOption Private Module, or of a class that another project can use; - a declaration called by convention or through the object it is a member of: an event handler, a member that implements an interface;
- a declaration named in a string, or reached by a member access that is bound only when the code runs.
Their references are not counted: References is then null, which says the references are not known and not that there are none.
Properties
Access
Who can refer to it besides the module's own code.
public AccessModifier Access { get; init; }
Property Value
AutoInstantiates
The class whose object the variable is given where code first uses it, for a variable declared As New, or an array whose elements are
(MS-VBAL §5.2.3.1.4): Classes says what is known of creating its objects. null
for any other declaration.
public SemanticId? AutoInstantiates { get; init; }
Property Value
CompiledOn
For a procedure declared by a Declare statement (MS-VBAL §5.2.3.5), the platforms it is declared on: the union of those of
each of its statements (StatementsCompiledOn).
public CompiledPlatforms? CompiledOn { get; init; }
Property Value
Remarks
A procedure written once in each branch of a #If is one procedure, which each platform declares with the statement of its own live branch. A
statement compiled on every platform calls its one library whatever the platform; a procedure declared on every platform by several statements, each
on some of them, does not: each platform calls the library of its own statement.
The host finds it by evaluating the module's #If and #ElseIf conditions once for each platform of
Each, with the predefined constants of that platform
(Of(IRuntimeEnvironmentProfile)) and every other constant as
the session has it: not only under the constants of the session that analyzed the code, which are those of the one platform it runs on.
null for any other declaration, and where a condition one of its statements depends on cannot be evaluated.
DeclaredBy
How a local variable came to be declared: a Dim or a Static statement, a ReDim statement whose name matched nothing
(MS-VBAL §5.4.3.3), or a reference to a name that matched nothing (§5.6.10). null for any other declaration.
public LocalDeclarationKind? DeclaredBy { get; init; }
Property Value
Hides
What the declaration hides: what its name would mean where the declaration is in scope, had it not been declared (MS-VBAL §5.6.10
matches a name in the procedure first, then in the module, then in the project and the libraries it references). A local or a parameter hides what
the name means in the rest of the module; a declaration of a module can hide one of another module or of a library (Public Function Replace
hides VBA.Strings.Replace). null when the name means nothing else, or when the host does not look for what the declaration hides.
public HiddenDeclaration? Hides { get; init; }
Property Value
IsArray
Whether it is declared as an array: with bounds, with an empty list of them (Dim a() As Long), or by a ReDim statement
(MS-VBAL §5.4.3.3). TypeKind is then the kind of its elements' type. A Variant that holds an array is not one.
public bool IsArray { get; init; }
Property Value
IsImplicit
Whether it was never declared: it came into being because something referred to it, which is legal and worth reporting.
public bool IsImplicit { get; init; }
Property Value
Kind
What it declares.
public DeclarationKind Kind { get; init; }
Property Value
Location
Where it is declared.
public SourceLocation Location { get; init; }
Property Value
Name
The name it is declared with.
public string Name { get; init; }
Property Value
ReferencedFrom
Each reference to the declaration, in any module of the project: one for each that References counts. null exactly when References is.
public ImmutableArray<DeclarationReference>? ReferencedFrom { get; init; }
Property Value
References
Every reference to it, when every reference to it is in the code that was analyzed and was analyzed completely; null otherwise.
public DeclarationReferences? References { get; init; }
Property Value
Role
What the declaration is there for, when it implements a member of an interface, handles an event, or is the project's entry point. A role is stated only for a member of a class module whose interfaces and event sources the pass resolved, and for the entry point of a project that has one; None is not a statement that it has none otherwise.
public DeclarationRole Role { get; init; }
Property Value
StatementsCompiledOn
For a procedure declared by Declare statements (MS-VBAL §5.2.3.5), the platforms each of them is compiled on, in the order they
are written: those whose predefined conditional-compilation constants make live the #If branch the statement is written in
(MS-VBAL §3.4.2). All for a statement outside any #If block.
public ImmutableArray<CompiledPlatforms> StatementsCompiledOn { get; init; }
Property Value
Remarks
One element for a procedure that one statement declares; one for each statement of a procedure written once in each branch of a #If, whose
CompiledOn is their union. The host finds them as it finds CompiledOn. Default for any other declaration, and where
CompiledOn is null.
Symbol
The identity of the declared symbol.
public SemanticId Symbol { get; init; }
Property Value
TypeKind
The kind of type it is declared as, or for an array the kind of its elements' type (IsArray): the type its As clause names, the
type a type-declaration character or a DefType directive gives it, or Variant (MS-VBAL §5.2.3.1.4,
§5.2.3.1.5). For a function or a property, the type it returns. null for a declaration that has no type (a
Sub, an Event), and for one whose type did not resolve.
public DeclaredTypeKind? TypeKind { get; init; }