Tools__ClassSorter.st
changeset 17643 15c9a7e95913
parent 17602 36908309a12c
--- a/Tools__ClassSorter.st	Wed Aug 30 16:03:25 2017 +0200
+++ b/Tools__ClassSorter.st	Thu Aug 31 20:05:29 2017 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2006 by eXept Software AG
 	      All Rights Reserved
@@ -50,20 +48,19 @@
 !ClassSorter methodsFor:'filtering'!
 
 sort: classes
-    "Sort nodes according to their position in the class hierarchy"
-
-    | supersChain |
+        "Sort nodes according to their position in the class hierarchy"
 
-    self initializeResults.
-    classes do:[:eachClass | 
-        supersChain := eachClass withAllSuperclasses intersect:classes.
-        order add: supersChain reverse "contents" -> eachClass
-    ].
-    self buildIndentIndex.
-    ^ self collectSortedClasses
+        | supersChain |
+        self initializeResults.
+        classes do: 
+                [:class | 
+                supersChain := class  withAllSuperclasses reversed.
+                supersChain removeAllSuchThat: [:cl | (classes includes: cl) not].
+                order add: supersChain "contents" -> class].
+        self buildIndentIndex.
+        ^self collectSortedClasses
 
     "Modified: / 21-01-2008 / 19:43:24 / janfrog"
-    "Modified: / 27-07-2017 / 09:38:20 / stefan"
 ! !
 
 !ClassSorter methodsFor:'private'!