SmalltalkCodeGeneratorTool.st
changeset 11523 d0f296d32d73
parent 11223 52963b06ef66
child 11637 b7ab3efa491e
--- a/SmalltalkCodeGeneratorTool.st	Mon May 21 10:11:18 2012 +0200
+++ b/SmalltalkCodeGeneratorTool.st	Tue May 22 18:33:26 2012 +0200
@@ -212,7 +212,7 @@
     alreadyInSuperclass ifTrue:[
         code := code, (('\    super %1\' bindWith:method) withCRs).
     ].
-    self compile:code forClass:aClass inCategory:(aCategory ? 'actions').
+    self compile:code forClass:aClass inCategory:(aCategory ? #actions).
     ^ code
 !
 
@@ -250,7 +250,7 @@
         text := '    ^ builder valueAspectFor:#''%1'' initialValue:true\' bindWith:aSelector.
     ].
     code := code, (text withCRs).
-    self compile:code forClass:aClass inCategory:(aCategory ? 'actions').
+    self compile:code forClass:aClass inCategory:(aCategory ? #actions).
     ^ code
 ! !
 
@@ -316,7 +316,7 @@
         self 
             compile:code
             forClass:metaClass 
-            inCategory:'initialization'.
+            inCategory:#initialization.
     ].
 
     self executeCollectedChangesNamed:('Add Class Initializer to ' , className).
@@ -339,14 +339,14 @@
             self 
                 compile:code
                 forClass:aClass 
-                inCategory:'testing'.
+                inCategory:#testing.
         ].
         (eachSubClass includesSelector:selector) ifFalse:[
             code := (selector , '\    ^ true') withCRs.
             self 
                 compile:code
                 forClass:eachSubClass 
-                inCategory:'testing'.
+                inCategory:#testing.
         ].
     ].
 
@@ -418,7 +418,7 @@
     self
         compile:(initCode contents)
         forClass:metaClass 
-        inCategory:'class initialization'.
+        inCategory:#'class initialization'.
 
 
     code := 'allStateNames\    ^ #( ' ,
@@ -429,7 +429,7 @@
     self
         compile:code withCRs
         forClass:metaClass 
-        inCategory:'queries'.
+        inCategory:#queries.
 
     self executeCollectedChangesNamed:('Generate EnumType Code for ' , className).
 
@@ -479,7 +479,7 @@
         self 
             compile:code
             forClass:metaClass 
-            inCategory:'documentation'.
+            inCategory:#documentation.
     ].
 
     self executeCollectedChangesNamed:('Add Example to ' , className).
@@ -496,7 +496,7 @@
 
     self startCollectChanges.
 
