Table of Contents

Class VBClassModuleSymbol

Namespace
RDCore.SDK.Model.Symbols
Assembly
RDCore.SDK.dll

An unbound symbol representing a class module.

public record VBClassModuleSymbol : VBModuleSymbol, IEquatable<Symbol>, IEquatable<VBModuleSymbol>, IEquatable<VBClassModuleSymbol>
Inheritance
VBClassModuleSymbol
Implements
Inherited Members
Extension Methods

Constructors

VBClassModuleSymbol(Uri, Uri, string)

Creates a new class module of the specified kind.

public VBClassModuleSymbol(Uri workspaceRoot, Uri parentUri, string name)

Parameters

workspaceRoot Uri

A Uri representing the absolute path to the library or project workspace.

parentUri Uri

The Uri of the parent symbol.

name string

The name of the symbol.

Properties

AutomationKind

Whether a live instance of this class is COM Automation-capable (IDispatch) or IUnknown-only. Defaults to Dispatch — true of every RD-VBA class module today; Unknown is groundwork for a future external/COM reference kind, not constructed anywhere yet.

public VBAutomationKind AutomationKind { get; init; }

Property Value

VBAutomationKind

DefaultInterfaceMembers

This class's default interface (MS-VBAL's own term) — the members reachable through a member-access expression typed against this class, whether through Me or any other variable declared as this class. A pure function of Members (FromClassModule(VBClassModuleSymbol) computes it), fixed the moment the class's own member list is known — populated exactly once, alongside Members, by WorkspaceSymbolResolver.Compose's second pass. Consumers (New, As-type clauses, Me) read this directly rather than recomputing it at resolution time.

public ImmutableArray<VBTypeMemberSymbol> DefaultInterfaceMembers { get; init; }

Property Value

ImmutableArray<VBTypeMemberSymbol>

Events

The events this class declares (MS-VBAL §5.2.4.3).

public IEnumerable<VBEventMemberSymbol> Events { get; }

Property Value

IEnumerable<VBEventMemberSymbol>

ImplementedInterfaceNames

The interface names named by this class module's own Implements directives (MS-VBAL §5.2.4.2), exactly as written — unresolved, and not yet checked for validity (self-reference, duplicates, or a name that doesn't resolve to a class at all). Captured directly off the AST, alongside Symbols.Abstract.VBModuleSymbol.Directives, in WorkspaceSymbolResolver.Compose's first pass — before any other module's symbol is known, so resolving these to real VBClassModuleSymbol references has to wait for ImplementedInterfaces.

public ImmutableArray<string> ImplementedInterfaceNames { get; init; }

Property Value

ImmutableArray<string>

ImplementedInterfaceRanges

Where each of ImplementedInterfaceNames is written in the source: the range of its Implements directive, one for each name and in the same order. Empty for a symbol that was not read from source, whose directives have no location; what is reported of one is then reported at the module.

public ImmutableArray<SourceRange> ImplementedInterfaceRanges { get; init; }

Property Value

ImmutableArray<SourceRange>

ImplementedInterfaces

ImplementedInterfaceNames, resolved to the sibling VBClassModuleSymbol each name refers to — populated by a third pass in WorkspaceSymbolResolver.Compose, once every module in the composition has its own symbol built. A name that doesn't resolve to a class in this composition (or that resolves back to this same class) is silently dropped rather than reported — full MS-VBAL §5.2.4.2/§5.3.1.9 validity checking is not modeled yet.

public ImmutableArray<VBClassModuleSymbol> ImplementedInterfaces { get; init; }

Property Value

ImmutableArray<VBClassModuleSymbol>

Remarks

FromClassModule(VBClassModuleSymbol) reads this to populate Supertypes — every consumer of that type gets a correct Supertypes array for free once this is resolved, with no other code to update.

What is assigned is what the source declares. What is read also has what the language implements for every class module, first: ClassLifecycleInterface, whose members are Initialize and Terminate. It is an interface of the module like any other, which is why whatever builds a list of the interfaces a module implements — an editor's dropdown among them — finds it there. Its members have an implementation of their own (DefaultImplementation), so a module that writes no handler still implements every one of them, as MS-VBAL §5.3.1.9 requires. It is still not a name workspace code can refer to.

