Table of Contents

Class VBClassType

Namespace
RDCore.SDK.Model.Types.Complex
Assembly
RDCore.SDK.dll

Represents a class type that can be consumed by VB code, not necessarily defined in user code.

public record VBClassType : VBType, IEquatable<VBType>, IVBMemberOwnerType, IEquatable<VBClassType>
Inheritance
VBClassType
Implements
Derived
Inherited Members
Extension Methods

Constructors

VBClassType(VBClassModuleSymbol, ImmutableArray<VBTypeMemberSymbol>, bool)

Represents a class type that can be consumed by VB code, not necessarily defined in user code.

public VBClassType(VBClassModuleSymbol Symbol, ImmutableArray<VBTypeMemberSymbol> Members, bool IsHidden = false)

Parameters

Symbol VBClassModuleSymbol
Members ImmutableArray<VBTypeMemberSymbol>
IsHidden bool

Properties

DefaultMember

The default member of the class, if any.

public VBTypeMemberSymbol? DefaultMember { get; init; }

Property Value

VBTypeMemberSymbol

Remarks

Controlled by the VB_UserMemId attribute or @DefaultMember annotation.

DefaultValue

Gets the default value for this data type.

public override VBObjectValue DefaultValue { get; }

Property Value

VBObjectValue

Remarks

⚠️ Derived types must back the implementation of this property with a thread-safe private static readonly Lazy<T>. Failure to do so would lock up the static context initialization of the StaticSymbol symbols.

Members

Gets the members of this type.

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

Property Value

ImmutableArray<VBTypeMemberSymbol>

Supertypes

An array of class types that this class directly inherits from, including interfaces.

public VBType[] Supertypes { get; init; }

Property Value

VBType[]

Remarks

Every class always includes VBObjectType; Implements directives (MS-VBAL §5.2.4.2, via ImplementedInterfaces) each contribute one more, recursively (an interface's own Implements directives are included too — see FromClassModule(VBClassModuleSymbol)). Left at the default [VBObjectType.TypeInfo] for a VBClassType built any other way than through FromClassModule(VBClassModuleSymbol).

Symbol

public VBClassModuleSymbol Symbol { get; init; }

Property Value

VBClassModuleSymbol

Methods

CreateValue(IBindingHandle)

A variable declared as a class holds an object reference like one declared As Object: what makes it a reference to an instance of this class is the object, not the variable's value.

public override VBTypedValue CreateValue(IBindingHandle handle)

Parameters

handle IBindingHandle

Returns

VBTypedValue

FromClassModule(VBClassModuleSymbol)

Builds the class's own default interface — its Public, implicitly-public, and Friend members, the surface visible to a member-access expression typed against this class, whether the reference is Me or any other variable declared as this class. Friend counts as visible here because RDCore only ever composes one project's modules at a time (no referenced-project/library symbol provider exists yet) — anything resolving against a given composition is, by construction, same-project code, and MS-VBAL's Friend accessibility is visible project-wide, not just module-wide. Private members are reached, from inside the class's own code, only through ordinary lexical name resolution — never through member access — so they alone are excluded from Members here.

public static VBClassType FromClassModule(VBClassModuleSymbol classModule)

Parameters

classModule VBClassModuleSymbol

Returns

VBClassType

Remarks

Called exactly once per class, by WorkspaceSymbolResolver.Compose, to populate DefaultInterfaceMembers — not at resolution time.

Of(VBClassModuleSymbol)

The type a name resolved to a class module is: its precomputed default interface (DefaultInterfaceMembers, which is not built again) with what that interface does not carry - the interfaces the class implements, which an object of it may be Set to, and its default member, which indexing an object of it calls.

public static VBClassType Of(VBClassModuleSymbol classModule)

Parameters

classModule VBClassModuleSymbol

The class module, as the composition has it.

Returns

VBClassType

WithMembers(IEnumerable<VBTypeMemberSymbol>)

Gets a copy of this type with the specified members.

public IVBMemberOwnerType WithMembers(IEnumerable<VBTypeMemberSymbol> members)

Parameters

members IEnumerable<VBTypeMemberSymbol>

The members of the new type.

Returns

IVBMemberOwnerType