示例#1
0
文件: Binder.cs 项目: fr3gu/minsk
        private BoundExpression BindUnaryExpression(UnaryExpressionSyntax syntax)
        {
            var boundOperand = BindExpression(syntax.Operand);

            if (boundOperand.Type == TypeSymbol.Error)
            {
                return(new BoundErrorExpression());
            }

            var boundOperator = BoundUnaryOperator.Bind(syntax.OperatorToken.Kind, boundOperand.Type);

            if (boundOperator == null)
            {
                Diagnostics.ReportUndefinedUnaryOperator(syntax.OperatorToken.Span, syntax.OperatorToken.Text, boundOperand.Type);
                return(new BoundErrorExpression());
            }

            return(new BoundUnaryExpression(boundOperator, boundOperand));
        }
示例#2
0
 public BoundUnaryExpression(BoundUnaryOperator op, BoundExpression operand)
 {
     Op      = op;
     Operand = operand;
 }