Example #1
0
        protected override IValue VisitUnaryMinusExpression(PrefixUnaryExpressionSyntax node)
        {
            var operand = Visit(node.Operand);
            // Debug.Assert(node.OperatorToken.Kind == SyntaxKind.MinusToken);
            Type t;

            if (TypesUtil.IsNumberType(operand.ValueType))
            {
                t = operand.ValueType;
            }
            else
            {
                throw new NotSupportedException();
            }
            var a = new UnaryOperatorExpression(operand, "-", t);

            return(Simplify(a));
        }