Interface ISessionSymbols
The symbol table of an execution session: defines and resolves symbols by scope.
public interface ISessionSymbols
Properties
Resolver
The read face over this table — resolves a name visible from a scope by walking the scope tree the currently-defined symbols form (tracks later TryDefine(Symbol, ScopeKind) calls), and reads the live run-time binding a defined symbol was allocated, if any.
ISymbolResolver Resolver { get; }
Property Value
Methods
CreateFrame(SyntaxNodeId, StaticSymbol)
Creates a new, empty ICallStackFrame for an activation of
procedure, wired to this session's value storage. The caller
Push(Symbol, VBTypedValue)es each parameter and Dim local it declares, then
pushes the frame onto CallStack to make them resolvable.
ICallStackFrame CreateFrame(SyntaxNodeId nodeId, StaticSymbol procedure)
Parameters
nodeIdSyntaxNodeIdThe
Identityof the call-site node this activation is for.procedureStaticSymbolThe StaticSymbol identifying the procedure being activated.
Returns
CreateInstance(VBRuntimeObjectId, VBClassModuleSymbol)
Creates a new IObjectInstance for a freshly-created object of
classModule, allocating storage for every instance field the class declares
(RD-VBAL §2.3.1.2's instance heap tier) and registering it for later lookup by
objectId. This only allocates the instance's field storage — the object's
reference-counted lifetime is tracked separately, by Objects.
IObjectInstance CreateInstance(VBRuntimeObjectId objectId, VBClassModuleSymbol classModule)
Parameters
objectIdVBRuntimeObjectIdThe object's identity, minted by CreateObject().
classModuleVBClassModuleSymbolThe class module being instantiated.
Returns
DestroyInstance(VBRuntimeObjectId)
Frees every field objectId's instance allocated and forgets it. Called once
the object's reference count reaches zero and TryRemoveObject(VBRuntimeObjectId)
succeeds.
bool DestroyInstance(VBRuntimeObjectId objectId)
Parameters
objectIdVBRuntimeObjectId
Returns
- bool
falseif no instance is registered forobjectId.
TryDefine(Symbol, ScopeKind)
Defines symbol in the given scope. A program-lifetime
declaration — a standard module's or the global scope's field or variable — is allocated
storage immediately, reachable afterwards through Resolver's GetValue.
bool TryDefine(Symbol symbol, ScopeKind scope)
Parameters
Returns
- bool
trueif the symbol was added;falseif it was already defined in that scope.
TryGetInstance(VBRuntimeObjectId, out IObjectInstance?)
Gets the IObjectInstance registered for objectId, if any —
e.g. to resolve a member-access expression's target once objectId is known
from evaluating the object reference it was accessed through.
bool TryGetInstance(VBRuntimeObjectId objectId, out IObjectInstance? instance)
Parameters
objectIdVBRuntimeObjectIdinstanceIObjectInstance
Returns
TryResolve(string, Symbol, out Symbol?)
Resolves name visible from scope.
bool TryResolve(string name, Symbol scope, out Symbol? symbol)