static void MultiAdd(Dictionary <string, List <MultiCandidate> > d, string n, MemberInfo mi, ParameterInfo[] pi) { List <MultiCandidate> l; if (!d.TryGetValue(n, out l)) { d[n] = l = new List <MultiCandidate>(); } OverloadCandidate.MakeCandidates(mi, pi, l); }
static Frame Binder(Frame th) { Variable[] rpos = new Variable[th.pos.Length - 1]; Array.Copy(th.pos, 1, rpos, 0, rpos.Length); OverloadCandidate oc = (OverloadCandidate) (th.info.param[0] as CandidateSet).DoDispatch(null, rpos, th.named); th.caller.resultSlot = oc.Invoke(Kernel.UnboxAny <object>( th.pos[0].Fetch()), rpos, th.named); return(th.caller); }
public override int Compare(int arity, MultiCandidate other_) { bool any_better = false, any_worse = false, any_diff = false; OverloadCandidate other = (OverloadCandidate)other_; for (int ix = 0; ix < arity; ix++) { Type t1 = ix >= args.Length ? param_array : args[ix]; Type t2 = ix >= other.args.Length ? other.param_array : other.args[ix]; int res = CompareType(t1, t2); if (t1 != t2) { any_diff = true; } if (res > 0) { any_better = true; } if (res < 0) { any_worse = true; } } if (any_better && !any_worse) { return(1); } if (any_worse && !any_better) { return(-1); } if (!any_diff) { if (param_array == null && other.param_array != null) { return(1); } if (param_array != null && other.param_array == null) { return(-1); } } return(0); }