private bool DependentMembersAffectedByShadow(CodeTypeMember current, HashSet <CodeTypeMember> shadows) { var shadowed = false; if (!shadows.Contains(current)) { var dependent = CodeDomHelper.DependentMembers(current, false); if (dependent != null) { foreach (var item in dependent) { shadowed |= DependentMembersAffectedByShadow(item, shadows); } } var shadowsOfCurrent = CodeDomHelper.Shadows(current, false); if (shadowsOfCurrent != null) { shadows.AddRange(shadowsOfCurrent); } } else { shadowed = true; } return(shadowed); }
private void RecursivelyAddDependentMembers(IList members, IList constructorStatements, CodeTypeMember current, HashSet <CodeTypeMember> shadows) { if (shadows.Add(current)) { var conflict = members.Cast <CodeTypeMember>().FirstOrDefault(member => AreConflicting(member, current)); if (conflict == null) { members.Add(current); } else { members.Remove(conflict); try { members.Add(conflict.Merge(current)); } catch (Exception e) { throw new InvalidOperationException(string.Format("Exception joining two members {0} and {1}: {2}", current.Name, conflict.Name, e.Message), e); } } var conStmts = current.ImpliedConstructorStatements(false); if (conStmts != null) { foreach (var stmt in conStmts) { constructorStatements.Add(stmt); } } var dependent = CodeDomHelper.DependentMembers(current, false); if (dependent != null) { foreach (var item in dependent) { RecursivelyAddDependentMembers(members, constructorStatements, item, shadows); } } var shadowing = CodeDomHelper.Shadows(current, false); if (shadowing != null) { shadows.AddRange(shadowing); } } }