Browse Source

Merge branch 'load-dependencies' into requirejs

Conflicts:
	js/Kernel-Objects.deploy.js
	js/Kernel-Objects.js
Herbert Vojčík 11 years ago
parent
commit
ee155cc000

+ 32 - 54
js/Importer-Exporter.deploy.js

@@ -145,10 +145,10 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
 $1=aStream;
-_st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._klass())));
+_st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._theClass())));
 $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._name())).__comma("'!"));
 return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
-messageSends: ["nextPutAll:", ",", "classNameFor:", "klass", "name"]}),
+messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]}),
 smalltalk.ChunkExporter.klass);
 
 smalltalk.addMethod(
@@ -285,14 +285,14 @@ return smalltalk.withContext(function($ctx4) {
 return _st(a).__lt_eq(b);
 }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
 return smalltalk.withContext(function($ctx4) {
-return _st($MethodCategory())._name_class_methods_(category,aClass,_st(map)._at_(category));
+return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
 }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
 }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
 $2=result;
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter.klass)})},
-messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:class:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
+messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
 smalltalk.ChunkExporter.klass);
 
 smalltalk.addMethod(
@@ -334,11 +334,11 @@ return smalltalk.withContext(function($ctx2) {
 return _st(a).__lt_eq(b);
 }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
 return smalltalk.withContext(function($ctx2) {
-return _st($MethodCategory())._name_class_methods_(category,aClass,_st(map)._at_(category));
+return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
 }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter.klass)})},
-messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:class:methods:", "at:", "sorted:", "<=", "keys"]}),
+messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"]}),
 smalltalk.ChunkExporter.klass);
 
 smalltalk.addMethod(
@@ -804,96 +804,96 @@ smalltalk.Importer);
 
 
 
-smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'klass'], 'Importer-Exporter');
+smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'theClass'], 'Importer-Exporter');
 smalltalk.addMethod(
 smalltalk.method({
-selector: "klass",
+selector: "methods",
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self["@klass"];
+$1=self["@methods"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"klass",{},smalltalk.MethodCategory)})},
+}, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
 messageSends: []}),
 smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "klass:",
-fn: function (aClass){
+selector: "methods:",
+fn: function (anArray){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self["@klass"]=aClass;
-return self}, function($ctx1) {$ctx1.fill(self,"klass:",{aClass:aClass},smalltalk.MethodCategory)})},
+self["@methods"]=anArray;
+return self}, function($ctx1) {$ctx1.fill(self,"methods:",{anArray:anArray},smalltalk.MethodCategory)})},
 messageSends: []}),
 smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "methods",
+selector: "name",
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self["@methods"];
+$1=self["@name"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
+}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
 messageSends: []}),
 smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "methods:",
-fn: function (anArray){
+selector: "name:",
+fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self["@methods"]=anArray;
-return self}, function($ctx1) {$ctx1.fill(self,"methods:",{anArray:anArray},smalltalk.MethodCategory)})},
+self["@name"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
 messageSends: []}),
 smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "name",
+selector: "theClass",
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self["@name"];
+$1=self["@theClass"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
+}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.MethodCategory)})},
 messageSends: []}),
 smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "name:",
-fn: function (aString){
+selector: "theClass:",
+fn: function (aClass){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self["@name"]=aString;
-return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
+self["@theClass"]=aClass;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.MethodCategory)})},
 messageSends: []}),
 smalltalk.MethodCategory);
 
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "name:class:methods:",
+selector: "name:theClass:methods:",
 fn: function (aString,aClass,anArray){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $2,$3,$1;
 $2=self._new();
 _st($2)._name_(aString);
-_st($2)._klass_(aClass);
+_st($2)._theClass_(aClass);
 _st($2)._methods_(anArray);
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"name:class:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
-messageSends: ["name:", "new", "klass:", "methods:", "yourself"]}),
+}, function($ctx1) {$ctx1.fill(self,"name:theClass:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
+messageSends: ["name:", "new", "theClass:", "methods:", "yourself"]}),
 smalltalk.MethodCategory.klass);
 
 
