Class VBPredeclaredInstanceSymbol
The default instance variable of a class module whose VB_PredeclaredId attribute is
True (MS-VBAL §5.2.4.1.2): a variable named after the class, declared as that
class, created with module extent as if declared As New — that is, an automatic instantiation
variable (AutoInstantiated, §2.5.1) — without any code
declaring it, so the class name itself can be used as if it were an automatic instantiation variable,
the way UserForm1.Show names a form's default instance.
public sealed record VBPredeclaredInstanceSymbol : BoundTypedSymbol, IEquatable<Symbol>, IEquatable<WorkspaceSymbol>, ITypedSymbol, IEquatable<BoundTypedSymbol>, IEquatable<VBPredeclaredInstanceSymbol>
- Inheritance
-
VBPredeclaredInstanceSymbol
- Implements
- Inherited Members
Remarks
A class module never binds as a name in the default binding context: its predeclared instance does
(ISymbolResolver.ResolveValue). The class itself is still what an As clause or the
operand of New names, in the type binding context. The variable is global rather than local to
its class module — RD-VBAL §3.1.1.5 calls it a global auto-object.
It is invalid for this variable to be the target of a Set assignment
(§5.2.4.1.2); StatementStaticSemanticsEvaluator reports it.
Only the static side is modeled: the variable's declared type. That the variable is never
Nothing — it is re-created the next time it is referred to — is a run-time concern.
Constructors
VBPredeclaredInstanceSymbol(VBClassModuleSymbol)
Creates the default instance variable of classModule.
public VBPredeclaredInstanceSymbol(VBClassModuleSymbol classModule)
Parameters
classModuleVBClassModuleSymbolThe class module this is the default instance of.
Properties
ClassModule
The class module this is the default instance of.
public VBClassModuleSymbol ClassModule { get; init; }