Interface IObjectInstance
Represents a single live object instance — a class module's activation record, owning the storage for every instance field it declares (RD-VBAL §2.3.1.2's instance heap tier). Two instances of the same class module never share a field's storage: each gets its own independent binding, exactly as two activations of the same procedure never share a local's storage on ICallStackFrame.
public interface IObjectInstance
Remarks
⚠️ An IObjectInstance is not immutable: the value retrieved for a given
field may be different at a subsequent retrieval. Its lifetime is tracked separately, by
ISessionObjects and the VBRuntimeObjectId it was created for.
Properties
ClassModule
The VBClassModuleSymbol this is an instance of.
VBClassModuleSymbol ClassModule { get; }
Property Value
ObjectId
The identity ISessionObjects tracks this instance's lifetime under.
VBRuntimeObjectId ObjectId { get; }
Property Value
StaticLocals
The Static locals of the members of the class that this instance holds: the ones of the members called on it so far, which go with it, and
let go of the objects they hold when it does.
IReadOnlyCollection<Symbol> StaticLocals { get; }
Property Value
Methods
GetValue(Symbol)
Gets the IBindingHandle currently held on this instance for the specified instance field Symbol.
IBindingHandle GetValue(Symbol field)
Parameters
fieldSymbol
Returns
Exceptions
- KeyNotFoundException
No binding exists for
fieldon this instance.
Push(Symbol, VBTypedValue)
Declares field on this instance and reserves storage sized for
value, its initial value — the class's declared type default for a freshly
created instance.
void Push(Symbol field, VBTypedValue value)
Parameters
fieldSymbolA field of the class; or a
Staticlocal of one of its members, which the first call of the member on this instance declares: as in MS-VBA, each object has its own, where MS-VBAL §5.4.3.1 gives aStaticlocal module extent.valueVBTypedValueThe initial value.
Exceptions
- InvalidOperationException
fieldis already declared on this instance.
TryGetAddress(Symbol, out MemoryAddress)
Gets the address this instance reserved for the specified instance field Symbol, if any: what a
ByRef argument that names the field is aliased to.
bool TryGetAddress(Symbol field, out MemoryAddress address)
Parameters
fieldSymboladdressMemoryAddress
Returns
TryResolve(Symbol, out IBindingHandle?)
Gets the IBindingHandle currently held on this instance for the specified instance field Symbol, if any.
bool TryResolve(Symbol field, out IBindingHandle? value)
Parameters
fieldSymbolvalueIBindingHandle