Class StdLibSymbolReader
Reads the standard library's symbols off the SDK declarations that define it — the interfaces and enumerations in RDCore.SDK.Runtime.Abstract.StdLib marked with StdLibModuleAttribute, StdLibClassAttribute and StdLibEnumAttribute.
public sealed class StdLibSymbolReader
- Inheritance
-
StdLibSymbolReader
- Inherited Members
Remarks
The declarations are the single source of truth: a module's members, their names, their parameters
and their return types are all read back off the signature an implementation has to satisfy, so the
symbol a workspace resolves and the method the runtime invokes cannot drift apart. What a signature
cannot express — an accessor kind, a $-suffixed name, a class or enumeration return type — is
stated by StdLibMemberAttribute.
🚧 A member whose declared type is another standard-library class resolves only because
classes are read before the modules that return them, which is enough for
Information.Err() As ErrObject. The RegExp family is mutually referential
(Execute returns a MatchCollection of Match, each with SubMatches), so
TODO: order class completion topologically, with a cycle guard, once those classes declare their
members.
Constructors
StdLibSymbolReader(Uri, Uri?, bool)
Creates the reader.
public StdLibSymbolReader(Uri workspaceRoot, Uri? globalsOwnerUri = null, bool is64Bit = true)
Parameters
workspaceRootUriThe workspace the symbols are addressed under. Standard-library symbols are not of the workspace, but every Symbol is addressed relative to one.
globalsOwnerUriUriThe standard module a predefined enum is declared in. The library's enums belong to no module of MS-VBAL's own description, but a declaration has to be somewhere for both halves of it to resolve: a standard module's public members reach the project scope, which is the tier a type reference and an unqualified enum constant are both looked up in. Defaults to
workspaceRoot, which leaves them in the global scope — where the constants still resolve, but the enum's own name is not a type reference.is64BitboolThe pointer width of the environment the symbols are for, which is the one thing a declaration cannot state:
LongPtris a different type in each (MS-VBAL §3.3.2), soConversion.CLngPtr's return type is not knowable from its signature alone. Defaults totrue, matchingSdkEnvironmentOptions.Is64Bit's own default — the one configured value both the language server and the environment host derive their profile from, so this is that setting rather than a second opinion about it.
Methods
ExternalTargetOf(Type, MethodInfo)
Reads every standard-library declaration an assembly exports.
public static string ExternalTargetOf(Type declaringType, MethodInfo method)
Parameters
declaringTypeTypeThe
IStd*interface declaring the member.methodMethodInfoThe method declaring the member.
Returns
Remarks
The reader is what defines the format, because the reader is what stamps it - a dispatcher that built its own key format could disagree with this one and nothing would say so until a call went to the wrong member.
Arity is part of the key because a property's two accessors are C# overloads of one name -
Description() and Description(value) - and nothing else about them differs. Two members
of one interface sharing a name and an arity would collide, which a dispatcher building its
table is expected to detect rather than dispatch one of them to the other.
Read(IEnumerable<Type>)
Reads the given standard-library declarations.
public ImmutableArray<Symbol> Read(IEnumerable<Type> declarations)
Parameters
declarationsIEnumerable<Type>The marked interfaces and enumerations. Anything unmarked is ignored, so this may be handed a whole assembly's types.
Returns
Exceptions
- InvalidOperationException
A marked declaration is not expressible as a VBA symbol — a parameter or return type that is neither an intrinsic value nor a marked enumeration or class, or an element type stated for a parameter that is not a required ByVal array. That is a mistake in the declaration rather than a condition to degrade over: the symbol it would produce would be declared as a type nothing can bind.
Read(Assembly)
public ImmutableArray<Symbol> Read(Assembly assembly)
Parameters
assemblyAssembly