Esempio n. 1
0
 Expression SetOperationInformations(ResolveContext rc, IType resultType, Expression lhs, BinaryOperatorType op, Expression rhs, bool isLifted = false)
 {
     this.isLiftedOperator = isLifted;
     this.ResolvedType     = resultType;
     this.left             = lhs;
     this.right            = rhs;
     this.operatortype     = ResolveContext.GetLinqNodeType(this.oper, rc.checkForOverflow);
     _resolved             = true;
     return(this);
 }
Esempio n. 2
0
        Expression SetUserDefinedOperationInformations(ResolveContext rc, OverloadResolution r)
        {//TODO:Is It OK
            if (r.BestCandidateErrors != OverloadResolutionErrors.None)
            {
                rc.Report.Error(0, loc, "Operator `{0}' is ambiguous on an operand of type `{1}'",
                                OperName(Oper), Expr.Type.ToString());
                return(r.CreateInvocation(null));
            }


            IMethod method   = (IMethod)r.BestCandidate;
            var     operands = r.GetArgumentsWithConversions();

            this.operatortype              = ResolveContext.GetLinqNodeType(this.Oper, rc.checkForOverflow);
            this.isLiftedOperator          = method is OverloadResolution.ILiftedOperator;
            this.ResolvedType              = method.ReturnType;
            this.Expr                      = operands[0];
            this.userDefinedOperatorMethod = method;
            _resolved                      = true;
            return(this);
        }
Esempio n. 3
0
 Expression SetOperationInformations(ResolveContext rc, IType resultType, UnaryOperatorType op, Expression expression, bool isLifted = false)
 {
     return(new OperatorExpression(
                resultType, ResolveContext.GetLinqNodeType(op, rc.checkForOverflow),
                null, isLifted, new[] { expression }));
 }