Example #1
0
        private BoundExpression BindUnaryExpression(UnaryExpressionSyntax syntax)
        {
            var boundExpresion = BindExpression(syntax.Expression);

            var op = BoundUnaryOperator.Bind(syntax.OperatorToken.Kind, boundExpresion.ReturnType);

            if (op == null)
            {
                _diagnostics.Add(Diagnostic.Create(DiagnosticDescriptors.UndefinedUnaryOperator, syntax.OperatorToken.Location, syntax.OperatorToken.ValueText, boundExpresion.ReturnType));
                return(boundExpresion);
            }

            return(new BoundUnaryExpresion(op, boundExpresion));
        }
Example #2
0
 internal BoundUnaryExpresion(BoundUnaryOperator op, BoundExpression expression)
 {
     Op         = op;
     Expression = expression;
 }