DoWhatIMeanSupport.st
changeset 5047 b22d13631deb
parent 5046 60d0ef296d3a
child 5048 8dbd0140a2f0
--- a/DoWhatIMeanSupport.st	Tue May 03 14:59:25 2016 +0200
+++ b/DoWhatIMeanSupport.st	Tue May 03 15:08:05 2016 +0200
@@ -1863,7 +1863,7 @@
     | nm nodeVal receiverClass 
       msgSelector msgReceiver msgArg1
       receiverClasses arg1Classes
-      mthd instVarClass|
+      mthd instVarClass valClass|
 
     aNode isBlock ifTrue:[
         ^ { Block }
@@ -1906,10 +1906,10 @@
         "/ heuristic: quickly assume boolean for some:
         (
             #( 
-                isNil notNil isEmptyOrNil notEmptyOrNil
+                isNil notNil isEmpty isEmptyOrNil notEmpty notEmptyOrNil
                 > >= < <= = == ~ ~=
-                isInteger isNumber isArray
                 knownAsSymbol
+                isMeta            
             ) includes:msgSelector
         ) ifTrue:[
             ^ { True } "/ use True, because boolean does not include the full protocol
@@ -1954,11 +1954,18 @@
             ].
         ].
 
+        ((msgSelector startsWith:'as')
+        and:[ (valClass := Smalltalk classNamed:(msgSelector copyFrom:3)) notNil ]
+        ) ifTrue:[
+            ^ { valClass }
+        ].    
+        ((msgSelector startsWith:'is')
+        and:[ (valClass := Smalltalk classNamed:(msgSelector copyFrom:3)) notNil ]
+        ) ifTrue:[
+            ^ { True } "/ Boolean - not boolean; it does not contain the full protocol (would not find ifTrue:)
+        ].    
+
         #(
-            asFilename              Filename
-            asOrderedCollection     OrderedCollection
-            asArray                 Array
-            asSet                   Set
             size                    SmallInteger
             hash                    SmallInteger
             identityHash            SmallInteger
@@ -1972,16 +1979,19 @@
         ].
 
         "/ some wellknown boolean returners (need better type inference here)
-        (#( isNil notNil not isEmptyOrNil notEmptyOrNil notEmpty isEmpty
-            isBehavior isMeta
-            = ~= == ~~ > >= < <=
+        (#(  
             includes: contains:
-            and: or:
+            not and: or:
             exists atEnd
         ) includes:msgSelector ) ifTrue:[
             ^ { True } "/ Boolean - not boolean; it does not contain the full protocol (would not find ifTrue:)
         ].
 
+        ( #( bitAnd: bitOr: bitShift: rightShift: >> << highBit lowBit ) includes:msgSelector) ifTrue:[
+            "/ assume integer
+
+            ^ { Integer }
+        ].
         ( #( + - * // \\ ) includes:msgSelector) ifTrue:[
             "/ assume numeric