Exemplo n.º 1
0
        private Bound_Expression_Node Bind_Unary_Expression(Unary_Expression_Syntax_Node expression_syntax)
        {
            var bound_operand  = Bind_Expression(expression_syntax.Operand_token);
            var bound_operator = Bound_Unary_Operator.Bind(expression_syntax.Operator_Token.Kind_Of_Token, bound_operand.Type);

            if (bound_operator == null)
            {
                _diagnostics.Add($"Unary operator '{expression_syntax.Operator_Token.Text}' is not defined for type {bound_operand.Type}....!");
                return(bound_operand);
            }

            return(new Bound_Unary_Expression_Node(bound_operator, bound_operand));
        }
Exemplo n.º 2
0
        private Bound_Expression_Node Bind_Unary_Expression(Unary_Expression_Syntax_Node expression_syntax)
        {
            var bound_operand  = Bind_Expression(expression_syntax.Operand_token);
            var bound_operator = Bound_Unary_Operator.Bind(expression_syntax.Operator_Token.Kind_Of_Token, bound_operand.Type);

            if (bound_operator == null)
            {
                _diagnostics.Report_Undefined_Unary_Operator(expression_syntax.Operator_Token.Span, expression_syntax.Operator_Token.Text, bound_operand.Type);
                return(bound_operand);
            }

            return(new Bound_Unary_Expression_Node(bound_operator, bound_operand));
        }
 public Bound_Unary_Expression_Node(Bound_Unary_Operator op, Bound_Expression_Node operand)
 {
     Op      = op;
     Operand = operand;
 }