Procházet zdrojové kódy

Move import readers to Platform-ImportExport

Herbert Vojčík před 9 roky
rodič
revize
984ffcb1ac
4 změnil soubory, kde provedl 439 přidání a 437 odebrání
  1. 0 345
      src/Kernel-Classes.js
  2. 0 91
      src/Kernel-Classes.st
  3. 346 1
      src/Platform-ImportExport.js
  4. 93 0
      src/Platform-ImportExport.st

+ 0 - 345
src/Kernel-Classes.js

@@ -489,60 +489,6 @@ messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "your
 }),
 $globals.Behavior);
 
-$core.addMethod(
-$core.method({
-selector: "commentStamp",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $2,$3,$1;
-$2=$recv($ClassCommentReader())._new();
-$recv($2)._class_(self);
-$3=$recv($2)._yourself();
-$1=$3;
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
-referencedClasses: ["ClassCommentReader"],
-//>>excludeEnd("ide");
-messageSends: ["class:", "new", "yourself"]
-}),
-$globals.Behavior);
-
-$core.addMethod(
-$core.method({
-selector: "commentStamp:prior:",
-protocol: 'accessing',
-fn: function (aStamp,prior){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._commentStamp();
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aStamp", "prior"],
-source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["commentStamp"]
-}),
-$globals.Behavior);
-
 $core.addMethod(
 $core.method({
 selector: "compile:protocol:",
@@ -1007,60 +953,6 @@ messageSends: ["values", "methodDictionary"]
 }),
 $globals.Behavior);
 
-$core.addMethod(
-$core.method({
-selector: "methodsFor:",
-protocol: 'accessing',
-fn: function (aString){
-var self=this;
-function $ClassCategoryReader(){return $globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $2,$3,$1;
-$2=$recv($ClassCategoryReader())._new();
-$recv($2)._class_category_(self,aString);
-$3=$recv($2)._yourself();
-$1=$3;
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
-referencedClasses: ["ClassCategoryReader"],
-//>>excludeEnd("ide");
-messageSends: ["class:category:", "new", "yourself"]
-}),
-$globals.Behavior);
-
-$core.addMethod(
-$core.method({
-selector: "methodsFor:stamp:",
-protocol: 'accessing',
-fn: function (aString,aStamp){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-$1=self._methodsFor_(aString);
-return $1;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString", "aStamp"],
-source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["methodsFor:"]
-}),
-$globals.Behavior);
-
 $core.addMethod(
 $core.method({
 selector: "methodsInProtocol:",
@@ -3132,243 +3024,6 @@ $globals.ClassBuilder);
 
 
 
-$core.addClass('ClassCategoryReader', $globals.Object, ['class', 'category'], 'Kernel-Classes');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "class:category:",
-protocol: 'accessing',
-fn: function (aClass,aString){
-var self=this;
-self["@class"]=aClass;
-self["@category"]=aString;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aClass", "aString"],
-source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.ClassCategoryReader);
-
-$core.addMethod(
-$core.method({
-selector: "compileMethod:",
-protocol: 'private',
-fn: function (aString){
-var self=this;
-function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassCategoryReader)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
-referencedClasses: ["Compiler"],
-//>>excludeEnd("ide");
-messageSends: ["install:forClass:protocol:", "new"]
-}),
-$globals.ClassCategoryReader);
-
-$core.addMethod(
-$core.method({
-selector: "initialize",
-protocol: 'initialization',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-(
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.supercall = true, 
-//>>excludeEnd("ctx");
-$globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply($recv(self), []));
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.supercall = false;
-//>>excludeEnd("ctx");;
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCategoryReader)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "initialize\x0a\x09super initialize.",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["initialize"]
-}),
-$globals.ClassCategoryReader);
-
-$core.addMethod(
-$core.method({
-selector: "scanFrom:",
-protocol: 'fileIn',
-fn: function (aChunkParser){
-var self=this;
-var chunk;
-function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv((function(){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-chunk=$recv(aChunkParser)._nextChunk();
-chunk;
-return $recv(chunk)._isEmpty();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
-//>>excludeEnd("ctx");
-}))._whileFalse_((function(){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return self._compileMethod_(chunk);
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
-//>>excludeEnd("ctx");
-}));
-$recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCategoryReader)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aChunkParser"],
-source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
-referencedClasses: ["ClassBuilder"],
-//>>excludeEnd("ide");
-messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
-}),
-$globals.ClassCategoryReader);
-
-
-
-$core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Kernel-Classes');
-//>>excludeStart("ide", pragmas.excludeIdeData);
-$globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
-//>>excludeEnd("ide");
-$core.addMethod(
-$core.method({
-selector: "class:",
-protocol: 'accessing',
-fn: function (aClass){
-var self=this;
-self["@class"]=aClass;
-return self;
-
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aClass"],
-source: "class: aClass\x0a\x09class := aClass",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: []
-}),
-$globals.ClassCommentReader);
-
-$core.addMethod(
-$core.method({
-selector: "initialize",
-protocol: 'initialization',
-fn: function (){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-(
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.supercall = true, 
-//>>excludeEnd("ctx");
-$globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.supercall = false;
-//>>excludeEnd("ctx");;
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: [],
-source: "initialize\x0a\x09super initialize.",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["initialize"]
-}),
-$globals.ClassCommentReader);
-
-$core.addMethod(
-$core.method({
-selector: "scanFrom:",
-protocol: 'fileIn',
-fn: function (aChunkParser){
-var self=this;
-var chunk;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-var $1;
-chunk=$recv(aChunkParser)._nextChunk();
-$1=$recv(chunk)._isEmpty();
-if(!$core.assert($1)){
-self._setComment_(chunk);
-};
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aChunkParser"],
-source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
-}),
-$globals.ClassCommentReader);
-
-$core.addMethod(
-$core.method({
-selector: "setComment:",
-protocol: 'private',
-fn: function (aString){
-var self=this;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx1) {
-//>>excludeEnd("ctx");
-$recv(self["@class"])._comment_(aString);
-return self;
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
-//>>excludeEnd("ctx");
-},
-//>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["aString"],
-source: "setComment: aString\x0a\x09class comment: aString",
-referencedClasses: [],
-//>>excludeEnd("ide");
-messageSends: ["comment:"]
-}),
-$globals.ClassCommentReader);
-
-
-
 $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";

+ 0 - 91
src/Kernel-Classes.st

@@ -67,16 +67,6 @@ comment: aString
 			yourself)
 !
 
-commentStamp
-	^ ClassCommentReader new
-	class: self;
-	yourself
-!
-
-commentStamp: aStamp prior: prior
-		^ self commentStamp
-!
-
 definition
 	^ ''
 !
@@ -145,17 +135,6 @@ methods
 	^ self methodDictionary values
 !
 
-methodsFor: aString
-	^ ClassCategoryReader new
-		class: self category: aString;
-		yourself
-!
-
-methodsFor: aString stamp: aStamp
-	"Added for file-in compatibility, ignores stamp."
-	^ self methodsFor: aString
-!
-
 methodsInProtocol: aString
 	^ self methods select: [ :each | each protocol = aString ]
 !
@@ -775,76 +754,6 @@ setupClass: aClass
 	<$core.init(aClass);>
 ! !
 
-Object subclass: #ClassCategoryReader
-	instanceVariableNames: 'class category'
-	package: 'Kernel-Classes'!
-!ClassCategoryReader commentStamp!
-I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.!
-
-!ClassCategoryReader methodsFor: 'accessing'!
-
-class: aClass category: aString
-	class := aClass.
-	category := aString
-! !
-
-!ClassCategoryReader methodsFor: 'fileIn'!
-
-scanFrom: aChunkParser
-	| chunk |
-	[ chunk := aChunkParser nextChunk.
-	chunk isEmpty ] whileFalse: [
-		self compileMethod: chunk ].
-	ClassBuilder new setupClass: class
-! !
-
-!ClassCategoryReader methodsFor: 'initialization'!
-
-initialize
-	super initialize.
-! !
-
-!ClassCategoryReader methodsFor: 'private'!
-
-compileMethod: aString
-	Compiler new install: aString forClass: class protocol: category
-! !
-
-Object subclass: #ClassCommentReader
-	instanceVariableNames: 'class'
-	package: 'Kernel-Classes'!
-!ClassCommentReader commentStamp!
-I provide a mechanism for retrieving class comments stored on a file.
-
-See also `ClassCategoryReader`.!
-
-!ClassCommentReader methodsFor: 'accessing'!
-
-class: aClass
-	class := aClass
-! !
-
-!ClassCommentReader methodsFor: 'fileIn'!
-
-scanFrom: aChunkParser
-	| chunk |
-	chunk := aChunkParser nextChunk.
-	chunk isEmpty ifFalse: [
-		self setComment: chunk ].
-! !
-
-!ClassCommentReader methodsFor: 'initialization'!
-
-initialize
-	super initialize.
-! !
-
-!ClassCommentReader methodsFor: 'private'!
-
-setComment: aString
-	class comment: aString
-! !
-
 Object subclass: #ClassSorterNode
 	instanceVariableNames: 'theClass level nodes'
 	package: 'Kernel-Classes'!

+ 346 - 1
src/Platform-ImportExport.js

@@ -1,4 +1,4 @@
-define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure"], function($boot){
+define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){
 var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
 $core.addPackage('Platform-ImportExport');
 $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
@@ -2287,6 +2287,243 @@ messageSends: ["stream:", "new"]
 $globals.ChunkParser.klass);
 
 
+$core.addClass('ClassCategoryReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "class:category:",
+protocol: 'accessing',
+fn: function (aClass,aString){
+var self=this;
+self["@class"]=aClass;
+self["@category"]=aString;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aClass", "aString"],
+source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.ClassCategoryReader);
+
+$core.addMethod(
+$core.method({
+selector: "compileMethod:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv($recv($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassCategoryReader)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
+referencedClasses: ["Compiler"],
+//>>excludeEnd("ide");
+messageSends: ["install:forClass:protocol:", "new"]
+}),
+$globals.ClassCategoryReader);
+
+$core.addMethod(
+$core.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true, 
+//>>excludeEnd("ctx");
+$globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply($recv(self), []));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCategoryReader)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "initialize\x0a\x09super initialize.",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["initialize"]
+}),
+$globals.ClassCategoryReader);
+
+$core.addMethod(
+$core.method({
+selector: "scanFrom:",
+protocol: 'fileIn',
+fn: function (aChunkParser){
+var self=this;
+var chunk;
+function $ClassBuilder(){return $globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+chunk=$recv(aChunkParser)._nextChunk();
+chunk;
+return $recv(chunk)._isEmpty();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
+//>>excludeEnd("ctx");
+}))._whileFalse_((function(){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return self._compileMethod_(chunk);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
+//>>excludeEnd("ctx");
+}));
+$recv($recv($ClassBuilder())._new())._setupClass_(self["@class"]);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCategoryReader)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aChunkParser"],
+source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
+referencedClasses: ["ClassBuilder"],
+//>>excludeEnd("ide");
+messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
+}),
+$globals.ClassCategoryReader);
+
+
+
+$core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
+//>>excludeStart("ide", pragmas.excludeIdeData);
+$globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
+//>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "class:",
+protocol: 'accessing',
+fn: function (aClass){
+var self=this;
+self["@class"]=aClass;
+return self;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aClass"],
+source: "class: aClass\x0a\x09class := aClass",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.ClassCommentReader);
+
+$core.addMethod(
+$core.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true, 
+//>>excludeEnd("ctx");
+$globals.ClassCommentReader.superclass.fn.prototype._initialize.apply($recv(self), []));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "initialize\x0a\x09super initialize.",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["initialize"]
+}),
+$globals.ClassCommentReader);
+
+$core.addMethod(
+$core.method({
+selector: "scanFrom:",
+protocol: 'fileIn',
+fn: function (aChunkParser){
+var self=this;
+var chunk;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+chunk=$recv(aChunkParser)._nextChunk();
+$1=$recv(chunk)._isEmpty();
+if(!$core.assert($1)){
+self._setComment_(chunk);
+};
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aChunkParser"],
+source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
+}),
+$globals.ClassCommentReader);
+
+$core.addMethod(
+$core.method({
+selector: "setComment:",
+protocol: 'private',
+fn: function (aString){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv(self["@class"])._comment_(aString);
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "setComment: aString\x0a\x09class comment: aString",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["comment:"]
+}),
+$globals.ClassCommentReader);
+
+
+
 $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
@@ -4049,6 +4286,114 @@ messageSends: []
 }),
 $globals.AmdPackageTransport.klass);
 
