--- a/SmalltalkCodeGeneratorTool.st Tue Nov 15 18:32:52 2022 +0000
+++ b/SmalltalkCodeGeneratorTool.st Mon Mar 06 15:22:35 2023 +0000
@@ -2,6 +2,7 @@
COPYRIGHT (c) 2002 by eXept Software AG
COPYRIGHT (c) 2016 Jan Vrany
COPYRIGHT (c) 2021 LabWare
+ COPYRIGHT (c) 2023 LabWare
All Rights Reserved
This software is furnished under a license and may be used
@@ -29,6 +30,7 @@
COPYRIGHT (c) 2002 by eXept Software AG
COPYRIGHT (c) 2016 Jan Vrany
COPYRIGHT (c) 2021 LabWare
+ COPYRIGHT (c) 2023 LabWare
All Rights Reserved
This software is furnished under a license and may be used
@@ -1581,7 +1583,7 @@
createAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange asValueHolder:asValueHolder readersOnly:readersOnly writersOnly:writersOnly lazyInitialization:lazyInitialization
"workhorse for creating access methods for instvars."
- |classesClassVars generateCommentsForSetters generateCommentsForGetters|
+ |classesClassVars generateCommentsForSetters generateCommentsForGetters spaceAfterKeyword|
self startCollectChanges.
@@ -1590,6 +1592,8 @@
classesClassVars := aClass theNonMetaclass allClassVarNames.
+ spaceAfterKeyword := RBFormatter spaceAfterKeywordSelector ifTrue: [ ' ' ] ifFalse: [ '' ].
+
aCollectionOfVarNames do:[:name |
|source varType methodName defaultMethodName argName|
@@ -1619,7 +1623,7 @@
generateComments ifTrue:[
source := source , ' "return/create the ''%2'' value holder (automatically generated)"\\'.
].
- source := source , ' %2 isNil ifTrue:[\'.
+ source := source , ' %2 isNil ifTrue:',spaceAfterKeyword,'[\'.
lazyInitialization ifTrue:[
source := source
, ' %2 := self class %3 asValue.\'.
@@ -1642,7 +1646,7 @@
source := source , ' "return the %1 instance variable ''%2'' with lazy instance creation (automatically generated)"\\'.
].
source := source
- , ' %2 isNil ifTrue:[\'
+ , ' %2 isNil ifTrue:',spaceAfterKeyword,'[\'
, ' %2 := self class %3.\'
, ' ].\'
, ' ^ %2'.
@@ -1684,31 +1688,31 @@
argName := 'aBoolean'
].
asValueHolder ifTrue:[
- source := methodName , ':%3\'. "/ argName
+ source := methodName , ':',spaceAfterKeyword,'%3\'. "/ argName
generateComments ifTrue:[
source := source , ' "set the ''%2'' value holder' , ' (automatically generated)"\\'.
].
withChange ifTrue:[
source := source
, ' |oldValue newValue|\\'
- , ' %2 notNil ifTrue:[\'
+ , ' %2 notNil ifTrue:',spaceAfterKeyword,'[\'
, ' oldValue := %2 value.\'
- , ' %2 removeDependent:self.\'
+ , ' %2 removeDependent:',spaceAfterKeyword,'self.\'
, ' ].\'
, ' %2 := %3.\' "/ argName
- , ' %2 notNil ifTrue:[\'
- , ' %2 addDependent:self.\'
+ , ' %2 notNil ifTrue:',spaceAfterKeyword,'[\'
+ , ' %2 addDependent:',spaceAfterKeyword,'self.\'
, ' ].\'
, ' newValue := %2 value.\'
- , ' oldValue ~~ newValue ifTrue:[\'
- , ' self update:#value with:newValue from:%2.\'
+ , ' oldValue ~~ newValue ifTrue:',spaceAfterKeyword,'[\'
+ , ' self update:',spaceAfterKeyword,'#value with:',spaceAfterKeyword,'newValue from:',spaceAfterKeyword,'%2.\'
, ' ].\'
] ifFalse:[
source := source
, ' %2 := %3.'. "/ argName
].
] ifFalse:[
- source := methodName , ':%3\'. "/ argName
+ source := methodName , ':',spaceAfterKeyword,'%3\'. "/ argName
withChange ifTrue:[
generateComments ifTrue:[
source := source , ' "set the value of the %1 variable ''%2'''.
@@ -1717,7 +1721,7 @@
source := source
, ' (%2 ~~ %3) ifTrue:[\'
, ' %2 := %3.\' "/ argName
- , ' self changed:#%2.\'
+ , ' self changed:',spaceAfterKeyword,'#%2.\'
, ' ].\'.
] ifFalse:[
generateCommentsForSetters ifTrue:[
@@ -1742,6 +1746,7 @@
self executeCollectedChangesNamed:('Add Accessors').
"Modified: / 21-07-2011 / 15:19:25 / cg"
+ "Modified: / 01-02-2023 / 11:10:13 / Jan Vrany <jan.vrany@labware.com>"
!
createCollectionAccessMethodsFor:aCollectionOfVarNames in:aClass withChange:withChange
@@ -2903,11 +2908,12 @@
methodBodyStream := '' writeStream.
methodBodyStream
- nextPutAll:mthd methodDefinitionTemplate; cr;
- nextPutAll:' "'.
+ nextPutAll:mthd methodDefinitionTemplate; cr.
+
"/ include the comment of the subclassResponsibility-sending method
-
+ UserPreferences current generateComments ifTrue: [
+ methodBodyStream nextPutAll:' "'.
comment := mthd methodComment.
comment isEmptyOrNil ifTrue:[
methodBodyStream
@@ -2923,6 +2929,7 @@
].
methodBodyStream
nextPut:$"; cr; cr.
+ ].
"/ include the argument of the subclassResponsibility:-sending method
self canUseRefactoringSupport ifTrue:[
@@ -2947,6 +2954,8 @@
].
^ methodBodyStream contents
+
+ "Modified: / 06-03-2023 / 15:18:27 / Jan Vrany <jan.vrany@labware.com>"
! !
!SmalltalkCodeGeneratorTool class methodsFor:'documentation'!