public PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
     : base(kind)
 {
     RegisterChildNode(out Operand, operand);
     RegisterChildNode(out OperatorToken, operatorToken);
     Operator = SyntaxFacts.GetUnaryOperatorKind(kind);
 }
        private BoundExpression ProcessPostfixUnary(PostfixUnaryExpressionSyntax node)
        {
            var expression   = BindExpression(node.Operand);
            var operatorKind = SyntaxFacts.GetUnaryOperatorKind(node.Kind);

            TypeSymbol expressionType;

            switch (operatorKind)
            {
            case UnaryOperatorKind.LogicalNot:
                expressionType = IntrinsicTypes.Bool;
                break;

            case UnaryOperatorKind.BitwiseNot:
                expressionType = IntrinsicTypes.Uint;
                break;

            case UnaryOperatorKind.Plus:
            case UnaryOperatorKind.Minus:
            case UnaryOperatorKind.PostIncrement:
            case UnaryOperatorKind.PostDecrement:
                expressionType = expression.Type;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(new BoundUnaryExpression(node, expression, operatorKind, expressionType));
        }
        private BoundExpression ProcessPrefixUnary(PrefixUnaryExpressionSyntax node)
        {
            var expression     = BindExpression(node.Operand);
            var operatorKind   = SyntaxFacts.GetUnaryOperatorKind(node.Kind);
            var expressionType = expression.Type;

            return(new BoundUnaryExpression(node, expression, operatorKind, expressionType));
        }
Beispiel #4
0
        private BoundExpression BindPostfixUnaryExpression(PostfixUnaryExpressionSyntax node)
        {
            var operatorKind = SyntaxFacts.GetUnaryOperatorKind(node.Kind);

            return(BindUnaryExpression(node.OperatorToken, node.Operand, operatorKind));
        }
 public PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken)
     : this(kind, operand, operatorToken, SyntaxFacts.GetUnaryOperatorKind(kind))
 {
 }
 public PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, IEnumerable <Diagnostic> diagnostics)
     : this(kind, operand, operatorToken, SyntaxFacts.GetUnaryOperatorKind(kind), diagnostics)
 {
 }