Esempio n. 1
0
        public AnnotatedExpression AnnotateBinaryExpression(BinaryExpressionSyntax syntax)
        {
            var annotateLeft         = AnnotateExpression(syntax.Left);
            var annotateRight        = AnnotateExpression(syntax.Right);
            var annotateOperatorKind = AnnotatedBinaryOperator.Annotate(syntax.OperatorToken.Kind, annotateLeft.Type, annotateRight.Type);

            if (annotateOperatorKind == null)
            {
                _diagnostics.ReportUndefinedBinaryOperator(syntax.OperatorToken.Span, annotateLeft.Type, syntax.OperatorToken.Text, annotateRight.Type);
                return(annotateRight);
            }
            return(new AnnotatedBinaryExpression(annotateLeft, annotateOperatorKind, annotateRight));
        }
Esempio n. 2
0
 public AnnotatedBinaryExpression(AnnotatedExpression left, AnnotatedBinaryOperator op, AnnotatedExpression right)
 {
     Left     = left;
     Operator = op;
     Right    = right;
 }