/// <summary>
 /// Safe compiler invoke for exceptions
 /// </summary>
 /// <param name="exp">Invoking expression</param>
 /// <param name="method">method to Invoke</param>
 /// <param name="target">method target</param>
 /// <param name="parmeters">parameters for invoke</param>
 /// <returns>result of invoke</returns>
 public static object SafeInvoke(Expression exp, System.Reflection.MethodBase method, object target, object[] parmeters)
 {
     try
     {
         return(method.Invoke(target, System.Reflection.BindingFlags.Default, null, parmeters, null));
     }
     catch (System.Reflection.TargetInvocationException)
     {
         throw ExecutionException.ThrowInvalidOp(exp);
     }
     catch (ArgumentException ex)
     {
         throw ExecutionException.ThrowInvalidOp(exp, new NameExpression(ex.ParamName, ExpressionType.Identifier));
     }
     catch (System.Reflection.TargetParameterCountException)
     {
         throw ExecutionException.ThrowArgumentMisMatch(exp);
     }
 }
        private object VisitExponentiation(BinaryExpression node)
        {
            var left  = node.Left.Accept(this);
            var right = node.Right.Accept(this);

            if (left is null)
            {
                ExecutionException.ThrowNullError(node, node.Left);
            }
            if (right is null)
            {
                ExecutionException.ThrowNullError(node, node.Right);
            }
            object[] args = new object[2] {
                left, right
            };
            if (node.Method is null)
            {
                Type leftType    = left.GetType();
                Type rightType   = right.GetType();
                var  types       = new Type[] { leftType, rightType };
                var  conversions = new ArgumentConversions(2);
                if (leftType.IsPrimitive || rightType.IsPrimitive)
                {
                    conversions.SetInitial(ReflectionUtils.FromSystemType(ref types));
                }
                if (!ReflectionHelpers.MathPow.MatchesArgumentTypes(types, conversions))
                {
                    ExecutionException.ThrowArgumentMisMatch(node);
                }
                node.Conversions = conversions;
                node.Method      = ReflectionHelpers.MathPow;
                node.Type        = TypeProvider.DoubleType;
            }
            node.Conversions.Invoke(ref args);
            return(node.Method.Invoke(null, args));
        }