SmallSense__Manager.st
branchcvs_MAIN
changeset 917 c1a6a847be65
parent 854 d9674dc0eb11
child 1009 79aa4f093313
--- a/SmallSense__Manager.st	Tue Jan 26 21:32:58 2016 +0100
+++ b/SmallSense__Manager.st	Tue Jan 26 21:40:42 2016 +0100
@@ -5,7 +5,7 @@
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
-version 2.1 of the License. 
+version 2.1 of the License.
 
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -37,7 +37,7 @@
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
-version 2.1 of the License. 
+version 2.1 of the License.
 
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -68,8 +68,8 @@
 flushSingleton
     "flushes the cached singleton"
 
-    Instance notNil ifTrue:[ 
-        Instance release.
+    Instance notNil ifTrue:[
+	Instance release.
     ].
     Instance := nil
 
@@ -84,7 +84,7 @@
     "returns a singleton"
 
     Instance isNil ifTrue:[
-        Instance := self basicNew initialize.
+	Instance := self basicNew initialize.
     ].
     ^ Instance.
 
@@ -106,7 +106,7 @@
     | info |
 
     accessLock critical:[
-        info := self basicInfoForClass: class.
+	info := self basicInfoForClass: class.
     ].
     ^info
 
@@ -127,9 +127,9 @@
     class isNil ifTrue:[^nil].
 
     ^classes at: class name ifAbsentPut:[
-        ClassInfo new
-            setManager: self
-            className: class name
+	ClassInfo new
+	    setManager: self
+	    className: class name
     ].
 
     "Created: / 27-11-2011 / 16:47:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -140,25 +140,25 @@
 update:what with:param from:sender
     "Invoked when an object that I depend upon sends a change notification."
 
-    UserPreferences current smallSenseBackgroundTypingEnabled ifFalse:[ ^ self ].
+    (UserPreferences current smallSenseBackgroundTypingEnabled == true) ifFalse:[ ^ self ].
 
     sender ~~ Smalltalk ifTrue:[
-        super update:what with:param from:sender.
-        ^self.
+	super update:what with:param from:sender.
+	^self.
     ].
 
     what == #methodInClass ifTrue:[
-        "/ If this is anonymous class, do not bother...        
+	"/ If this is anonymous class, do not bother...
 
-        | nm |
+	| nm |
 
-        nm := param first name.
-        (nm isSymbol and:[ Smalltalk includesKey: nm ]) ifTrue:[
-            self updateInfoForMethod: (param first >> param second).
-        ].
-        ^self.
+	nm := param first name.
+	(nm isSymbol and:[ Smalltalk includesKey: nm ]) ifTrue:[
+	    self updateInfoForMethod: (param first >> param second).
+	].
+	^self.
     ].
-    
+
 
 "/    Transcript show: 'SmallSense: Smalltalk changed: ', what , ' with: ', param printString.
 
@@ -172,13 +172,13 @@
 
     classes := Dictionary new.
     accessLock := Semaphore forMutualExclusion.
-    updater := BackgroundQueueProcessingJob 
-                    named: 'SmallSense background updater' 
-                    on: [:classOrMethod|self delayedUpdateInfoForClassOrMethod: classOrMethod].
+    updater := BackgroundQueueProcessingJob
+		    named: 'SmallSense background updater'
+		    on: [:classOrMethod|self delayedUpdateInfoForClassOrMethod: classOrMethod].
     updater priority: Processor userBackgroundPriority - 1.
 
