当前位置: 首页>>代码示例>>C#>>正文


C# InvokeBinder.FallbackInvoke方法代码示例

本文整理汇总了C#中System.Dynamic.InvokeBinder.FallbackInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# InvokeBinder.FallbackInvoke方法的具体用法?C# InvokeBinder.FallbackInvoke怎么用?C# InvokeBinder.FallbackInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Dynamic.InvokeBinder的用法示例。


在下文中一共展示了InvokeBinder.FallbackInvoke方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bind

            public static DynamicMetaObject/*!*/ Bind(RubyContext/*!*/ context, InvokeBinder/*!*/ binder,
                RubyMetaObject/*!*/ target, DynamicMetaObject/*!*/[]/*!*/ args, Action<MetaObjectBuilder, CallArguments>/*!*/ buildInvoke) {

                RubyCallSignature callSignature;
                if (RubyCallSignature.TryCreate(binder.CallInfo, out callSignature)) {
                    return binder.FallbackInvoke(target, args);
                }

                var metaBuilder = new MetaObjectBuilder();
                buildInvoke(metaBuilder, new CallArguments(target.CreateMetaContext(), target, args, callSignature));
                return metaBuilder.CreateMetaObject(binder);
            }
开发者ID:tnachen,项目名称:ironruby,代码行数:12,代码来源:InteropBinder.cs

示例2: BindInvoke

            public override DynamicMetaObject/*!*/ BindInvoke(InvokeBinder/*!*/ action, DynamicMetaObject/*!*/[]/*!*/ args) {
                RubyCallSignature callSignature;
                if (RubyCallSignature.TryCreate(action.Arguments, out callSignature)) {
                    return action.FallbackInvoke(this, args);
                }

                var metaBuilder = new MetaObjectBuilder();

                var context = new DynamicMetaObject(
                    Methods.GetContextFromBlockParam.OpCall(AstUtils.Convert(Expression, typeof(BlockParam))),
                    BindingRestrictions.Empty,
                    RubyOps.GetContextFromBlockParam((BlockParam)Value)
                );

                BlockParam.SetCallActionRule(metaBuilder, new CallArguments(context, this, args, callSignature));
                return metaBuilder.CreateMetaObject(action, args);
            }
开发者ID:joshholmes,项目名称:ironruby,代码行数:17,代码来源:BlockParam.Meta.cs

示例3: BindInvoke

            public override MetaObject/*!*/ BindInvoke(InvokeBinder/*!*/ action, MetaObject/*!*/[]/*!*/ args) {
                RubyCallSignature callSignature;
                if (RubyCallSignature.TryCreate(action.Arguments, out callSignature)) {
                    return action.FallbackInvoke(this, args);
                }

                var self = (RubyMethod)Value;

                var context = new MetaObject(
                    Methods.GetContextFromMethod.OpCall(AstUtils.Convert(Expression, typeof(RubyMethod))),
                    Restrictions.Empty,
                    RubyOps.GetContextFromMethod(self)
                );

                var metaBuilder = new MetaObjectBuilder();
                Method.SetRuleForCall(metaBuilder, new CallArguments(context, this, args, callSignature));
                return metaBuilder.CreateMetaObject(action, args);
            }
开发者ID:mscottford,项目名称:ironruby,代码行数:18,代码来源:RubyMethod.Meta.cs

