# HG changeset patch # User Jan Vrany # Date 1540378690 -3600 # Node ID 0bb5e8a11f90c026ef59457a4ecf735dad9ec210 # Parent 22577f834a764f202a80966ae0453be57930ef0e Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out. This can be used (is used) by source code exporters that need to rewrite class definitions on the fly. See for example BeeProjectWriter. diff -r 22577f834a76 -r 0bb5e8a11f90 AbstractSourceFileWriter.st --- a/AbstractSourceFileWriter.st Wed Oct 17 21:45:02 2018 +0200 +++ b/AbstractSourceFileWriter.st Wed Oct 24 11:58:10 2018 +0100 @@ -21,8 +21,15 @@ category:'Kernel-Classes-Support' ! +Query subclass:#ClassSourceRewriteQuery + instanceVariableNames:'source klass' + classVariableNames:'' + poolDictionaries:'' + privateIn:AbstractSourceFileWriter +! + Query subclass:#MethodSourceRewriteQuery - instanceVariableNames:'method source' + instanceVariableNames:'source method' classVariableNames:'' poolDictionaries:'' privateIn:AbstractSourceFileWriter @@ -59,6 +66,21 @@ !AbstractSourceFileWriter class methodsFor:'signal constants'! +classSourceRewriteQuery + " + Hook to allow for just-in-time rewriting of a class definition while filing out. + This can be used (is used) by source code exporters that need to rewrite class + definitions on the fly. + + See for example BeeProjectWriter. + " + + + ^ ClassSourceRewriteQuery + + "Created: / 24-10-2018 / 10:49:52 / Jan Vrany " +! + methodSourceRewriteQuery "hook to allow for just-in-time rewriting of a method's sourceCode while filing out used when saving version_XXX methods in a non-XXX sourceCodeManager @@ -198,6 +220,32 @@ "Created: / 21-08-2009 / 09:40:28 / Jan Vrany " ! ! + +!AbstractSourceFileWriter::ClassSourceRewriteQuery methodsFor:'accessing'! + +klass + ^ klass +! + +klass:aClass + klass := aClass. +! + +klass:aClass source: aString + klass := aClass. + source := aString. + + "Created: / 24-10-2018 / 11:10:00 / Jan Vrany " +! + +source + ^ source +! + +source:aString + source := aString. +! ! + !AbstractSourceFileWriter::MethodSourceRewriteQuery class methodsFor:'documentation'! documentation @@ -238,6 +286,11 @@ ^ '$Header$' ! +version_HG + + ^ '$Changeset: $' +! + version_SVN ^ '$ Id: AbstractSourceFileWriter.st 10643 2011-06-08 21:53:07Z vranyj1 $' ! !