Oops, added lost method (#visitVariableNode:)
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 19 Nov 2013 13:02:56 +0000
changeset 145 94e4ee54e364
parent 144 a43236d0c411
child 146 dfb2ae961d9c
child 172 18a221bc0d1e
child 174 3e08d765d86f
Oops, added lost method (#visitVariableNode:)
SmallSense__SmalltalkInferencer.st
--- a/SmallSense__SmalltalkInferencer.st	Tue Nov 19 12:48:26 2013 +0000
+++ b/SmallSense__SmalltalkInferencer.st	Tue Nov 19 13:02:56 2013 +0000
@@ -484,6 +484,42 @@
 
     "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>"
+!
+
+visitVariableNode:anObject
+
+    | t |
+
+    "Following code ensures, that all variable nodes refering same
+     variable shares the inferred type"
+    t := types at: anObject name ifAbsentPut:[Type unknown].
+    anObject inferedType: t.
+
+    anObject isGlobalVariable ifTrue:[
+        | global class |
+
+        global := Smalltalk at: anObject name asSymbol.
+        "/ Special hack for JAVA - its actually a JavaPackage...
+
+        global == (Smalltalk at: #JAVA) ifTrue:[
+            global := JavaPackage
+        ].
+        class := global class.
+
+        global notNil ifTrue:[
+            t addClass:  class.
+            t trustfullness: 100.
+        ].
+        ^self.
+    ].
+    anObject isClassVariable ifTrue:[
+        t addClass: (class theNonMetaclass classVarAt: anObject name asSymbol) class.
+        t trustfullness: 100.
+        ^self.
+    ].
+
+    "Created: / 26-11-2011 / 13:31:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-10-2013 / 10:08:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkInferencer::Phase2 methodsFor:'processing'!