コード例 #1
0
        private DynamicMetaObject InvokeFallback(DynamicMetaObjectBinder action, Expression codeContext, DynamicMetaObject /*!*/[] args)
        {
            InvokeBinder ib = action as InvokeBinder;

            if (ib != null)
            {
                if (_baseMetaObject != null)
                {
                    return(_baseMetaObject.BindInvoke(ib, args));
                }

                return(ib.FallbackInvoke(this.Restrict(this.GetLimitType()), args));
            }

            PythonInvokeBinder pib = action as PythonInvokeBinder;

            if (pib != null)
            {
                IPythonInvokable ipi = _baseMetaObject as IPythonInvokable;
                if (ipi != null)
                {
                    return(ipi.Invoke(pib, codeContext, this, args));
                }

                if (_baseMetaObject != null)
                {
                    return(pib.InvokeForeignObject(this, args));
                }

                return(pib.Fallback(codeContext, this, args));
            }

            // unreachable, we always have one of these binders
            throw new InvalidOperationException();
        }