Browse Source

Fixed SD2-1474 (ClassInheritanceTree returns incorrect results)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3602 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
cd400c7cc0
  1. 17
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultClass.cs
  2. 1
      src/Main/ICSharpCode.SharpDevelop.Dom/Tests/ICSharpCode.SharpDevelop.Dom.Tests/ClassInheritanceTreeTests.cs

17
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultClass.cs

@ -358,6 +358,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -358,6 +358,7 @@ namespace ICSharpCode.SharpDevelop.Dom
visitedList = new List<IClass>();
Queue<IReturnType> typesToVisit = new Queue<IReturnType>();
bool enqueuedLastBaseType = false;
bool hasErrors = false;
IClass currentClass = this;
IReturnType nextType;
do {
@ -377,11 +378,21 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -377,11 +378,21 @@ namespace ICSharpCode.SharpDevelop.Dom
}
if (nextType != null) {
currentClass = nextType.GetUnderlyingClass();
if (currentClass == null)
hasErrors = true;
}
} while (nextType != null);
inheritanceTreeCache = visitedList;
if (!KeepInheritanceTree)
DomCache.RegisterForClear(delegate { inheritanceTreeCache = null; });
// A SearchType request causes the inheritance tree to be generated, but if it was
// this classes' base type that caused the SearchType request, the GetUnderlyingClass()
// will fail and we will produce an incomplete inheritance tree.
// So we don't cache incomplete inheritance trees for parsed classes (fixes SD2-1474).
if (!hasErrors || KeepInheritanceTree) {
inheritanceTreeCache = visitedList;
if (!KeepInheritanceTree)
DomCache.RegisterForClear(delegate { inheritanceTreeCache = null; });
}
return visitedList;
}
}

1
src/Main/ICSharpCode.SharpDevelop.Dom/Tests/ICSharpCode.SharpDevelop.Dom.Tests/ClassInheritanceTreeTests.cs

@ -110,7 +110,6 @@ namespace B { @@ -110,7 +110,6 @@ namespace B {
}
[Test]
[Ignore("Bugfix needed (this is the cause for SD2-1474).")]
public void DerivedClassInheritanceTreeAfterCheckBaseTypesDifferentNamespaceUsing()
{
Prepare(CodeDifferentNamespaceUsing, "A.Base", "B.Derived");

Loading…
Cancel
Save