@@ -1635,28 +1635,6 @@ return $1;
 messageSends: ["at:put:", "ifNil:"]}),
 smalltalk.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "loadDependencies",
-fn: function (){
-var self=this;
-var root;
-function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
-return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3;
-root=_st($Object())._package();
-$1=self.__eq_eq(root);
-if(smalltalk.assert($1)){
-$2=[];
-return $2;
-} else {
-$3=[root];
-return $3;
-};
-return self}, function($ctx1) {$ctx1.fill(self,"loadDependencies",{root:root},smalltalk.Package)})},
-messageSends: ["package", "ifTrue:ifFalse:", "=="]}),
-smalltalk.Package);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "transport",

+ 47 - 72
js/Importer-Exporter.js

@@ -182,12 +182,12 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
 $1=aStream;
-_st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._klass())));
+_st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._theClass())));
 $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._name())).__comma("'!"));
 return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter.klass)})},
 args: ["category", "aStream"],
-source: "exportCategoryPrologueOf: category on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: category klass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category name, '''!'",
-messageSends: ["nextPutAll:", ",", "classNameFor:", "klass", "name"],
+source: "exportCategoryPrologueOf: category on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: category theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category name, '''!'",
+messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
 referencedClasses: []
 }),
 smalltalk.ChunkExporter.klass);
@@ -347,7 +347,7 @@ return smalltalk.withContext(function($ctx4) {
 return _st(a).__lt_eq(b);
 }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
 return smalltalk.withContext(function($ctx4) {
-return _st($MethodCategory())._name_class_methods_(category,aClass,_st(map)._at_(category));
+return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
 }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
 }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
@@ -355,8 +355,8 @@ $2=result;
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter.klass)})},
 args: ["package"],
-source: "extensionCategoriesOfPackage: package\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := package name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09\x09\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09result addAll: ((map keys sorted: [:a :b | a <= b ]) collect: [:category |\x0a\x09\x09\x09\x09MethodCategory name: category class: aClass methods: (map at: category)]) ]].\x0a\x09^result",
-messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:class:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
+source: "extensionCategoriesOfPackage: package\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := package name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09\x09\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09result addAll: ((map keys sorted: [:a :b | a <= b ]) collect: [:category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category)]) ]].\x0a\x09^result",
+messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
 referencedClasses: ["OrderedCollection", "Dictionary", "MethodCategory", "Smalltalk", "Package"]
 }),
 smalltalk.ChunkExporter.klass);
@@ -406,13 +406,13 @@ return smalltalk.withContext(function($ctx2) {
 return _st(a).__lt_eq(b);
 }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
 return smalltalk.withContext(function($ctx2) {
-return _st($MethodCategory())._name_class_methods_(category,aClass,_st(map)._at_(category));
+return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
 }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter.klass)})},
 args: ["aClass"],
-source: "ownCategoriesOfClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09^(map keys sorted: [:a :b | a <= b ]) collect: [:category |\x0a\x09\x09MethodCategory name: category class: aClass methods: (map at: category) ]",
-messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:class:methods:", "at:", "sorted:", "<=", "keys"],
+source: "ownCategoriesOfClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [:category :methods |\x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09^(map keys sorted: [:a :b | a <= b ]) collect: [:category |\x0a\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]",
+messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "name:theClass:methods:", "at:", "sorted:", "<=", "keys"],
 referencedClasses: ["Dictionary", "MethodCategory"]
 }),
 smalltalk.ChunkExporter.klass);
@@ -984,20 +984,21 @@ smalltalk.Importer);
 
 
 
-smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'klass'], 'Importer-Exporter');
+smalltalk.addClass('MethodCategory', smalltalk.Object, ['methods', 'name', 'theClass'], 'Importer-Exporter');
+smalltalk.MethodCategory.comment="I am an abstraction for a method category in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
 smalltalk.addMethod(
 smalltalk.method({
-selector: "klass",
+selector: "methods",
 category: 'accessing',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self["@klass"];
+$1=self["@methods"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"klass",{},smalltalk.MethodCategory)})},
+}, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
 args: [],
-source: "klass\x0a\x09^klass",
+source: "methods\x0a\x09^methods",
 messageSends: [],
 referencedClasses: []
 }),
@@ -1005,15 +1006,15 @@ smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "klass:",
+selector: "methods:",
 category: 'accessing',
-fn: function (aClass){
+fn: function (anArray){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self["@klass"]=aClass;
-return self}, function($ctx1) {$ctx1.fill(self,"klass:",{aClass:aClass},smalltalk.MethodCategory)})},
-args: ["aClass"],
-source: "klass: aClass\x0a\x09klass := aClass",
+self["@methods"]=anArray;
+return self}, function($ctx1) {$ctx1.fill(self,"methods:",{anArray:anArray},smalltalk.MethodCategory)})},
+args: ["anArray"],
+source: "methods: anArray\x0a\x09methods := anArray",
 messageSends: [],
 referencedClasses: []
 }),
@@ -1021,17 +1022,17 @@ smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "methods",
+selector: "name",
 category: 'accessing',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self["@methods"];
+$1=self["@name"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.MethodCategory)})},
+}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
 args: [],
-source: "methods\x0a\x09^methods",
+source: "name\x0a\x09^name",
 messageSends: [],
 referencedClasses: []
 }),
@@ -1039,15 +1040,15 @@ smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "methods:",
+selector: "name:",
 category: 'accessing',
-fn: function (anArray){
+fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self["@methods"]=anArray;
-return self}, function($ctx1) {$ctx1.fill(self,"methods:",{anArray:anArray},smalltalk.MethodCategory)})},
-args: ["anArray"],
-source: "methods: anArray\x0a\x09methods := anArray",
+self["@name"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
+args: ["aString"],
+source: "name: aString\x0a\x09name := aString",
 messageSends: [],
 referencedClasses: []
 }),
@@ -1055,17 +1056,17 @@ smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "name",
+selector: "theClass",
 category: 'accessing',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=self["@name"];
+$1=self["@theClass"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.MethodCategory)})},
+}, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.MethodCategory)})},
 args: [],
-source: "name\x0a\x09^name",
+source: "theClass\x0a\x09^theClass",
 messageSends: [],
 referencedClasses: []
 }),
@@ -1073,15 +1074,15 @@ smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "name:",
+selector: "theClass:",
 category: 'accessing',
-fn: function (aString){
+fn: function (aClass){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-self["@name"]=aString;
-return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},smalltalk.MethodCategory)})},
-args: ["aString"],
-source: "name: aString\x0a\x09name := aString",
+self["@theClass"]=aClass;
+return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.MethodCategory)})},
+args: ["aClass"],
+source: "theClass: aClass\x0a\x09theClass := aClass",
 messageSends: [],
 referencedClasses: []
 }),
@@ -1090,7 +1091,7 @@ smalltalk.MethodCategory);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "name:class:methods:",
+selector: "name:theClass:methods:",
 category: 'not yet classified',
 fn: function (aString,aClass,anArray){
 var self=this;
@@ -1098,15 +1099,15 @@ return smalltalk.withContext(function($ctx1) {
 var $2,$3,$1;
 $2=self._new();
 _st($2)._name_(aString);
-_st($2)._klass_(aClass);
+_st($2)._theClass_(aClass);
 _st($2)._methods_(anArray);
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"name:class:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
+}, function($ctx1) {$ctx1.fill(self,"name:theClass:methods:",{aString:aString,aClass:aClass,anArray:anArray},smalltalk.MethodCategory.klass)})},
 args: ["aString", "aClass", "anArray"],
