Add "hook query" tp allow for on-the-fly rewriting of class definitions while filing out. jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 24 Oct 2018 11:58:10 +0100
branchjv
changeset 23546 0bb5e8a11f90
parent 23545 22577f834a76
child 23547 c69c97cec351
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.
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 <jan.vrany@fit.cvut.cz>"
+!
+
 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 <vranyj1@fel.cvut.cz>"
 ! !
 
+
+!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 <jan.vrany@fit.cvut.cz>"
+!
+
+source
+    ^ source
+!
+
+source:aString
+    source := aString.
+! !
+
 !AbstractSourceFileWriter::MethodSourceRewriteQuery class methodsFor:'documentation'!
 
 documentation
@@ -238,6 +286,11 @@
     ^ '$Header$'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$ Id: AbstractSourceFileWriter.st 10643 2011-06-08 21:53:07Z vranyj1  $'
 ! !