示例4: BindInvoke

            public override DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args) {
                if (IsOverridden("TryInvoke")) {
                    return CallMethodWithResult("TryInvoke", binder, DynamicMetaObject.GetExpressions(args), (e) => binder.FallbackInvoke(this, args, e));
                }

                return base.BindInvoke(binder, args);
            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:DynamicObject.cs

示例5: BindInvoke

 /// <summary>
 /// Performs the binding of the dynamic invoke operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="InvokeBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="args">An array of <see cref="DynamicMetaObject"/> instances - arguments to the invoke operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackInvoke(this, args);
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:10,代码来源:DynamicMetaObject.cs

示例6: BindInvoke

            public override DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args)
            {
                // TODO: Implement using InvokeAttribute

                DynamicMetaObject ret;
                if (_type.HandleInvoke(binder, this, args, out ret))
                    return ret;

                CodeContext context;
                Expression contextExpression;
                if (args.Length == binder.CallInfo.ArgumentCount + 1)
                {
                    context = (CodeContext)args[0].Value;
                    contextExpression = args[0].Expression;
                    args = ArrayUtils.RemoveFirst(args);
                }
                Debug.Assert(args.Length == binder.CallInfo.ArgumentCount);

                var fallback = binder.FallbackInvoke(this, args, ret);
                BindingRestrictions restrictions = fallback.Restrictions.Merge(BindingRestrictions.GetTypeRestriction(Expression, LimitType));
                foreach (var arg in args)
                    restrictions = restrictions.Merge(BindingRestrictions.GetTypeRestriction(arg.Expression, arg.LimitType));

                int normalArgCount = binder.CallInfo.ArgumentCount - binder.CallInfo.ArgumentNames.Count;

                List<Expression> normalArgs = new List<Expression>();
                for (var i = 0; i < normalArgCount; i++)
                    normalArgs.Add(EnsureObject(args[i].Expression));

                var addMethod = typeof(Dictionary<string, object>).GetMethod("Add");
                List<ElementInit> namedArgs = new List<ElementInit>();
                for (var i = 0; i < binder.CallInfo.ArgumentNames.Count; i++)
                {
                    namedArgs.Add(
                        Expression.ElementInit(
                            addMethod,
                            Expression.Constant(binder.CallInfo.ArgumentNames[i], typeof(string)),
                            EnsureObject(args[normalArgCount + i].Expression)
                        )
                    );
                }

                var dictExpr = namedArgs.Count > 0 ?
                    (Expression)Expression.ListInit(
                        Expression.New(typeof(Dictionary<string, object>)),
                        namedArgs
                    ) : Expression.New(typeof(Dictionary<string, object>));

                return new DynamicMetaObject(
                    AssertImplemented(
                        Expression.Call(
                            Expression.Constant(_type, typeof(TotemType)),
                            TotemType.MissingInvokeInfo,
                            Expression,
                            Expression.NewArrayInit(
                                typeof(object),
                                normalArgs
                            ),
                            dictExpr
                        ),
                        fallback.Expression
                    ),
                    restrictions
                );
            }
开发者ID:Alxandr,项目名称:IronTotem,代码行数:65,代码来源:TotemType.cs

示例7: BindInvoke

 public override DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args)
 {
     Fallback fallback = null;
     if (!this.IsOverridden("TryInvoke"))
     {
         return base.BindInvoke(binder, args);
     }
     if (fallback == null)
     {
         fallback = e => binder.FallbackInvoke(this, args, e);
     }
     return this.CallMethodWithResult("TryInvoke", binder, GetArgArray(args), fallback);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:DynamicObject.cs

示例8: BindInvoke

 /// <summary>
 ///     Performs the binding of the dynamic invoke operation.
 /// </summary>
 /// <param name="binder">
 ///     An instance of the <see cref="T:System.Dynamic.InvokeBinder" /> that represents the details of the dynamic operation.
 /// </param>
 /// <param name="args">
 ///     An array of <see cref="T:System.Dynamic.DynamicMetaObject" /> instances - arguments to the invoke operation.
 /// </param>
 /// <returns>
 ///     The new <see cref="T:System.Dynamic.DynamicMetaObject" /> representing the result of the binding.
 /// </returns>
 public override DynamicMetaObject BindInvoke( InvokeBinder binder, DynamicMetaObject[] args )
 {
     return ApplyBinding( meta => meta.BindInvoke( binder, args ),
                          ( target, errorSuggestion ) => binder.FallbackInvoke( target, args, errorSuggestion ) );
 }
开发者ID:idavis,项目名称:Archetype,代码行数:17,代码来源:DelegatingMetaObject.cs

示例9: BindInvoke

 public override DynamicMetaObject BindInvoke( InvokeBinder binder, DynamicMetaObject[] args )
 {
     return binder.FallbackInvoke( _baseMetaObject,
                                   args,
                                   AddTypeRestrictions( _metaObject.BindInvoke( binder, args ) ) );
 }
开发者ID:allenwgreaves,项目名称:prototype.ps,代码行数:6,代码来源:Prototype.cs


注:本文中的System.Dynamic.InvokeBinder.FallbackInvoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。