Ejemplo 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.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));
        }
Ejemplo 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.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));
        }