|
@@ -1,6 +1,6 @@
|
|
smalltalk.addPackage('Importer-Exporter');
|
|
smalltalk.addPackage('Importer-Exporter');
|
|
smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
|
|
smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
|
|
-smalltalk.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk"
|
|
|
|
|
|
+smalltalk.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "nextChunk",
|
|
selector: "nextChunk",
|
|
@@ -80,7 +80,7 @@ smalltalk.ChunkParser.klass);
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
|
|
smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
|
|
-smalltalk.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).\x0a\x0a## API\x0a\x0aUse `#exportAll`, `#exportClass:` or `#exportPackage:` methods."
|
|
|
|
|
|
+smalltalk.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).\x0a\x0a## API\x0a\x0aUse `#exportAll`, `#exportClass:` or `#exportPackage:` methods.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "classNameFor:",
|
|
selector: "classNameFor:",
|
|
@@ -191,13 +191,14 @@ _st($6)._lf();
|
|
_st($6)._nextPutAll_("smalltalk.");
|
|
_st($6)._nextPutAll_("smalltalk.");
|
|
_st($6)._nextPutAll_(_st(self)._classNameFor_(aClass));
|
|
_st($6)._nextPutAll_(_st(self)._classNameFor_(aClass));
|
|
_st($6)._nextPutAll_(".comment=");
|
|
_st($6)._nextPutAll_(".comment=");
|
|
-$7=_st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
|
|
|
|
|
|
+_st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
|
|
|
|
+$7=_st($6)._nextPutAll_(";");
|
|
$7;
|
|
$7;
|
|
};
|
|
};
|
|
_st(aStream)._lf();
|
|
_st(aStream)._lf();
|
|
return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
|
|
return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
|
|
args: ["aClass", "aStream"],
|
|
args: ["aClass", "aStream"],
|
|
-source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript].\x0a\x09aStream lf",
|
|
|
|
|
|
+source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';'].\x0a\x09aStream lf",
|
|
messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"],
|
|
messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"],
|
|
referencedClasses: []
|
|
referencedClasses: []
|
|
}),
|
|
}),
|
|
@@ -394,7 +395,7 @@ smalltalk.Exporter);
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
|
|
smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
|
|
-smalltalk.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."
|
|
|
|
|
|
+smalltalk.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.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "chunkEscape:",
|
|
selector: "chunkEscape:",
|
|
@@ -677,7 +678,7 @@ smalltalk.ChunkExporter);
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
|
|
smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
|
|
-smalltalk.StrippedExporter.comment="I export Amber code into a JavaScript string, but without any optional associated data like the Amber source code."
|
|
|
|
|
|
+smalltalk.StrippedExporter.comment="I export Amber code into a JavaScript string, but without any optional associated data like the Amber source code.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "exportDefinitionOf:on:",
|
|
selector: "exportDefinitionOf:on:",
|
|
@@ -746,7 +747,7 @@ smalltalk.StrippedExporter);
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
|
|
smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
|
|
-smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString"
|
|
|
|
|
|
+smalltalk.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "import:",
|
|
selector: "import:",
|
|
@@ -793,7 +794,7 @@ smalltalk.Importer);
|
|
|
|
|
|
|
|
|
|
smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
|
|
smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
|
|
-smalltalk.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods."
|
|
|
|
|
|
+smalltalk.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "ajaxPutAt:data:",
|
|
selector: "ajaxPutAt:data:",
|