Esempio n. 1
0
        internal static CallResolution Create(ComputationContext ctx,
                                              IEnumerable <TemplateArgument> templateArguments,
                                              IFunctionArgumentsProvider argumentsProvider,
                                              CallContext callContext,
                                              EntityInstance targetFunctionInstance)
        {
            // at this point we target true function (any function-like object is converted to closure already)
            if (!targetFunctionInstance.Target.IsFunction())
            {
                throw new Exception("Internal error");
            }

            List <int> arg_param_mapping = createArgParamMapping(targetFunctionInstance,
                                                                 callContext.MetaThisArgument, argumentsProvider.UserArguments);

            if (arg_param_mapping == null)
            {
                return(null);
            }

            var result = new CallResolution(ctx, templateArguments, argumentsProvider,
                                            callContext,
                                            targetFunctionInstance,
                                            arg_param_mapping,
                                            out bool success);

            if (success)
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        private CallResolution(ComputationContext ctx,
                               IEnumerable <TemplateArgument> templateArguments,
                               IFunctionArgumentsProvider argumentsProvider,
                               CallContext callContext,
                               EntityInstance targetFunctionInstance,
                               List <int> argParamMapping,
                               out bool success)
        {
            success = true;

            this.MetaThisArgument       = callContext.MetaThisArgument;
            this.TargetFunctionInstance = targetFunctionInstance;
            this.argumentsProvider      = argumentsProvider;

            if (this.IsExtendedCall)
            {
                this.ExtensionsArguments = new[] { this.MetaThisArgument }
            }