class: SmalltalkChunkFileSourceWriter
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fixed ClassSourceWriter to NOT save extensionsVersionMethods
with the base project definition class.
todo: this is all duplicate code with SourceFileWriter;
who needs that one?
and if so, why not use commin code (using a method
accessor which is passed to the writer)
--- a/SmalltalkChunkFileSourceWriter.st Thu Nov 27 19:00:18 2014 +0100
+++ b/SmalltalkChunkFileSourceWriter.st Thu Nov 27 21:11:02 2014 +0100
@@ -145,11 +145,19 @@
If stampIt is true, a timeStamp comment is prepended.
If initIt is true, and the class implements a class-initialize method,
append a corresponding doIt expression for initialization.
- The order by which the fileOut is done is used to put the version string at the end.
- Thus, if the version string is expanded (by CVS), the characterPositions of methods should not move"
+ The order by which the fileOut is done is used to put the version method at the end.
+ Thus, if the version string is expanded (by CVS), the characterPositions of all other methods should not move.
+ Notice that any extensions version method is NOT written when a project definition is saved;
+ it is ABSOLUTELY required, that it is saved to the extensions.st file only (because the expanded version string
+ would be the version string of the project definition file and NOT the version string of the extensions file).
+ todo: code duplication with JavaScriptSourceFileWriter - please refactor"
- |collectionOfCategories comment versionMethods
- nonMeta meta classesImplementingInitialize outStream|
+ |collectionOfCategories comment versionMethods extensionVersionMethods
+ nonMeta meta classesImplementingInitialize outStream
+ allMetaClassSelectors versionSelectors extensionVersionSelectors
+ allVersionMethods|
+
+ self todo:'code duplication with JavaScriptSourceFileWriter - please refactor'.
classBeingSaved := nonMeta := aClass theNonMetaclass.
meta := nonMeta class.
@@ -210,7 +218,13 @@
"/ (RCS expands this string, so its size is not constant)
"/
collectionOfCategories := meta categories asSortedCollection.
- versionMethods := meta methodDictionary values select:[:mthd | mthd isVersionMethod].
+
+ allMetaClassSelectors := meta methodDictionary keys.
+ versionSelectors := allMetaClassSelectors select:[:selector | AbstractSourceCodeManager isVersionMethodSelector:selector ].
+ versionMethods := versionSelectors collect:[:eachSelector | meta methodDictionary at:eachSelector].
+ extensionVersionSelectors := allMetaClassSelectors select:[:selector | AbstractSourceCodeManager isExtensionsVersionMethodSelector:selector ].
+ extensionVersionMethods := extensionVersionSelectors collect:[:eachSelector | meta methodDictionary at:eachSelector].
+ allVersionMethods := Set new addAll:versionMethods; addAll:extensionVersionMethods; yourself.
collectionOfCategories notNil ifTrue:[
"/
@@ -231,7 +245,7 @@
"/ ].
"/ ].
- self fileOutCategory:'documentation' of:meta except:versionMethods only:nil methodFilter:methodFilter on:outStream.
+ self fileOutCategory:'documentation' of:meta except:allVersionMethods only:nil methodFilter:methodFilter on:outStream.
].
"/
@@ -279,13 +293,13 @@
"/
"/ any private classes' methods
"/
- nonMeta privateClassesSorted do:[:aClass |
- self fileOutAllMethodsOf:aClass on:outStream methodFilter:methodFilter
+ nonMeta privateClassesSorted do:[:eachPrivateClass |
+ self fileOutAllMethodsOf:eachPrivateClass on:outStream methodFilter:methodFilter
].
"/
- "/ finally, the previously skipped version method
+ "/ finally, the previously skipped version method (but not the extensionsVersion methods!!)
"/
versionMethods notEmpty ifTrue: [
self fileOutCategory:'documentation' of:meta except:nil only:versionMethods methodFilter:methodFilter on:outStream.
@@ -678,11 +692,11 @@
!SmalltalkChunkFileSourceWriter class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.26 2014-10-04 11:27:04 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.27 2014-11-27 20:11:02 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.26 2014-10-04 11:27:04 vrany Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.27 2014-11-27 20:11:02 cg Exp $'
!
version_SVN