-source: "name: aString class: aClass methods: anArray\x0a\x09^self new\x0a\x09\x09name: aString;\x0a\x09\x09klass: aClass;\x0a\x09\x09methods: anArray;\x0a\x09\x09yourself",
-messageSends: ["name:", "new", "klass:", "methods:", "yourself"],
+source: "name: aString theClass: aClass methods: anArray\x0a\x09^self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09methods: anArray;\x0a\x09\x09yourself",
+messageSends: ["name:", "new", "theClass:", "methods:", "yourself"],
 referencedClasses: []
 }),
 smalltalk.MethodCategory.klass);
@@ -1772,6 +1773,7 @@ smalltalk.LegacyPackageHandler.klass);
 
 
 smalltalk.addClass('PluggableExporter', smalltalk.Object, ['recipe'], 'Importer-Exporter');
+smalltalk.PluggableExporter.comment="I am an engine for exporting structured data on a Stream.\x0a\x0aMy instances are created using\x0a  PluggableExporter newUsing: recipe,\x0awhere recipe is structured description of the exporting algorithm,\x0a\x0aThen actual exporting is done using\x0a  aPluggableExporter export: data usingRecipe: recipe on: stream\x0a\x0aRecipe is an array, which can contain two kinds of elements:\x0a - an assocation where key is the receiver and value is two-arg selector\x0a    In this case, `receiver perform: selector withArguments: { data. stream }` is called.\x0a\x09This essentially defines one step of export process.\x0a\x09The key (eg. receiver) is presumed to be some kind of 'repository' of the exporting methods\x0a\x09that just format appropriate aspect of data into a stream; like a class or a singleton,\x0a\x09so you can make the recipe itself decoupled from data.\x0a - a subarray (sa), where first element is special and the rest is recursive recipe\x0a    `sa first` must be an association similar to one above,\x0a\x09with key being the 'repository' receiver, but value is one-arg selector.\x0a\x09In this case, `receiver perform: selector withArguments: { data }` should create a collection.\x0a\x09Then, the sub-recipe (`sa allButFirst`) is applied to every element of a collection, eg.\x0a\x09  collection do: [ :each | self export: each using: sa allButFirst on: stream ]\x0a  \x0aI am used to export amber packages, so I have convenience method\x0aexportPackage: aPackage on: aStream\x0awhich exports aPackage using recipe you passed on newUsing:\x0a(it is otherwise no special, so it may be renamed to export:on:)";
 smalltalk.addMethod(
 smalltalk.method({
 selector: "export:usingRecipe:on:",
@@ -2083,33 +2085,6 @@ referencedClasses: []
 }),
 smalltalk.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "loadDependencies",
-category: '*Importer-Exporter',
-fn: function (){
-var self=this;
-var root;
-function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
-return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3;
-root=_st($Object())._package();
-$1=self.__eq_eq(root);
-if(smalltalk.assert($1)){
-$2=[];
-return $2;
-} else {
-$3=[root];
-return $3;
-};
-return self}, function($ctx1) {$ctx1.fill(self,"loadDependencies",{root:root},smalltalk.Package)})},
-args: [],
-source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be present\x0a\x09before loading this package.\x0a\x09These are determined as set of packages covering\x0a\x09all classes used either for subclassing or for defining\x0a\x09extension methods on.\x22\x0a\x09\x0a\x09\x22Fake one for now. TODO\x22\x0a\x09| root |\x0a\x09root := Object package.\x0a\x09self == root ifTrue: [ ^#() ] ifFalse: [ ^{root} ]",
-messageSends: ["package", "ifTrue:ifFalse:", "=="],
-referencedClasses: ["Object"]
-}),
-smalltalk.Package);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "transport",

+ 24 - 2
js/Kernel-Infrastructure.deploy.js

@@ -1,5 +1,6 @@
 define("amber/Kernel-Infrastructure", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Infrastructure');
+
 smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
 
 smalltalk.InspectorHandler.klass.iVarNames = ['inspector'];
@@ -904,7 +905,7 @@ smalltalk.ClassOrganizer);
 smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Infrastructure');
 
 
