コード例 #1
0
        private BoundExpression BindUnaryExpression(UnaryExpressionSyntax syntax)
        {
            var boundOperand  = BindExpression(syntax.Operand);
            var boundOperator = BoundUnaryOperator.Bind(syntax.OperatorToken.Kind, boundOperand.Type);

            if (boundOperator == null)
            {
                _diagnostics.Add($"Unary operator '{syntax.OperatorToken.Text}' is not defined for type {boundOperand.Type}");
                return(boundOperand);
            }

            return(new BoundUnaryExpression(boundOperator, boundOperand));
        }
コード例 #2
0
ファイル: BoundUnaryExpression.cs プロジェクト: 0Seren/Daevix
 public BoundUnaryExpression(BoundUnaryOperator op, BoundExpression operand)
 {
     Op      = op;
     Operand = operand;
 }