+$core.addMethod(
+$core.method({
+selector: "commentStamp",
+protocol: '*Platform-ImportExport',
+fn: function (){
+var self=this;
+function $ClassCommentReader(){return $globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $2,$3,$1;
+$2=$recv($ClassCommentReader())._new();
+$recv($2)._class_(self);
+$3=$recv($2)._yourself();
+$1=$3;
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
+referencedClasses: ["ClassCommentReader"],
+//>>excludeEnd("ide");
+messageSends: ["class:", "new", "yourself"]
+}),
+$globals.Behavior);
+
+$core.addMethod(
+$core.method({
+selector: "commentStamp:prior:",
+protocol: '*Platform-ImportExport',
+fn: function (aStamp,prior){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._commentStamp();
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aStamp", "prior"],
+source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["commentStamp"]
+}),
+$globals.Behavior);
+
+$core.addMethod(
+$core.method({
+selector: "methodsFor:",
+protocol: '*Platform-ImportExport',
+fn: function (aString){
+var self=this;
+function $ClassCategoryReader(){return $globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $2,$3,$1;
+$2=$recv($ClassCategoryReader())._new();
+$recv($2)._class_category_(self,aString);
+$3=$recv($2)._yourself();
+$1=$3;
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString"],
+source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
+referencedClasses: ["ClassCategoryReader"],
+//>>excludeEnd("ide");
+messageSends: ["class:category:", "new", "yourself"]
+}),
+$globals.Behavior);
+
+$core.addMethod(
+$core.method({
+selector: "methodsFor:stamp:",
+protocol: '*Platform-ImportExport',
+fn: function (aString,aStamp){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=self._methodsFor_(aString);
+return $1;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aString", "aStamp"],
+source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["methodsFor:"]
+}),
+$globals.Behavior);
+
 $core.addMethod(
 $core.method({
 selector: "commit",

+ 93 - 0
src/Platform-ImportExport.st

@@ -528,6 +528,76 @@ on: aStream
 	^ self new stream: aStream
 ! !
 
+Object subclass: #ClassCategoryReader
+	instanceVariableNames: 'class category'
+	package: 'Platform-ImportExport'!
+!ClassCategoryReader commentStamp!
+I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.!
+
+!ClassCategoryReader methodsFor: 'accessing'!
+
+class: aClass category: aString
+	class := aClass.
+	category := aString
+! !
+
+!ClassCategoryReader methodsFor: 'fileIn'!
+
+scanFrom: aChunkParser
+	| chunk |
+	[ chunk := aChunkParser nextChunk.
+	chunk isEmpty ] whileFalse: [
+		self compileMethod: chunk ].
+	ClassBuilder new setupClass: class
+! !
+
+!ClassCategoryReader methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+! !
+
+!ClassCategoryReader methodsFor: 'private'!
+
+compileMethod: aString
+	Compiler new install: aString forClass: class protocol: category
+! !
+
+Object subclass: #ClassCommentReader
+	instanceVariableNames: 'class'
+	package: 'Platform-ImportExport'!
+!ClassCommentReader commentStamp!
+I provide a mechanism for retrieving class comments stored on a file.
+
+See also `ClassCategoryReader`.!
+
+!ClassCommentReader methodsFor: 'accessing'!
+
+class: aClass
+	class := aClass
+! !
+
+!ClassCommentReader methodsFor: 'fileIn'!
+
+scanFrom: aChunkParser
+	| chunk |
+	chunk := aChunkParser nextChunk.
+	chunk isEmpty ifFalse: [
+		self setComment: chunk ].
+! !
+
+!ClassCommentReader methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+! !
+
+!ClassCommentReader methodsFor: 'private'!
+
+setComment: aString
+	class comment: aString
+! !
+
 Object subclass: #ExportMethodProtocol
 	instanceVariableNames: 'name theClass'
 	package: 'Platform-ImportExport'!
@@ -991,6 +1061,29 @@ namespace: aString
 		yourself
 ! !
 
+!Behavior methodsFor: '*Platform-ImportExport'!
+
+commentStamp
+	^ ClassCommentReader new
+	class: self;
+	yourself
+!
+
+commentStamp: aStamp prior: prior
+		^ self commentStamp
+!
+
+methodsFor: aString
+	^ ClassCategoryReader new
+		class: self category: aString;
+		yourself
+!
+
+methodsFor: aString stamp: aStamp
+	"Added for file-in compatibility, ignores stamp."
+	^ self methodsFor: aString
+! !
+
 !Package methodsFor: '*Platform-ImportExport'!
 
 commit