ImplementsLifecycle

Whether the language implements ClassLifecycleInterface for this module, which it does for every class module but that interface itself.

public bool ImplementsLifecycle { get; init; }

Property Value

bool

WithEventsVariables

The WithEvents variables this class declares (MS-VBAL §5.2.3.1.2).

public IEnumerable<VBTypeMemberSymbol> WithEventsVariables { get; }

Property Value

IEnumerable<VBTypeMemberSymbol>

Methods

FindEvent(string)

The event of this class named name, or null when it declares none.

public VBEventMemberSymbol? FindEvent(string name)

Parameters

name string

The event name, compared without regard to case.

Returns

VBEventMemberSymbol

FindEventHandler(VBTypeMemberSymbol, VBEventMemberSymbol)

The procedure of this class that handles handled for variable (MS-VBAL §5.3.1.8): the one named VariableName_EventName.

public VBProcedureMemberSymbol? FindEventHandler(VBTypeMemberSymbol variable, VBEventMemberSymbol handled)

Parameters

variable VBTypeMemberSymbol

A WithEvents variable of this class.

handled VBEventMemberSymbol

An event of the class that is the variable's declared type.

Returns

VBProcedureMemberSymbol

The handler, or null when this class does not handle the event.

Remarks

Whether it is a valid handler - a subroutine, with a parameter list compatible with the event's - is not decided here: this is only the procedure that is named like one.

FindImplementation(VBClassModuleSymbol, VBTypeMemberSymbol)

The member of this class that implements interfaceMember of implemented (MS-VBAL §5.3.1.9): the declaration named InterfaceName_MemberName, whatever its access, of the kind the member calls for.

public VBTypeMemberSymbol? FindImplementation(VBClassModuleSymbol implemented, VBTypeMemberSymbol interfaceMember)

Parameters

implemented VBClassModuleSymbol

An interface this class implements, explicitly or implicitly.

interfaceMember VBTypeMemberSymbol

A member of implemented.

Returns

VBTypeMemberSymbol

The implementing declaration, or null when this class does not implement the member.

Remarks

A subroutine is implemented by a subroutine, a function by a function, and each property accessor by the same accessor. A public variable is implemented by property declarations; the one this finds is its Property Get, which is what reading the variable through the interface invokes.

FindImplementation(VBClassModuleSymbol, VBTypeMemberSymbol, ImplementationAccess)

The member of this class that implements interfaceMember of implemented (MS-VBAL §5.3.1.9): the declaration named InterfaceName_MemberName, whatever its access, of the kind the member calls for.
public VBTypeMemberSymbol? FindImplementation(VBClassModuleSymbol implemented, VBTypeMemberSymbol interfaceMember, ImplementationAccess access)

Parameters

implemented VBClassModuleSymbol

An interface this class implements, explicitly or implicitly.

interfaceMember VBTypeMemberSymbol

A member of implemented.

access ImplementationAccess

What is done to interfaceMember, when it is a variable.

Returns

VBTypeMemberSymbol

Remarks

A public variable of the interface is implemented by property declarations, and which of them is access: reading the variable invokes the Property Get, assigning it the Property Let, and Set-assigning it the Property Set. Any other member is implemented by one declaration, and access is not asked of it.

IsImplemented(VBClassModuleSymbol, VBTypeMemberSymbol)

Whether this class implements interfaceMember of implemented (MS-VBAL §5.3.1.9): it has the procedure for it (FindImplementation(VBClassModuleSymbol, VBTypeMemberSymbol)), or the member has an implementation of its own (DefaultImplementation). What a check that an Implements directive is complete asks, of each member of the interface.

public bool IsImplemented(VBClassModuleSymbol implemented, VBTypeMemberSymbol interfaceMember)

Parameters

implemented VBClassModuleSymbol

An interface this class implements, explicitly or implicitly.

interfaceMember VBTypeMemberSymbol

A member of implemented.

Returns

bool