private Expression GenerateUnaryExpression(CallSiteInfo callSiteInfo, IList <Expression> arguments, IEnumerable <Instruction> instructions)
 {
     if (arguments.get_Count() != 1)
     {
         throw new Exception("Invalid number of arguments for unary expression.");
     }
     if (callSiteInfo.get_Operator() == 83)
     {
         return(arguments.get_Item(0));
     }
     return(new UnaryExpression(DynamicHelper.GetUnaryOperator(callSiteInfo.get_Operator()), arguments.get_Item(0), instructions));
 }
Example #2
0
        private Expression GenerateUnaryExpression(CallSiteInfo callSiteInfo, IList <Expression> arguments, IEnumerable <Instruction> instructions)
        {
            if (arguments.Count != 1)
            {
                throw new Exception("Invalid number of arguments for unary expression.");
            }

            if (callSiteInfo.Operator != ExpressionType.IsTrue)
            {
                return(new UnaryExpression(DynamicHelper.GetUnaryOperator(callSiteInfo.Operator), arguments[0], instructions));
            }
            else
            {
                return(arguments[0]);
            }
        }