Oops, forgotten method in SmallSense::SmalltalkInferencer.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 08 Oct 2013 14:11:55 +0100
changeset 129 71e5c8bb9dc0
parent 128 a98866596a98
child 130 1274cc0394cb
Oops, forgotten method in SmallSense::SmalltalkInferencer.
SmallSense__SmalltalkInferencer.st
--- a/SmallSense__SmalltalkInferencer.st	Tue Oct 08 11:11:14 2013 +0100
+++ b/SmallSense__SmalltalkInferencer.st	Tue Oct 08 14:11:55 2013 +0100
@@ -481,6 +481,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 == 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: / 08-10-2013 / 11:04:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkInferencer::Phase2 methodsFor:'processing'!