Esempio n. 1
0
        public static Expression UnaryOp(Expression lhs, ExpressionType expressionType)
        {
            var expArgs = new List <Expression>()
            {
                lhs
            };
            var binderM = Binder.UnaryOperation(CSharpBinderFlags.None, expressionType, lhs.Type, new []
            {
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
            });

            return(Expression.Dynamic(binderM, typeof(object), expArgs));
        }
Esempio n. 2
0
        private static Expression DynamicUnaryOperatorFunc(Expression le, ExpressionType expressionType)
        {
            var expArgs = new List <Expression>()
            {
                le
            };

            var binderM = Binder.UnaryOperation(CSharpBinderFlags.None, expressionType, le.Type, new CSharpArgumentInfo[]
            {
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
            });

            return(Expression.Dynamic(binderM, typeof(object), expArgs));
        }
 internal static CallSiteBinder GetUnaryBinder(TokenType tokenType)
 {
     return(Binder.UnaryOperation(CSharpBinderFlags.CheckedContext, GetExpressionType(tokenType), null, GetArgInfo(1)));
 }