-smalltalk.addClass('Package', smalltalk.Object, ['extension'], 'Kernel-Infrastructure');
+smalltalk.addClass('Package', smalltalk.Object, [], 'Kernel-Infrastructure');
 smalltalk.addMethod(
 smalltalk.method({
 selector: "classes",
@@ -929,6 +930,28 @@ return true;
 messageSends: []}),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "loadDependencies",
+fn: function (){
+var self=this;
+var root;
+function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+root=_st($Object())._package();
+$1=self.__eq_eq(root);
+if(smalltalk.assert($1)){
+$2=[];
+return $2;
+} else {
+$3=[root];
+return $3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"loadDependencies",{root:root},smalltalk.Package)})},
+messageSends: ["package", "ifTrue:ifFalse:", "=="]}),
+smalltalk.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "name",
@@ -1668,7 +1691,6 @@ return self}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.
 messageSends: []}),
 smalltalk.Smalltalk.klass);
 
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "asJavaScriptSelector",

+ 29 - 2
js/Kernel-Infrastructure.js

@@ -1,5 +1,6 @@
 define("amber/Kernel-Infrastructure", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Infrastructure');
+
 smalltalk.addClass('InspectorHandler', smalltalk.Object, [], 'Kernel-Infrastructure');
 smalltalk.InspectorHandler.comment="I am responsible for inspecting object.\x0a\x0aMy class-side `inspector` inst var holds the current inspector I'm delegating object inspection to.\x0a\x0aThe default inspector object is the transcript.";
 
@@ -1206,7 +1207,7 @@ smalltalk.addClass('PackageOrganizer', smalltalk.Organizer, [], 'Kernel-Infrastr
 smalltalk.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
 
 
-smalltalk.addClass('Package', smalltalk.Object, ['extension'], 'Kernel-Infrastructure');
+smalltalk.addClass('Package', smalltalk.Object, [], 'Kernel-Infrastructure');
 smalltalk.Package.comment="I am similar to a \x22class category\x22 typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.\x0a\x0aEach package has a name and can be queried for its classes, but it will then resort to a reverse scan of all classes to find them.\x0a\x0a## API\x0a\x0aPackages are manipulated through \x22Smalltalk current\x22, like for example finding one based on a name or with `Package class >> #name` directly:\x0a\x0a    Smalltalk current packageAt: 'Kernel'\x0a    Package named: 'Kernel'\x0a\x0aA package differs slightly from a Monticello package which can span multiple class categories using a naming convention based on hyphenation. But just as in Monticello a package supports \x22class extensions\x22 so a package can define behaviors in foreign classes using a naming convention for method categories where the category starts with an asterisk and then the name of the owning package follows.\x0a\x0aYou can fetch a package from the server:\x0a\x0a\x09Package load: 'Additional-Examples'";
 smalltalk.addMethod(
 smalltalk.method({
@@ -1242,6 +1243,33 @@ referencedClasses: []
 }),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "loadDependencies",
+category: 'dependencies',
+fn: function (){
+var self=this;
+var root;
+function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+root=_st($Object())._package();
+$1=self.__eq_eq(root);
+if(smalltalk.assert($1)){
+$2=[];
+return $2;
+} else {
+$3=[root];
+return $3;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"loadDependencies",{root:root},smalltalk.Package)})},
+args: [],
+source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be present\x0a\x09before loading this package.\x0a\x09These are determined as set of packages covering\x0a\x09all classes used either for subclassing or for defining\x0a\x09extension methods on.\x22\x0a\x09\x0a\x09\x22Fake one for now. TODO\x22\x0a\x09| root |\x0a\x09root := Object package.\x0a\x09self == root ifTrue: [ ^#() ] ifFalse: [ ^{root} ]",
+messageSends: ["package", "ifTrue:ifFalse:", "=="],
+referencedClasses: ["Object"]
+}),
+smalltalk.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "name",
@@ -2224,7 +2252,6 @@ referencedClasses: []
 }),
 smalltalk.Smalltalk.klass);
 
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "asJavaScriptSelector",

