// Collects every call and combines them into a format that will be easy to process. private void Merge(Dictionary <ITypeArgTrackee, TrackeeInfo> collected) { _trackers = new Dictionary <ITypeArgTrackee, ProviderTrackerInfo>(); // Create foreach (var raw in collected) { _trackers.Add(raw.Key, new ProviderTrackerInfo(raw.Key)); } // Add calls. foreach (var raw in collected) { var tracker = _trackers[raw.Key]; if (raw.Key.GenericsCount != 0) { foreach (var call in raw.Value.Calls) { // Create the TypeArgCombo for this call. var combo = new TypeArgCombo(this, tracker, call.TypeArgs); combo.StartNext(); } } else { tracker.AddCombo(new TypeArgCombo(this, tracker, new CodeType[0])); } } }
private TypeArgCombo(TypeArgCombo existing) { Completed = existing.Completed; Tracker = existing.Tracker; TypeArgs = (CodeType[])existing.TypeArgs.Clone(); _providedTypeArguments = existing._providedTypeArguments; _collector = existing._collector; _current = existing._current; }
public bool CompatibleWith(TypeArgCombo other) { // Make sure the trackers match. This will also ensure that the type args are the same length. if (Tracker != other.Tracker) { return(false); } // Make sure each pair is compatible with each other. for (int i = 0; i < TypeArgs.Length; i++) { if (!TypeArgs[i].CompatibleWith(other.TypeArgs[i])) { return(false); } } return(true); }
public void AddCombo(TypeArgCombo combo) => _typeArgCombos.Add(combo);