-    UserPreferences current smallSenseEnabled ifTrue:[
-        Smalltalk addDependent: self.
+    (UserPreferences current smallSenseEnabled == true) ifTrue:[
+	Smalltalk addDependent: self.
     ].
     seqno := 0
 
@@ -192,8 +192,8 @@
     accessLock := Semaphore forMutualExclusion.
     updater stopAndRemoveAll.
 
-    UserPreferences current smallSenseEnabled ifTrue:[
-        Smalltalk removeDependent: self.
+    (UserPreferences current smallSenseEnabled == true) ifTrue:[
+	Smalltalk removeDependent: self.
     ].
 
     "Created: / 21-11-2014 / 17:36:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -208,7 +208,7 @@
     class programmingLanguage isSmalltalk ifFalse:[ ^ self ].
     info := self infoForClassOrNil: class.
     (info isNil or:[(info seqno ? 0) < (seqno - 100)]) ifTrue:[
-        updater add: class
+	updater add: class
     ].
     seqno := seqno == SmallInteger maxVal ifTrue: [1] ifFalse:[seqno + 1]
 
@@ -223,9 +223,9 @@
     method programmingLanguage isSmalltalk ifFalse:[ ^ self ].
     info := self basicInfoForClass: method mclass.
     info isNil ifTrue:[
-        updater add: method mclass
+	updater add: method mclass
     ] ifFalse:[
-        updater add: method
+	updater add: method
     ]
 
     "Created: / 28-11-2011 / 19:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -243,40 +243,40 @@
     info isErrorneous ifTrue:[ ^ self ].
     info seqno: seqno.
     [
-        instVarNames := class allInstVarNames.
-        instVarTypes := instVarNames collect: [:instvar | info infoForInstvar: instvar ]. 
-        "/ Check for the source stream - if none, then do not add methods (one cannot
-        "/ infer types without a source anyway  and mark the class errorneous...
-        [ 
-            sourceStream := class sourceStream.
-        ] on: Error do:[ 
-            sourceStream := nil.
-        ].
-        sourceStream isNil ifTrue:[ 
-            info errorneous: true.
-            ^ self.
-        ].
-        class methodsDo:[:mthd|updater add:mthd].
+	instVarNames := class allInstVarNames.
+	instVarTypes := instVarNames collect: [:instvar | info infoForInstvar: instvar ].
+	"/ Check for the source stream - if none, then do not add methods (one cannot
+	"/ infer types without a source anyway  and mark the class errorneous...
+	[
+	    sourceStream := class sourceStream.
+	] on: Error do:[
+	    sourceStream := nil.
+	].
+	sourceStream isNil ifTrue:[
+	    info errorneous: true.
+	    ^ self.
+	].
+	class methodsDo:[:mthd|updater add:mthd].
 
-        probe := [:instance |
-            instVarTypes withIndexDo: [:instVarType :i | 
-                instVarType union: ((Type withClass: (instance instVarAt: i) class) type trustfullness: 70). 
-            ].
-            nprobed := nprobed + 1.
-            nprobed > 100 ifTrue:[
-                "/ Probe at most 100 instancess
-                ^ self
-            ].   
-        ].
-        nprobed := 0.
-        class allInstancesDo: probe.
-        "/ Maube an abstract class?
-        nprobed < 100 ifTrue:[ 
-            class allSubInstancesDo: probe
-        ].
-    ] on: Error do:[:ex |  
-        info errorneous: true.  
-        Logger error:'Error when infering instvars for %1: %2' with: class name with: ex description
+	probe := [:instance |
+	    instVarTypes withIndexDo: [:instVarType :i |
+		instVarType union: ((Type withClass: (instance instVarAt: i) class) type trustfullness: 70).
+	    ].
+	    nprobed := nprobed + 1.
+	    nprobed > 100 ifTrue:[
+		"/ Probe at most 100 instancess
+		^ self
+	    ].
+	].
+	nprobed := 0.
+	class allInstancesDo: probe.
+	"/ Maube an abstract class?
+	nprobed < 100 ifTrue:[
+	    class allSubInstancesDo: probe
+	].
+    ] on: Error do:[:ex |
+	info errorneous: true.
+	Logger error:'Error when infering instvars for %1: %2' with: class name with: ex description
     ]
 
     "Created: / 27-11-2011 / 18:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -287,22 +287,22 @@
     | currentThread |
 
     currentThread := Processor activeProcess.
-    updaterThread ~~ currentThread ifTrue:[ 
-        updaterThread := currentThread.
-        updaterThread addExitAction:[ 
-            updater stopAndRemoveAll.
-        ].
+    updaterThread ~~ currentThread ifTrue:[
+	updaterThread := currentThread.
+	updaterThread addExitAction:[
+	    updater stopAndRemoveAll.
+	].
     ].
 
     [
-        classOrMethod isBehavior ifTrue:[
-           self delayedUpdateInfoForClass: classOrMethod.
-        ].
-        classOrMethod isMethod ifTrue:[
-           self delayedUpdateInfoForMethod: classOrMethod.
-        ]
+	classOrMethod isBehavior ifTrue:[
+	   self delayedUpdateInfoForClass: classOrMethod.
+	].
+	classOrMethod isMethod ifTrue:[
+	   self delayedUpdateInfoForMethod: classOrMethod.
+	]
     ] on: Error do:[:ex|
-        Logger error: 'Error when infering for %1: %2' with: classOrMethod with: ex description.
+	Logger error: 'Error when infering for %1: %2' with: classOrMethod with: ex description.
     ]
 
     "Created: / 27-11-2011 / 18:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -314,13 +314,13 @@
     | inferencer |
 
     [
-        method mclass isNil ifTrue:["Obsolete method" ^ self ].
-        method mclass programmingLanguage isSmalltalk ifFalse: [ ^ self ].
+	method mclass isNil ifTrue:["Obsolete method" ^ self ].
+	method mclass programmingLanguage isSmalltalk ifFalse: [ ^ self ].
     "/    Transcript showCR: 'SmallSense: updating info for: ', method printString.
-        inferencer := SmalltalkInferencer forMethod: method.
-        inferencer process.
-    ] on: Error do:[:ex |  
-        Logger error:'Error when infering for method %1: %2' with: method printString with: ex description
+	inferencer := SmalltalkInferencer forMethod: method.
+	inferencer process.
+    ] on: Error do:[:ex |
+	Logger error:'Error when infering for method %1: %2' with: method printString with: ex description
     ]
 
     "Created: / 27-11-2011 / 18:06:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"