C# Класс IronPython.Runtime.Binding.MetaPythonFunction.FunctionBinderHelper

Performs the actual work of binding to the function. Overall this works by going through the arguments and attempting to bind all the outstanding known arguments - position arguments and named arguments which map to parameters are easy and handled in the 1st pass for GetArgumentsForRule. We also pick up any extra named or position arguments which will need to be passed off to a kw argument or a params array. After all the normal args have been assigned to do a 2nd pass in FinishArguments. Here we assign a value to either a value from the params list, kw-dict, or defaults. If there is ambiguity between this (e.g. we have a splatted params list, kw-dict, and defaults) we call a helper which extracts them in the proper order (first try the list, then the dict, then the defaults).
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
AddCheckForNoExtraParameters void
AddInitialization Expression
EnsureInit void
EnsureParams void
ExtractDefaultValue Expression
ExtractDictionaryArgument Expression
ExtractFromListOrDictionary Expression
ExtractNextParamsArg Expression
ExtractNonDefaultValue Expression
FinishArguments bool
GetArgumentsForRule Expression[]
GetArgumentsForTargetType Expression[]
GetComplexRestriction BindingRestrictions
GetFunctionParam UnaryExpression
GetRestrictions BindingRestrictions
GetSimpleRestriction BindingRestrictions
MakeDictionary Expression
MakeDictionaryAddition void
MakeDictionaryCopy DynamicMetaObject
MakeFunctionInvoke Expression
MakeParamsAddition void
MakeParamsCopy void
MakeParamsTuple Expression
MakeUnexpectedKeywordError void
TryFinishDictionary bool
TryFinishList bool
ValidateNotDuplicate Expression
VariableOrNull Expression

Открытые методы

Метод Описание
FunctionBinderHelper ( DynamicMetaObjectBinder call, MetaPythonFunction function, Expression codeContext, DynamicMetaObject args ) : System.Linq.Expressions
MakeMetaObject ( ) : DynamicMetaObject

Приватные методы

Метод Описание
AddCheckForNoExtraParameters ( Expression exprArgs ) : void

Adds a check to the last parameter (so it's evaluated after we've extracted all the parameters) to ensure that we don't have any extra params or kw-params when we don't have a params array or params dict to expand them into.

AddInitialization ( Expression body ) : Expression

Appends the initialization code for the call to the function if any exists.

EnsureInit ( ) : void
EnsureParams ( ) : void
ExtractDefaultValue ( int index, int dfltIndex ) : Expression

Helper function to extract the variable from defaults, or to call a helper to check params / kw-dict / defaults to see which one contains the actual value.

ExtractDictionaryArgument ( string name ) : Expression

Helper function to get the specified variable from the dictionary.

ExtractFromListOrDictionary ( string name ) : Expression

Helper function to extract from the params list or dictionary depending upon which one has an available value.

ExtractNextParamsArg ( ) : Expression

Helper function to extract the next argument from the params list.

ExtractNonDefaultValue ( string name ) : Expression

Helper function to get a value (which has no default) from either the params list or the dictionary (or both).

FinishArguments ( Expression exprArgs, List paramsArgs, Expression>.Dictionary namedArgs ) : bool

Binds any missing arguments to values from params array, kw dictionary, or default values.

GetArgumentsForRule ( ) : Expression[]

Gets the array of expressions which correspond to each argument for the function. These correspond with the function as it's defined in Python and must be transformed for our delegate type before being used.

GetArgumentsForTargetType ( Expression exprArgs ) : Expression[]

Fixes up the argument list for the appropriate target delegate type.

GetComplexRestriction ( ) : BindingRestrictions

Makes the test when we have a keyword argument call or splatting.

GetFunctionParam ( ) : UnaryExpression

Helper function to get the function argument strongly typed.

GetRestrictions ( ) : BindingRestrictions

Makes the test for our rule.

GetSimpleRestriction ( ) : BindingRestrictions

Makes the test when we just have simple positional arguments.

MakeDictionary ( Expression/*!*/>.Dictionary namedArgs ) : Expression

Called when the user hasn't supplied a dictionary to be expanded but the function takes a dictionary to be expanded.

MakeDictionaryAddition ( Expression>.KeyValuePair kvp ) : void

Adds an unbound keyword argument into the dictionary.

MakeDictionaryCopy ( DynamicMetaObject userDict ) : DynamicMetaObject

Called when the user is expanding a dictionary - we copy the user dictionary and verify that it contains only valid string names.

MakeFunctionInvoke ( Expression invokeArgs ) : Expression

Creates the code to invoke the target delegate function w/ the specified arguments.

MakeParamsAddition ( List paramsArgs ) : void

Adds extra positional arguments to the start of the expanded list.

MakeParamsCopy ( Expression userList ) : void

Called when the user is expanding a params argument

MakeParamsTuple ( List extraArgs ) : Expression

Helper function to create the expression for creating the actual tuple passed through.

MakeUnexpectedKeywordError ( Expression>.Dictionary namedArgs ) : void
TryFinishDictionary ( Expression exprArgs, Expression>.Dictionary namedArgs ) : bool

Creates the argument for the dictionary expansion parameter.

TryFinishList ( Expression exprArgs, List paramsArgs ) : bool

Creates the argument for the list expansion parameter.

ValidateNotDuplicate ( Expression value, string name, int position ) : Expression

Helper function to validate that a named arg isn't duplicated with by a params list or the dictionary (or both).

VariableOrNull ( System.Linq.Expressions.ParameterExpression var, Type type ) : Expression

Описание методов

FunctionBinderHelper() публичный Метод

public FunctionBinderHelper ( DynamicMetaObjectBinder call, MetaPythonFunction function, Expression codeContext, DynamicMetaObject args ) : System.Linq.Expressions
call DynamicMetaObjectBinder
function MetaPythonFunction
codeContext Expression
args DynamicMetaObject
Результат System.Linq.Expressions

MakeMetaObject() публичный Метод

public MakeMetaObject ( ) : DynamicMetaObject
Результат DynamicMetaObject