-    (nonMetaClass includesSelector:#'initialize') ifFalse:[
+    (nonMetaClass includesSelector:#initialize) ifFalse:[
         code :=
 'initialize
     "Invoked when a new instance is created."
@@ -525,7 +525,7 @@
         self 
             compile:code
             forClass:nonMetaClass 
-            inCategory:'initialization'.
+            inCategory:#initialization.
     ].
 
     self executeCollectedChangesNamed:('Add Initialized Instance Creation to ' , className).
@@ -544,7 +544,7 @@
 
     self createInitializationMethodIn:aClass.
 
-    (metaClass includesSelector:#'new') ifFalse:[
+    (metaClass includesSelector:#new) ifFalse:[
         m := metaClass responseTo:#new.
         (m isNil 
         or:[ (m sends:#initialize) not 
@@ -563,7 +563,7 @@
             self 
                 compile:code
                 forClass:metaClass 
-                inCategory:'instance creation'.
+                inCategory:#'instance creation'.
         ].
     ].
 
@@ -615,7 +615,7 @@
         self 
             compile:code
             forClass:nonMetaClass 
-            inCategory:'initialization'.
+            inCategory:#initialization.
     ].
 
     (metaClass includesSelector:selector) ifFalse:[
@@ -632,7 +632,7 @@
             self 
                 compile:code
                 forClass:metaClass 
-                inCategory:'instance creation'.
+                inCategory:#'instance creation'.
         ].
     ].
 
@@ -640,7 +640,7 @@
 !
 
 createPoolInitializationCodeFor:aClass
-    |nonMetaClass metaClass className poolVars code initCode runValue maxValue|
+    |nonMetaClass metaClass className poolVars initCode|
 
     self startCollectChanges.
 
@@ -677,7 +677,7 @@
     self
         compile:(initCode contents)
         forClass:metaClass 
-        inCategory:'class initialization'.
+        inCategory:#'class initialization'.
 
     self executeCollectedChangesNamed:('Generate Pool Initialization Code for ' , className).
 
@@ -705,7 +705,7 @@
         self 
             compile:code
             forClass:metaClass 
-            inCategory:'redefined instance creation'.
+            inCategory:#'redefined instance creation'.
     ].
     (metaClass includesSelector:#'new:') ifFalse:[
         code :=
@@ -715,7 +715,7 @@
         self 
             compile:code
             forClass:metaClass 
-            inCategory:'redefined instance creation'.
+            inCategory:#'redefined instance creation'.
     ].
 
     self executeCollectedChangesNamed:('Redefined Instance Creation to ' , className).
@@ -733,7 +733,7 @@
 
     self startCollectChanges.
 
-    (metaClass includesSelector:#'theOneAndOnlyInstance') ifFalse:[
+    (metaClass includesSelector:#theOneAndOnlyInstance) ifFalse:[
         code :=
 'theOneAndOnlyInstance
     "returns a singleton"
@@ -746,10 +746,10 @@
         self 
             compile:(code bindWith:varName)
             forClass:metaClass 
-            inCategory:'instance creation'.
+            inCategory:#'instance creation'.
     ].
 
-    (metaClass includesSelector:#'new') ifFalse:[
+    (metaClass includesSelector:#new) ifFalse:[
         code :=
 'new
     "returns a singleton"
@@ -759,10 +759,10 @@
         self 
             compile:(code bindWith:varName)
             forClass:metaClass 
-            inCategory:'instance creation'.
+            inCategory:#'instance creation'.
     ].
 
-   (metaClass includesSelector:#'flushSingleton') ifFalse:[
+   (metaClass includesSelector:#flushSingleton) ifFalse:[
         code :=
 'flushSingleton
     "flushes the cached singleton"
@@ -776,7 +776,7 @@
         self 
             compile:(code bindWith:varName)
             forClass:metaClass 
-            inCategory:'instance creation'.
+            inCategory:#'instance creation'.
     ].
 
     self executeCollectedChangesNamed:('Singleton Pattern for ' , className).
@@ -793,7 +793,7 @@
 
     self startCollectChanges.
 
-    (nonMetaClass includesSelector:#'printOn:') ifFalse:[
+    (nonMetaClass includesSelector:#printOn:) ifFalse:[
         code :=
 'printOn:aStream
     "append a printed representation if the receiver to the argument, aStream"
@@ -814,7 +814,7 @@
         self 
             compile:code
             forClass:nonMetaClass 
-            inCategory:'printing & storing'.
+            inCategory:#'printing & storing'.
     ].
 
 
@@ -861,7 +861,7 @@
         self
             compile:(source bindWith:anApplicationClassNameOrStartupClassName)
             forClass:metaClass 
-            inCategory:'startup'.
+            inCategory:#startup.
     ].
     self executeCollectedChangesNamed:('Add Startup Code to ' , className).
 !
@@ -897,7 +897,7 @@
     "
 '
             forClass:nonMetaClass 
-            inCategory:'tests'.
+            inCategory:#tests.
     ].
 
     ( nonMetaClass includesSelector:#test2 ) ifFalse:[
@@ -920,7 +920,7 @@
     "
 '
             forClass:nonMetaClass 
-            inCategory:'tests'.
+            inCategory:#tests.
     ].
 
     ( nonMetaClass includesSelector:#test3 ) ifFalse:[
@@ -943,7 +943,7 @@
     "
 '
             forClass:nonMetaClass 
-            inCategory:'tests'.
+            inCategory:#tests.
     ].
 
     ( nonMetaClass includesSelector:#setUp ) ifFalse:[
@@ -955,7 +955,7 @@
     super setUp
 '
             forClass:nonMetaClass 
-            inCategory:'initialize / release'.
+            inCategory:#'initialize / release'.
     ].
 
     ( nonMetaClass includesSelector:#tearDown ) ifFalse:[
@@ -967,7 +967,7 @@
     super tearDown
 '
             forClass:nonMetaClass 
-            inCategory:'initialize / release'.
+            inCategory:#'initialize / release'.
     ]
 !
 
@@ -995,10 +995,10 @@
     ^ self visitObject:anObject
 ') bindWith:sel with:visitedClass nameWithoutPrefix asLowercaseFirst)
             forClass:visitorClass 
-            inCategory:'visiting'.
+            inCategory:#visiting.
     ].
 
-    (visitorClass includesSelector:#'visitObject:') ifFalse:[
+    (visitorClass includesSelector:#visitObject:) ifFalse:[
         self 
             compile:
 ('visitObject:anObject 
@@ -1009,10 +1009,10 @@
     self halt:''not yet implemented''
 ')
             forClass:visitorClass 
-            inCategory:'visiting'.
+            inCategory:#visiting.
     ].
 
-    (visitorClass includesSelector:#'visit:') ifFalse:[
+    (visitorClass includesSelector:#visit:) ifFalse:[
         self 
             compile:
 ('visit:anObject 
@@ -1022,7 +1022,7 @@
     ^ anObject acceptVisitor:self
 ')
             forClass:visitorClass 
-            inCategory:'visiting'.
+            inCategory:#visiting.
     ].
 
     self executeCollectedChangesNamed:('Add Visitor Pattern').
@@ -1044,7 +1044,7 @@
         self
             compile:(txt bindWith:className)
             forClass:metaClass 
-            inCategory:'page specs'.
+            inCategory:#'page specs'.
     ].
 
     self executeCollectedChangesNamed:('Add WebApplication Code for ' , className).
@@ -1085,7 +1085,7 @@
         self
             compile:txt
             forClass:nonMetaClass 
-            inCategory:'response generation - pages'.
+            inCategory:#'response generation - pages'.
     ].
 
     (nonMetaClass includesSelector:#page2:) ifFalse:[
@@ -1119,7 +1119,7 @@
         self
             compile:txt
             forClass:nonMetaClass 
-            inCategory:'response generation - pages'.
+            inCategory:#'response generation - pages'.
     ].
 
     (nonMetaClass includesSelector:#page3:) ifFalse:[
@@ -1135,7 +1135,7 @@
         self
             compile:txt
             forClass:nonMetaClass 
-            inCategory:'response generation - pages'.
+            inCategory:#'response generation - pages'.
     ].
 
     (nonMetaClass includesSelector:#process:) ifFalse:[
@@ -1171,7 +1171,7 @@
         self
             compile:txt
             forClass:nonMetaClass 
-            inCategory:'response generation'.
+            inCategory:#'response generation'.
     ].
 
     (metaClass includesSelector:#linkName) ifFalse:[
@@ -1184,7 +1184,7 @@
         self
             compile:txt
             forClass:metaClass 
-            inCategory:'defaults'.
+            inCategory:#defaults.
     ].
 
     (metaClass includesSelector:#settingsApplicationClass) ifFalse:[
@@ -1197,7 +1197,7 @@
         self
             compile:txt
             forClass:metaClass 
-            inCategory:'defaults'.
+            inCategory:#defaults.
     ].
 
 
@@ -1231,12 +1231,12 @@
         ].
 
     #(
-        #'initialize'               #code_forWidget_initialize  'initialization & release'
-        #'update:with:from:'        #code_forWidget_update      'change & update'
-        #'redrawX:y:width:height:'  #code_forWidget_redraw      'drawing'
-        #'buttonPress:x:y:'         #code_forWidget_buttonPress 'event handling'
-        #'keyPress:x:y:'            #code_forWidget_keyPress    'event handling'
-        #'sizeChanged:'             #code_forWidget_sizeChanged 'event handling'
+        initialize               code_forWidget_initialize  #'initialization & release'
+        update:with:from:        code_forWidget_update      #'change & update'
+        redrawX:y:width:height:  code_forWidget_redraw      #'drawing'
+        buttonPress:x:y:         code_forWidget_buttonPress #'event handling'
+        keyPress:x:y:            code_forWidget_keyPress    #'event handling'
+        sizeChanged:             code_forWidget_sizeChanged #'event handling'
     ) inGroupsOf:3 do:compileTemplateAction.
 
     self executeCollectedChangesNamed:('Add Widget Code for ' , className).
@@ -1321,7 +1321,7 @@
                     ].
                 ].
                 source := (source bindWith:varType with:name with:defaultMethodName) withCRs.
