Table of Contents

Class DeclarationUsage

Namespace
RDCore.SDK.Semantics.Static
Assembly
RDCore.SDK.dll

Counts how the declarations of a module are used by its code, from the expression facts of its procedures, where the count is the whole truth.

public static class DeclarationUsage
Inheritance
DeclarationUsage
Inherited Members

Remarks

A fact is stated only when it is true, and a count of the references to a declaration is true only when every reference to it is among the ones counted. That takes two things, and a declaration that lacks either has no count (References is null):

  • Nothing outside the code analyzed can refer to it: a local, a parameter, a Private variable or constant. A Public or Friend declaration can be referred to from another module; a procedure, a property or an event is also called by convention (an event handler, a member that implements an interface) or by name at run time, which no expression says.
  • The code that could refer to it was analyzed completely (IsFullyAnalyzed): a procedure that has an error, or that the pass does not look into entirely, may refer to anything. For a local or a parameter that is its procedure; for a variable or a constant of the module, every procedure of it.

What is counted is each expression bound to the declaration: written to when it is flagged AssignmentTarget, passed as an argument that may be taken by reference when it is flagged PassedAsArgument, read otherwise.

Methods

DeclaredBy(IEnumerable<VBTypeMemberSymbol>)

Everything a module declares that Of(IEnumerable<Symbol>, IEnumerable<ProcedureSemanticModel>) states: its members, and the parameters and locals of each.

public static IEnumerable<Symbol> DeclaredBy(IEnumerable<VBTypeMemberSymbol> members)

Parameters

members IEnumerable<VBTypeMemberSymbol>

The members declared by the module.

Returns

IEnumerable<Symbol>

Of(IEnumerable<Symbol>, IEnumerable<ProcedureSemanticModel>)

Counts the references to declared by procedures.

public static ImmutableArray<DeclarationFact> Of(IEnumerable<Symbol> declared, IEnumerable<ProcedureSemanticModel> procedures)

Parameters

declared IEnumerable<Symbol>

The symbols the module declares, of which the variables, constants, parameters, procedures, properties and events are the declarations stated: its members, and the parameters and locals of its procedures. Whatever else is among them is not a declaration of one of those kinds, and is left out.

procedures IEnumerable<ProcedureSemanticModel>

The models of the procedures of the module.

Returns

ImmutableArray<DeclarationFact>

A fact for each declaration, in the order they are given.