Class StdLibSymbolProvider
The symbols of the standard library and of the objects the language environment provides globally — everything a name in VBA source can resolve to without the workspace declaring it.
public sealed class StdLibSymbolProvider : ISymbolProvider
- Inheritance
-
StdLibSymbolProvider
- Implements
- Inherited Members
Remarks
Without these, every standard-library name is unbound, and an unbound name in a module with no
Option Explicit is a declaration (MS-VBAL §5.6.10) — so Debug.Print x
would quietly declare a local called Debug. Resolution is what stops that, which is why this
exists before anything here is callable.
The standard library itself is read off the declarations that define it, by
StdLibSymbolReader, and is provided unconditionally: every VBA project has it whether
or not a .rdproj mentions it (RD-VBAL §6.1), so there is nothing to opt into
and nothing to reference.
Debug is synthesized here instead, because nothing declares it: it is not in
MS-VBAL's standard library at all (§6.1 has no Debug), it is provided by the host's own
development environment, and it has exactly two members.
Constructors
StdLibSymbolProvider(Uri, bool)
Creates the provider.
public StdLibSymbolProvider(Uri workspaceRoot, bool is64Bit = true)
Parameters
workspaceRootUriThe workspace the symbols are addressed under. Library symbols are not of the workspace, but every Symbol is addressed relative to one, so they share its root and hang off the global scope rather than off a module.
is64BitboolThe pointer width of the environment these symbols are for —
LongPtris a different type in each, soConversion.CLngPtr's return type depends on it. Defaults totrue, matchingSdkEnvironmentOptions.Is64Bit's own default.
Fields
AssertMemberName
Debug.Assert: enters break mode when its expression is False.
public const string AssertMemberName = "Assert"
Field Value
DebugObjectName
The name of the object the development environment exposes for diagnostic output.
public const string DebugObjectName = "Debug"
Field Value
GlobalModuleName
The name of the synthetic module every global the language environment provides hangs off.
public const string GlobalModuleName = "_Global"
Field Value
Remarks
A leading underscore is not a legal VBA identifier, so no source can name this module and no workspace module can collide with it — which is the whole reason for the spelling. It is a standard module, so its members are promoted to the project scope and resolve unqualified, the way a standard library's members do.
It also gives a global object's class somewhere to be parented that is not the global
scope itself. That matters: a predeclared instance is named after its class, so a class parented
to the global scope has the very same Uri as its own instance, and the name then resolves
to neither of them.
LibraryName
The name of the project the standard library is.
public const string LibraryName = "VBA"
Field Value
Remarks
It is what a project-qualified reference to the library names — VBA.Strings.LenB, VBA.LenB
(MS-VBAL §5.6.12). It is the same in every dialect: VB6 loads the very same VBA library, and what
it calls VB is the runtime library of its ActiveX controls, which is not this one. Where a dialect has more or fewer
members than another, the members are what say so, not the name of the library.
PrintMemberName
Debug.Print: writes an output list to the environment's own output
(MS-VBAL §5.4.5.8's rules, against no file).
public const string PrintMemberName = "Print"
Field Value
Methods
ProvideSymbols()
Yields the symbols this provider's source defines. May be lazy.
public IEnumerable<Symbol> ProvideSymbols()