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); }
ResolveResult CreateResolveResultForUserDefinedOperator(OverloadResolution r, System.Linq.Expressions.ExpressionType operatorType) { if (r.BestCandidateErrors != OverloadResolutionErrors.None) return r.CreateResolveResult(null); IMethod method = (IMethod)r.BestCandidate; return new OperatorResolveResult(method.ReturnType, operatorType, method, isLiftedOperator: method is OverloadResolution.ILiftedOperator, operands: r.GetArgumentsWithConversions()); }