Class ExternalCallRequest
One call to something that is not the workspace's own code: a standard-library member, a referenced
library's, a host application's object model, or a native export a Declare named.
public sealed record ExternalCallRequest : IEquatable<ExternalCallRequest>
- Inheritance
-
ExternalCallRequest
- Implements
- Inherited Members
Remarks
A growable record rather than a parameter list, so a new fact about a call — the policy decision that let it through, the reference it came from — gets a field here rather than a new parameter on every dispatcher.
Constructors
ExternalCallRequest(VBTypeMemberSymbol, IRuntimeValue[], SourceLocation, VBClassModuleSymbol?, ExternalObjectRequest?)
One call to something that is not the workspace's own code: a standard-library member, a referenced
library's, a host application's object model, or a native export a Declare named.
public ExternalCallRequest(VBTypeMemberSymbol Member, IRuntimeValue[] Arguments, SourceLocation CallSite = default, VBClassModuleSymbol? Creates = null, ExternalObjectRequest? Obtains = null)
Parameters
MemberVBTypeMemberSymbolThe member being called. Its ExternalTarget is what says which implementation to reach, and its own parameters say how to marshal the arguments.
ArgumentsIRuntimeValue[]The arguments, in the member's declared parameter order, including the receiver at index
0for a member of a class — the same shape Invoke(VBTypeMemberSymbol, ISymbolResolver, IRuntimeValue[]) takes, so a call site does not have to know which of the two will run it.CallSiteSourceLocationWhere the call is written. An external member that raises an error cannot know this for itself, and an error with no location is one no editor can point at.
CreatesVBClassModuleSymbolThe class of a referenced library that is being instantiated, when this is not a call to a member but the creation of an object (
New Excel.Application). Member is then theInitializeof the class's implicit interface, and the only argument is the new object, which the provider binds the real one to. Creating an object is an external call like any other, and exactly the one a policy wants to see.ObtainsExternalObjectRequestThe object being obtained by name, when this is neither a call to a member nor the creation of an object of a known class:
CreateObject,GetObject. Member is then theInitializeof the class's implicit interface, as for a creation, and there is no argument; what the call returns is the object.
Remarks
A growable record rather than a parameter list, so a new fact about a call — the policy decision that let it through, the reference it came from — gets a field here rather than a new parameter on every dispatcher.
Properties
Arguments
The arguments, in the member's declared parameter order, including the receiver at index
0 for a member of a class — the same shape Invoke(VBTypeMemberSymbol, ISymbolResolver, IRuntimeValue[]) takes, so a
call site does not have to know which of the two will run it.
public IRuntimeValue[] Arguments { get; init; }
Property Value
CallSite
Where the call is written. An external member that raises an error cannot know this for itself, and an error with no location is one no editor can point at.
public SourceLocation CallSite { get; init; }
Property Value
Creates
The class of a referenced library that is being instantiated, when this is not a call to a member but the creation of an object (New Excel.Application).
Member is then the Initialize of the class's implicit interface, and the only argument is the new object, which the provider binds the
real one to. Creating an object is an external call like any other, and exactly the one a policy wants to see.
public VBClassModuleSymbol? Creates { get; init; }
Property Value
IsAutomation
Whether this call is to a referenced library's object model - creating an object of one of its classes, or calling a member of one - which is what
an administrator means by automation, as distinct from the standard library and from a Declared import.
public bool IsAutomation { get; }
Property Value
IsCreation
Whether this call creates an object of a class, rather than calling a member of one.
public bool IsCreation { get; }
Property Value
IsLibraryImport
Whether this call is to a native library a Declare named — the calls an administrator most
wants a say over, since a library call is a way to run arbitrary code.
public bool IsLibraryImport { get; }
Property Value
Library
The library a Declare named, or null for a call that is not one.
public string? Library { get; }
Property Value
Member
The member being called. Its ExternalTarget is what says which implementation to reach, and its own parameters say how to marshal the arguments.
public VBTypeMemberSymbol Member { get; init; }
Property Value
Obtains
The object being obtained by name, when this is neither a call to a member nor the creation of an object of a known class: CreateObject, GetObject.
Member is then the Initialize of the class's implicit interface, as for a creation, and there is no argument; what the call returns is
the object.
public ExternalObjectRequest? Obtains { get; init; }
Property Value
Methods
Describe()
The call as one line, arguments included: what an interceptor logs, and what the verbose half of a refusal has to say so that a reader can tell which call was refused.
public string Describe()
Returns
Remarks
Names the library and the entry point a Declare actually reaches — its Alias when it has
one, since that is the exported name and the VBA name may be nothing like it.
ForCreation(VBClassModuleSymbol, IRuntimeValue, SourceLocation)
The request that creates an object of classModule.
public static ExternalCallRequest ForCreation(VBClassModuleSymbol classModule, IRuntimeValue created, SourceLocation callSite = default)
Parameters
classModuleVBClassModuleSymbolThe class of a referenced library to create an object of.
createdIRuntimeValueThe new object, which has no external object behind it yet.
callSiteSourceLocationWhere the creation is written.
Returns
ForObject(ExternalObjectRequest, SourceLocation)
The request that obtains an object by name (CreateObject, GetObject).
public static ExternalCallRequest ForObject(ExternalObjectRequest request, SourceLocation callSite = default)
Parameters
requestExternalObjectRequestHow the object is obtained.
callSiteSourceLocationWhere the call is written.