#UI_ENHANCEMENT by cg cvs_MAIN
authorClaus Gittinger <cg@exept.de>
Fri, 14 Jul 2017 13:39:58 +0200
branchcvs_MAIN
changeset 1034 48e230fa84f4
parent 1033 eeb3f8ceb201
child 1035 e80138cb34b8
#UI_ENHANCEMENT by cg fixed/improved class: SmallSense::SmalltalkInferencer::Phase2 changed: #visitMessageNode: #visitUnaryNode:
SmallSense__SmalltalkInferencer.st
--- a/SmallSense__SmalltalkInferencer.st	Thu Jun 22 07:01:01 2017 +0200
+++ b/SmallSense__SmalltalkInferencer.st	Fri Jul 14 13:39:58 2017 +0200
@@ -303,10 +303,11 @@
 
     sends := Dictionary new.
     types := Dictionary new.
-
+    
     "/ super initialize.   -- commented since inherited method does nothing
 
     "Modified: / 26-11-2011 / 19:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-07-2017 / 12:57:55 / cg"
 ! !
 
 !SmalltalkInferencer::Phase1 methodsFor:'private'!
@@ -439,12 +440,18 @@
     self visit: variable.
     self visit: expression.
     type := expression inferedType type.
+
     type isUnknownType ifFalse:[
-         variable inferedType union: type
+        variable inferedType union: type.
+        "/ cg: the node may be used as another expr-node;
+        "/ eg. in: foo := bar := 123,
+        "/ the expr of the foo assignment should have type info too.
+        anObject inferedType: type.
     ].
 
     "Created: / 26-11-2011 / 13:53:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 18-09-2013 / 02:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-07-2017 / 13:39:27 / cg"
 !
 
 visitBlockNode:anObject
@@ -464,11 +471,13 @@
     | type |
 
     super visitConstantNode: anObject.
-    type := (Type withClass: anObject value class).
+    
+    type := Type withClass:(anObject value class).
     type trustfullness: 100.
     anObject inferedType: type.
 
     "Created: / 26-11-2011 / 13:55:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-07-2017 / 13:33:16 / cg"
 !
 
 visitMessageNode:anObject
@@ -502,6 +511,17 @@
                     ]
                 ]
             ].
+"/            
+"/            ( #( new basicNew new: basicNew: ) includes:anObject selector) ifTrue:[
+"/                |classOrNil|
+"/
+"/                (classOrNil := Smalltalk classNamed:rec name) notNil ifTrue:[
+"/                    classOrNil isBehavior ifTrue:[
+"/                        anObject inferedType:((Type withClass: classOrNil) trustfullness: 99)
+"/                    ].    
+"/                ].    
+"/            ].
+            
         ] ifFalse:[
             (sends at: rec name ifAbsentPut:[Set new]) add: anObject selector.
         ].
@@ -509,6 +529,7 @@
 
     "Created: / 26-11-2011 / 13:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 04-10-2013 / 07:56:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-07-2017 / 13:18:39 / cg"
 !
 
 visitSelfNode:anObject
@@ -639,7 +660,7 @@
         rec := aMessageNode receiver.
         (rec isSelf and:[class isMetaclass]) ifTrue:[
             type := Type withClass: class theNonMetaclass.
-            type trustfullnessAdd: 50.
+            type trustfullnessAdd: 99.
             aMessageNode inferedType: type.
             ^self.
         ].
@@ -650,6 +671,7 @@
 
     "Created: / 05-08-2014 / 14:03:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 26-09-2014 / 11:20:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-07-2017 / 13:19:27 / cg"
 !
 
 visitUnaryNode:anObject
@@ -672,7 +694,7 @@
         rec := anObject receiver.
         (rec isSelf and:[class isMetaclass]) ifTrue:[
             type := Type withClass: class theNonMetaclass.
-            type trustfullnessAdd: 50.
+            type trustfullnessAdd: 99.
             anObject inferedType: type.
             ^self.
         ].
@@ -717,7 +739,7 @@
     "Created: / 27-11-2011 / 15:49:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 08-10-2013 / 11:07:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (comment): / 05-08-2014 / 13:56:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 22-06-2017 / 06:54:21 / cg"
+    "Modified: / 14-07-2017 / 13:19:15 / cg"
 ! !
 
 !SmalltalkInferencer::Phase3 class methodsFor:'documentation'!