-                self compile:source forClass:aClass inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']).
+                self compile:source forClass:aClass inCategory:(asValueHolder ifTrue:[#aspects] ifFalse:[#accessing]).
             ] ifTrue:[
                 Transcript showCR:'method ''', methodName , ''' already present'
             ].
@@ -1337,7 +1337,7 @@
                                , '    self shouldImplement.\'
                                , '    ^ nil.'.
                     source := (source bindWith:varType with:name) withCRs.
-                    self compile:source forClass:aClass theMetaclass inCategory:'defaults'.
+                    self compile:source forClass:aClass theMetaclass inCategory:#defaults.
                 ].
             ].
         ].
@@ -1398,7 +1398,7 @@
                 self 
                     compile:source 
                     forClass:aClass 
-                    inCategory:(asValueHolder ifTrue:['aspects'] ifFalse:['accessing']).
+                    inCategory:(asValueHolder ifTrue:[#aspects] ifFalse:[#accessing]).
             ] ifTrue:[
                 Transcript showCR:'method ''', methodName , ':'' already present'
             ].
@@ -1444,7 +1444,7 @@
                        , '    ].\'
                        , '    %2 add: a%1'.
             source := (source bindWith:methodNameBase with:name) withCRs.
-            self compile:source forClass:aClass inCategory:'accessing'.
+            self compile:source forClass:aClass inCategory:#accessing.
         ] ifTrue:[
             Transcript showCR:'method ''', methodName , ''' already present'
         ].
@@ -1460,7 +1460,7 @@
             source := source
                        , '    %2 remove: a%1'.
             source := (source bindWith:methodNameBase with:name) withCRs.
-            self compile:source forClass:aClass inCategory:'accessing'.
+            self compile:source forClass:aClass inCategory:#accessing.
         ] ifTrue:[
             Transcript showCR:'method ''', methodName , ''' already present'
         ].
@@ -1517,7 +1517,7 @@
                 ].
                 source := source , '    ^ self %2 value'.
                 source := (source bindWith:methodName with:holderMethodName) withCRs.
-                self compile:source forClass:nonMetaClass inCategory:('accessing').
+                self compile:source forClass:nonMetaClass inCategory:#accessing.
             ] ifTrue:[
                 Transcript showCR:'method ''', methodName , ''' already present'
             ].
@@ -1529,7 +1529,7 @@
                 ].
                 source := source , '    self %2 value: newValue'.
                 source := (source bindWith:methodName with:holderMethodName) withCRs.
-                self compile:source forClass:nonMetaClass inCategory:('accessing').
+                self compile:source forClass:nonMetaClass inCategory:#accessing.
             ] ifTrue:[
                 Transcript showCR:'method ''', methodName , ':'' already present'
             ].
