C# (CSharp) Microsoft.Scripting.Actions.Calls Namespace

Сlasses

Name Description
ArgBuilder ArgBuilder provides an argument value used by the MethodBinder. One ArgBuilder exists for each physical parameter defined on a method. Contrast this with ParameterWrapper which represents the logical argument passed to the method.
BindingTarget Encapsulates the result of an attempt to bind to one or methods using the OverloadResolver. Users should first check the Result property to see if the binding was successful or to determine the specific type of failure that occured. If the binding was successful MakeExpression can then be called to create an expression which calls the method. If the binding was a failure callers can then create a custom error message based upon the reason the call failed.
ByRefReturnBuilder
DefaultArgBuilder ArgBuilder which provides a default parameter value for a method call.
InferenceResult Provides information about the result of a custom object which dynamically infers back types. Currently only used for invokable objects to feedback the types for a delegate type.
KeywordArgBuilder ArgBuilder which provides a value for a keyword argument. The KeywordArgBuilder calculates its position at emit time using it's initial offset within the keyword arguments, the number of keyword arguments, and the total number of arguments provided by the user. It then delegates to an underlying ArgBuilder which only receives the single correct argument. Delaying the calculation of the position to emit time allows the method binding to be done without knowing the exact the number of arguments provided by the user. Hence, the method binder can be dependent only on the set of method overloads and keyword names, but not the user arguments. While the number of user arguments could be determined upfront, the current MethodBinder does not have this design.
KeywordConstructorReturnBuilder Updates fields/properties of the returned value with unused keyword parameters.
MethodCandidate MethodCandidate represents the different possible ways of calling a method or a set of method overloads. A single method can result in multiple MethodCandidates. Some reasons include: - Every optional parameter or parameter with a default value will result in a candidate - The presence of ref and out parameters will add a candidate for languages which want to return the updated values as return values. - ArgumentKind.List and ArgumentKind.Dictionary can result in a new candidate per invocation since the list might be different every time. Each MethodCandidate represents the parameter type for the candidate using ParameterWrapper.
OverloadInfo
OverloadResolver Provides binding and overload resolution to .NET methods. MethodBinder's can be used for: generating new AST code for calling a method calling a method via reflection at runtime (not implemented) performing an abstract call MethodBinder's support default arguments, optional arguments, by-ref (in and out), and keyword arguments. Implementation Details: The MethodBinder works by building up a CandidateSet for each number of effective arguments that can be passed to a set of overloads. For example a set of overloads such as: foo(object a, object b, object c) foo(int a, int b) would have 2 target sets - one for 3 parameters and one for 2 parameters. For parameter arrays we fallback and create the appropriately sized CandidateSet on demand. Each CandidateSet consists of a set of MethodCandidate's. Each MethodCandidate knows the flattened parameters that could be received. For example for a function such as: foo(params int[] args) When this method is in a CandidateSet of size 3 the MethodCandidate takes 3 parameters - all of them ints; if it's in a CandidateSet of size 4 it takes 4 parameters. Effectively a MethodCandidate is a simplified view that allows all arguments to be treated as required positional arguments. Each MethodCandidate in turn refers to a MethodTarget. The MethodTarget is composed of a set of ArgBuilder's and a ReturnBuilder which know how to consume the positional arguments and pass them to the appropriate argument of the destination method. This includes routing keyword arguments to the correct position, providing the default values for optional arguments, etc... After binding is finished the MethodCandidates are thrown away and a BindingTarget is returned. The BindingTarget indicates whether the binding was successful and if not any additional information that should be reported to the user about the failed binding. It also exposes the MethodTarget which allows consumers to get the flattened list of required parameters for the call. MethodCandidates are not exposed and are an internal implementation detail of the MethodBinder.
ParameterMapping
ParamsArgBuilder
ParamsDictArgBuilder Builds the parameter for a params dictionary argument - this collects all the extra name/value pairs provided to the function into a SymbolDictionary which is passed to the function.
ReferenceArgBuilder An argument that the user wants to explicitly pass by-reference (with copy-in copy-out semantics). The user passes a StrongBox[T] object whose value will get updated when the call returns.
ReflectionOverloadInfo Represents a method overload that is bound to a T:System.Reflection.MethodBase.
ReturnReferenceArgBuilder Builds a parameter for a reference argument when a StrongBox has not been provided. The updated return value is returned as one of the resulting return values.
SimpleArgBuilder SimpleArgBuilder produces the value produced by the user as the argument value. It also tracks information about the original parameter and is used to create extended methods for params arrays and param dictionary functions.
TypeInferer
TypeInferer.ArgumentInputs Maps a single type parameter to the possible parameters and DynamicMetaObjects we can get inference from. For example for the signature: void Foo{T0, T1}(T0 x, T1 y, IList{T1} z); We would have one ArgumentInput for T0 which holds onto the DMO providing the argument value for x. We would also have one ArgumentInput for T1 which holds onto the 2 DMOs for y and z. Associated with y would be a GenericParameterInferer and associated with z would be a ConstructedParameterInferer.