DoWhatIMeanSupport.st
changeset 4418 149eefdc6206
parent 4417 a523d812f6c1
child 4419 633a3beef0b3
--- a/DoWhatIMeanSupport.st	Tue Sep 24 17:05:18 2013 +0200
+++ b/DoWhatIMeanSupport.st	Tue Sep 24 18:45:41 2013 +0200
@@ -1700,6 +1700,9 @@
     aNode isLiteral ifTrue:[
         ^ aNode value class
     ].
+    aNode isBlock ifTrue:[
+        ^ Block
+    ].
     aNode isVariable ifTrue:[
         nm := aNode name.
         nm = 'self' ifTrue:[
@@ -2363,6 +2366,22 @@
                                 codeView insertStringAtCursor:('[:each | ]',extra).
                                 codeView cursorLeft:1+extra size. 
                             ].
+                            (
+                                #(
+                                    'contains:' 'findFirst:' 'detect:'
+                                ) includes:chosen
+                            ) ifTrue:[
+                                codeView insertStringAtCursor:('[:some | ]',extra).
+                                codeView cursorLeft:1+extra size. 
+                            ].
+                            (
+                                #(
+                                    'remove:ifAbsent:' 'detect:ifNone:' 
+                                ) includes:chosen
+                            ) ifTrue:[
+                                codeView insertStringAtCursor:('[]',extra).
+                                codeView cursorLeft:1+extra size. 
+                            ].
                         ].
                         parentsToInsert notNil ifTrue:[
                             |sav|
@@ -3593,7 +3612,7 @@
 !
 
 withoutSelectorsUnlikelyFor:aClass from:selectorsArg forPartial:partialSelector
-    |selectors noNilChecks noIsXXXChecks|
+    |selectors noNilChecks noIsXXXChecks noNoXXXChecks|
 
     aClass isNil ifTrue:[ ^ selectorsArg ].
 
@@ -3607,13 +3626,12 @@
     aClass == True ifTrue:[
         noNilChecks := true.
         (partialSelector startsWith:'is') ifFalse:[ noIsXXXChecks := true ].
-        (partialSelector startsWith:'no') ifFalse:[
-            "/ get rid of all notXXX selectors
-            selectors := selectors reject:[:sel | sel startsWith:'no'].
-        ].
+        (partialSelector startsWith:'no') ifFalse:[ noNoXXXChecks := true ].
     ].
 
-    (aClass inheritsFrom: ArithmeticValue) ifTrue:[ noNilChecks := true ].
+    (aClass includesBehavior: ArithmeticValue) ifTrue:[ noNilChecks := true ].
+    (aClass includesBehavior: Block) ifTrue:[ noNilChecks := noIsXXXChecks := noNoXXXChecks := true ].
+
     (aClass isMeta) ifTrue:[ 
         noNilChecks := true.
         "/ remove messages which are only defined in Object and non-meta classes.
@@ -3636,7 +3654,10 @@
         "/ get rid of all isXXX selectors
         selectors := selectors reject:[:sel | sel startsWith:'is'].
     ].
-
+    noNoXXXChecks ifTrue:[
+        "/ get rid of all notXXX selectors
+        selectors := selectors reject:[:sel | sel startsWith:'no'].
+    ].
 
     "/ actually: directly implemented selectors are more likely, so move them to top
     selectors := (selectors select:[:sel | aClass implements:sel])
@@ -4388,10 +4409,10 @@
 !DoWhatIMeanSupport class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.170 2013-09-24 15:05:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.171 2013-09-24 16:45:41 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.170 2013-09-24 15:05:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.171 2013-09-24 16:45:41 cg Exp $'
 ! !