private int BetterCandidate(CandidateMethod c1, CandidateMethod c2) { int result = Math.Sign(TotalScore(c1) - TotalScore(c2)); if (result != 0) { return(result); } if (c1.VarArgs && !c2.VarArgs) { return(-1); } if (c2.VarArgs && !c1.VarArgs) { return(1); } int minArgumentCount = Math.Min(c1.MinimumArgumentCount, c2.MinimumArgumentCount); for (int i = 0; i < minArgumentCount; ++i) { result += MoreSpecificType(c1.GetParameterType(i), c2.GetParameterType(i)); } if (result != 0) { return(result); } if (c1.VarArgs && c2.VarArgs) { return(MoreSpecificType(c1.VarArgsParameterType, c2.VarArgsParameterType)); } return(0); }
private void EmitFixedMethodArguments() { int offset = FixedArgumentOffset; int count = MinimumArgumentCount(); for (int i = 0; i < count; ++i) { Type paramType = _found.GetParameterType(i + offset); EmitMethodArgument(i, paramType); } }
private int BetterCandidate(CandidateMethod c1, CandidateMethod c2) { int result = Math.Sign(TotalScore(c1) - TotalScore(c2)); if (result != 0) return result; if (c1.VarArgs && !c2.VarArgs) return -1; if (c2.VarArgs && !c1.VarArgs) return 1; int minArgumentCount = Math.Min(c1.MinimumArgumentCount, c2.MinimumArgumentCount); for (int i = 0; i < minArgumentCount; ++i) { result += MoreSpecificType(c1.GetParameterType(i), c2.GetParameterType(i)); } if (result != 0) return result; if (c1.VarArgs && c2.VarArgs) { return MoreSpecificType(c1.VarArgsParameterType, c2.VarArgsParameterType); } return 0; }