Exemple #1
0
        private object interpretUnaryOp(UnaryOpNode node)
        {
            switch (node.UnOp)
            {
            case UnaryOperation.Not:
                return(!Convert.ToBoolean((EvaluateNode(node.Value))));

            case UnaryOperation.Negate:
                return(-Convert.ToDouble((EvaluateNode(node.Value))));

            case UnaryOperation.Complement:
                return(~(int)Convert.ToDouble((EvaluateNode(node.Value))));
            }
            //Raise error
            return(-1);
        }
Exemple #2
0
 private object interpretUnaryOp(UnaryOpNode node)
 {
     switch (node.UnOp)
     {
         case UnaryOperation.Not:
             return !Convert.ToBoolean((EvaluateNode(node.Value)));
         case UnaryOperation.Negate:
             return -Convert.ToDouble((EvaluateNode(node.Value)));
         case UnaryOperation.Complement:
             return ~(int)Convert.ToDouble((EvaluateNode(node.Value)));
     }
     //Raise error
     return -1;
 }