public override object VisitUnary(UnaryAstNode node) {
            var operandValue = Evaluate(node.Operand);
            if (operandValue.IsError)
                return operandValue;

            switch (node.Operator.Kind) {
                case TokenKind.Not:
                case TokenKind.NotSign:
                    var operandBoolValue = ConvertToBool(operandValue);
                    if (operandBoolValue.IsError)
                        return operandBoolValue;

                    return Result(!operandBoolValue.BoolValue);
                default:
                    throw new InvalidOperationException(string.Format("Internal error: unary operator '{0}' is not supported.", node.Token.Kind));
            }
        }
Exemple #2
0
 public virtual object VisitUnary(UnaryAstNode node) {
     return null;
 }
 public virtual object VisitUnary(UnaryAstNode node)
 {
     return(null);
 }