@@ -1544,7 +1544,7 @@
             source := source , '    ].\'.
             source := source , '    ^ %1\'.
             source := (source bindWith:holderMethodName) withCRs.
-            self compile:source forClass:nonMetaClass inCategory:('accessing').
+            self compile:source forClass:nonMetaClass inCategory:#accessing.
         ] ifTrue:[
             Transcript showCR:'method ''', methodName , ''' already present'
         ].
@@ -1573,7 +1573,7 @@
     ^ aVisitor %1self
 ') bindWith:selector)
             forClass:aClass 
-            inCategory:'visiting'.
+            inCategory:#visiting.
     ]
 !
 
@@ -1601,7 +1601,7 @@
 ' , txt , '
 "
 '             forClass:aClass 
-              inCategory:'documentation'.
+              inCategory:#documentation.
         ]
     ].
 !
@@ -1680,7 +1680,7 @@
         self 
             compile:code
             forClass:metaClass 
-            inCategory:'documentation'.
+            inCategory:#documentation.
     ].
 
     "Modified: / 24-11-2006 / 15:54:27 / cg"
@@ -1729,7 +1729,7 @@
 "
 '                   
             forClass:aClass 
-            inCategory:'documentation'.
+            inCategory:#documentation.
     ].
 !
 
@@ -1739,12 +1739,12 @@
     anImage storeOn: (imageStoreStream := WriteStream on: '').
 
     "/ if that method already exists, do not overwrite the category
-    category := 'image specs'.
+    category := #'image specs'.
     (mthd := aClass compiledMethodAt:sel) notNil ifTrue:[
         category := mthd category.
     ].
 
-    imageKey :=  (aClass name, ' ', sel) asSymbol.
+    imageKey :=  aClass theNonMetaclass name, ' ', sel.
     Icon constantNamed: imageKey put:nil.
     self
         compile: ((sel,
@@ -1779,7 +1779,7 @@
             self
                 compile:code
                 forClass:aClass 
-                inCategory:'documentation'.
+                inCategory:#documentation.
         ].
     ].
 !
@@ -1825,7 +1825,7 @@
     aCollectionOfVarNames do:[:eachVar |
         source := source , ('    ' , eachVar , ' := ' , eachVar , 'Arg.' , Character cr).
     ].
-    self compile:source forClass:aClass inCategory:'accessing'.
+    self compile:source forClass:aClass inCategory:#accessing.
 !
 
 createSubclassResponsibilityMethodFor:aSelector category:cat in:aClass
@@ -1852,7 +1852,7 @@
 
     |code|
 
-    (aClass includesSelector:#'update:with:from:') ifFalse:[
+    (aClass includesSelector:#update:with:from:) ifFalse:[
         generateComments ifFalse:[
             code :=
 'update:something with:aParameter from:changedObject
@@ -1876,7 +1876,7 @@
         self 
             compile:code
             forClass:aClass 
-            inCategory:'change & update'.
+            inCategory:#'change & update'.
     ]
 !
 
@@ -1900,7 +1900,7 @@
             self 
                 compile:code
                 forClass:aClass 
-                inCategory:'documentation'.
+                inCategory:#documentation.
         ]
     ].
 ! !
@@ -2493,11 +2493,11 @@
 !SmalltalkCodeGeneratorTool class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.12 2012-01-27 13:55:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.13 2012-05-22 16:33:26 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.12 2012-01-27 13:55:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SmalltalkCodeGeneratorTool.st,v 1.13 2012-05-22 16:33:26 stefan Exp $'
 !
 
 version_SVN