+ 0 - 1
js/Kernel-Objects.deploy.js

@@ -2635,5 +2635,4 @@ return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.UndefinedObjec
 messageSends: ["error:"]}),
 smalltalk.UndefinedObject.klass);
 
-
 });

+ 0 - 1
js/Kernel-Objects.js

@@ -3642,5 +3642,4 @@ referencedClasses: []
 }),
 smalltalk.UndefinedObject.klass);
 
-
 });

+ 47 - 27
st/Importer-Exporter.st

@@ -64,7 +64,7 @@ extensionCategoriesOfPackage: package
 			aClass protocolsDo: [:category :methods |
 				(category match: '^\*', name) ifTrue: [ map at: category put: methods ]].
 			result addAll: ((map keys sorted: [:a :b | a <= b ]) collect: [:category |
-				MethodCategory name: category class: aClass methods: (map at: category)]) ]].
+				MethodCategory name: category theClass: aClass methods: (map at: category)]) ]].
 	^result
 !
 
@@ -82,7 +82,7 @@ ownCategoriesOfClass: aClass
 	aClass protocolsDo: [:category :methods |
 		(category match: '^\*') ifFalse: [ map at: category put: methods ]].
 	^(map keys sorted: [:a :b | a <= b ]) collect: [:category |
-		MethodCategory name: category class: aClass methods: (map at: category) ]
+		MethodCategory name: category theClass: aClass methods: (map at: category) ]
 !
 
 ownCategoriesOfMetaClass: aClass
@@ -99,7 +99,7 @@ exportCategoryEpilogueOf: category on: aStream
 
 exportCategoryPrologueOf: category on: aStream
 	aStream
