Ejemplo n.º 1
0
        private Bound_Expression_Node Bind_Binary_Expression(Binary_Expression_Syntax_Node expression_syntax)
        {
            var bound_left     = Bind_Expression(expression_syntax.Left_Token);
            var bound_right    = Bind_Expression(expression_syntax.Right_Token);
            var bound_operator = Bound_Binary_Operator.Bind(expression_syntax.Operator_Token.Kind_Of_Token, bound_left.Type, bound_right.Type);

            if (bound_operator == null)
            {
                _diagnostics.Add($"Binary operator '{expression_syntax.Operator_Token.Text}' is not defined for types {bound_left.Type} and {bound_right.Type}....!");
                return(bound_left);
            }

            return(new Bound_Binary_Expression_Node(bound_left, bound_operator, bound_right));
        }
Ejemplo n.º 2
0
        private Bound_Expression_Node Bind_Binary_Expression(Binary_Expression_Syntax_Node expression_syntax)
        {
            var bound_left     = Bind_Expression(expression_syntax.Left_Token);
            var bound_right    = Bind_Expression(expression_syntax.Right_Token);
            var bound_operator = Bound_Binary_Operator.Bind(expression_syntax.Operator_Token.Kind_Of_Token, bound_left.Type, bound_right.Type);

            if (bound_operator == null)
            {
                _diagnostics.Report_Undefined_Binary_Operator(expression_syntax.Operator_Token.Span, expression_syntax.Operator_Token.Text, bound_left.Type, bound_right.Type);
                return(bound_left);
            }

            return(new Bound_Binary_Expression_Node(bound_left, bound_operator, bound_right));
        }
Ejemplo n.º 3
0
 public Bound_Binary_Expression_Node(Bound_Expression_Node left, Bound_Binary_Operator op, Bound_Expression_Node right)
 {
     Left  = left;
     Op    = op;
     Right = right;
 }