Esempio n. 1
0
        private void BinaryOperatorEasyOut(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, BinaryOperatorOverloadResolutionResult result)
        {
            var leftType = left.Type;

            if ((object)leftType == null)
            {
                return;
            }

            var rightType = right.Type;

            if ((object)rightType == null)
            {
                return;
            }

            var easyOut = BinopEasyOut.OpKind(kind, leftType, rightType);

            if (easyOut == BinaryOperatorKind.Error)
            {
                return;
            }

            BinaryOperatorSignature signature = this.Compilation.builtInOperators.GetSignature(easyOut);

            result.Results.Add(BinaryOperatorAnalysisResult.Applicable(signature));
        }
        public void BinaryOperatorOverloadResolution(BinaryOperatorKind kind, BoundExpression left, BoundExpression right, BinaryOperatorOverloadResolutionResult result)
        {
            Debug.Assert(left != null);
            Debug.Assert(right != null);
            Debug.Assert(result.Results.Count == 0);

            BinaryOperatorEasyOut(kind, left, right, result);
            if (result.Results.Count > 0)
            {
                return;
            }
        }