Added simple debugg option to SmalltaqlkCodeCompletion.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 22 Jan 2014 12:52:34 +0000
changeset 158 d275ae2a0003
parent 157 c71d2e62ece2
child 159 289c7ef539af
Added simple debugg option to SmalltaqlkCodeCompletion.
SmallSense__SmalltalkCompletionEngine.st
--- a/SmallSense__SmalltalkCompletionEngine.st	Tue Jan 21 23:33:53 2014 +0000
+++ b/SmallSense__SmalltalkCompletionEngine.st	Wed Jan 22 12:52:34 2014 +0000
@@ -4,12 +4,42 @@
 
 CompletionEngine subclass:#SmalltalkCompletionEngine
 	instanceVariableNames:'collector'
-	classVariableNames:''
+	classVariableNames:'Debug'
 	poolDictionaries:''
 	category:'SmallSense-Smalltalk'
 !
 
 
+!SmalltalkCompletionEngine class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "/ please change as required (and remove this comment)
+
+    Debug := false.
+
+    "Modified: / 22-01-2014 / 09:08:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SmalltalkCompletionEngine class methodsFor:'accessing'!
+
+debug
+    ^ Debug
+
+    "Created: / 22-01-2014 / 09:08:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+debug: aBoolean
+    Debug := aBoolean .
+    "
+    seld debug: true.
+    seld debug: false.
+    "
+
+    "Created: / 22-01-2014 / 09:08:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SmalltalkCompletionEngine class methodsFor:'utilities'!
 
 resultSetFor: mode source: source class: class line: line column: col 
@@ -248,7 +278,12 @@
 
             result add: po.
         ].
-        klass := klass superclass.
+        "/ When on class side (i.e., in class method), do not complete
+        "/ instance variables of Class / ClassDescription / Behaviour
+        "/ as STC won't compile such code.
+        klass := (klass isMetaclass and:[klass superclass == Class]) 
+                    ifTrue:[nil]
+                    ifFalse:[klass superclass].
     ].
     "Add pseudo variables"
     #(self super here thisContext) do:[:nm|
@@ -273,7 +308,7 @@
     ]
 
     "Created: / 31-07-2013 / 00:32:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 18-01-2014 / 22:50:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-01-2014 / 09:21:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkCompletionEngine methodsFor:'completion-private'!
@@ -404,6 +439,10 @@
         | type |
 
         type := node receiver inferedType.
+        Debug ifTrue:[
+            Transcript showCR: '--> completing messages for ' , type printString.
+        ].
+
         type isUnknownType ifFalse:[
             self addMethodsForType: type.
             "/ If the type is union of more than 6 types, then
@@ -425,7 +464,7 @@
     "Created: / 07-03-2011 / 18:59:02 / Jakub <zelenja7@fel.cvut.cz>"
     "Modified: / 08-04-2011 / 09:31:51 / Jakub <zelenja7@fel.cvut.cz>"
     "Created: / 26-11-2011 / 17:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 16-10-2013 / 15:53:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-01-2014 / 09:10:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkCompletionEngine class methodsFor:'documentation'!
@@ -439,3 +478,5 @@
     ^ '$Id: SmallSenseRecognizer.st 7826 2011-11-27 09:48:43Z vranyj1 $'
 ! !
 
+
+SmalltalkCompletionEngine initialize!