SmallSense__SmalltalkInferencer.st
changeset 1059 acfcb242f75e
parent 1058 6d4bf422a7dd
child 1060 af3a048f9618
--- a/SmallSense__SmalltalkInferencer.st	Sun Oct 22 03:41:12 2017 +0000
+++ b/SmallSense__SmalltalkInferencer.st	Thu Oct 26 12:35:22 2017 +0000
@@ -223,12 +223,13 @@
 infer
     Phase1 process:tree in:class manager:manager.
     Phase2 process:tree in:class manager:manager.
+    Phase3 process:tree in:class manager:manager.
 
     "
      (SmallSenseParseNodeInspector new node: tree source: source) open"
 
     "Created: / 26-11-2011 / 12:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-08-2015 / 15:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-07-2017 / 16:21:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parse
@@ -710,6 +711,32 @@
 "
 ! !
 
+!SmalltalkInferencer::Phase3 methodsFor:'visiting'!
+
+visitVariableNode:anObject
+    | name className |
+
+    name := anObject name.
+    (name size > 1 and:[name first == $a]) ifTrue:[ 
+        (name size > 2 and: [name second == $n and:[ name third isUppercase ]]) ifTrue:[ 
+            className := (name copyFrom: 3) asSymbolIfInterned.
+        ] ifFalse:[ name second isUppercase ifTrue:[
+            className := (name copyFrom: 2) asSymbolIfInterned.
+        ]].
+        className notNil ifTrue:[
+            | cls |
+            cls := Smalltalk at: className.
+            cls notNil ifTrue:[ 
+                anObject inferedType type: (Type withClass: cls) type
+            ].
+        ].
+
+    ].
+
+    "Created: / 06-07-2017 / 16:15:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-10-2017 / 23:39:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SmalltalkInferencer class methodsFor:'documentation'!
 
 version_HG