class: MethodFinderWindow
authorStefan Vogel <sv@exept.de>
Tue, 04 Mar 2014 16:00:23 +0100
changeset 3090 ef71554ea9e9
parent 3089 994863569542
child 3091 4ec02687f35f
class: MethodFinderWindow changed: #cleanInputs: #markMatchingClasses:classesWithSelector: prepare for semantics change of #upToAll:
MethodFinderWindow.st
--- a/MethodFinderWindow.st	Tue Mar 04 14:18:51 2014 +0100
+++ b/MethodFinderWindow.st	Tue Mar 04 16:00:23 2014 +0100
@@ -1133,71 +1133,90 @@
 
 !MethodFinderWindow methodsFor:'controlInput'!
 
-cleanInputs: aDirtyString
-     "Find and remove common mistakes made by the user. Return the 
+cleanInputs:aDirtyString 
+    "Find and remove common mistakes made by the user. Return the 
      'aStringToBeCleaned' variable"
-       | aStringToBeCleaned rs position|
-
-   aStringToBeCleaned:=aDirtyString.
-
-(aStringToBeCleaned endsWith:(Character cr)) ifTrue:[
-                        aStringToBeCleaned:=aStringToBeCleaned copyFrom:1 to: (aStringToBeCleaned size -1).].
-aStringToBeCleaned:= aStringToBeCleaned withoutSeparators.
-
+    
+    |aStringToBeCleaned rs position|
 
-rs:=ReadStream on: aStringToBeCleaned.
-[rs upToAll: '#true'.  rs atEnd] whileFalse: [
-                        position:= rs position. 
-                        aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
-                        rs:=ReadStream on: aStringToBeCleaned.
-                        ].
-
-rs:=ReadStream on: aStringToBeCleaned.
-[rs upToAll: '#false'.  rs atEnd] whileFalse: [
-                        position:= rs position. 
-                        aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
-                        rs:=ReadStream on: aStringToBeCleaned.
-                        rs:=ReadStream on: aStringToBeCleaned. ].
-
-[rs upToAll: '#nil'.  rs atEnd] whileFalse: [
-                        position:= rs position. 
-                        aStringToBeCleaned:=aStringToBeCleaned copyReplaceFrom: position to: position with: ''. "remove #"
-                        rs:=ReadStream on: aStringToBeCleaned.  ].
-                   ^aStringToBeCleaned    
+    aStringToBeCleaned := aDirtyString.
+    (aStringToBeCleaned endsWith:(Character cr)) ifTrue:[
+        aStringToBeCleaned := aStringToBeCleaned copyFrom:1 to:(aStringToBeCleaned size - 1).
+    ].
+    aStringToBeCleaned := aStringToBeCleaned withoutSeparators.
+    rs := ReadStream on:aStringToBeCleaned.
+    [
+        rs upToAll_positionBefore:'#true'.
+        rs atEnd
+    ] whileFalse:[
+        position := rs position.
+        aStringToBeCleaned := aStringToBeCleaned 
+                copyReplaceFrom:position
+                to:position
+                with:''.
+        rs := ReadStream on:aStringToBeCleaned.
+    ].
+    rs := ReadStream on:aStringToBeCleaned.
+    [
+        rs upToAll_positionBefore:'#false'.
+        rs atEnd
+    ] whileFalse:[
+        position := rs position.
+        aStringToBeCleaned := aStringToBeCleaned 
+                copyReplaceFrom:position
+                to:position
+                with:''.
+        rs := ReadStream on:aStringToBeCleaned.
+    ].
+    [
+        rs upToAll_positionBefore:'#nil'.
+        rs atEnd
+    ] whileFalse:[
+        position := rs position.
+        aStringToBeCleaned := aStringToBeCleaned 
+                copyReplaceFrom:position
+                to:position
+                with:''.
+        rs := ReadStream on:aStringToBeCleaned.
+    ].
+    ^ aStringToBeCleaned
 !
 
-markMatchingClasses: aSelector  classesWithSelector:anOrderedCollection
-   " Matches the class of the receiver with all the elements in anOrderedCollection
-    (which are classes with selectors). If a match is found it is marked with an asterisk. 
-    The classes are then sorted so the the asterisk appears first. Return the 
-    markedClassList."
+markMatchingClasses:aSelector classesWithSelector:anOrderedCollection 
+    " Matches the class of the receiver with all the elements in anOrderedCollection
+     (which are classes with selectors). If a match is found it is marked with an asterisk.
+     The classes are then sorted so the the asterisk appears first. Return the
+     markedClassList."
+    
+    |marker recClass unmarkedClassList markedClassList|
 
-        | marker recClass unmarkedClassList markedClassList|
-
-        marker := self class markerForImplementingClass.
+    marker := self class markerForImplementingClass.
+    recClass := receiver value class.
+    unmarkedClassList := anOrderedCollection copy.
+    unmarkedClassList do:[:classAndMethod | 
+        |class|
 
-        recClass := receiver value class.
-        unmarkedClassList:=anOrderedCollection copy.
-        unmarkedClassList do:
-                [:classAndMethod | | class |
-                class:=Compiler evaluate:
-                                ((ReadStream on: classAndMethod) upToAll: aSelector).
-                "/ (recClass == class)
-                (recClass whichClassImplements:aSelector) == class
-                ifTrue:
-                        ["/ unmarkedClassList add: marker, classAndMethod.
-                        unmarkedClassList add: classAndMethod allBold.
-                        unmarkedClassList remove: classAndMethod.
-                        ].
+        class := Compiler 
+                evaluate:(classAndMethod upToAll:aSelector).
+        
+        "/ (recClass == class)
+        
+        (recClass whichClassImplements:aSelector) == class ifTrue:[
+            "/ unmarkedClassList add: marker, classAndMethod.
+            unmarkedClassList add:classAndMethod allBold.
+            unmarkedClassList remove:classAndMethod.
         ].
+    ].
+    unmarkedClassList 
+        sort:[:a :b | 
+            |rawA rawB|
 
-      unmarkedClassList sort:[:a :b | |rawA rawB|
-                    rawA := a string withoutPrefix:marker.
-                    rawB := b string withoutPrefix:marker.
-                    rawA < rawB.  ].
-      markedClassList:= unmarkedClassList. 
-
-         ^markedClassList
+            rawA := a string withoutPrefix:marker.
+            rawB := b string withoutPrefix:marker.
+            rawA < rawB.
+        ].
+    markedClassList := unmarkedClassList.
+    ^ markedClassList
 
     "Modified: / 13.11.2001 / 12:16:05 / cg"
 !