Behavior.st
changeset 12862 aab829fab334
parent 12858 695cbd35ce8a
child 12869 1976f873e0de
--- a/Behavior.st	Thu Apr 08 11:31:03 2010 +0200
+++ b/Behavior.st	Thu Apr 08 13:10:54 2010 +0200
@@ -1809,13 +1809,21 @@
 !
 
 whichClassSatisfies: aBlock
-    |superclass|
-
-    (aBlock value: self) ifTrue: [^self].
-    superclass := self superclass.
-    ^ superclass isNil
-		ifTrue: [nil]
-		ifFalse: [superclass whichClassSatisfies: aBlock]
+    "return the first class along the superclass-chain, which satisfies aBlock.
+     Return nil, if there is none."
+
+    |cls|
+
+    cls := self.
+    [cls notNil] whileTrue:[
+        (aBlock value: cls) ifTrue: [^ cls].
+        cls := cls superclass.
+    ].
+    ^ nil
+
+    "
+     SimpleView whichClassSatisfies:[:cls | cls instanceVariableNames includes:'gc']
+    "
 !
 
 withAllSubclassesDo:aBlock
@@ -4437,15 +4445,20 @@
     "Modified: 3.6.1996 / 16:03:33 / stefan"
 !
 
-whichClassDefinesClassVar: aString
-	^self whichClassSatisfies:
-			[:aClass |
-			(aClass classVarNames collect: [:each | each asString])
-				includes: aString asString]
+whichClassDefinesClassVar:aStringOrText
+    |name|
+
+    name := aStringOrText asString string.
+    ^ self whichClassSatisfies:[:aClass | aClass classVarNames includes:name]
+
+    "
+     TextView whichClassDefinesClassVar:'CachedScales' 
+     TextView whichClassDefinesClassVar:'xxx' 
+    "
 !
 
 whichClassDefinesInstVar: aString
-	^self whichClassSatisfies: [:aClass | aClass instVarNames includes: aString]
+    ^ self whichClassSatisfies: [:aClass | aClass instVarNames includes: aString]
 !
 
 whichSelectorsAssign: instVarName
@@ -4567,9 +4580,9 @@
 !Behavior class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.302 2010-04-07 18:08:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.303 2010-04-08 11:10:54 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.302 2010-04-07 18:08:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.303 2010-04-08 11:10:54 cg Exp $'
 ! !