예제 #1
0
        protected CallSiteBinder GetLightBinder()
        {
            ILightExceptionBinder binder = _binder as ILightExceptionBinder;

            if (binder != null)
            {
                return(binder.GetLightExceptionBinder());
            }
            return(_binder);
        }
예제 #2
0
        /// <summary>
        /// Returns true if the call site binder is a light exception binder and supports
        /// light throws.  Returns false otherwise.
        /// </summary>
        /// <param name="binder"></param>
        /// <returns></returns>
        public static bool SupportsLightThrow(this CallSiteBinder binder)
        {
            ILightExceptionBinder lightBinder = binder as ILightExceptionBinder;

            if (lightBinder != null)
            {
                return(lightBinder.SupportsLightThrow);
            }
            return(false);
        }
예제 #3
0
        Expression ILightExceptionAwareExpression.ReduceForLightExceptions()
        {
            ILightExceptionBinder binder = Binder as ILightExceptionBinder;

            if (binder != null)
            {
                var lightBinder = binder.GetLightExceptionBinder() as DynamicMetaObjectBinder;
                if (lightBinder != binder)
                {
                    return(DynamicExpression.Dynamic(
                               lightBinder,
                               Type,
                               Args));
                }
            }
            return(this);
        }