Browse Source

Push #chunkEscape down to ChunkExporter

Herbert Vojčík 9 years ago
parent
commit
66222c8969
2 changed files with 33 additions and 31 deletions
  1. 25 25
      src/Kernel-ImportExport.js
  2. 8 6
      src/Kernel-ImportExport.st

+ 25 - 25
src/Kernel-ImportExport.js

@@ -8,31 +8,6 @@ $core.addClass('AbstractExporter', $globals.Object, [], 'Kernel-ImportExport');
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
 //>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "chunkEscape:",
-protocol: 'convenience',
-fn: function (aString){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.AbstractExporter)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["trimBoth", "replace:with:"]
-}),
-$globals.AbstractExporter);
-
 $core.addMethod(
 $core.method({
 selector: "classNameFor:",
@@ -209,6 +184,31 @@ $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Kernel-ImportExp
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
 //>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "chunkEscape:",
+protocol: 'convenience',
+fn: function (aString){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["trimBoth", "replace:with:"]
+}),
+$globals.ChunkExporter);
+
 $core.addMethod(
 $core.method({
 selector: "exportCategoryEpilogueOf:on:",

+ 8 - 6
src/Kernel-ImportExport.st

@@ -44,12 +44,6 @@ extensionProtocolsOfPackage: aPackage
 
 !AbstractExporter methodsFor: 'convenience'!
 
-chunkEscape: aString
-	"Replace all occurrences of !! with !!!! and trim at both ends."
-
-	^ (aString replace: '!!' with: '!!!!') trimBoth
-!
-
 classNameFor: aClass
 	^ aClass isMetaclass
 		ifTrue: [ aClass instanceClass name, ' class' ]
@@ -117,6 +111,14 @@ ownMethodProtocolsOfClass: aClass
 		ExportMethodProtocol name: each theClass: aClass ]
 ! !
 
+!ChunkExporter methodsFor: 'convenience'!
+
+chunkEscape: aString
+	"Replace all occurrences of !! with !!!! and trim at both ends."
+
+	^ (aString replace: '!!' with: '!!!!') trimBoth
+! !
+
 !ChunkExporter methodsFor: 'output'!
 
 exportCategoryEpilogueOf: aCategory on: aStream