-		nextPutAll: '!!', (self classNameFor: category klass);
+		nextPutAll: '!!', (self classNameFor: category theClass);
 		nextPutAll: ' methodsFor: ''', category name, '''!!'
 !
 
@@ -476,18 +476,15 @@ import: aStream
 ! !
 
 Object subclass: #MethodCategory
-	instanceVariableNames: 'methods name klass'
+	instanceVariableNames: 'methods name theClass'
 	package: 'Importer-Exporter'!
+!MethodCategory commentStamp!
+I am an abstraction for a method category in a class / metaclass.
 
-!MethodCategory methodsFor: 'accessing'!
-
-klass
-	^klass
-!
+I know of my class, name and methods.
+I am used when exporting a package.!
 
-klass: aClass
-	klass := aClass
-!
+!MethodCategory methodsFor: 'accessing'!
 
 methods
 	^methods
@@ -503,14 +500,22 @@ name
 
 name: aString
 	name := aString
+!
+
+theClass
+	^theClass
+!
+
+theClass: aClass
+	theClass := aClass
 ! !
 
 !MethodCategory class methodsFor: 'not yet classified'!
 
-name: aString class: aClass methods: anArray
+name: aString theClass: aClass methods: anArray
 	^self new
 		name: aString;
-		klass: aClass;
+		theClass: aClass;
 		methods: anArray;
 		yourself
 ! !
@@ -757,6 +762,34 @@ loadPackages: aCollection prefix: aString
 Object subclass: #PluggableExporter
 	instanceVariableNames: 'recipe'
 	package: 'Importer-Exporter'!
+!PluggableExporter commentStamp!
+I am an engine for exporting structured data on a Stream.
+
+My instances are created using
+  PluggableExporter newUsing: recipe,
+where recipe is structured description of the exporting algorithm,
+
+Then actual exporting is done using
+  aPluggableExporter export: data usingRecipe: recipe on: stream
+
+Recipe is an array, which can contain two kinds of elements:
+ - an assocation where key is the receiver and value is two-arg selector
+    In this case, `receiver perform: selector withArguments: { data. stream }` is called.
+	This essentially defines one step of export process.
+	The key (eg. receiver) is presumed to be some kind of 'repository' of the exporting methods
+	that just format appropriate aspect of data into a stream; like a class or a singleton,
+	so you can make the recipe itself decoupled from data.
+ - a subarray (sa), where first element is special and the rest is recursive recipe
+    `sa first` must be an association similar to one above,
+	with key being the 'repository' receiver, but value is one-arg selector.
+	In this case, `receiver perform: selector withArguments: { data }` should create a collection.
+	Then, the sub-recipe (`sa allButFirst`) is applied to every element of a collection, eg.
+	  collection do: [ :each | self export: each using: sa allButFirst on: stream ]
+  
+I am used to export amber packages, so I have convenience method
+exportPackage: aPackage on: aStream
+which exports aPackage using recipe you passed on newUsing:
+(it is otherwise no special, so it may be renamed to export:on:)!
 
 !PluggableExporter methodsFor: 'accessing'!
 
@@ -842,19 +875,6 @@ commitPathSt: aString
 	^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt put: aString
 !
 
-loadDependencies
-	"Returns list of packages that need to be present
-	before loading this package.
-	These are determined as set of packages covering
-	all classes used either for subclassing or for defining
-	extension methods on."
-	
-	"Fake one for now. TODO"
-	| root |
-	root := Object package.
-	self == root ifTrue: [ ^#() ] ifFalse: [ ^{root} ]
-!
-
 transport
 	^ PackageHandler for: self transportType
 !

+ 16 - 1
st/Kernel-Infrastructure.st

@@ -452,7 +452,7 @@ Organizer subclass: #PackageOrganizer
 I am an organizer specific to packages. I hold classes categorization information.!
 
 Object subclass: #Package
-	instanceVariableNames: 'extension'
+	instanceVariableNames: ''
 	package: 'Kernel-Infrastructure'!
 !Package commentStamp!
 I am similar to a "class category" typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.
@@ -504,6 +504,21 @@ sortedClasses
 	^self class sortedClasses: self classes
 ! !
 
+!Package methodsFor: 'dependencies'!
+
+loadDependencies
+	"Returns list of packages that need to be present
+	before loading this package.
+	These are determined as set of packages covering
+	all classes used either for subclassing or for defining
+	extension methods on."
+	
+	"Fake one for now. TODO"
+	| root |
+	root := Object package.
+	self == root ifTrue: [ ^#() ] ifFalse: [ ^{root} ]
+! !
+
 !Package methodsFor: 'printing'!
 
 printOn: aStream

+ 5 - 5
support/boot.js

@@ -105,7 +105,7 @@ function RootBrik(brikz, st) {
 
 	this.__init__ = function () {
 		st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, undefined, false);
-		st.wrapClassName("Smalltalk", "Kernel-Objects", Smalltalk, st.Object, false);
+		st.wrapClassName("Smalltalk", "Kernel-Infrastructure", Smalltalk, st.Object, false);
 		st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, st.Object, false);
 	};
 }
@@ -128,9 +128,9 @@ function OrganizeBrik(brikz, st) {
 	inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
 
 	this.__init__ = function () {
-		st.wrapClassName("Organizer", "Kernel-Objects", SmalltalkOrganizer, st.Object, false);
-		st.wrapClassName("PackageOrganizer", "Kernel-Objects", SmalltalkPackageOrganizer, st.Organizer, false);
-		st.wrapClassName("ClassOrganizer", "Kernel-Objects", SmalltalkClassOrganizer, st.Organizer, false);
+		st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, st.Object, false);
+		st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, st.Organizer, false);
+		st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, st.Organizer, false);
 	};
 
 	this.setupClassOrganization = function (klass) {
@@ -317,7 +317,7 @@ function ClassesBrik(brikz, st) {
 
 		st.Object.klass.superclass = st.Class;
 
-		st.wrapClassName("Package", "Kernel-Objects", SmalltalkPackage, st.Object, false);
+		st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, st.Object, false);
 	};
 
 	/* Smalltalk classes */