--- a/VSEChunkFileSourceWriter.st Tue Jan 27 21:28:12 2015 +0100
+++ b/VSEChunkFileSourceWriter.st Tue Jan 27 21:29:28 2015 +0100
@@ -13,20 +13,13 @@
"{ NameSpace: Smalltalk }"
-SmalltalkChunkFileSourceWriter subclass:#VSEChunkFileSourceWriter
+VSEFileSourceWriter subclass:#VSEChunkFileSourceWriter
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Kernel-Classes-Support'
!
-Object subclass:#VSESourceRewriter
- instanceVariableNames:'source method methodClass'
- classVariableNames:''
- poolDictionaries:''
- privateIn:VSEChunkFileSourceWriter
-!
-
!VSEChunkFileSourceWriter class methodsFor:'documentation'!
copyright
@@ -79,12 +72,6 @@
"
! !
-!VSEChunkFileSourceWriter class methodsFor:'class access'!
-
-vseSourceRewriter
- ^ VSESourceRewriter
-! !
-
!VSEChunkFileSourceWriter class methodsFor:'utilities'!
fileOutPackage:packageID on:aStream
@@ -93,6 +80,7 @@
aStream lineEndCRLF.
classesToFileout := Smalltalk allClassesInPackage:packageID.
+ classesToFileout := classesToFileout reject:[:cls | cls isSubclassOf: ProjectDefinition ].
classesToFileout topologicalSort:[:a :b | b isSubclassOf:a].
AbstractSourceFileWriter methodSourceRewriteQuery handle:[:rewriteQuery |
@@ -100,7 +88,7 @@
method := rewriteQuery method.
source := rewriteQuery source.
- source := VSEChunkFileSourceWriter vseSourceRewriter rewriteMethod:method.
+ source := self vseSourceRewriter rewriteMethod:method.
rewriteQuery proceedWith:source.
] do:[
classesToFileout do:[:eachClass |
@@ -248,118 +236,13 @@
aStream cr.
! !
-!VSEChunkFileSourceWriter::VSESourceRewriter class methodsFor:'translation'!
-
-rewriteMethod:method
- ^ self new rewriteMethod:method
-! !
-
-!VSEChunkFileSourceWriter::VSESourceRewriter methodsFor:'accessing'!
-
-method
- ^ method
-!
-
-method:something
- method := something.
-!
-
-methodClass
- ^ methodClass
-!
-
-methodClass:something
- methodClass := something.
-!
-
-source
- ^ source
-!
-
-source:something
- source := something.
-! !
-
-!VSEChunkFileSourceWriter::VSESourceRewriter methodsFor:'translation'!
-
-doRewrite
- self rewriteEOLComments.
- self rewriteGlobalsWithNamespace.
- ^ source.
-!
-
-rewriteEOLComments
- |tree parser eolComments|
-
- parser := Parser new.
- parser saveComments:true.
- parser parseMethod:source in:methodClass ignoreErrors:true ignoreWarnings:true.
-
- tree := parser tree.
- eolComments := parser comments select:[:each | each isEndOfLineComment].
- "/ start with the last (so I don't have to update the positions)
- eolComments sort:[:a :b | a position < b position].
- eolComments reverseDo:[:each |
- source := (source copyTo:(each endPosition)),'"',(source copyFrom:(each endPosition + 1))
- ].
-!
-
-rewriteGlobalsWithNamespace
- |tree parser namesToRewrite|
-
- namesToRewrite := OrderedCollection new.
-
- parser := Parser new.
- parser saveComments:true.
- parser parseMethod:source in:methodClass ignoreErrors:true ignoreWarnings:true.
- parser tree isNil ifTrue:[ ^ self ].
-
- parser tree variableNodesDo:[:each |
- |nameInSource|
-
- each isGlobalVariable ifTrue:[
- (each name includes:$:) ifTrue:[
- nameInSource := source copyFrom:each startPosition to:each endPosition.
- (nameInSource includes:$:) ifTrue:[
- namesToRewrite add:each.
- ].
- ].
- ].
- ].
-
- "/ start with the last (so I don't have to update the positions)
- namesToRewrite sort:[:a :b | a position < b position].
- namesToRewrite reverseDo:[:each |
- |idx nameInSource ns nm|
-
- nameInSource := source copyFrom:each startPosition to:each endPosition.
- idx := nameInSource indexOf:$:.
- ns := nameInSource copyTo:idx-1.
- idx := nameInSource indexOf:$: startingAt:idx+1.
- nm := nameInSource copyFrom:idx+1.
- (ns = methodClass nameSpace name) ifFalse:[
- Transcript show:'reference to other namespace'.
- ] ifTrue:[
- source := (source copyTo:(each startPosition-1)),nm,(source copyFrom:(each endPosition + 1))
- ].
- ].
-!
-
-rewriteMethod:methodArg
- method := methodArg.
- source := method source.
- methodClass := method mclass.
-
- ^ self doRewrite.
-! !
-
!VSEChunkFileSourceWriter class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic3/VSEChunkFileSourceWriter.st,v 1.3 2015-01-27 15:17:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/VSEChunkFileSourceWriter.st,v 1.4 2015-01-27 20:29:28 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/VSEChunkFileSourceWriter.st,v 1.3 2015-01-27 15:17:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/VSEChunkFileSourceWriter.st,v 1.4 2015-01-27 20:29:28 cg Exp $'
! !