ソースを参照

Split Kernel in several packages

Nicolas Petton 12 年 前
コミット
48d35a2ad6

+ 3 - 3
bin/amberc

@@ -74,9 +74,9 @@ Usage: $0 [-l lib1,lib2...] [-i file] [-m class] [-M file]
 
      Example invocations:
 
-     Just compile Kernel.st to Kernel.js:
+     Just compile Kernel-Objects.st to Kernel-Objects.js:
 
-        amberc Kernel.st
+        amberc Kernel-Objects.st
 
      Compile Hello.st to Hello.js and create complete program called
      Program.js and adding a call to class method #main in class Hello:
@@ -99,7 +99,7 @@ if [ -z $1 ] ; then
 fi
 
 # Define our predefined library combinations
-KERNEL="boot Kernel"
+KERNEL="boot Kernel-Objects Kernel-Classes Kernel-Methods Kernel-Collections Kernel-Exceptions Kernel-Transcript"
 COMPILER="$KERNEL parser Compiler"
 
 # Predefined initializer

+ 13 - 13
js/IDE.deploy.js

@@ -1116,6 +1116,19 @@ return self;}
 }),
 smalltalk.Browser);
 
+smalltalk.addMethod(
+'_copyClass',
+smalltalk.method({
+selector: 'copyClass',
+fn: function (){
+var self=this;
+var className=nil;
+className=smalltalk.send((typeof window == 'undefined' ? nil : window), "_prompt_", ["Copy class"]);
+((($receiver = smalltalk.send(smalltalk.send(className, "_notNil", []), "_and_", [(function(){return smalltalk.send(className, "_notEmpty", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})]));
+return self;}
+}),
+smalltalk.Browser);
+
 smalltalk.addMethod(
 '_initialize',
 smalltalk.method({
@@ -1302,19 +1315,6 @@ return self;}
 }),
 smalltalk.Browser);
 
-smalltalk.addMethod(
-'_copyClass',
-smalltalk.method({
-selector: 'copyClass',
-fn: function (){
-var self=this;
-var className=nil;
-className=smalltalk.send((typeof window == 'undefined' ? nil : window), "_prompt_", ["Copy class"]);
-((($receiver = smalltalk.send(smalltalk.send(className, "_notNil", []), "_and_", [(function(){return smalltalk.send(className, "_notEmpty", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})]));
-return self;}
-}),
-smalltalk.Browser);
-
 
 smalltalk.addMethod(
 '_commitPathJs',

+ 18 - 18
js/IDE.js

@@ -1571,6 +1571,24 @@ referencedClasses: ["Object", "Smalltalk"]
 }),
 smalltalk.Browser);
 
+smalltalk.addMethod(
+unescape('_copyClass'),
+smalltalk.method({
+selector: unescape('copyClass'),
+category: 'actions',
+fn: function (){
+var self=this;
+var className=nil;
+className=smalltalk.send((typeof window == 'undefined' ? nil : window), "_prompt_", ["Copy class"]);
+((($receiver = smalltalk.send(smalltalk.send(className, "_notNil", []), "_and_", [(function(){return smalltalk.send(className, "_notEmpty", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})]));
+return self;},
+args: [],
+source: unescape('copyClass%0A%09%7C%20className%20%7C%0A%09className%20%3A%3D%20window%20prompt%3A%20%27Copy%20class%27.%0A%09%28className%20notNil%20and%3A%20%5BclassName%20notEmpty%5D%29%20ifTrue%3A%20%5B%0A%09%09ClassBuilder%20new%20copyClass%3A%20self%20selectedClass%20named%3A%20className.%0A%20%20%20%20%20%20%20%20%20%20%09%20self%20%0A%09%09%09resetClassesList%3B%0A%09%09%09updateClassesList.%0A%09%09self%20selectClass%3A%20%28Smalltalk%20current%20at%3A%20className%29%5D'),
+messageSends: ["prompt:", "ifTrue:", "and:", "notNil", "notEmpty", "copyClass:named:", "new", "selectedClass", "resetClassesList", "updateClassesList", "selectClass:", "at:", "current"],
+referencedClasses: ["ClassBuilder", "Smalltalk"]
+}),
+smalltalk.Browser);
+
 smalltalk.addMethod(
 unescape('_initialize'),
 smalltalk.method({
@@ -1832,24 +1850,6 @@ referencedClasses: []
 }),
 smalltalk.Browser);
 
-smalltalk.addMethod(
-unescape('_copyClass'),
-smalltalk.method({
-selector: unescape('copyClass'),
-category: 'actions',
-fn: function (){
-var self=this;
-var className=nil;
-className=smalltalk.send((typeof window == 'undefined' ? nil : window), "_prompt_", ["Copy class"]);
-((($receiver = smalltalk.send(smalltalk.send(className, "_notNil", []), "_and_", [(function(){return smalltalk.send(className, "_notEmpty", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_copyClass_named_", [smalltalk.send(self, "_selectedClass", []), className]);(function($rec){smalltalk.send($rec, "_resetClassesList", []);return smalltalk.send($rec, "_updateClassesList", []);})(self);return smalltalk.send(self, "_selectClass_", [smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_at_", [className])]);})]));
-return self;},
-args: [],
-source: unescape('copyClass%0A%09%7C%20className%20%7C%0A%09className%20%3A%3D%20window%20prompt%3A%20%27Copy%20class%27.%0A%09%28className%20notNil%20and%3A%20%5BclassName%20notEmpty%5D%29%20ifTrue%3A%20%5B%0A%09%09ClassBuilder%20new%20copyClass%3A%20self%20selectedClass%20named%3A%20className.%0A%20%20%20%20%20%20%20%20%20%20%09%20self%20%0A%09%09%09resetClassesList%3B%0A%09%09%09updateClassesList.%0A%09%09self%20selectClass%3A%20%28Smalltalk%20current%20at%3A%20className%29%5D'),
-messageSends: ["prompt:", "ifTrue:", "and:", "notNil", "notEmpty", "copyClass:named:", "new", "selectedClass", "resetClassesList", "updateClassesList", "selectClass:", "at:", "current"],
-referencedClasses: ["ClassBuilder", "Smalltalk"]
-}),
-smalltalk.Browser);
-
 
 smalltalk.addMethod(
 unescape('_commitPathJs'),

+ 675 - 0
js/Kernel-Classes.deploy.js

@@ -0,0 +1,675 @@
+smalltalk.addPackage('Kernel-Classes', {});
+smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
+smalltalk.addMethod(
+'_new',
+smalltalk.method({
+selector: 'new',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(self, "_basicNew", []), "_initialize", []);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_basicNew',
+smalltalk.method({
+selector: 'basicNew',
+fn: function (){
+var self=this;
+return new self.fn();
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_name',
+smalltalk.method({
+selector: 'name',
+fn: function (){
+var self=this;
+return self.className || nil;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_superclass',
+smalltalk.method({
+selector: 'superclass',
+fn: function (){
+var self=this;
+return self.superclass || nil;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_subclasses',
+smalltalk.method({
+selector: 'subclasses',
+fn: function (){
+var self=this;
+return smalltalk.subclasses(self);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_allSubclasses',
+smalltalk.method({
+selector: 'allSubclasses',
+fn: function (){
+var self=this;
+var result=nil;
+result=smalltalk.send(self, "_subclasses", []);
+smalltalk.send(smalltalk.send(self, "_subclasses", []), "_do_", [(function(each){return smalltalk.send(result, "_addAll_", [smalltalk.send(each, "_allSubclasses", [])]);})]);
+return result;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_withAllSubclasses',
+smalltalk.method({
+selector: 'withAllSubclasses',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_allSubclasses", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_with_", [self]));
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_prototype',
+smalltalk.method({
+selector: 'prototype',
+fn: function (){
+var self=this;
+return self.fn.prototype;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_methodDictionary',
+smalltalk.method({
+selector: 'methodDictionary',
+fn: function (){
+var self=this;
+var dict = smalltalk.Dictionary._new();
+	var methods = self.fn.prototype.methods;
+	for(var i in methods) {
+		if(methods[i].selector) {
+			dict._at_put_(methods[i].selector, methods[i]);
+		}
+	};
+	return dict;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_methodsFor_',
+smalltalk.method({
+selector: 'methodsFor:',
+fn: function (aString){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_class_category_", [self, aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader), "_new", []));
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_addCompiledMethod_',
+smalltalk.method({
+selector: 'addCompiledMethod:',
+fn: function (aMethod){
+var self=this;
+smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_instanceVariableNames',
+smalltalk.method({
+selector: 'instanceVariableNames',
+fn: function (){
+var self=this;
+return self.iVarNames;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_comment',
+smalltalk.method({
+selector: 'comment',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_basicAt_", ["comment"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_comment_',
+smalltalk.method({
+selector: 'comment:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["comment", aString]);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_commentStamp',
+smalltalk.method({
+selector: 'commentStamp',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_class_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader), "_new", []));
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_removeCompiledMethod_',
+smalltalk.method({
+selector: 'removeCompiledMethod:',
+fn: function (aMethod){
+var self=this;
+delete self.fn.prototype[aMethod.selector._asSelector()];
+	delete self.fn.prototype.methods[aMethod.selector];
+	smalltalk.init(self);;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_inheritsFrom_',
+smalltalk.method({
+selector: 'inheritsFrom:',
+fn: function (aClass){
+var self=this;
+return smalltalk.send(smalltalk.send(aClass, "_allSubclasses", []), "_includes_", [self]);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_protocols',
+smalltalk.method({
+selector: 'protocols',
+fn: function (){
+var self=this;
+var protocols=nil;
+protocols=smalltalk.send((smalltalk.Array || Array), "_new", []);
+smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_do_", [(function(each){return ((($receiver = smalltalk.send(protocols, "_includes_", [smalltalk.send(each, "_category", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})]));})]);
+return smalltalk.send(protocols, "_sort", []);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_protocolsDo_',
+smalltalk.method({
+selector: 'protocolsDo:',
+fn: function (aBlock){
+var self=this;
+var methodsByCategory=nil;
+methodsByCategory=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
+smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_values", []), "_do_", [(function(m){return smalltalk.send(smalltalk.send(methodsByCategory, "_at_ifAbsentPut_", [smalltalk.send(m, "_category", []), (function(){return smalltalk.send((smalltalk.Array || Array), "_new", []);})]), "_add_", [m]);})]);
+smalltalk.send(smalltalk.send(self, "_protocols", []), "_do_", [(function(category){return smalltalk.send(aBlock, "_value_value_", [category, smalltalk.send(methodsByCategory, "_at_", [category])]);})]);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_allInstanceVariableNames',
+smalltalk.method({
+selector: 'allInstanceVariableNames',
+fn: function (){
+var self=this;
+var result=nil;
+result=smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_copy", []);
+(($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(result, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allInstanceVariableNames", [])]);})() : nil;
+return result;
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_methodAt_',
+smalltalk.method({
+selector: 'methodAt:',
+fn: function (aString){
+var self=this;
+return smalltalk.methods(self)[aString];
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_methodsFor_stamp_',
+smalltalk.method({
+selector: 'methodsFor:stamp:',
+fn: function (aString, aStamp){
+var self=this;
+return smalltalk.send(self, "_methodsFor_", [aString]);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_commentStamp_prior_',
+smalltalk.method({
+selector: 'commentStamp:prior:',
+fn: function (aStamp, prior){
+var self=this;
+return smalltalk.send(self, "_commentStamp", []);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_compile_',
+smalltalk.method({
+selector: 'compile:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_compile_category_", [aString, ""]);
+return self;}
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+'_compile_category_',
+smalltalk.method({
+selector: 'compile:category:',
+fn: function (aString, anotherString){
+var self=this;
+var method=nil;
+method=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [aString, self]);
+smalltalk.send(method, "_category_", [anotherString]);
+smalltalk.send(self, "_addCompiledMethod_", [method]);
+return self;}
+}),
+smalltalk.Behavior);
+
+
+
+smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
+smalltalk.addMethod(
+'_category',
+smalltalk.method({
+selector: 'category',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_package", [])) == nil || $receiver == undefined) ? (function(){return "Unclassified";})() : (function(){return smalltalk.send(smalltalk.send(self, "_package", []), "_name", []);})();
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_subclass_instanceVariableNames_',
+smalltalk.method({
+selector: 'subclass:instanceVariableNames:',
+fn: function (aString, anotherString){
+var self=this;
+return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_subclass_instanceVariableNames_category_',
+smalltalk.method({
+selector: 'subclass:instanceVariableNames:category:',
+fn: function (aString, aString2, aString3){
+var self=this;
+smalltalk.send(self, "_deprecatedAPI", []);
+return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_isClass',
+smalltalk.method({
+selector: 'isClass',
+fn: function (){
+var self=this;
+return true;
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_printString',
+smalltalk.method({
+selector: 'printString',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_name", []);
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_rename_',
+smalltalk.method({
+selector: 'rename:',
+fn: function (aString){
+var self=this;
+
+		smalltalk[aString] = self;
+		delete smalltalk[self.className];
+		self.className = aString;
+	;
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_',
+smalltalk.method({
+selector: 'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:',
+fn: function (aString, aString2, classVars, pools, aString3){
+var self=this;
+return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_package',
+smalltalk.method({
+selector: 'package',
+fn: function (){
+var self=this;
+return self.pkg;
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_package_',
+smalltalk.method({
+selector: 'package:',
+fn: function (aPackage){
+var self=this;
+self.pkg = aPackage;
+return self;}
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+'_subclass_instanceVariableNames_package_',
+smalltalk.method({
+selector: 'subclass:instanceVariableNames:package:',
+fn: function (aString, aString2, aString3){
+var self=this;
+return smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
+return self;}
+}),
+smalltalk.Class);
+
+
+
+smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
+smalltalk.addMethod(
+'_instanceClass',
+smalltalk.method({
+selector: 'instanceClass',
+fn: function (){
+var self=this;
+return self.instanceClass;
+return self;}
+}),
+smalltalk.Metaclass);
+
+smalltalk.addMethod(
+'_instanceVariableNames_',
+smalltalk.method({
+selector: 'instanceVariableNames:',
+fn: function (aCollection){
+var self=this;
+smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_class_instanceVariableNames_", [self, aCollection]);
+return self;}
+}),
+smalltalk.Metaclass);
+
+smalltalk.addMethod(
+'_isMetaclass',
+smalltalk.method({
+selector: 'isMetaclass',
+fn: function (){
+var self=this;
+return true;
+return self;}
+}),
+smalltalk.Metaclass);
+
+smalltalk.addMethod(
+'_printString',
+smalltalk.method({
+selector: 'printString',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instanceClass", []), "_name", []), "__comma", [" class"]);
+return self;}
+}),
+smalltalk.Metaclass);
+
+
+
+smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
+smalltalk.addMethod(
+'_superclass_subclass_',
+smalltalk.method({
+selector: 'superclass:subclass:',
+fn: function (aClass, aString){
+var self=this;
+return smalltalk.send(self, "_superclass_subclass_instanceVariableNames_package_", [aClass, aString, "", nil]);
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_class_instanceVariableNames_',
+smalltalk.method({
+selector: 'class:instanceVariableNames:',
+fn: function (aClass, aString){
+var self=this;
+((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})]));
+smalltalk.send(aClass, "_basicAt_put_", ["iVarNames", smalltalk.send(self, "_instanceVariableNamesFor_", [aString])]);
+smalltalk.send(self, "_setupClass_", [aClass]);
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_instanceVariableNamesFor_',
+smalltalk.method({
+selector: 'instanceVariableNamesFor:',
+fn: function (aString){
+var self=this;
+return smalltalk.send(smalltalk.send(aString, "_tokenize_", [" "]), "_reject_", [(function(each){return smalltalk.send(each, "_isEmpty", []);})]);
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_addSubclassOf_named_instanceVariableNames_',
+smalltalk.method({
+selector: 'addSubclassOf:named:instanceVariableNames:',
+fn: function (aClass, aString, aCollection){
+var self=this;
+smalltalk.addClass(aString, aClass, aCollection);
+	    return smalltalk[aString];
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_setupClass_',
+smalltalk.method({
+selector: 'setupClass:',
+fn: function (aClass){
+var self=this;
+smalltalk.init(aClass);;
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_superclass_subclass_instanceVariableNames_package_',
+smalltalk.method({
+selector: 'superclass:subclass:instanceVariableNames:package:',
+fn: function (aClass, aString, aString2, aString3){
+var self=this;
+var newClass=nil;
+newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]);
+smalltalk.send(self, "_setupClass_", [newClass]);
+return newClass;
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_addSubclassOf_named_instanceVariableNames_package_',
+smalltalk.method({
+selector: 'addSubclassOf:named:instanceVariableNames:package:',
+fn: function (aClass, aString, aCollection, packageName){
+var self=this;
+smalltalk.addClass(aString, aClass, aCollection, packageName);
+	    return smalltalk[aString];
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+'_copyClass_named_',
+smalltalk.method({
+selector: 'copyClass:named:',
+fn: function (aClass, aString){
+var self=this;
+var newClass=nil;
+newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [smalltalk.send(aClass, "_superclass", []), aString, smalltalk.send(aClass, "_instanceVariableNames", []), smalltalk.send(smalltalk.send(aClass, "_package", []), "_name", [])]);
+smalltalk.send(self, "_setupClass_", [newClass]);
+smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){smalltalk.send(newClass, "_addCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [smalltalk.send(each, "_source", []), newClass])]);return smalltalk.send(smalltalk.send(smalltalk.send(newClass, "_methodDictionary", []), "_at_", [smalltalk.send(each, "_selector", [])]), "_category_", [smalltalk.send(each, "_category", [])]);})]);
+smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){smalltalk.send(smalltalk.send(newClass, "_class", []), "_addCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [smalltalk.send(each, "_source", []), smalltalk.send(newClass, "_class", [])])]);return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(newClass, "_class", []), "_methodDictionary", []), "_at_", [smalltalk.send(each, "_selector", [])]), "_category_", [smalltalk.send(each, "_category", [])]);})]);
+smalltalk.send(self, "_setupClass_", [newClass]);
+return newClass;
+return self;}
+}),
+smalltalk.ClassBuilder);
+
+
+
+smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_initialize", [], smalltalk.Object);
+self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []);
+return self;}
+}),
+smalltalk.ClassCategoryReader);
+
+smalltalk.addMethod(
+'_class_category_',
+smalltalk.method({
+selector: 'class:category:',
+fn: function (aClass, aString){
+var self=this;
+self['@class']=aClass;
+self['@category']=aString;
+return self;}
+}),
+smalltalk.ClassCategoryReader);
+
+smalltalk.addMethod(
+'_scanFrom_',
+smalltalk.method({
+selector: 'scanFrom:',
+fn: function (aChunkParser){
+var self=this;
+var chunk=nil;
+(function(){while(!(function(){chunk=smalltalk.send(aChunkParser, "_nextChunk", []);return smalltalk.send(chunk, "_isEmpty", []);})()) {(function(){return smalltalk.send(self, "_compileMethod_", [chunk]);})()}})();
+return self;}
+}),
+smalltalk.ClassCategoryReader);
+
+smalltalk.addMethod(
+'_compileMethod_',
+smalltalk.method({
+selector: 'compileMethod:',
+fn: function (aString){
+var self=this;
+var method=nil;
+method=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [aString, self['@class']]);
+smalltalk.send(method, "_category_", [self['@category']]);
+smalltalk.send(self['@class'], "_addCompiledMethod_", [method]);
+return self;}
+}),
+smalltalk.ClassCategoryReader);
+
+
+
+smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel-Classes');
+smalltalk.addMethod(
+'_class_',
+smalltalk.method({
+selector: 'class:',
+fn: function (aClass){
+var self=this;
+self['@class']=aClass;
+return self;}
+}),
+smalltalk.ClassCommentReader);
+
+smalltalk.addMethod(
+'_scanFrom_',
+smalltalk.method({
+selector: 'scanFrom:',
+fn: function (aChunkParser){
+var self=this;
+var chunk=nil;
+chunk=smalltalk.send(aChunkParser, "_nextChunk", []);
+((($receiver = smalltalk.send(chunk, "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_setComment_", [chunk]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_setComment_", [chunk]);})]));
+return self;}
+}),
+smalltalk.ClassCommentReader);
+
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_initialize", [], smalltalk.Object);
+self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []);
+return self;}
+}),
+smalltalk.ClassCommentReader);
+
+smalltalk.addMethod(
+'_setComment_',
+smalltalk.method({
+selector: 'setComment:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self['@class'], "_comment_", [aString]);
+return self;}
+}),
+smalltalk.ClassCommentReader);
+
+
+

+ 950 - 0
js/Kernel-Classes.js

@@ -0,0 +1,950 @@
+smalltalk.addPackage('Kernel-Classes', {});
+smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
+smalltalk.addMethod(
+unescape('_new'),
+smalltalk.method({
+selector: unescape('new'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(self, "_basicNew", []), "_initialize", []);
+return self;},
+args: [],
+source: unescape('new%0A%09%5Eself%20basicNew%20initialize'),
+messageSends: ["initialize", "basicNew"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_basicNew'),
+smalltalk.method({
+selector: unescape('basicNew'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+return new self.fn();
+return self;},
+args: [],
+source: unescape('basicNew%0A%09%3Creturn%20new%20self.fn%28%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_name'),
+smalltalk.method({
+selector: unescape('name'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.className || nil;
+return self;},
+args: [],
+source: unescape('name%0A%09%3Creturn%20self.className%20%7C%7C%20nil%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_superclass'),
+smalltalk.method({
+selector: unescape('superclass'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.superclass || nil;
+return self;},
+args: [],
+source: unescape('superclass%0A%09%3Creturn%20self.superclass%20%7C%7C%20nil%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_subclasses'),
+smalltalk.method({
+selector: unescape('subclasses'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.subclasses(self);
+return self;},
+args: [],
+source: unescape('subclasses%0A%09%3Creturn%20smalltalk.subclasses%28self%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_allSubclasses'),
+smalltalk.method({
+selector: unescape('allSubclasses'),
+category: 'accessing',
+fn: function (){
+var self=this;
+var result=nil;
+result=smalltalk.send(self, "_subclasses", []);
+smalltalk.send(smalltalk.send(self, "_subclasses", []), "_do_", [(function(each){return smalltalk.send(result, "_addAll_", [smalltalk.send(each, "_allSubclasses", [])]);})]);
+return result;
+return self;},
+args: [],
+source: unescape('allSubclasses%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20self%20subclasses.%0A%09self%20subclasses%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20result%20addAll%3A%20each%20allSubclasses%5D.%0A%09%5Eresult'),
+messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_withAllSubclasses'),
+smalltalk.method({
+selector: unescape('withAllSubclasses'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_allSubclasses", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_with_", [self]));
+return self;},
+args: [],
+source: unescape('withAllSubclasses%0A%09%5E%28Array%20with%3A%20self%29%20addAll%3A%20self%20allSubclasses%3B%20yourself'),
+messageSends: ["addAll:", "allSubclasses", "yourself", "with:"],
+referencedClasses: ["Array"]
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_prototype'),
+smalltalk.method({
+selector: unescape('prototype'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.fn.prototype;
+return self;},
+args: [],
+source: unescape('prototype%0A%09%3Creturn%20self.fn.prototype%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_methodDictionary'),
+smalltalk.method({
+selector: unescape('methodDictionary'),
+category: 'accessing',
+fn: function (){
+var self=this;
+var dict = smalltalk.Dictionary._new();
+	var methods = self.fn.prototype.methods;
+	for(var i in methods) {
+		if(methods[i].selector) {
+			dict._at_put_(methods[i].selector, methods[i]);
+		}
+	};
+	return dict;
+return self;},
+args: [],
+source: unescape('methodDictionary%0A%09%3Cvar%20dict%20%3D%20smalltalk.Dictionary._new%28%29%3B%0A%09var%20methods%20%3D%20self.fn.prototype.methods%3B%0A%09for%28var%20i%20in%20methods%29%20%7B%0A%09%09if%28methods%5Bi%5D.selector%29%20%7B%0A%09%09%09dict._at_put_%28methods%5Bi%5D.selector%2C%20methods%5Bi%5D%29%3B%0A%09%09%7D%0A%09%7D%3B%0A%09return%20dict%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_methodsFor_'),
+smalltalk.method({
+selector: unescape('methodsFor%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_class_category_", [self, aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader), "_new", []));
+return self;},
+args: ["aString"],
+source: unescape('methodsFor%3A%20aString%0A%09%5EClassCategoryReader%20new%0A%09%20%20%20%20class%3A%20self%20category%3A%20aString%3B%0A%09%20%20%20%20yourself'),
+messageSends: ["class:category:", "yourself", "new"],
+referencedClasses: ["ClassCategoryReader"]
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_addCompiledMethod_'),
+smalltalk.method({
+selector: unescape('addCompiledMethod%3A'),
+category: 'accessing',
+fn: function (aMethod){
+var self=this;
+smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
+return self;},
+args: ["aMethod"],
+source: unescape('addCompiledMethod%3A%20aMethod%0A%09%3Csmalltalk.addMethod%28aMethod.selector._asSelector%28%29%2C%20aMethod%2C%20self%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_instanceVariableNames'),
+smalltalk.method({
+selector: unescape('instanceVariableNames'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.iVarNames;
+return self;},
+args: [],
+source: unescape('instanceVariableNames%0A%09%3Creturn%20self.iVarNames%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_comment'),
+smalltalk.method({
+selector: unescape('comment'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_basicAt_", ["comment"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
+return self;},
+args: [],
+source: unescape('comment%0A%20%20%20%20%5E%28self%20basicAt%3A%20%27comment%27%29%20ifNil%3A%20%5B%27%27%5D'),
+messageSends: ["ifNil:", "basicAt:"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_comment_'),
+smalltalk.method({
+selector: unescape('comment%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["comment", aString]);
+return self;},
+args: ["aString"],
+source: unescape('comment%3A%20aString%0A%20%20%20%20self%20basicAt%3A%20%27comment%27%20put%3A%20aString'),
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_commentStamp'),
+smalltalk.method({
+selector: unescape('commentStamp'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_class_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader), "_new", []));
+return self;},
+args: [],
+source: unescape('commentStamp%0A%20%20%20%20%5EClassCommentReader%20new%0A%09class%3A%20self%3B%0A%09yourself'),
+messageSends: ["class:", "yourself", "new"],
+referencedClasses: ["ClassCommentReader"]
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_removeCompiledMethod_'),
+smalltalk.method({
+selector: unescape('removeCompiledMethod%3A'),
+category: 'accessing',
+fn: function (aMethod){
+var self=this;
+delete self.fn.prototype[aMethod.selector._asSelector()];
+	delete self.fn.prototype.methods[aMethod.selector];
+	smalltalk.init(self);;
+return self;},
+args: ["aMethod"],
+source: unescape('removeCompiledMethod%3A%20aMethod%0A%09%3Cdelete%20self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%3B%0A%09delete%20self.fn.prototype.methods%5BaMethod.selector%5D%3B%0A%09smalltalk.init%28self%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_inheritsFrom_'),
+smalltalk.method({
+selector: unescape('inheritsFrom%3A'),
+category: 'instance creation',
+fn: function (aClass){
+var self=this;
+return smalltalk.send(smalltalk.send(aClass, "_allSubclasses", []), "_includes_", [self]);
+return self;},
+args: ["aClass"],
+source: unescape('inheritsFrom%3A%20aClass%0A%09%5EaClass%20allSubclasses%20includes%3A%20self'),
+messageSends: ["includes:", "allSubclasses"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_protocols'),
+smalltalk.method({
+selector: unescape('protocols'),
+category: 'accessing',
+fn: function (){
+var self=this;
+var protocols=nil;
+protocols=smalltalk.send((smalltalk.Array || Array), "_new", []);
+smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_do_", [(function(each){return ((($receiver = smalltalk.send(protocols, "_includes_", [smalltalk.send(each, "_category", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})]));})]);
+return smalltalk.send(protocols, "_sort", []);
+return self;},
+args: [],
+source: unescape('protocols%0A%20%20%20%20%7C%20protocols%20%7C%0A%20%20%20%20protocols%20%3A%3D%20Array%20new.%0A%20%20%20%20self%20methodDictionary%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20%28protocols%20includes%3A%20each%20category%29%20ifFalse%3A%20%5B%0A%09%09protocols%20add%3A%20each%20category%5D%5D.%0A%20%20%20%20%5Eprotocols%20sort'),
+messageSends: ["new", "do:", "methodDictionary", "ifFalse:", "includes:", "category", "add:", "sort"],
+referencedClasses: ["Array"]
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_protocolsDo_'),
+smalltalk.method({
+selector: unescape('protocolsDo%3A'),
+category: 'accessing',
+fn: function (aBlock){
+var self=this;
+var methodsByCategory=nil;
+methodsByCategory=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
+smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_values", []), "_do_", [(function(m){return smalltalk.send(smalltalk.send(methodsByCategory, "_at_ifAbsentPut_", [smalltalk.send(m, "_category", []), (function(){return smalltalk.send((smalltalk.Array || Array), "_new", []);})]), "_add_", [m]);})]);
+smalltalk.send(smalltalk.send(self, "_protocols", []), "_do_", [(function(category){return smalltalk.send(aBlock, "_value_value_", [category, smalltalk.send(methodsByCategory, "_at_", [category])]);})]);
+return self;},
+args: ["aBlock"],
+source: unescape('protocolsDo%3A%20aBlock%0A%09%22Execute%20aBlock%20for%20each%20method%20category%20with%0A%09its%20collection%20of%20methods%20in%20the%20sort%20order%20of%20category%20name.%22%0A%0A%09%7C%20methodsByCategory%20%7C%0A%09methodsByCategory%20%3A%3D%20Dictionary%20new.%0A%09self%20methodDictionary%20values%20do%3A%20%5B%3Am%20%7C%0A%09%09%28methodsByCategory%20at%3A%20m%20category%20ifAbsentPut%3A%20%5BArray%20new%5D%29%0A%20%09%09%09add%3A%20m%5D.%20%0A%09self%20protocols%20do%3A%20%5B%3Acategory%20%7C%0A%09%09aBlock%20value%3A%20category%20value%3A%20%28methodsByCategory%20at%3A%20category%29%5D'),
+messageSends: ["new", "do:", "values", "methodDictionary", "add:", "at:ifAbsentPut:", "category", "protocols", "value:value:", "at:"],
+referencedClasses: ["Dictionary", "Array"]
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_allInstanceVariableNames'),
+smalltalk.method({
+selector: unescape('allInstanceVariableNames'),
+category: 'accessing',
+fn: function (){
+var self=this;
+var result=nil;
+result=smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_copy", []);
+(($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(result, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allInstanceVariableNames", [])]);})() : nil;
+return result;
+return self;},
+args: [],
+source: unescape('allInstanceVariableNames%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20self%20instanceVariableNames%20copy.%0A%09self%20superclass%20ifNotNil%3A%20%5B%0A%09%20%20%20%20result%20addAll%3A%20self%20superclass%20allInstanceVariableNames%5D.%0A%09%5Eresult'),
+messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_methodAt_'),
+smalltalk.method({
+selector: unescape('methodAt%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.methods(self)[aString];
+return self;},
+args: ["aString"],
+source: unescape('methodAt%3A%20aString%0A%09%3Creturn%20smalltalk.methods%28self%29%5BaString%5D%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_methodsFor_stamp_'),
+smalltalk.method({
+selector: unescape('methodsFor%3Astamp%3A'),
+category: 'accessing',
+fn: function (aString, aStamp){
+var self=this;
+return smalltalk.send(self, "_methodsFor_", [aString]);
+return self;},
+args: ["aString", "aStamp"],
+source: unescape('methodsFor%3A%20aString%20stamp%3A%20aStamp%0A%09%22Added%20for%20compatibility%2C%20right%20now%20ignores%20stamp.%22%0A%09%5Eself%20methodsFor%3A%20aString'),
+messageSends: ["methodsFor:"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_commentStamp_prior_'),
+smalltalk.method({
+selector: unescape('commentStamp%3Aprior%3A'),
+category: 'accessing',
+fn: function (aStamp, prior){
+var self=this;
+return smalltalk.send(self, "_commentStamp", []);
+return self;},
+args: ["aStamp", "prior"],
+source: unescape('commentStamp%3A%20aStamp%20prior%3A%20prior%0A%20%20%20%20%20%20%20%20%5Eself%20commentStamp'),
+messageSends: ["commentStamp"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_compile_'),
+smalltalk.method({
+selector: unescape('compile%3A'),
+category: 'compiling',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_compile_category_", [aString, ""]);
+return self;},
+args: ["aString"],
+source: unescape('compile%3A%20aString%0A%09self%20compile%3A%20aString%20category%3A%20%27%27'),
+messageSends: ["compile:category:"],
+referencedClasses: []
+}),
+smalltalk.Behavior);
+
+smalltalk.addMethod(
+unescape('_compile_category_'),
+smalltalk.method({
+selector: unescape('compile%3Acategory%3A'),
+category: 'compiling',
+fn: function (aString, anotherString){
+var self=this;
+var method=nil;
+method=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [aString, self]);
+smalltalk.send(method, "_category_", [anotherString]);
+smalltalk.send(self, "_addCompiledMethod_", [method]);
+return self;},
+args: ["aString", "anotherString"],
+source: unescape('compile%3A%20aString%20category%3A%20anotherString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20self.%0A%09method%20category%3A%20anotherString.%0A%09self%20addCompiledMethod%3A%20method'),
+messageSends: ["load:forClass:", "new", "category:", "addCompiledMethod:"],
+referencedClasses: ["Compiler"]
+}),
+smalltalk.Behavior);
+
+
+
+smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
+smalltalk.addMethod(
+unescape('_category'),
+smalltalk.method({
+selector: unescape('category'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_package", [])) == nil || $receiver == undefined) ? (function(){return "Unclassified";})() : (function(){return smalltalk.send(smalltalk.send(self, "_package", []), "_name", []);})();
+return self;},
+args: [],
+source: unescape('category%0A%09%5Eself%20package%20ifNil%3A%20%5B%27Unclassified%27%5D%20ifNotNil%3A%20%5Bself%20package%20name%5D'),
+messageSends: ["ifNil:ifNotNil:", "package", "name"],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_subclass_instanceVariableNames_'),
+smalltalk.method({
+selector: unescape('subclass%3AinstanceVariableNames%3A'),
+category: 'class creation',
+fn: function (aString, anotherString){
+var self=this;
+return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
+return self;},
+args: ["aString", "anotherString"],
+source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%22Kept%20for%20compatibility.%22%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20package%3A%20nil'),
+messageSends: ["subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_subclass_instanceVariableNames_category_'),
+smalltalk.method({
+selector: unescape('subclass%3AinstanceVariableNames%3Acategory%3A'),
+category: 'class creation',
+fn: function (aString, aString2, aString3){
+var self=this;
+smalltalk.send(self, "_deprecatedAPI", []);
+return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
+return self;},
+args: ["aString", "aString2", "aString3"],
+source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%22Kept%20for%20compatibility.%22%0A%09self%20deprecatedAPI.%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3'),
+messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_isClass'),
+smalltalk.method({
+selector: unescape('isClass'),
+category: 'testing',
+fn: function (){
+var self=this;
+return true;
+return self;},
+args: [],
+source: unescape('isClass%0A%09%5Etrue'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_printString'),
+smalltalk.method({
+selector: unescape('printString'),
+category: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_name", []);
+return self;},
+args: [],
+source: unescape('printString%0A%09%5Eself%20name'),
+messageSends: ["name"],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_rename_'),
+smalltalk.method({
+selector: unescape('rename%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+
+		smalltalk[aString] = self;
+		delete smalltalk[self.className];
+		self.className = aString;
+	;
+return self;},
+args: ["aString"],
+source: unescape('rename%3A%20aString%0A%09%3C%0A%09%09smalltalk%5BaString%5D%20%3D%20self%3B%0A%09%09delete%20smalltalk%5Bself.className%5D%3B%0A%09%09self.className%20%3D%20aString%3B%0A%09%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_'),
+smalltalk.method({
+selector: unescape('subclass%3AinstanceVariableNames%3AclassVariableNames%3ApoolDictionaries%3Acategory%3A'),
+category: 'class creation',
+fn: function (aString, aString2, classVars, pools, aString3){
+var self=this;
+return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
+return self;},
+args: ["aString", "aString2", "classVars", "pools", "aString3"],
+source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20classVariableNames%3A%20classVars%20poolDictionaries%3A%20pools%20category%3A%20aString3%0A%09%22Just%20ignore%20class%20variables%20and%20pools.%20Added%20for%20compatibility.%22%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3'),
+messageSends: ["subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_package'),
+smalltalk.method({
+selector: unescape('package'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.pkg;
+return self;},
+args: [],
+source: unescape('package%0A%09%3Creturn%20self.pkg%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_package_'),
+smalltalk.method({
+selector: unescape('package%3A'),
+category: 'accessing',
+fn: function (aPackage){
+var self=this;
+self.pkg = aPackage;
+return self;},
+args: ["aPackage"],
+source: unescape('package%3A%20aPackage%0A%09%3Cself.pkg%20%3D%20aPackage%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Class);
+
+smalltalk.addMethod(
+unescape('_subclass_instanceVariableNames_package_'),
+smalltalk.method({
+selector: unescape('subclass%3AinstanceVariableNames%3Apackage%3A'),
+category: 'class creation',
+fn: function (aString, aString2, aString3){
+var self=this;
+return smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, aString, aString2, aString3]);
+return self;},
+args: ["aString", "aString2", "aString3"],
+source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3'),
+messageSends: ["superclass:subclass:instanceVariableNames:package:", "new"],
+referencedClasses: ["ClassBuilder"]
+}),
+smalltalk.Class);
+
+
+
+smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
+smalltalk.addMethod(
+unescape('_instanceClass'),
+smalltalk.method({
+selector: unescape('instanceClass'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.instanceClass;
+return self;},
+args: [],
+source: unescape('instanceClass%0A%09%3Creturn%20self.instanceClass%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Metaclass);
+
+smalltalk.addMethod(
+unescape('_instanceVariableNames_'),
+smalltalk.method({
+selector: unescape('instanceVariableNames%3A'),
+category: 'accessing',
+fn: function (aCollection){
+var self=this;
+smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_class_instanceVariableNames_", [self, aCollection]);
+return self;},
+args: ["aCollection"],
+source: unescape('instanceVariableNames%3A%20aCollection%0A%09ClassBuilder%20new%0A%09%20%20%20%20class%3A%20self%20instanceVariableNames%3A%20aCollection'),
+messageSends: ["class:instanceVariableNames:", "new"],
+referencedClasses: ["ClassBuilder"]
+}),
+smalltalk.Metaclass);
+
+smalltalk.addMethod(
+unescape('_isMetaclass'),
+smalltalk.method({
+selector: unescape('isMetaclass'),
+category: 'testing',
+fn: function (){
+var self=this;
+return true;
+return self;},
+args: [],
+source: unescape('isMetaclass%0A%09%5Etrue'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Metaclass);
+
+smalltalk.addMethod(
+unescape('_printString'),
+smalltalk.method({
+selector: unescape('printString'),
+category: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instanceClass", []), "_name", []), "__comma", [" class"]);
+return self;},
+args: [],
+source: unescape('printString%0A%09%5Eself%20instanceClass%20name%2C%20%27%20class%27'),
+messageSends: [unescape("%2C"), "name", "instanceClass"],
+referencedClasses: []
+}),
+smalltalk.Metaclass);
+
+
+
+smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
+smalltalk.addMethod(
+unescape('_superclass_subclass_'),
+smalltalk.method({
+selector: unescape('superclass%3Asubclass%3A'),
+category: 'class creation',
+fn: function (aClass, aString){
+var self=this;
+return smalltalk.send(self, "_superclass_subclass_instanceVariableNames_package_", [aClass, aString, "", nil]);
+return self;},
+args: ["aClass", "aString"],
+source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%0A%09%5Eself%20superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20%27%27%20package%3A%20nil'),
+messageSends: ["superclass:subclass:instanceVariableNames:package:"],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_class_instanceVariableNames_'),
+smalltalk.method({
+selector: unescape('class%3AinstanceVariableNames%3A'),
+category: 'class creation',
+fn: function (aClass, aString){
+var self=this;
+((($receiver = smalltalk.send(aClass, "_isMetaclass", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})]));
+smalltalk.send(aClass, "_basicAt_put_", ["iVarNames", smalltalk.send(self, "_instanceVariableNamesFor_", [aString])]);
+smalltalk.send(self, "_setupClass_", [aClass]);
+return self;},
+args: ["aClass", "aString"],
+source: unescape('class%3A%20aClass%20instanceVariableNames%3A%20aString%0A%09aClass%20isMetaclass%20ifFalse%3A%20%5Bself%20error%3A%20aClass%20name%2C%20%27%20is%20not%20a%20metaclass%27%5D.%0A%09aClass%20basicAt%3A%20%27iVarNames%27%20put%3A%20%28self%20instanceVariableNamesFor%3A%20aString%29.%0A%09self%20setupClass%3A%20aClass'),
+messageSends: ["ifFalse:", "isMetaclass", "error:", unescape("%2C"), "name", "basicAt:put:", "instanceVariableNamesFor:", "setupClass:"],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_instanceVariableNamesFor_'),
+smalltalk.method({
+selector: unescape('instanceVariableNamesFor%3A'),
+category: 'private',
+fn: function (aString){
+var self=this;
+return smalltalk.send(smalltalk.send(aString, "_tokenize_", [" "]), "_reject_", [(function(each){return smalltalk.send(each, "_isEmpty", []);})]);
+return self;},
+args: ["aString"],
+source: unescape('instanceVariableNamesFor%3A%20aString%0A%09%5E%28aString%20tokenize%3A%20%27%20%27%29%20reject%3A%20%5B%3Aeach%20%7C%20each%20isEmpty%5D'),
+messageSends: ["reject:", "tokenize:", "isEmpty"],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_addSubclassOf_named_instanceVariableNames_'),
+smalltalk.method({
+selector: unescape('addSubclassOf%3Anamed%3AinstanceVariableNames%3A'),
+category: 'private',
+fn: function (aClass, aString, aCollection){
+var self=this;
+smalltalk.addClass(aString, aClass, aCollection);
+	    return smalltalk[aString];
+return self;},
+args: ["aClass", "aString", "aCollection"],
+source: unescape('addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20aCollection%0A%09%3Csmalltalk.addClass%28aString%2C%20aClass%2C%20aCollection%29%3B%0A%09%20%20%20%20return%20smalltalk%5BaString%5D%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_setupClass_'),
+smalltalk.method({
+selector: unescape('setupClass%3A'),
+category: 'private',
+fn: function (aClass){
+var self=this;
+smalltalk.init(aClass);;
+return self;},
+args: ["aClass"],
+source: unescape('setupClass%3A%20aClass%0A%09%3Csmalltalk.init%28aClass%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_superclass_subclass_instanceVariableNames_package_'),
+smalltalk.method({
+selector: unescape('superclass%3Asubclass%3AinstanceVariableNames%3Apackage%3A'),
+category: 'class creation',
+fn: function (aClass, aString, aString2, aString3){
+var self=this;
+var newClass=nil;
+newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2]), (($receiver = aString3) == nil || $receiver == undefined) ? (function(){return "unclassified";})() : $receiver]);
+smalltalk.send(self, "_setupClass_", [newClass]);
+return newClass;
+return self;},
+args: ["aClass", "aString", "aString2", "aString3"],
+source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20package%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%0A%09%09%09%09named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29%0A%09%09%09%09package%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29.%0A%09self%20setupClass%3A%20newClass.%0A%09%5EnewClass'),
+messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:"],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_addSubclassOf_named_instanceVariableNames_package_'),
+smalltalk.method({
+selector: unescape('addSubclassOf%3Anamed%3AinstanceVariableNames%3Apackage%3A'),
+category: 'private',
+fn: function (aClass, aString, aCollection, packageName){
+var self=this;
+smalltalk.addClass(aString, aClass, aCollection, packageName);
+	    return smalltalk[aString];
+return self;},
+args: ["aClass", "aString", "aCollection", "packageName"],
+source: unescape('addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20aCollection%20package%3A%20packageName%0A%09%3Csmalltalk.addClass%28aString%2C%20aClass%2C%20aCollection%2C%20packageName%29%3B%0A%09%20%20%20%20return%20smalltalk%5BaString%5D%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ClassBuilder);
+
+smalltalk.addMethod(
+unescape('_copyClass_named_'),
+smalltalk.method({
+selector: unescape('copyClass%3Anamed%3A'),
+category: 'private',
+fn: function (aClass, aString){
+var self=this;
+var newClass=nil;
+newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [smalltalk.send(aClass, "_superclass", []), aString, smalltalk.send(aClass, "_instanceVariableNames", []), smalltalk.send(smalltalk.send(aClass, "_package", []), "_name", [])]);
+smalltalk.send(self, "_setupClass_", [newClass]);
+smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){smalltalk.send(newClass, "_addCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [smalltalk.send(each, "_source", []), newClass])]);return smalltalk.send(smalltalk.send(smalltalk.send(newClass, "_methodDictionary", []), "_at_", [smalltalk.send(each, "_selector", [])]), "_category_", [smalltalk.send(each, "_category", [])]);})]);
+smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){smalltalk.send(smalltalk.send(newClass, "_class", []), "_addCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [smalltalk.send(each, "_source", []), smalltalk.send(newClass, "_class", [])])]);return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(newClass, "_class", []), "_methodDictionary", []), "_at_", [smalltalk.send(each, "_selector", [])]), "_category_", [smalltalk.send(each, "_category", [])]);})]);
+smalltalk.send(self, "_setupClass_", [newClass]);
+return newClass;
+return self;},
+args: ["aClass", "aString"],
+source: unescape('copyClass%3A%20aClass%20named%3A%20aString%0A%09%7C%20newClass%20%7C%0A%0A%09newClass%20%3A%3D%20self%20%0A%09%09addSubclassOf%3A%20aClass%20superclass%0A%09%09named%3A%20aString%20%0A%09%09instanceVariableNames%3A%20aClass%20instanceVariableNames%20%0A%09%09package%3A%20aClass%20package%20name.%0A%0A%09self%20setupClass%3A%20newClass.%0A%0A%09aClass%20methodDictionary%20values%20do%3A%20%5B%3Aeach%20%7C%0A%09%09newClass%20addCompiledMethod%3A%20%28Compiler%20new%20load%3A%20each%20source%20forClass%3A%20newClass%29.%0A%09%09%28newClass%20methodDictionary%20at%3A%20each%20selector%29%20category%3A%20each%20category%5D.%0A%0A%09aClass%20class%20methodDictionary%20values%20do%3A%20%5B%3Aeach%20%7C%0A%09%09newClass%20class%20addCompiledMethod%3A%20%28Compiler%20new%20load%3A%20each%20source%20forClass%3A%20newClass%20class%29.%0A%09%09%28newClass%20class%20methodDictionary%20at%3A%20each%20selector%29%20category%3A%20each%20category%5D.%0A%0A%09self%20setupClass%3A%20newClass.%0A%09%5EnewClass'),
+messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "setupClass:", "do:", "values", "methodDictionary", "addCompiledMethod:", "load:forClass:", "new", "source", "category:", "at:", "selector", "category", "class"],
+referencedClasses: ["Compiler"]
+}),
+smalltalk.ClassBuilder);
+
+
+
+smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
+smalltalk.addMethod(
+unescape('_initialize'),
+smalltalk.method({
+selector: unescape('initialize'),
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_initialize", [], smalltalk.Object);
+self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []);
+return self;},
+args: [],
+source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.'),
+messageSends: ["initialize", "new"],
+referencedClasses: ["ChunkParser"]
+}),
+smalltalk.ClassCategoryReader);
+
+smalltalk.addMethod(
+unescape('_class_category_'),
+smalltalk.method({
+selector: unescape('class%3Acategory%3A'),
+category: 'accessing',
+fn: function (aClass, aString){
+var self=this;
+self['@class']=aClass;
+self['@category']=aString;
+return self;},
+args: ["aClass", "aString"],
+source: unescape('class%3A%20aClass%20category%3A%20aString%0A%09class%20%3A%3D%20aClass.%0A%09category%20%3A%3D%20aString'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ClassCategoryReader);
+
+smalltalk.addMethod(
+unescape('_scanFrom_'),
+smalltalk.method({
+selector: unescape('scanFrom%3A'),
+category: 'fileIn',
+fn: function (aChunkParser){
+var self=this;
+var chunk=nil;
+(function(){while(!(function(){chunk=smalltalk.send(aChunkParser, "_nextChunk", []);return smalltalk.send(chunk, "_isEmpty", []);})()) {(function(){return smalltalk.send(self, "_compileMethod_", [chunk]);})()}})();
+return self;},
+args: ["aChunkParser"],
+source: unescape('scanFrom%3A%20aChunkParser%0A%09%7C%20chunk%20%7C%0A%09%5Bchunk%20%3A%3D%20aChunkParser%20nextChunk.%0A%09chunk%20isEmpty%5D%20whileFalse%3A%20%5B%0A%09%20%20%20%20self%20compileMethod%3A%20chunk%5D'),
+messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"],
+referencedClasses: []
+}),
+smalltalk.ClassCategoryReader);
+
+smalltalk.addMethod(
+unescape('_compileMethod_'),
+smalltalk.method({
+selector: unescape('compileMethod%3A'),
+category: 'private',
+fn: function (aString){
+var self=this;
+var method=nil;
+method=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [aString, self['@class']]);
+smalltalk.send(method, "_category_", [self['@category']]);
+smalltalk.send(self['@class'], "_addCompiledMethod_", [method]);
+return self;},
+args: ["aString"],
+source: unescape('compileMethod%3A%20aString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20class.%0A%09method%20category%3A%20category.%0A%09class%20addCompiledMethod%3A%20method'),
+messageSends: ["load:forClass:", "new", "category:", "addCompiledMethod:"],
+referencedClasses: ["Compiler"]
+}),
+smalltalk.ClassCategoryReader);
+
+
+
+smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel-Classes');
+smalltalk.addMethod(
+unescape('_class_'),
+smalltalk.method({
+selector: unescape('class%3A'),
+category: 'accessing',
+fn: function (aClass){
+var self=this;
+self['@class']=aClass;
+return self;},
+args: ["aClass"],
+source: unescape('class%3A%20aClass%0A%09class%20%3A%3D%20aClass'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ClassCommentReader);
+
+smalltalk.addMethod(
+unescape('_scanFrom_'),
+smalltalk.method({
+selector: unescape('scanFrom%3A'),
+category: 'fileIn',
+fn: function (aChunkParser){
+var self=this;
+var chunk=nil;
+chunk=smalltalk.send(aChunkParser, "_nextChunk", []);
+((($receiver = smalltalk.send(chunk, "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_setComment_", [chunk]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_setComment_", [chunk]);})]));
+return self;},
+args: ["aChunkParser"],
+source: unescape('scanFrom%3A%20aChunkParser%0A%09%7C%20chunk%20%7C%0A%09chunk%20%3A%3D%20aChunkParser%20nextChunk.%0A%09chunk%20isEmpty%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20setComment%3A%20chunk%5D.'),
+messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
+referencedClasses: []
+}),
+smalltalk.ClassCommentReader);
+
+smalltalk.addMethod(
+unescape('_initialize'),
+smalltalk.method({
+selector: unescape('initialize'),
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_initialize", [], smalltalk.Object);
+self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []);
+return self;},
+args: [],
+source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.'),
+messageSends: ["initialize", "new"],
+referencedClasses: ["ChunkParser"]
+}),
+smalltalk.ClassCommentReader);
+
+smalltalk.addMethod(
+unescape('_setComment_'),
+smalltalk.method({
+selector: unescape('setComment%3A'),
+category: 'private',
+fn: function (aString){
+var self=this;
+smalltalk.send(self['@class'], "_comment_", [aString]);
+return self;},
+args: ["aString"],
+source: unescape('setComment%3A%20aString%0A%20%20%20%20class%20comment%3A%20aString'),
+messageSends: ["comment:"],
+referencedClasses: []
+}),
+smalltalk.ClassCommentReader);
+
+
+

ファイルの差分が大きいため隠しています
+ 1117 - 0
js/Kernel-Collections.deploy.js


ファイルの差分が大きいため隠しています
+ 1588 - 0
js/Kernel-Collections.js


+ 244 - 0
js/Kernel-Exceptions.deploy.js

@@ -0,0 +1,244 @@
+smalltalk.addPackage('Kernel-Exceptions', {});
+smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
+smalltalk.addMethod(
+'_messageText',
+smalltalk.method({
+selector: 'messageText',
+fn: function (){
+var self=this;
+return self['@messageText'];
+return self;}
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+'_messageText_',
+smalltalk.method({
+selector: 'messageText:',
+fn: function (aString){
+var self=this;
+self['@messageText']=aString;
+return self;}
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+'_signal',
+smalltalk.method({
+selector: 'signal',
+fn: function (){
+var self=this;
+self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
+return self;}
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+'_context',
+smalltalk.method({
+selector: 'context',
+fn: function (){
+var self=this;
+return self.context;
+return self;}
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+'_jsStack',
+smalltalk.method({
+selector: 'jsStack',
+fn: function (){
+var self=this;
+return self.stack;
+return self;}
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+'_isSmalltalkError',
+smalltalk.method({
+selector: 'isSmalltalkError',
+fn: function (){
+var self=this;
+return self.smalltalkError === true;
+return self;}
+}),
+smalltalk.Error);
+
+
+smalltalk.addMethod(
+'_signal_',
+smalltalk.method({
+selector: 'signal:',
+fn: function (aString){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_messageText_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(self, "_new", []));
+return self;}
+}),
+smalltalk.Error.klass);
+
+
+smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
+smalltalk.addMethod(
+'_message',
+smalltalk.method({
+selector: 'message',
+fn: function (){
+var self=this;
+return self['@message'];
+return self;}
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+'_message_',
+smalltalk.method({
+selector: 'message:',
+fn: function (aMessage){
+var self=this;
+self['@message']=aMessage;
+return self;}
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+'_receiver',
+smalltalk.method({
+selector: 'receiver',
+fn: function (){
+var self=this;
+return self['@receiver'];
+return self;}
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+'_receiver_',
+smalltalk.method({
+selector: 'receiver:',
+fn: function (anObject){
+var self=this;
+self['@receiver']=anObject;
+return self;}
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+'_messageText',
+smalltalk.method({
+selector: 'messageText',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_asString", []), "__comma", [unescape("%20does%20not%20understand%20%23")]), "__comma", [smalltalk.send(smalltalk.send(self, "_message", []), "_selector", [])]);
+return self;}
+}),
+smalltalk.MessageNotUnderstood);
+
+
+
+smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
+smalltalk.addMethod(
+'_handleError_',
+smalltalk.method({
+selector: 'handleError:',
+fn: function (anError){
+var self=this;
+(($receiver = smalltalk.send(anError, "_context", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logErrorContext_", [smalltalk.send(anError, "_context", [])]);})() : nil;
+smalltalk.send(self, "_logError_", [anError]);
+return self;}
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+'_logContext_',
+smalltalk.method({
+selector: 'logContext:',
+fn: function (aContext){
+var self=this;
+(($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;
+smalltalk.send(self, "_log_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext, "_receiver", []), "_asString", []), "__comma", [unescape("%3E%3E")]), "__comma", [smalltalk.send(aContext, "_selector", [])])]);
+return self;}
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+'_logErrorContext_',
+smalltalk.method({
+selector: 'logErrorContext:',
+fn: function (aContext){
+var self=this;
+(($receiver = aContext) != nil && $receiver != undefined) ? (function(){return (($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;})() : nil;
+return self;}
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+'_logError_',
+smalltalk.method({
+selector: 'logError:',
+fn: function (anError){
+var self=this;
+smalltalk.send(self, "_log_", [smalltalk.send(anError, "_messageText", [])]);
+return self;}
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+'_log_',
+smalltalk.method({
+selector: 'log:',
+fn: function (aString){
+var self=this;
+smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [aString]);
+return self;}
+}),
+smalltalk.ErrorHandler);
+
+
+smalltalk.ErrorHandler.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+'_current',
+smalltalk.method({
+selector: 'current',
+fn: function (){
+var self=this;
+return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return self['@current']=smalltalk.send(self, "_new", []);})() : $receiver;
+return self;}
+}),
+smalltalk.ErrorHandler.klass);
+
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_register", []);
+return self;}
+}),
+smalltalk.ErrorHandler.klass);
+
+smalltalk.addMethod(
+'_register',
+smalltalk.method({
+selector: 'register',
+fn: function (){
+var self=this;
+smalltalk.send((smalltalk.ErrorHandler || ErrorHandler), "_setCurrent_", [smalltalk.send(self, "_new", [])]);
+return self;}
+}),
+smalltalk.ErrorHandler.klass);
+
+smalltalk.addMethod(
+'_setCurrent_',
+smalltalk.method({
+selector: 'setCurrent:',
+fn: function (anHandler){
+var self=this;
+self['@current']=anHandler;
+return self;}
+}),
+smalltalk.ErrorHandler.klass);
+
+

+ 349 - 0
js/Kernel-Exceptions.js

@@ -0,0 +1,349 @@
+smalltalk.addPackage('Kernel-Exceptions', {});
+smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
+smalltalk.addMethod(
+unescape('_messageText'),
+smalltalk.method({
+selector: unescape('messageText'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self['@messageText'];
+return self;},
+args: [],
+source: unescape('messageText%0A%09%5EmessageText'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+unescape('_messageText_'),
+smalltalk.method({
+selector: unescape('messageText%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+self['@messageText']=aString;
+return self;},
+args: ["aString"],
+source: unescape('messageText%3A%20aString%0A%09messageText%20%3A%3D%20aString'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+unescape('_signal'),
+smalltalk.method({
+selector: unescape('signal'),
+category: 'signaling',
+fn: function (){
+var self=this;
+self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
+return self;},
+args: [],
+source: unescape('signal%0A%09%3Cself.context%20%3D%20smalltalk.getThisContext%28%29%3B%20self.smalltalkError%20%3D%20true%3B%20throw%28self%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+unescape('_context'),
+smalltalk.method({
+selector: unescape('context'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.context;
+return self;},
+args: [],
+source: unescape('context%0A%09%3Creturn%20self.context%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+unescape('_jsStack'),
+smalltalk.method({
+selector: unescape('jsStack'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.stack;
+return self;},
+args: [],
+source: unescape('jsStack%0A%09%3Creturn%20self.stack%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Error);
+
+smalltalk.addMethod(
+unescape('_isSmalltalkError'),
+smalltalk.method({
+selector: unescape('isSmalltalkError'),
+category: 'testing',
+fn: function (){
+var self=this;
+return self.smalltalkError === true;
+return self;},
+args: [],
+source: unescape('isSmalltalkError%0A%09%3Creturn%20self.smalltalkError%20%3D%3D%3D%20true%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Error);
+
+
+smalltalk.addMethod(
+unescape('_signal_'),
+smalltalk.method({
+selector: unescape('signal%3A'),
+category: 'instance creation',
+fn: function (aString){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_messageText_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(self, "_new", []));
+return self;},
+args: ["aString"],
+source: unescape('signal%3A%20aString%0A%09%20%20%20%20%5Eself%20new%0A%09%09messageText%3A%20aString%3B%0A%09%09signal'),
+messageSends: ["messageText:", "signal", "new"],
+referencedClasses: []
+}),
+smalltalk.Error.klass);
+
+
+smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
+smalltalk.addMethod(
+unescape('_message'),
+smalltalk.method({
+selector: unescape('message'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self['@message'];
+return self;},
+args: [],
+source: unescape('message%0A%09%5Emessage'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+unescape('_message_'),
+smalltalk.method({
+selector: unescape('message%3A'),
+category: 'accessing',
+fn: function (aMessage){
+var self=this;
+self['@message']=aMessage;
+return self;},
+args: ["aMessage"],
+source: unescape('message%3A%20aMessage%0A%09message%20%3A%3D%20aMessage'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+unescape('_receiver'),
+smalltalk.method({
+selector: unescape('receiver'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self['@receiver'];
+return self;},
+args: [],
+source: unescape('receiver%0A%09%5Ereceiver'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+unescape('_receiver_'),
+smalltalk.method({
+selector: unescape('receiver%3A'),
+category: 'accessing',
+fn: function (anObject){
+var self=this;
+self['@receiver']=anObject;
+return self;},
+args: ["anObject"],
+source: unescape('receiver%3A%20anObject%0A%09receiver%20%3A%3D%20anObject'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MessageNotUnderstood);
+
+smalltalk.addMethod(
+unescape('_messageText'),
+smalltalk.method({
+selector: unescape('messageText'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_asString", []), "__comma", [unescape("%20does%20not%20understand%20%23")]), "__comma", [smalltalk.send(smalltalk.send(self, "_message", []), "_selector", [])]);
+return self;},
+args: [],
+source: unescape('messageText%0A%09%5Eself%20receiver%20asString%2C%20%27%20does%20not%20understand%20%23%27%2C%20self%20message%20selector'),
+messageSends: [unescape("%2C"), "asString", "receiver", "selector", "message"],
+referencedClasses: []
+}),
+smalltalk.MessageNotUnderstood);
+
+
+
+smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
+smalltalk.addMethod(
+unescape('_handleError_'),
+smalltalk.method({
+selector: unescape('handleError%3A'),
+category: 'error handling',
+fn: function (anError){
+var self=this;
+(($receiver = smalltalk.send(anError, "_context", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logErrorContext_", [smalltalk.send(anError, "_context", [])]);})() : nil;
+smalltalk.send(self, "_logError_", [anError]);
+return self;},
+args: ["anError"],
+source: unescape('handleError%3A%20anError%0A%09anError%20context%20ifNotNil%3A%20%5Bself%20logErrorContext%3A%20anError%20context%5D.%0A%09self%20logError%3A%20anError'),
+messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+unescape('_logContext_'),
+smalltalk.method({
+selector: unescape('logContext%3A'),
+category: 'private',
+fn: function (aContext){
+var self=this;
+(($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;
+smalltalk.send(self, "_log_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext, "_receiver", []), "_asString", []), "__comma", [unescape("%3E%3E")]), "__comma", [smalltalk.send(aContext, "_selector", [])])]);
+return self;},
+args: ["aContext"],
+source: unescape('logContext%3A%20aContext%0A%09aContext%20home%20ifNotNil%3A%20%5B%0A%09%09self%20logContext%3A%20aContext%20home%5D.%0A%09self%20log%3A%20aContext%20receiver%20asString%2C%20%27%3E%3E%27%2C%20aContext%20selector'),
+messageSends: ["ifNotNil:", "home", "logContext:", "log:", unescape("%2C"), "asString", "receiver", "selector"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+unescape('_logErrorContext_'),
+smalltalk.method({
+selector: unescape('logErrorContext%3A'),
+category: 'private',
+fn: function (aContext){
+var self=this;
+(($receiver = aContext) != nil && $receiver != undefined) ? (function(){return (($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;})() : nil;
+return self;},
+args: ["aContext"],
+source: unescape('logErrorContext%3A%20aContext%0A%09aContext%20ifNotNil%3A%20%5B%0A%09%09aContext%20home%20ifNotNil%3A%20%5B%0A%09%09%09self%20logContext%3A%20aContext%20home%5D%5D'),
+messageSends: ["ifNotNil:", "home", "logContext:"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+unescape('_logError_'),
+smalltalk.method({
+selector: unescape('logError%3A'),
+category: 'private',
+fn: function (anError){
+var self=this;
+smalltalk.send(self, "_log_", [smalltalk.send(anError, "_messageText", [])]);
+return self;},
+args: ["anError"],
+source: unescape('logError%3A%20anError%0A%09self%20log%3A%20anError%20messageText'),
+messageSends: ["log:", "messageText"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler);
+
+smalltalk.addMethod(
+unescape('_log_'),
+smalltalk.method({
+selector: unescape('log%3A'),
+category: 'private',
+fn: function (aString){
+var self=this;
+smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [aString]);
+return self;},
+args: ["aString"],
+source: unescape('log%3A%20aString%0A%09console%20log%3A%20aString'),
+messageSends: ["log:"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler);
+
+
+smalltalk.ErrorHandler.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+unescape('_current'),
+smalltalk.method({
+selector: unescape('current'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return self['@current']=smalltalk.send(self, "_new", []);})() : $receiver;
+return self;},
+args: [],
+source: unescape('current%0A%09%5Ecurrent%20ifNil%3A%20%5Bcurrent%20%3A%3D%20self%20new%5D'),
+messageSends: ["ifNil:", "new"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler.klass);
+
+smalltalk.addMethod(
+unescape('_initialize'),
+smalltalk.method({
+selector: unescape('initialize'),
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_register", []);
+return self;},
+args: [],
+source: unescape('initialize%0A%09self%20register'),
+messageSends: ["register"],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler.klass);
+
+smalltalk.addMethod(
+unescape('_register'),
+smalltalk.method({
+selector: unescape('register'),
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send((smalltalk.ErrorHandler || ErrorHandler), "_setCurrent_", [smalltalk.send(self, "_new", [])]);
+return self;},
+args: [],
+source: unescape('register%0A%09ErrorHandler%20setCurrent%3A%20self%20new'),
+messageSends: ["setCurrent:", "new"],
+referencedClasses: ["ErrorHandler"]
+}),
+smalltalk.ErrorHandler.klass);
+
+smalltalk.addMethod(
+unescape('_setCurrent_'),
+smalltalk.method({
+selector: unescape('setCurrent%3A'),
+category: 'accessing',
+fn: function (anHandler){
+var self=this;
+self['@current']=anHandler;
+return self;},
+args: ["anHandler"],
+source: unescape('setCurrent%3A%20anHandler%0A%09current%20%3A%3D%20anHandler'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ErrorHandler.klass);
+
+

+ 477 - 0
js/Kernel-Methods.deploy.js

@@ -0,0 +1,477 @@
+smalltalk.addPackage('Kernel-Methods', {});
+smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.addMethod(
+'_source',
+smalltalk.method({
+selector: 'source',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_basicAt_", ["source"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_source_',
+smalltalk.method({
+selector: 'source:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["source", aString]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_category',
+smalltalk.method({
+selector: 'category',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_basicAt_", ["category"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_category_',
+smalltalk.method({
+selector: 'category:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["category", aString]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_selector',
+smalltalk.method({
+selector: 'selector',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["selector"]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_selector_',
+smalltalk.method({
+selector: 'selector:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_fn',
+smalltalk.method({
+selector: 'fn',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["fn"]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_fn_',
+smalltalk.method({
+selector: 'fn:',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_messageSends',
+smalltalk.method({
+selector: 'messageSends',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["messageSends"]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_methodClass',
+smalltalk.method({
+selector: 'methodClass',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["methodClass"]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_referencedClasses',
+smalltalk.method({
+selector: 'referencedClasses',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+'_arguments',
+smalltalk.method({
+selector: 'arguments',
+fn: function (){
+var self=this;
+return self.args || [];
+return self;}
+}),
+smalltalk.CompiledMethod);
+
+
+
+smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.addMethod(
+'_compiledSource',
+smalltalk.method({
+selector: 'compiledSource',
+fn: function (){
+var self=this;
+return self.toString();
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_whileTrue_',
+smalltalk.method({
+selector: 'whileTrue:',
+fn: function (aBlock){
+var self=this;
+while(self()) {aBlock()};
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_whileFalse_',
+smalltalk.method({
+selector: 'whileFalse:',
+fn: function (aBlock){
+var self=this;
+while(!self()) {aBlock()};
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_value',
+smalltalk.method({
+selector: 'value',
+fn: function (){
+var self=this;
+return self();;
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_value_',
+smalltalk.method({
+selector: 'value:',
+fn: function (anArg){
+var self=this;
+return self(anArg);;
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_value_value_',
+smalltalk.method({
+selector: 'value:value:',
+fn: function (firstArg, secondArg){
+var self=this;
+return self(firstArg, secondArg);;
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_value_value_value_',
+smalltalk.method({
+selector: 'value:value:value:',
+fn: function (firstArg, secondArg, thirdArg){
+var self=this;
+return self(firstArg, secondArg, thirdArg);;
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_valueWithPossibleArguments_',
+smalltalk.method({
+selector: 'valueWithPossibleArguments:',
+fn: function (aCollection){
+var self=this;
+return self.apply(null, aCollection);;
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_on_do_',
+smalltalk.method({
+selector: 'on:do:',
+fn: function (anErrorClass, aBlock){
+var self=this;
+smalltalk.send(self, "_try_catch_", [self, (function(error){return ((($receiver = smalltalk.send(error, "_isKindOf_", [anErrorClass])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value_", [error]);})() : (function(){return smalltalk.send(error, "_signal", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [error]);}), (function(){return smalltalk.send(error, "_signal", []);})]));})]);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_valueWithTimeout_',
+smalltalk.method({
+selector: 'valueWithTimeout:',
+fn: function (aNumber){
+var self=this;
+return setTimeout(self, aNumber);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_valueWithInterval_',
+smalltalk.method({
+selector: 'valueWithInterval:',
+fn: function (aNumber){
+var self=this;
+return setInterval(self, aNumber);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_whileFalse',
+smalltalk.method({
+selector: 'whileFalse',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_whileFalse_", [(function(){return nil;})]);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_whileTrue',
+smalltalk.method({
+selector: 'whileTrue',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_whileTrue_", [(function(){return nil;})]);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_new',
+smalltalk.method({
+selector: 'new',
+fn: function (){
+var self=this;
+return new self();
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_applyTo_arguments_',
+smalltalk.method({
+selector: 'applyTo:arguments:',
+fn: function (anObject, aCollection){
+var self=this;
+return self.apply(anObject, aCollection);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_timeToRun',
+smalltalk.method({
+selector: 'timeToRun',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [self]);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_numArgs',
+smalltalk.method({
+selector: 'numArgs',
+fn: function (){
+var self=this;
+return self.length;
+return self;}
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+'_ensure_',
+smalltalk.method({
+selector: 'ensure:',
+fn: function (aBlock){
+var self=this;
+var success=nil;
+success=false;
+smalltalk.send((function(){smalltalk.send(self, "_value", []);success=true;return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
+return self;}
+}),
+smalltalk.BlockClosure);
+
+
+
+smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.addMethod(
+'_receiver',
+smalltalk.method({
+selector: 'receiver',
+fn: function (){
+var self=this;
+return self.receiver;
+return self;}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+'_selector',
+smalltalk.method({
+selector: 'selector',
+fn: function (){
+var self=this;
+return smalltalk.convertSelector(self.selector);
+return self;}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+'_home',
+smalltalk.method({
+selector: 'home',
+fn: function (){
+var self=this;
+return self.homeContext;
+return self;}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+'_temps',
+smalltalk.method({
+selector: 'temps',
+fn: function (){
+var self=this;
+return self.temps;
+return self;}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+'_printString',
+smalltalk.method({
+selector: 'printString',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", [unescape("%28")]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [unescape("%29")]);
+return self;}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+'_asString',
+smalltalk.method({
+selector: 'asString',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [unescape("%20%3E%3E%20")]), "__comma", [smalltalk.send(self, "_selector", [])]);
+return self;}
+}),
+smalltalk.MethodContext);
+
+
+
+smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
+smalltalk.addMethod(
+'_selector',
+smalltalk.method({
+selector: 'selector',
+fn: function (){
+var self=this;
+return self['@selector'];
+return self;}
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+'_selector_',
+smalltalk.method({
+selector: 'selector:',
+fn: function (aString){
+var self=this;
+self['@selector']=aString;
+return self;}
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+'_arguments_',
+smalltalk.method({
+selector: 'arguments:',
+fn: function (anArray){
+var self=this;
+self['@arguments']=anArray;
+return self;}
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+'_arguments',
+smalltalk.method({
+selector: 'arguments',
+fn: function (){
+var self=this;
+return self['@arguments'];
+return self;}
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+'_printString',
+smalltalk.method({
+selector: 'printString',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);smalltalk.send($rec, "_nextPutAll_", [self['@selector']]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%29")]);})(aStream);})]);
+return self;}
+}),
+smalltalk.Message);
+
+
+smalltalk.addMethod(
+'_selector_arguments_',
+smalltalk.method({
+selector: 'selector:arguments:',
+fn: function (aString, anArray){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
+return self;}
+}),
+smalltalk.Message.klass);
+
+

+ 687 - 0
js/Kernel-Methods.js

@@ -0,0 +1,687 @@
+smalltalk.addPackage('Kernel-Methods', {});
+smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.addMethod(
+unescape('_source'),
+smalltalk.method({
+selector: unescape('source'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_basicAt_", ["source"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
+return self;},
+args: [],
+source: unescape('source%0A%09%5E%28self%20basicAt%3A%20%27source%27%29%20ifNil%3A%20%5B%27%27%5D'),
+messageSends: ["ifNil:", "basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_source_'),
+smalltalk.method({
+selector: unescape('source%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["source", aString]);
+return self;},
+args: ["aString"],
+source: unescape('source%3A%20aString%0A%09self%20basicAt%3A%20%27source%27%20put%3A%20aString'),
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_category'),
+smalltalk.method({
+selector: unescape('category'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return (($receiver = smalltalk.send(self, "_basicAt_", ["category"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
+return self;},
+args: [],
+source: unescape('category%0A%09%5E%28self%20basicAt%3A%20%27category%27%29%20ifNil%3A%20%5B%27%27%5D'),
+messageSends: ["ifNil:", "basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_category_'),
+smalltalk.method({
+selector: unescape('category%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["category", aString]);
+return self;},
+args: ["aString"],
+source: unescape('category%3A%20aString%0A%09self%20basicAt%3A%20%27category%27%20put%3A%20aString'),
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_selector'),
+smalltalk.method({
+selector: unescape('selector'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["selector"]);
+return self;},
+args: [],
+source: unescape('selector%0A%09%5Eself%20basicAt%3A%20%27selector%27'),
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_selector_'),
+smalltalk.method({
+selector: unescape('selector%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
+return self;},
+args: ["aString"],
+source: unescape('selector%3A%20aString%0A%09self%20basicAt%3A%20%27selector%27%20put%3A%20aString'),
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_fn'),
+smalltalk.method({
+selector: unescape('fn'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["fn"]);
+return self;},
+args: [],
+source: unescape('fn%0A%09%5Eself%20basicAt%3A%20%27fn%27'),
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_fn_'),
+smalltalk.method({
+selector: unescape('fn%3A'),
+category: 'accessing',
+fn: function (aBlock){
+var self=this;
+smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
+return self;},
+args: ["aBlock"],
+source: unescape('fn%3A%20aBlock%0A%09self%20basicAt%3A%20%27fn%27%20put%3A%20aBlock'),
+messageSends: ["basicAt:put:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_messageSends'),
+smalltalk.method({
+selector: unescape('messageSends'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["messageSends"]);
+return self;},
+args: [],
+source: unescape('messageSends%0A%09%5Eself%20basicAt%3A%20%27messageSends%27'),
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_methodClass'),
+smalltalk.method({
+selector: unescape('methodClass'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["methodClass"]);
+return self;},
+args: [],
+source: unescape('methodClass%0A%09%5Eself%20basicAt%3A%20%27methodClass%27'),
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_referencedClasses'),
+smalltalk.method({
+selector: unescape('referencedClasses'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
+return self;},
+args: [],
+source: unescape('referencedClasses%0A%09%5Eself%20basicAt%3A%20%27referencedClasses%27'),
+messageSends: ["basicAt:"],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+smalltalk.addMethod(
+unescape('_arguments'),
+smalltalk.method({
+selector: unescape('arguments'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.args || [];
+return self;},
+args: [],
+source: unescape('arguments%0A%09%3Creturn%20self.args%20%7C%7C%20%5B%5D%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.CompiledMethod);
+
+
+
+smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.addMethod(
+unescape('_compiledSource'),
+smalltalk.method({
+selector: unescape('compiledSource'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.toString();
+return self;},
+args: [],
+source: unescape('compiledSource%0A%09%3Creturn%20self.toString%28%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_whileTrue_'),
+smalltalk.method({
+selector: unescape('whileTrue%3A'),
+category: 'controlling',
+fn: function (aBlock){
+var self=this;
+while(self()) {aBlock()};
+return self;},
+args: ["aBlock"],
+source: unescape('whileTrue%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Cwhile%28self%28%29%29%20%7BaBlock%28%29%7D%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_whileFalse_'),
+smalltalk.method({
+selector: unescape('whileFalse%3A'),
+category: 'controlling',
+fn: function (aBlock){
+var self=this;
+while(!self()) {aBlock()};
+return self;},
+args: ["aBlock"],
+source: unescape('whileFalse%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Cwhile%28%21self%28%29%29%20%7BaBlock%28%29%7D%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_value'),
+smalltalk.method({
+selector: unescape('value'),
+category: 'evaluating',
+fn: function (){
+var self=this;
+return self();;
+return self;},
+args: [],
+source: unescape('value%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_value_'),
+smalltalk.method({
+selector: unescape('value%3A'),
+category: 'evaluating',
+fn: function (anArg){
+var self=this;
+return self(anArg);;
+return self;},
+args: ["anArg"],
+source: unescape('value%3A%20anArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28anArg%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_value_value_'),
+smalltalk.method({
+selector: unescape('value%3Avalue%3A'),
+category: 'evaluating',
+fn: function (firstArg, secondArg){
+var self=this;
+return self(firstArg, secondArg);;
+return self;},
+args: ["firstArg", "secondArg"],
+source: unescape('value%3A%20firstArg%20value%3A%20secondArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28firstArg%2C%20secondArg%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_value_value_value_'),
+smalltalk.method({
+selector: unescape('value%3Avalue%3Avalue%3A'),
+category: 'evaluating',
+fn: function (firstArg, secondArg, thirdArg){
+var self=this;
+return self(firstArg, secondArg, thirdArg);;
+return self;},
+args: ["firstArg", "secondArg", "thirdArg"],
+source: unescape('value%3A%20firstArg%20value%3A%20secondArg%20value%3A%20thirdArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28firstArg%2C%20secondArg%2C%20thirdArg%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_valueWithPossibleArguments_'),
+smalltalk.method({
+selector: unescape('valueWithPossibleArguments%3A'),
+category: 'evaluating',
+fn: function (aCollection){
+var self=this;
+return self.apply(null, aCollection);;
+return self;},
+args: ["aCollection"],
+source: unescape('valueWithPossibleArguments%3A%20aCollection%0A%09%3Creturn%20self.apply%28null%2C%20aCollection%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_on_do_'),
+smalltalk.method({
+selector: unescape('on%3Ado%3A'),
+category: 'error handling',
+fn: function (anErrorClass, aBlock){
+var self=this;
+smalltalk.send(self, "_try_catch_", [self, (function(error){return ((($receiver = smalltalk.send(error, "_isKindOf_", [anErrorClass])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(aBlock, "_value_", [error]);})() : (function(){return smalltalk.send(error, "_signal", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [error]);}), (function(){return smalltalk.send(error, "_signal", []);})]));})]);
+return self;},
+args: ["anErrorClass", "aBlock"],
+source: unescape('on%3A%20anErrorClass%20do%3A%20aBlock%0A%09self%20try%3A%20self%20catch%3A%20%5B%3Aerror%20%7C%0A%09%20%20%20%20%28error%20isKindOf%3A%20anErrorClass%29%20%0A%09%20%20%20%20%20ifTrue%3A%20%5BaBlock%20value%3A%20error%5D%0A%09%20%20%20%20%20ifFalse%3A%20%5Berror%20signal%5D%5D'),
+messageSends: ["try:catch:", "ifTrue:ifFalse:", "isKindOf:", "value:", "signal"],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_valueWithTimeout_'),
+smalltalk.method({
+selector: unescape('valueWithTimeout%3A'),
+category: 'timeout/interval',
+fn: function (aNumber){
+var self=this;
+return setTimeout(self, aNumber);
+return self;},
+args: ["aNumber"],
+source: unescape('valueWithTimeout%3A%20aNumber%0A%09%3Creturn%20setTimeout%28self%2C%20aNumber%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_valueWithInterval_'),
+smalltalk.method({
+selector: unescape('valueWithInterval%3A'),
+category: 'timeout/interval',
+fn: function (aNumber){
+var self=this;
+return setInterval(self, aNumber);
+return self;},
+args: ["aNumber"],
+source: unescape('valueWithInterval%3A%20aNumber%0A%09%3Creturn%20setInterval%28self%2C%20aNumber%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_whileFalse'),
+smalltalk.method({
+selector: unescape('whileFalse'),
+category: 'controlling',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_whileFalse_", [(function(){return nil;})]);
+return self;},
+args: [],
+source: unescape('whileFalse%0A%09%22inlined%20in%20the%20Compiler%22%0A%09self%20whileFalse%3A%20%5B%5D'),
+messageSends: ["whileFalse:"],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_whileTrue'),
+smalltalk.method({
+selector: unescape('whileTrue'),
+category: 'controlling',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_whileTrue_", [(function(){return nil;})]);
+return self;},
+args: [],
+source: unescape('whileTrue%0A%09%22inlined%20in%20the%20Compiler%22%0A%09self%20whileTrue%3A%20%5B%5D'),
+messageSends: ["whileTrue:"],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_new'),
+smalltalk.method({
+selector: unescape('new'),
+category: 'evaluating',
+fn: function (){
+var self=this;
+return new self();
+return self;},
+args: [],
+source: unescape('new%0A%09%22Use%20the%20receiver%20as%20a%20JS%20constructor.%20%0A%09*Do%20not*%20use%20this%20method%20to%20instanciate%20Smalltalk%20objects%21%22%0A%09%3Creturn%20new%20self%28%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_applyTo_arguments_'),
+smalltalk.method({
+selector: unescape('applyTo%3Aarguments%3A'),
+category: 'evaluating',
+fn: function (anObject, aCollection){
+var self=this;
+return self.apply(anObject, aCollection);
+return self;},
+args: ["anObject", "aCollection"],
+source: unescape('applyTo%3A%20anObject%20arguments%3A%20aCollection%0A%09%3Creturn%20self.apply%28anObject%2C%20aCollection%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_timeToRun'),
+smalltalk.method({
+selector: unescape('timeToRun'),
+category: 'evaluating',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.Date || Date), "_millisecondsToRun_", [self]);
+return self;},
+args: [],
+source: unescape('timeToRun%0A%09%22Answer%20the%20number%20of%20milliseconds%20taken%20to%20execute%20this%20block.%22%0A%0A%09%5E%20Date%20millisecondsToRun%3A%20self'),
+messageSends: ["millisecondsToRun:"],
+referencedClasses: ["Date"]
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_numArgs'),
+smalltalk.method({
+selector: unescape('numArgs'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.length;
+return self;},
+args: [],
+source: unescape('numArgs%0A%09%3Creturn%20self.length%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.BlockClosure);
+
+smalltalk.addMethod(
+unescape('_ensure_'),
+smalltalk.method({
+selector: unescape('ensure%3A'),
+category: 'evaluating',
+fn: function (aBlock){
+var self=this;
+var success=nil;
+success=false;
+smalltalk.send((function(){smalltalk.send(self, "_value", []);success=true;return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
+return self;},
+args: ["aBlock"],
+source: unescape('ensure%3A%20aBlock%0A%09%7C%20success%20%7C%0A%09success%20%3A%3D%20false.%0A%09%5Bself%20value.%20success%20%3A%3D%20true.%20aBlock%20value%5D%0A%09%09on%3A%20Error%0A%09%09do%3A%20%5B%3Aex%20%7C%0A%09%09%09success%20ifFalse%3A%20%5BaBlock%20value%5D.%0A%09%09%09ex%20signal%5D'),
+messageSends: ["on:do:", "value", "ifFalse:", "signal"],
+referencedClasses: ["Error"]
+}),
+smalltalk.BlockClosure);
+
+
+
+smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.addMethod(
+unescape('_receiver'),
+smalltalk.method({
+selector: unescape('receiver'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.receiver;
+return self;},
+args: [],
+source: unescape('receiver%0A%09%3Creturn%20self.receiver%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+unescape('_selector'),
+smalltalk.method({
+selector: unescape('selector'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.convertSelector(self.selector);
+return self;},
+args: [],
+source: unescape('selector%0A%09%3Creturn%20smalltalk.convertSelector%28self.selector%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+unescape('_home'),
+smalltalk.method({
+selector: unescape('home'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.homeContext;
+return self;},
+args: [],
+source: unescape('home%0A%09%3Creturn%20self.homeContext%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+unescape('_temps'),
+smalltalk.method({
+selector: unescape('temps'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.temps;
+return self;},
+args: [],
+source: unescape('temps%0A%09%3Creturn%20self.temps%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+unescape('_printString'),
+smalltalk.method({
+selector: unescape('printString'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", [unescape("%28")]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [unescape("%29")]);
+return self;},
+args: [],
+source: unescape('printString%0A%09%5Esuper%20printString%2C%20%27%28%27%2C%20self%20asString%2C%20%27%29%27'),
+messageSends: [unescape("%2C"), "printString", "asString"],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+unescape('_asString'),
+smalltalk.method({
+selector: unescape('asString'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [unescape("%20%3E%3E%20")]), "__comma", [smalltalk.send(self, "_selector", [])]);
+return self;},
+args: [],
+source: unescape('asString%0A%09%5Eself%20receiver%20class%20printString%2C%20%27%20%3E%3E%20%27%2C%20self%20selector'),
+messageSends: [unescape("%2C"), "printString", "class", "receiver", "selector"],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+
+
+smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
+smalltalk.addMethod(
+unescape('_selector'),
+smalltalk.method({
+selector: unescape('selector'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self['@selector'];
+return self;},
+args: [],
+source: unescape('selector%0A%09%5Eselector'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+unescape('_selector_'),
+smalltalk.method({
+selector: unescape('selector%3A'),
+category: 'accessing',
+fn: function (aString){
+var self=this;
+self['@selector']=aString;
+return self;},
+args: ["aString"],
+source: unescape('selector%3A%20aString%0A%09selector%20%3A%3D%20aString'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+unescape('_arguments_'),
+smalltalk.method({
+selector: unescape('arguments%3A'),
+category: 'accessing',
+fn: function (anArray){
+var self=this;
+self['@arguments']=anArray;
+return self;},
+args: ["anArray"],
+source: unescape('arguments%3A%20anArray%0A%09arguments%20%3A%3D%20anArray'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+unescape('_arguments'),
+smalltalk.method({
+selector: unescape('arguments'),
+category: 'accessing',
+fn: function (){
+var self=this;
+return self['@arguments'];
+return self;},
+args: [],
+source: unescape('arguments%0A%09%5Earguments'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Message);
+
+smalltalk.addMethod(
+unescape('_printString'),
+smalltalk.method({
+selector: unescape('printString'),
+category: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);smalltalk.send($rec, "_nextPutAll_", [self['@selector']]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%29")]);})(aStream);})]);
+return self;},
+args: [],
+source: unescape('printString%0A%09%5E%20String%20streamContents%3A%20%5B%3AaStream%7C%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09aStream%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20super%20printString%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27%28%27%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20selector%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%09%09%09nextPutAll%3A%20%27%29%27%20%09%09%09%09%5D'),
+messageSends: ["streamContents:", "nextPutAll:", "printString"],
+referencedClasses: ["String"]
+}),
+smalltalk.Message);
+
+
+smalltalk.addMethod(
+unescape('_selector_arguments_'),
+smalltalk.method({
+selector: unescape('selector%3Aarguments%3A'),
+category: 'instance creation',
+fn: function (aString, anArray){
+var self=this;
+return (function($rec){smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
+return self;},
+args: ["aString", "anArray"],
+source: unescape('selector%3A%20aString%20arguments%3A%20anArray%0A%09%5Eself%20new%0A%09%09selector%3A%20aString%3B%0A%09%09arguments%3A%20anArray%3B%0A%09%09yourself'),
+messageSends: ["selector:", "arguments:", "yourself", "new"],
+referencedClasses: []
+}),
+smalltalk.Message.klass);
+
+

ファイルの差分が大きいため隠しています
+ 1373 - 0
js/Kernel-Objects.deploy.js


ファイルの差分が大きいため隠しています
+ 1955 - 0
js/Kernel-Objects.js


+ 142 - 0
js/Kernel-Transcript.deploy.js

@@ -0,0 +1,142 @@
+smalltalk.addPackage('Kernel-Transcript', {});
+smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
+
+smalltalk.Transcript.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+'_open',
+smalltalk.method({
+selector: 'open',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_new',
+smalltalk.method({
+selector: 'new',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_shouldNotImplement", []);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_current',
+smalltalk.method({
+selector: 'current',
+fn: function (){
+var self=this;
+return self['@current'];
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_show_',
+smalltalk.method({
+selector: 'show:',
+fn: function (anObject){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [anObject]);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_cr',
+smalltalk.method({
+selector: 'cr',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_clear',
+smalltalk.method({
+selector: 'clear',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_clear", []);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_register_',
+smalltalk.method({
+selector: 'register:',
+fn: function (aTranscript){
+var self=this;
+self['@current']=aTranscript;
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+
+smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
+smalltalk.addMethod(
+'_clear',
+smalltalk.method({
+selector: 'clear',
+fn: function (){
+var self=this;
+
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+'_cr',
+smalltalk.method({
+selector: 'cr',
+fn: function (){
+var self=this;
+
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+'_show_',
+smalltalk.method({
+selector: 'show:',
+fn: function (anObject){
+var self=this;
+var string=nil;
+string=smalltalk.send(anObject, "_asString", []);
+console.log(String(string));
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+'_open',
+smalltalk.method({
+selector: 'open',
+fn: function (){
+var self=this;
+
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+fn: function (){
+var self=this;
+smalltalk.send((smalltalk.Transcript || Transcript), "_register_", [smalltalk.send(self, "_new", [])]);
+return self;}
+}),
+smalltalk.ConsoleTranscript.klass);
+
+

+ 202 - 0
js/Kernel-Transcript.js

@@ -0,0 +1,202 @@
+smalltalk.addPackage('Kernel-Transcript', {});
+smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
+
+smalltalk.Transcript.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+unescape('_open'),
+smalltalk.method({
+selector: unescape('open'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);
+return self;},
+args: [],
+source: unescape('open%0A%20%20%20%20self%20current%20open'),
+messageSends: ["open", "current"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_new'),
+smalltalk.method({
+selector: unescape('new'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_shouldNotImplement", []);
+return self;},
+args: [],
+source: unescape('new%0A%20%20%20%20self%20shouldNotImplement'),
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_current'),
+smalltalk.method({
+selector: unescape('current'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+return self['@current'];
+return self;},
+args: [],
+source: unescape('current%0A%20%20%20%20%5Ecurrent'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_show_'),
+smalltalk.method({
+selector: unescape('show%3A'),
+category: 'printing',
+fn: function (anObject){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [anObject]);
+return self;},
+args: ["anObject"],
+source: unescape('show%3A%20anObject%0A%20%20%20%20self%20current%20show%3A%20anObject'),
+messageSends: ["show:", "current"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_cr'),
+smalltalk.method({
+selector: unescape('cr'),
+category: 'printing',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
+return self;},
+args: [],
+source: unescape('cr%0A%20%20%20%20self%20current%20show%3A%20String%20cr'),
+messageSends: ["show:", "current", "cr"],
+referencedClasses: ["String"]
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_clear'),
+smalltalk.method({
+selector: unescape('clear'),
+category: 'printing',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_clear", []);
+return self;},
+args: [],
+source: unescape('clear%0A%20%20%20%20self%20current%20clear'),
+messageSends: ["clear", "current"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_register_'),
+smalltalk.method({
+selector: unescape('register%3A'),
+category: 'instance creation',
+fn: function (aTranscript){
+var self=this;
+self['@current']=aTranscript;
+return self;},
+args: ["aTranscript"],
+source: unescape('register%3A%20aTranscript%0A%09current%20%3A%3D%20aTranscript'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+
+smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
+smalltalk.addMethod(
+unescape('_clear'),
+smalltalk.method({
+selector: unescape('clear'),
+category: 'printing',
+fn: function (){
+var self=this;
+
+return self;},
+args: [],
+source: unescape('clear%0A%09%22no%20op%22'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+unescape('_cr'),
+smalltalk.method({
+selector: unescape('cr'),
+category: 'printing',
+fn: function (){
+var self=this;
+
+return self;},
+args: [],
+source: unescape('cr%0A%09%22no%20op%22'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+unescape('_show_'),
+smalltalk.method({
+selector: unescape('show%3A'),
+category: 'printing',
+fn: function (anObject){
+var self=this;
+var string=nil;
+string=smalltalk.send(anObject, "_asString", []);
+console.log(String(string));
+return self;},
+args: ["anObject"],
+source: unescape('show%3A%20anObject%0A%09%7C%20string%20%7C%0A%09string%20%3A%3D%20anObject%20asString.%0A%09%3Cconsole.log%28String%28string%29%29%3E'),
+messageSends: ["asString"],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+unescape('_open'),
+smalltalk.method({
+selector: unescape('open'),
+category: 'actions',
+fn: function (){
+var self=this;
+
+return self;},
+args: [],
+source: unescape('open'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+
+smalltalk.addMethod(
+unescape('_initialize'),
+smalltalk.method({
+selector: unescape('initialize'),
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send((smalltalk.Transcript || Transcript), "_register_", [smalltalk.send(self, "_new", [])]);
+return self;},
+args: [],
+source: unescape('initialize%0A%09Transcript%20register%3A%20self%20new'),
+messageSends: ["register:", "new"],
+referencedClasses: ["Transcript"]
+}),
+smalltalk.ConsoleTranscript.klass);
+
+

ファイルの差分が大きいため隠しています
+ 0 - 1975
js/Kernel.deploy.js


ファイルの差分が大きいため隠しています
+ 0 - 2812
js/Kernel.js


+ 12 - 2
js/amber.js

@@ -46,7 +46,12 @@ amber = (function() {
 
 		if (deploy) {
 			loadPackages([
-					'Kernel.deploy',
+					'Kernel-Objects.deploy',
+					'Kernel-Classes.deploy',
+					'Kernel-Methods.deploy',
+					'Kernel-Collections.deploy',
+					'Kernel-Exceptions.deploy',
+					'Kernel-Transcript.deploy',
 					'Canvas.deploy'
 					]);
 		} else {
@@ -54,7 +59,12 @@ amber = (function() {
 			loadCSS('amber.css');
 
 			loadPackages([
-				'Kernel',
+				'Kernel-Objects',
+				'Kernel-Classes',
+				'Kernel-Methods',
+				'Kernel-Collections',
+				'Kernel-Exceptions',
+				'Kernel-Transcript',
 				'Canvas',
 				'Compiler',
 				'parser',

+ 374 - 0
st/Kernel-Classes.st

@@ -0,0 +1,374 @@
+Smalltalk current createPackage: 'Kernel-Classes' properties: #{}!
+Object subclass: #Behavior
+	instanceVariableNames: ''
+	category: 'Kernel-Classes'!
+
+!Behavior methodsFor: 'accessing'!
+
+name
+	<return self.className || nil>
+!
+
+superclass
+	<return self.superclass || nil>
+!
+
+subclasses
+	<return smalltalk.subclasses(self)>
+!
+
+allSubclasses
+	| result |
+	result := self subclasses.
+	self subclasses do: [:each |
+	    result addAll: each allSubclasses].
+	^result
+!
+
+withAllSubclasses
+	^(Array with: self) addAll: self allSubclasses; yourself
+!
+
+prototype
+	<return self.fn.prototype>
+!
+
+methodDictionary
+	<var dict = smalltalk.Dictionary._new();
+	var methods = self.fn.prototype.methods;
+	for(var i in methods) {
+		if(methods[i].selector) {
+			dict._at_put_(methods[i].selector, methods[i]);
+		}
+	};
+	return dict>
+!
+
+methodsFor: aString
+	^ClassCategoryReader new
+	    class: self category: aString;
+	    yourself
+!
+
+addCompiledMethod: aMethod
+	<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>
+!
+
+instanceVariableNames
+	<return self.iVarNames>
+!
+
+comment
+    ^(self basicAt: 'comment') ifNil: ['']
+!
+
+comment: aString
+    self basicAt: 'comment' put: aString
+!
+
+commentStamp
+    ^ClassCommentReader new
+	class: self;
+	yourself
+!
+
+removeCompiledMethod: aMethod
+	<delete self.fn.prototype[aMethod.selector._asSelector()];
+	delete self.fn.prototype.methods[aMethod.selector];
+	smalltalk.init(self);>
+!
+
+protocols
+    | protocols |
+    protocols := Array new.
+    self methodDictionary do: [:each |
+	    (protocols includes: each category) ifFalse: [
+		protocols add: each category]].
+    ^protocols sort
+!
+
+protocolsDo: aBlock
+	"Execute aBlock for each method category with
+	its collection of methods in the sort order of category name."
+
+	| methodsByCategory |
+	methodsByCategory := Dictionary new.
+	self methodDictionary values do: [:m |
+		(methodsByCategory at: m category ifAbsentPut: [Array new])
+ 			add: m]. 
+	self protocols do: [:category |
+		aBlock value: category value: (methodsByCategory at: category)]
+!
+
+allInstanceVariableNames
+	| result |
+	result := self instanceVariableNames copy.
+	self superclass ifNotNil: [
+	    result addAll: self superclass allInstanceVariableNames].
+	^result
+!
+
+methodAt: aString
+	<return smalltalk.methods(self)[aString]>
+!
+
+methodsFor: aString stamp: aStamp
+	"Added for compatibility, right now ignores stamp."
+	^self methodsFor: aString
+!
+
+commentStamp: aStamp prior: prior
+        ^self commentStamp
+! !
+
+!Behavior methodsFor: 'compiling'!
+
+compile: aString
+	self compile: aString category: ''
+!
+
+compile: aString category: anotherString
+	| method |
+	method := Compiler new load: aString forClass: self.
+	method category: anotherString.
+	self addCompiledMethod: method
+! !
+
+!Behavior methodsFor: 'instance creation'!
+
+new
+	^self basicNew initialize
+!
+
+basicNew
+	<return new self.fn()>
+!
+
+inheritsFrom: aClass
+	^aClass allSubclasses includes: self
+! !
+
+Behavior subclass: #Class
+	instanceVariableNames: ''
+	category: 'Kernel-Classes'!
+
+!Class methodsFor: 'accessing'!
+
+category
+	^self package ifNil: ['Unclassified'] ifNotNil: [self package name]
+!
+
+rename: aString
+	<
+		smalltalk[aString] = self;
+		delete smalltalk[self.className];
+		self.className = aString;
+	>
+!
+
+package
+	<return self.pkg>
+!
+
+package: aPackage
+	<self.pkg = aPackage>
+! !
+
+!Class methodsFor: 'class creation'!
+
+subclass: aString instanceVariableNames: anotherString
+	"Kept for compatibility."
+	^self subclass: aString instanceVariableNames: anotherString package: nil
+!
+
+subclass: aString instanceVariableNames: aString2 category: aString3
+	"Kept for compatibility."
+	self deprecatedAPI.
+	^self subclass: aString instanceVariableNames: aString2 package: aString3
+!
+
+subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3
+	"Just ignore class variables and pools. Added for compatibility."
+	^self subclass: aString instanceVariableNames: aString2 package: aString3
+!
+
+subclass: aString instanceVariableNames: aString2 package: aString3
+	^ClassBuilder new
+	    superclass: self subclass: aString instanceVariableNames: aString2 package: aString3
+! !
+
+!Class methodsFor: 'printing'!
+
+printString
+	^self name
+! !
+
+!Class methodsFor: 'testing'!
+
+isClass
+	^true
+! !
+
+Behavior subclass: #Metaclass
+	instanceVariableNames: ''
+	category: 'Kernel-Classes'!
+
+!Metaclass methodsFor: 'accessing'!
+
+instanceClass
+	<return self.instanceClass>
+!
+
+instanceVariableNames: aCollection
+	ClassBuilder new
+	    class: self instanceVariableNames: aCollection
+! !
+
+!Metaclass methodsFor: 'printing'!
+
+printString
+	^self instanceClass name, ' class'
+! !
+
+!Metaclass methodsFor: 'testing'!
+
+isMetaclass
+	^true
+! !
+
+Object subclass: #ClassBuilder
+	instanceVariableNames: ''
+	category: 'Kernel-Classes'!
+
+!ClassBuilder methodsFor: 'class creation'!
+
+superclass: aClass subclass: aString
+	^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil
+!
+
+class: aClass instanceVariableNames: aString
+	aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].
+	aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).
+	self setupClass: aClass
+!
+
+superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3
+	| newClass |
+	newClass := self addSubclassOf: aClass
+				named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
+				package: (aString3 ifNil: ['unclassified']).
+	self setupClass: newClass.
+	^newClass
+! !
+
+!ClassBuilder methodsFor: 'private'!
+
+instanceVariableNamesFor: aString
+	^(aString tokenize: ' ') reject: [:each | each isEmpty]
+!
+
+addSubclassOf: aClass named: aString instanceVariableNames: aCollection
+	<smalltalk.addClass(aString, aClass, aCollection);
+	    return smalltalk[aString]>
+!
+
+setupClass: aClass
+	<smalltalk.init(aClass);>
+!
+
+addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
+	<smalltalk.addClass(aString, aClass, aCollection, packageName);
+	    return smalltalk[aString]>
+!
+
+copyClass: aClass named: aString
+	| newClass |
+
+	newClass := self 
+		addSubclassOf: aClass superclass
+		named: aString 
+		instanceVariableNames: aClass instanceVariableNames 
+		package: aClass package name.
+
+	self setupClass: newClass.
+
+	aClass methodDictionary values do: [:each |
+		newClass addCompiledMethod: (Compiler new load: each source forClass: newClass).
+		(newClass methodDictionary at: each selector) category: each category].
+
+	aClass class methodDictionary values do: [:each |
+		newClass class addCompiledMethod: (Compiler new load: each source forClass: newClass class).
+		(newClass class methodDictionary at: each selector) category: each category].
+
+	self setupClass: newClass.
+	^newClass
+! !
+
+Object subclass: #ClassCategoryReader
+	instanceVariableNames: 'class category chunkParser'
+	category: 'Kernel-Classes'!
+
+!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]
+! !
+
+!ClassCategoryReader methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	chunkParser := ChunkParser new.
+! !
+
+!ClassCategoryReader methodsFor: 'private'!
+
+compileMethod: aString
+	| method |
+	method := Compiler new load: aString forClass: class.
+	method category: category.
+	class addCompiledMethod: method
+! !
+
+Object subclass: #ClassCommentReader
+	instanceVariableNames: 'class chunkParser'
+	category: 'Kernel-Classes'!
+
+!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.
+	chunkParser := ChunkParser new.
+! !
+
+!ClassCommentReader methodsFor: 'private'!
+
+setComment: aString
+    class comment: aString
+! !
+

+ 1296 - 0
st/Kernel-Collections.st

@@ -0,0 +1,1296 @@
+Smalltalk current createPackage: 'Kernel-Collections' properties: #{}!
+Object subclass: #Collection
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!Collection methodsFor: 'accessing'!
+
+size
+	self subclassResponsibility
+!
+
+readStream
+	^self stream
+!
+
+writeStream
+	^self stream
+!
+
+stream
+	^self streamClass on: self
+!
+
+streamClass
+	^self class streamClass
+! !
+
+!Collection methodsFor: 'adding/removing'!
+
+add: anObject
+	self subclassResponsibility
+!
+
+addAll: aCollection
+	aCollection do: [:each |
+	    self add: each].
+	^aCollection
+!
+
+remove: anObject
+    ^self remove: anObject ifAbsent: [self errorNotFound]
+!
+
+remove: anObject ifAbsent: aBlock
+    self subclassResponsibility
+! !
+
+!Collection methodsFor: 'converting'!
+
+asArray
+	| array index |
+	array := Array new.
+	index := 0.
+	self do: [:each |
+	    index := index + 1.
+	    array at: index put: each].
+	^array
+!
+
+asSet
+	^Set withAll: self
+! !
+
+!Collection methodsFor: 'copying'!
+
+, aCollection
+	^self copy 
+	    addAll: aCollection; 
+	    yourself
+!
+
+copyWith: anObject
+	^self copy add: anObject; yourself
+!
+
+copyWithAll: aCollection
+	^self copy addAll: aCollection; yourself
+!
+
+copyWithoutAll: aCollection
+	"Answer a copy of the receiver that does not contain any elements 
+	equal to those in aCollection."
+
+	^ self reject: [:each | aCollection includes: each]
+! !
+
+!Collection methodsFor: 'enumerating'!
+
+do: aBlock
+	<for(var i=0;i<self.length;i++){aBlock(self[i]);}>
+!
+
+collect: aBlock
+	| newCollection |
+	newCollection := self class new.
+	self do: [:each |
+	    newCollection add: (aBlock value: each)].
+	^newCollection
+!
+
+detect: aBlock
+	^self detect: aBlock ifNone: [self errorNotFound]
+!
+
+detect: aBlock ifNone: anotherBlock
+	<
+		for(var i = 0; i < self.length; i++)
+			if(aBlock(self[i]))
+				return self[i];
+		return anotherBlock();
+	>
+!
+
+do: aBlock separatedBy: anotherBlock
+    	| first |
+    	first := true.
+    	self do: [:each |
+    	    first
+    		ifTrue: [first := false]
+    		ifFalse: [anotherBlock value].
+    	    aBlock value: each]
+!
+
+inject: anObject into: aBlock
+	| result |
+	result := anObject.
+	self do: [:each | 
+	    result := aBlock value: result value: each].
+	^result
+!
+
+reject: aBlock
+	^self select: [:each | (aBlock value: each) = false]
+!
+
+select: aBlock
+	| stream |
+	stream := self class new writeStream.
+	self do: [:each |
+	    (aBlock value: each) ifTrue: [
+		stream nextPut: each]].
+	^stream contents
+! !
+
+!Collection methodsFor: 'error handling'!
+
+errorNotFound
+	self error: 'Object is not in the collection'
+! !
+
+!Collection methodsFor: 'testing'!
+
+includes: anObject
+	<
+		var i = self.length;
+		while (i--) {
+			if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}	
+		}
+		return false
+	>
+!
+
+notEmpty
+	^self isEmpty not
+!
+
+isEmpty
+	^self size = 0
+!
+
+ifNotEmpty: aBlock
+	self notEmpty ifTrue: aBlock.
+!
+
+ifEmpty: aBlock
+	self isEmpty ifTrue: aBlock.
+! !
+
+!Collection class methodsFor: 'accessing'!
+
+streamClass
+	    ^Stream
+! !
+
+!Collection class methodsFor: 'instance creation'!
+
+with: anObject
+	    ^self new
+		add: anObject;
+		yourself
+!
+
+with: anObject with: anotherObject
+	    ^self new
+		add: anObject;
+		add: anotherObject;
+		yourself
+!
+
+with: firstObject with: secondObject with: thirdObject
+	    ^self new
+		add: firstObject;
+		add: secondObject;
+		add: thirdObject;
+		yourself
+!
+
+withAll: aCollection
+	    ^self new
+		addAll: aCollection;
+		yourself
+! !
+
+Collection subclass: #SequenceableCollection
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!SequenceableCollection methodsFor: 'accessing'!
+
+at: anIndex
+	^self at: anIndex ifAbsent: [
+	    self errorNotFound]
+!
+
+at: anIndex ifAbsent: aBlock
+	self subclassResponsibility
+!
+
+at: anIndex put: anObject
+	self subclassResponsibility
+!
+
+first
+	^self at: 1
+!
+
+fourth
+	^self at: 4
+!
+
+last
+	^self at: self size
+!
+
+second
+	^self at: 2
+!
+
+third
+	^self at: 3
+!
+
+allButFirst
+	^self copyFrom: 2 to: self size
+!
+
+allButLast
+	^self copyFrom: 1 to: self size - 1
+!
+
+indexOf: anObject
+	^self indexOf: anObject ifAbsent: [self errorNotFound]
+!
+
+indexOf: anObject ifAbsent: aBlock
+	<
+		for(var i=0;i<self.length;i++){
+			if(self[i].__eq(anObject)) {return i+1}
+		}
+		return aBlock();
+	>
+!
+
+indexOf: anObject startingAt: start ifAbsent: aBlock
+	<
+		for(var i=start-1;i<self.length;i++){
+			if(self[i].__eq(anObject)) {return i+1}
+		}
+		return aBlock();
+	>
+!
+
+indexOf: anObject startingAt: start
+	"Answer the index of the first occurence of anElement after start
+	within the receiver. If the receiver does not contain anElement, 
+	answer 0."
+	^self indexOf: anObject startingAt: start ifAbsent: [0]
+!
+
+atRandom
+	^ self at: self size atRandom
+! !
+
+!SequenceableCollection methodsFor: 'adding'!
+
+removeLast
+	self remove: self last
+!
+
+addLast: anObject
+	self add: anObject
+! !
+
+!SequenceableCollection methodsFor: 'converting'!
+
+reversed
+	self subclassResponsibility
+! !
+
+!SequenceableCollection methodsFor: 'copying'!
+
+copyFrom: anIndex to: anotherIndex
+	self subclassResponsibility
+! !
+
+!SequenceableCollection methodsFor: 'enumerating'!
+
+withIndexDo: aBlock
+	<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>
+! !
+
+SequenceableCollection subclass: #String
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!String methodsFor: 'accessing'!
+
+size
+	<return self.length>
+!
+
+at: anIndex
+	<return self[anIndex - 1]>
+!
+
+at: anIndex put: anObject
+    	self errorReadOnly
+!
+
+at: anIndex ifAbsent: aBlock
+    	(self at: anIndex) ifNil: [aBlock]
+!
+
+escaped
+	<return escape(self)>
+!
+
+unescaped
+	<return unescape(self)>
+!
+
+asciiValue
+	<return self.charCodeAt(0);>
+! !
+
+!String methodsFor: 'adding'!
+
+add: anObject
+    	self errorReadOnly
+!
+
+remove: anObject
+	self errorReadOnly
+! !
+
+!String methodsFor: 'comparing'!
+
+= aString
+	aString class = self class ifFalse: [^false].
+	<return String(self) == aString>
+!
+
+> aString
+	<return String(self) >> aString>
+!
+
+< aString
+	<return String(self) < aString>
+!
+
+>= aString
+	<return String(self) >>= aString>
+!
+
+<= aString
+	<return String(self) <= aString>
+!
+
+== aString
+	aString class = self class ifFalse: [^false].
+	<return String(self) === String(aString)>
+! !
+
+!String methodsFor: 'converting'!
+
+asSelector
+	"If you change this method, change smalltalk.convertSelector too (see js/boot.js file)"
+
+	| selector |
+	selector := '_', self.
+    	selector := selector replace: ':' with: '_'.
+    	selector := selector replace: '[+]' with: '_plus'.
+    	selector := selector replace: '-' with: '_minus'.
+    	selector := selector replace: '[*]' with: '_star'.
+    	selector := selector replace: '[/]' with: '_slash'.
+    	selector := selector replace: '>' with: '_gt'.
+    	selector := selector replace: '<' with: '_lt'.
+    	selector := selector replace: '=' with: '_eq'.
+    	selector := selector replace: ',' with: '_comma'.
+    	selector := selector replace: '[@]' with: '_at'.
+	^selector
+!
+
+asJavascript
+	<
+		if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
+			return "unescape(\"" + escape(self) + "\")";
+		else
+			return "\"" + self + "\"";
+	>
+!
+
+tokenize: aString
+	<return self.split(aString)>
+!
+
+asString
+    	^self
+!
+
+asNumber
+	<return Number(self)>
+!
+
+asLowercase
+	<return self.toLowerCase()>
+!
+
+asUppercase
+	<return self.toUpperCase()>
+!
+
+reversed
+	<return self.split("").reverse().join("")>
+!
+
+asJavaScriptSelector
+	^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.
+! !
+
+!String methodsFor: 'copying'!
+
+, aString
+	<return self + aString>
+!
+
+copyFrom: anIndex to: anotherIndex
+	<return self.substring(anIndex - 1, anotherIndex)>
+!
+
+shallowCopy
+    	^self class fromString: self
+!
+
+deepCopy
+    	^self shallowCopy
+! !
+
+!String methodsFor: 'error handling'!
+
+errorReadOnly
+    	self error: 'Object is read-only'
+! !
+
+!String methodsFor: 'printing'!
+
+printString
+    	^'''', self, ''''
+!
+
+printNl
+	<console.log(self)>
+! !
+
+!String methodsFor: 'regular expressions'!
+
+replace: aString with: anotherString
+    	^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString
+!
+
+replaceRegexp: aRegexp with: aString
+	<return self.replace(aRegexp, aString)>
+!
+
+match: aRegexp
+	<return self.search(aRegexp) !!= -1>
+!
+
+trimLeft: separators
+
+    	^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''
+!
+
+trimRight: separators
+
+    	^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''
+!
+
+trimLeft
+	^self trimLeft: '\s'
+!
+
+trimRight
+	^self trimRight: '\s'
+!
+
+trimBoth
+	^self trimBoth: '\s'
+!
+
+trimBoth: separators
+
+    	^(self trimLeft: separators) trimRight: separators
+! !
+
+!String methodsFor: 'split join'!
+
+join: aCollection 
+	^ String
+		streamContents: [:stream | aCollection
+				do: [:each | stream nextPutAll: each asString] 
+				separatedBy: [stream nextPutAll: self]]
+!
+
+lineIndicesDo: aBlock
+	"execute aBlock with 3 arguments for each line:
+	- start index of line
+	- end index of line without line delimiter
+	- end index of line including line delimiter(s) CR, LF or CRLF"
+	
+	| cr lf start sz nextLF nextCR |
+	start := 1.
+	sz := self size.
+	cr := String cr.
+	nextCR := self indexOf: cr startingAt: 1.
+	lf := String lf.
+	nextLF := self indexOf: lf startingAt: 1.
+	[ start <= sz ] whileTrue: [
+		(nextLF = 0 and: [ nextCR = 0 ])
+			ifTrue: [ "No more CR, nor LF, the string is over"
+					aBlock value: start value: sz value: sz.
+					^self ].
+		(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])
+			ifTrue: [ "Found a LF"
+					aBlock value: start value: nextLF - 1 value: nextLF.
+					start := 1 + nextLF.
+					nextLF := self indexOf: lf startingAt: start ]
+			ifFalse: [ 1 + nextCR = nextLF
+				ifTrue: [ "Found a CR-LF pair"
+					aBlock value: start value: nextCR - 1 value: nextLF.
+					start := 1 + nextLF.
+					nextCR := self indexOf: cr startingAt: start.
+					nextLF := self indexOf: lf startingAt: start ]
+				ifFalse: [ "Found a CR"
+					aBlock value: start value: nextCR - 1 value: nextCR.
+					start := 1 + nextCR.
+					nextCR := self indexOf: cr startingAt: start ]]]
+!
+
+linesDo: aBlock
+	"Execute aBlock with each line in this string. The terminating line
+	delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock"
+
+	self lineIndicesDo: [:start :endWithoutDelimiters :end |
+		aBlock value: (self copyFrom: start to: endWithoutDelimiters)]
+!
+
+lines
+	"Answer an array of lines composing this receiver without the line ending delimiters."
+
+	| lines |
+	lines := Array new.
+	self linesDo: [:aLine | lines add: aLine].
+	^lines
+!
+
+lineNumber: anIndex
+	"Answer a string containing the characters in the given line number."
+
+	| lineCount |
+	lineCount := 0.
+	self lineIndicesDo: [:start :endWithoutDelimiters :end |
+		(lineCount := lineCount + 1) = anIndex ifTrue: [^self copyFrom: start to: endWithoutDelimiters]].
+	^nil
+! !
+
+!String methodsFor: 'testing'!
+
+isString
+    	^true
+!
+
+includesSubString: subString
+	< return self.indexOf(subString) !!= -1 >
+! !
+
+!String class methodsFor: 'accessing'!
+
+streamClass
+	    ^StringStream
+!
+
+cr
+	<return '\r'>
+!
+
+lf
+	<return '\n'>
+!
+
+space
+	<return ' '>
+!
+
+tab
+	<return '\t'>
+!
+
+crlf
+	<return '\r\n'>
+! !
+
+!String class methodsFor: 'instance creation'!
+
+fromString: aString
+	    <return new self.fn(aString)>
+!
+
+streamContents: blockWithArg
+	|stream|
+	stream := (self streamClass on: String new).
+	blockWithArg value: stream.
+	^ stream contents
+!
+
+value: aUTFCharCode
+
+	<return String.fromCharCode(aUTFCharCode);>
+! !
+
+SequenceableCollection subclass: #Array
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!Array methodsFor: 'accessing'!
+
+size
+	<return self.length>
+!
+
+at: anIndex put: anObject
+	<return self[anIndex - 1] = anObject>
+!
+
+at: anIndex ifAbsent: aBlock
+	<
+	    var value = self[anIndex - 1];
+	    if(value === undefined) {
+		return aBlock();
+	    } else {
+		return value;
+	    }
+	>
+! !
+
+!Array methodsFor: 'adding/removing'!
+
+add: anObject
+	<self.push(anObject); return anObject;>
+!
+
+remove: anObject
+	<
+		for(var i=0;i<self.length;i++) {
+			if(self[i] == anObject) {
+				self.splice(i,1);
+				break;
+			}
+		}
+	>
+!
+
+removeFrom: aNumber to: anotherNumber
+	<self.splice(aNumber - 1,anotherNumber - 1)>
+! !
+
+!Array methodsFor: 'comparing'!
+
+= aCollection
+	(self class = aCollection class and: [
+        	self size = aCollection size]) ifFalse: [^false].
+	self withIndexDo: [:each :i |
+                 (aCollection at: i) = each ifFalse: [^false]].
+	^true
+! !
+
+!Array methodsFor: 'converting'!
+
+asJavascript
+	^'[', ((self collect: [:each | each asJavascript]) join: ', '),  ']'
+!
+
+reversed
+	<return self._copy().reverse()>
+! !
+
+!Array methodsFor: 'copying'!
+
+shallowCopy
+	| newCollection |
+	newCollection := self class new.
+	self do: [:each | newCollection add: each].
+	^newCollection
+!
+
+deepCopy
+	| newCollection |
+	newCollection := self class new.
+	self do: [:each | newCollection add: each deepCopy].
+	^newCollection
+!
+
+copyFrom: anIndex to: anotherIndex
+	| array |
+	array := self class new.
+	anIndex to: anotherIndex do: [:each |
+	    array add: (self at: each)].
+	^array
+! !
+
+!Array methodsFor: 'enumerating'!
+
+join: aString
+	<return self.join(aString)>
+!
+
+sort
+    ^self basicPerform: 'sort'
+!
+
+sort: aBlock
+	<
+		return self.sort(function(a, b) {
+			if(aBlock(a,b)) {return -1} else {return 1}
+		})
+	>
+!
+
+sorted
+	^self copy sort
+!
+
+sorted: aBlock
+	^self copy sort: aBlock
+!
+
+printString
+	| str |
+	str := '' writeStream.
+	str nextPutAll: super printString, ' ('.
+	self 
+		do: [:each | str nextPutAll: each printString]
+		separatedBy: [str nextPutAll: ' '].
+	str nextPutAll: ')'.
+	^str contents
+! !
+
+Object subclass: #RegularExpression
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!RegularExpression methodsFor: 'evaluating'!
+
+compile: aString
+	<return self.compile(aString)>
+!
+
+exec: aString
+	<return self.exec(aString) || nil>
+!
+
+test: aString
+	<return self.test(aString)>
+! !
+
+!RegularExpression class methodsFor: 'instance creation'!
+
+fromString: aString flag: anotherString
+	<return new RegExp(aString, anotherString)>
+!
+
+fromString: aString
+	    ^self fromString: aString flag: ''
+! !
+
+Object subclass: #Association
+	instanceVariableNames: 'key value'
+	category: 'Kernel-Collections'!
+
+!Association methodsFor: 'accessing'!
+
+key: aKey
+	key := aKey
+!
+
+key
+	^key
+!
+
+value: aValue
+	value := aValue
+!
+
+value
+	^value
+! !
+
+!Association methodsFor: 'comparing'!
+
+= anAssociation
+	^self class = anAssociation class and: [
+	    self key = anAssociation key and: [
+		self value = anAssociation value]]
+!
+
+storeOn: aStream
+	"Store in the format (key->value)"
+
+	"aStream nextPutAll: '('."
+	key storeOn: aStream.
+	aStream nextPutAll: '->'.
+	value storeOn: aStream.
+	"aStream nextPutAll: ')'"
+! !
+
+!Association class methodsFor: 'instance creation'!
+
+key: aKey value: aValue
+	    ^self new
+		key: aKey;
+		value: aValue;
+		yourself
+! !
+
+Collection subclass: #Dictionary
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!Dictionary methodsFor: 'accessing'!
+
+size
+	^self keys size
+!
+
+associations
+	| associations |
+	associations := #().
+	self keys do: [:each |
+	    associations add: (Association key: each value: (self at: each))].
+	^associations
+!
+
+keys
+	<
+		var keys = [];
+		for(var i in self) {
+			if(self.hasOwnProperty(i)) {
+				keys.push(i);
+			}
+		};
+		return keys;
+	>
+!
+
+values
+    	^self keys collect: [:each | self at: each]
+!
+
+at: aKey put: aValue
+	^self basicAt: aKey put: aValue
+!
+
+at: aKey ifAbsent: aBlock
+	^(self includesKey: aKey)
+		ifTrue: [self basicAt: aKey]
+		ifFalse: aBlock
+!
+
+at: aKey ifAbsentPut: aBlock
+    	^self at: aKey ifAbsent: [
+    	    self at: aKey put: aBlock value]
+!
+
+at: aKey ifPresent: aBlock
+	^(self basicAt: aKey) ifNotNil: [aBlock value: (self at: aKey)]
+!
+
+at: aKey ifPresent: aBlock ifAbsent: anotherBlock
+	^(self basicAt: aKey)
+	    ifNil: anotherBlock
+	    ifNotNil: [aBlock value: (self at: aKey)]
+!
+
+at: aKey
+	^self at: aKey ifAbsent: [self errorNotFound]
+! !
+
+!Dictionary methodsFor: 'adding/removing'!
+
+add: anAssociation
+    	self at: anAssociation key put: anAssociation value
+!
+
+addAll: aDictionary
+    	super addAll: aDictionary associations.
+    	^aDictionary
+!
+
+removeKey: aKey
+    self remove: aKey
+!
+
+remove: aKey ifAbsent: aBlock
+    ^self removeKey: aKey ifAbsent: aBlock
+!
+
+removeKey: aKey ifAbsent: aBlock
+	^(self includesKey: aKey) 
+		ifFalse: [aBlock value]
+		ifTrue: [self basicDelete: aKey]
+! !
+
+!Dictionary methodsFor: 'comparing'!
+
+= aDictionary
+	self class = aDictionary class ifFalse: [^false].
+	self size = aDictionary size ifFalse: [^false].
+	^self associations = aDictionary associations
+! !
+
+!Dictionary methodsFor: 'copying'!
+
+shallowCopy
+	| copy |
+	copy := self class new.
+	self associationsDo: [:each |
+	    copy at: each key  put: each value].
+	^copy
+!
+
+, aCollection
+	self shouldNotImplement
+!
+
+copyFrom: anIndex to: anotherIndex
+	self shouldNotImplement
+!
+
+deepCopy
+	| copy |
+	copy := self class new.
+	self associationsDo: [:each |
+	    copy at: each key  put: each value deepCopy].
+	^copy
+! !
+
+!Dictionary methodsFor: 'enumerating'!
+
+associationsDo: aBlock
+    	self associations do: aBlock
+!
+
+keysAndValuesDo: aBlock
+    	self associationsDo: [:each |
+    	    aBlock value: each key value: each value]
+!
+
+do: aBlock
+    	self values do: aBlock
+!
+
+select: aBlock
+    	| newDict |
+    	newDict := self class new.
+    	self keysAndValuesDo: [:key :value |
+    	    (aBlock value: value) ifTrue: [newDict at: key put: value]].
+    	^newDict
+!
+
+collect: aBlock
+    	| newDict |
+    	newDict := self class new.
+    	self keysAndValuesDo: [:key :value |
+    	    newDict at: key put: (aBlock value: value)].
+    	^newDict
+!
+
+detect: aBlock ifNone: anotherBlock
+	^self values detect: aBlock ifNone: anotherBlock
+!
+
+includes: anObject
+	^self values includes: anObject
+! !
+
+!Dictionary methodsFor: 'printing'!
+
+printString
+	^String streamContents: [:aStream|  
+		aStream 
+			nextPutAll: super printString;
+			nextPutAll: '('.
+				self associations 
+					do: [:anAssociation|  
+						aStream 
+							nextPutAll: anAssociation key printString;
+								nextPutAll: ' -> ';
+								nextPutAll: anAssociation value printString]
+							separatedBy: [aStream nextPutAll: ' , '].
+						aStream nextPutAll: ')']
+!
+
+storeOn: aStream
+	aStream nextPutAll: '#{'.
+	self associations
+		do: [:each | each storeOn: aStream]
+		separatedBy: [ aStream nextPutAll: '. '].
+	aStream nextPutAll: '}'
+! !
+
+!Dictionary methodsFor: 'testing'!
+
+includesKey: aKey
+	<return self.hasOwnProperty(aKey)>
+! !
+
+!Dictionary class methodsFor: 'instance creation'!
+
+fromPairs: aCollection
+	| dict |
+	dict := self new.
+	aCollection do: [:each | dict add: each].
+	^dict
+! !
+
+Object subclass: #Stream
+	instanceVariableNames: 'collection position streamSize'
+	category: 'Kernel-Collections'!
+
+!Stream methodsFor: 'accessing'!
+
+collection
+	^collection
+!
+
+setCollection: aCollection
+	collection := aCollection
+!
+
+position
+	^position ifNil: [position := 0]
+!
+
+position: anInteger
+	position := anInteger
+!
+
+streamSize
+	^streamSize
+!
+
+setStreamSize: anInteger
+	streamSize := anInteger
+!
+
+contents
+	^self collection
+	    copyFrom: 1 
+	    to: self streamSize
+!
+
+size
+	^self streamSize
+! !
+
+!Stream methodsFor: 'actions'!
+
+reset
+	self position: 0
+!
+
+close
+!
+
+flush
+!
+
+resetContents
+	self reset.
+	self setStreamSize: 0
+! !
+
+!Stream methodsFor: 'enumerating'!
+
+do: aBlock
+	[self atEnd] whileFalse: [aBlock value: self next]
+! !
+
+!Stream methodsFor: 'positioning'!
+
+setToEnd
+	self position: self size
+!
+
+skip: anInteger
+	self position: ((self position + anInteger) min: self size max: 0)
+! !
+
+!Stream methodsFor: 'reading'!
+
+next
+	self position: self position + 1. 
+	^collection at: self position
+!
+
+next: anInteger
+	| tempCollection |
+	tempCollection := self collection class new.
+	anInteger timesRepeat: [
+	    self atEnd ifFalse: [
+		tempCollection add: self next]].
+	^tempCollection
+!
+
+peek
+	^self atEnd ifFalse: [
+	    self collection at: self position + 1]
+! !
+
+!Stream methodsFor: 'testing'!
+
+atEnd
+	^self position = self size
+!
+
+atStart
+	^self position = 0
+!
+
+isEmpty
+	^self size = 0
+! !
+
+!Stream methodsFor: 'writing'!
+
+nextPut: anObject
+	self position: self position + 1.
+	self collection at: self position put: anObject.
+	self setStreamSize: (self streamSize max: self position)
+!
+
+nextPutAll: aCollection
+	aCollection do: [:each |
+	    self nextPut: each]
+! !
+
+!Stream class methodsFor: 'instance creation'!
+
+on: aCollection
+	    ^self new 
+		setCollection: aCollection;
+		setStreamSize: aCollection size;
+		yourself
+! !
+
+Stream subclass: #StringStream
+	instanceVariableNames: ''
+	category: 'Kernel-Collections'!
+
+!StringStream methodsFor: 'reading'!
+
+next: anInteger
+	| tempCollection |
+	tempCollection := self collection class new.
+	anInteger timesRepeat: [
+	    self atEnd ifFalse: [
+		tempCollection := tempCollection, self next]].
+	^tempCollection
+! !
+
+!StringStream methodsFor: 'writing'!
+
+nextPut: aString
+	self nextPutAll: aString
+!
+
+nextPutAll: aString
+	self setCollection: 
+	    (self collection copyFrom: 1 to: self position),
+	    aString,
+	    (self collection copyFrom: (self position + 1 + aString size) to: self collection size).
+	self position: self position + aString size.
+	self setStreamSize: (self streamSize max: self position)
+!
+
+cr
+	^self nextPutAll: String cr
+!
+
+crlf
+	^self nextPutAll: String crlf
+!
+
+lf
+	^self nextPutAll: String lf
+!
+
+space
+	self nextPut: ' '
+! !
+
+Collection subclass: #Set
+	instanceVariableNames: 'elements'
+	category: 'Kernel-Collections'!
+
+!Set methodsFor: 'accessing'!
+
+size
+	^elements size
+! !
+
+!Set methodsFor: 'adding/removing'!
+
+add: anObject
+	<
+		var found;
+		for(var i in self['@elements']) {
+			if(anObject == self['@elements'][i]) {
+				found = true;
+				break;
+			}
+		}
+		if(!!found) {self['@elements'].push(anObject)}
+	>
+!
+
+remove: anObject
+	elements remove: anObject
+! !
+
+!Set methodsFor: 'comparing'!
+
+= aCollection
+	^self class = aCollection class and: [
+        	elements = aCollection asArray]
+! !
+
+!Set methodsFor: 'converting'!
+
+asArray
+	^elements copy
+! !
+
+!Set methodsFor: 'enumerating'!
+
+detect: aBlock ifNone: anotherBlock
+	^elements detect: aBlock ifNone: anotherBlock
+!
+
+do: aBlock
+	elements do: aBlock
+! !
+
+!Set methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	elements := #()
+! !
+
+!Set methodsFor: 'testing'!
+
+includes: anObject
+	^elements includes: anObject
+! !
+

+ 124 - 0
st/Kernel-Exceptions.st

@@ -0,0 +1,124 @@
+Smalltalk current createPackage: 'Kernel-Exceptions' properties: #{}!
+Object subclass: #Error
+	instanceVariableNames: 'messageText'
+	category: 'Kernel-Exceptions'!
+
+!Error methodsFor: 'accessing'!
+
+messageText
+	^messageText
+!
+
+messageText: aString
+	messageText := aString
+!
+
+context
+	<return self.context>
+!
+
+jsStack
+	<return self.stack>
+! !
+
+!Error methodsFor: 'signaling'!
+
+signal
+	<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>
+! !
+
+!Error methodsFor: 'testing'!
+
+isSmalltalkError
+	<return self.smalltalkError === true>
+! !
+
+!Error class methodsFor: 'instance creation'!
+
+signal: aString
+	    ^self new
+		messageText: aString;
+		signal
+! !
+
+Error subclass: #MessageNotUnderstood
+	instanceVariableNames: 'message receiver'
+	category: 'Kernel-Exceptions'!
+
+!MessageNotUnderstood methodsFor: 'accessing'!
+
+message
+	^message
+!
+
+message: aMessage
+	message := aMessage
+!
+
+receiver
+	^receiver
+!
+
+receiver: anObject
+	receiver := anObject
+!
+
+messageText
+	^self receiver asString, ' does not understand #', self message selector
+! !
+
+Object subclass: #ErrorHandler
+	instanceVariableNames: ''
+	category: 'Kernel-Exceptions'!
+
+!ErrorHandler methodsFor: 'error handling'!
+
+handleError: anError
+	anError context ifNotNil: [self logErrorContext: anError context].
+	self logError: anError
+! !
+
+!ErrorHandler methodsFor: 'private'!
+
+logContext: aContext
+	aContext home ifNotNil: [
+		self logContext: aContext home].
+	self log: aContext receiver asString, '>>', aContext selector
+!
+
+logErrorContext: aContext
+	aContext ifNotNil: [
+		aContext home ifNotNil: [
+			self logContext: aContext home]]
+!
+
+logError: anError
+	self log: anError messageText
+!
+
+log: aString
+	console log: aString
+! !
+
+ErrorHandler class instanceVariableNames: 'current'!
+
+!ErrorHandler class methodsFor: 'accessing'!
+
+current
+	^current ifNil: [current := self new]
+!
+
+setCurrent: anHandler
+	current := anHandler
+! !
+
+!ErrorHandler class methodsFor: 'initialization'!
+
+initialize
+	self register
+!
+
+register
+	ErrorHandler setCurrent: self new
+! !
+

+ 234 - 0
st/Kernel-Methods.st

@@ -0,0 +1,234 @@
+Smalltalk current createPackage: 'Kernel-Methods' properties: #{}!
+Object subclass: #CompiledMethod
+	instanceVariableNames: ''
+	category: 'Kernel-Methods'!
+
+!CompiledMethod methodsFor: 'accessing'!
+
+source
+	^(self basicAt: 'source') ifNil: ['']
+!
+
+source: aString
+	self basicAt: 'source' put: aString
+!
+
+category
+	^(self basicAt: 'category') ifNil: ['']
+!
+
+category: aString
+	self basicAt: 'category' put: aString
+!
+
+selector
+	^self basicAt: 'selector'
+!
+
+selector: aString
+	self basicAt: 'selector' put: aString
+!
+
+fn
+	^self basicAt: 'fn'
+!
+
+fn: aBlock
+	self basicAt: 'fn' put: aBlock
+!
+
+messageSends
+	^self basicAt: 'messageSends'
+!
+
+methodClass
+	^self basicAt: 'methodClass'
+!
+
+referencedClasses
+	^self basicAt: 'referencedClasses'
+!
+
+arguments
+	<return self.args || []>
+! !
+
+Object subclass: #BlockClosure
+	instanceVariableNames: ''
+	category: 'Kernel-Methods'!
+
+!BlockClosure methodsFor: 'accessing'!
+
+compiledSource
+	<return self.toString()>
+!
+
+numArgs
+	<return self.length>
+! !
+
+!BlockClosure methodsFor: 'controlling'!
+
+whileTrue: aBlock
+	"inlined in the Compiler"
+	<while(self()) {aBlock()}>
+!
+
+whileFalse: aBlock
+	"inlined in the Compiler"
+	<while(!!self()) {aBlock()}>
+!
+
+whileFalse
+	"inlined in the Compiler"
+	self whileFalse: []
+!
+
+whileTrue
+	"inlined in the Compiler"
+	self whileTrue: []
+! !
+
+!BlockClosure methodsFor: 'error handling'!
+
+on: anErrorClass do: aBlock
+	self try: self catch: [:error |
+	    (error isKindOf: anErrorClass) 
+	     ifTrue: [aBlock value: error]
+	     ifFalse: [error signal]]
+! !
+
+!BlockClosure methodsFor: 'evaluating'!
+
+value
+	"inlined in the Compiler"
+	<return self();>
+!
+
+value: anArg
+	"inlined in the Compiler"
+	<return self(anArg);>
+!
+
+value: firstArg value: secondArg
+	"inlined in the Compiler"
+	<return self(firstArg, secondArg);>
+!
+
+value: firstArg value: secondArg value: thirdArg
+	"inlined in the Compiler"
+	<return self(firstArg, secondArg, thirdArg);>
+!
+
+valueWithPossibleArguments: aCollection
+	<return self.apply(null, aCollection);>
+!
+
+new
+	"Use the receiver as a JS constructor. 
+	*Do not* use this method to instanciate Smalltalk objects!!"
+	<return new self()>
+!
+
+applyTo: anObject arguments: aCollection
+	<return self.apply(anObject, aCollection)>
+!
+
+timeToRun
+	"Answer the number of milliseconds taken to execute this block."
+
+	^ Date millisecondsToRun: self
+!
+
+ensure: aBlock
+	| success |
+	success := false.
+	[self value. success := true. aBlock value]
+		on: Error
+		do: [:ex |
+			success ifFalse: [aBlock value].
+			ex signal]
+! !
+
+!BlockClosure methodsFor: 'timeout/interval'!
+
+valueWithTimeout: aNumber
+	<return setTimeout(self, aNumber)>
+!
+
+valueWithInterval: aNumber
+	<return setInterval(self, aNumber)>
+! !
+
+Object subclass: #MethodContext
+	instanceVariableNames: ''
+	category: 'Kernel-Methods'!
+
+!MethodContext methodsFor: 'accessing'!
+
+receiver
+	<return self.receiver>
+!
+
+selector
+	<return smalltalk.convertSelector(self.selector)>
+!
+
+home
+	<return self.homeContext>
+!
+
+temps
+	<return self.temps>
+!
+
+printString
+	^super printString, '(', self asString, ')'
+!
+
+asString
+	^self receiver class printString, ' >> ', self selector
+! !
+
+Object subclass: #Message
+	instanceVariableNames: 'selector arguments'
+	category: 'Kernel-Methods'!
+
+!Message methodsFor: 'accessing'!
+
+selector
+	^selector
+!
+
+selector: aString
+	selector := aString
+!
+
+arguments: anArray
+	arguments := anArray
+!
+
+arguments
+	^arguments
+! !
+
+!Message methodsFor: 'printing'!
+
+printString
+	^ String streamContents: [:aStream|  
+                                  				aStream 
+                                  					nextPutAll: super printString;
+                                  					nextPutAll: '(';
+                                  					nextPutAll: selector;
+                                  					nextPutAll: ')' 				]
+! !
+
+!Message class methodsFor: 'instance creation'!
+
+selector: aString arguments: anArray
+	^self new
+		selector: aString;
+		arguments: anArray;
+		yourself
+! !
+

+ 1223 - 0
st/Kernel-Objects.st

@@ -0,0 +1,1223 @@
+Smalltalk current createPackage: 'Kernel-Objects' properties: #{}!
+nil subclass: #Object
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+
+!Object methodsFor: 'accessing'!
+
+yourself
+	^self
+!
+
+class
+	<return self.klass>
+!
+
+size
+	self error: 'Object not indexable'
+!
+
+instVarAt: aString
+	<return self['@'+aString]>
+!
+
+instVarAt: aString put: anObject
+	<self['@' + aString] = anObject>
+!
+
+basicAt: aString
+	<return self[aString]>
+!
+
+basicAt: aString put: anObject
+	<return self[aString] = anObject>
+!
+
+basicDelete: aString
+    <delete self[aString]; return aString>
+! !
+
+!Object methodsFor: 'comparing'!
+
+= anObject
+	^self == anObject
+!
+
+~= anObject
+	^(self = anObject) = false
+!
+
+== anObject
+	<return self === anObject>
+!
+
+~~ anObject
+	^(self == anObject) = false
+! !
+
+!Object methodsFor: 'converting'!
+
+-> anObject
+	^Association key: self value: anObject
+!
+
+asString
+	^self printString
+!
+
+asJavascript
+	^self asString
+!
+
+asJSON
+	^JSON parse: self asJSONString
+!
+
+asJSONString
+	^JSON stringify: self
+! !
+
+!Object methodsFor: 'copying'!
+
+copy
+	^self shallowCopy postCopy
+!
+
+shallowCopy
+	<
+	    var copy = self.klass._new();
+	    for(var i in self) {
+		if(/^@.+/.test(i)) {
+		    copy[i] = self[i];
+		}
+	    }
+	    return copy;
+	>
+!
+
+deepCopy
+	<    
+	    var copy = self.klass._new();
+	    for(var i in self) {
+		if(/^@.+/.test(i)) {
+		    copy[i] = self[i]._deepCopy();
+		}
+	    }
+	    return copy;
+	>
+!
+
+postCopy
+! !
+
+!Object methodsFor: 'error handling'!
+
+error: aString
+	Error signal: aString
+!
+
+subclassResponsibility
+	self error: 'This method is a responsibility of a subclass'
+!
+
+shouldNotImplement
+	self error: 'This method should not be implemented in ', self class name
+!
+
+try: aBlock catch: anotherBlock
+	<try{aBlock()} catch(e) {anotherBlock(e)}>
+!
+
+doesNotUnderstand: aMessage
+	MessageNotUnderstood new
+		receiver: self;
+		message: aMessage;
+		signal
+!
+
+halt
+	self error: 'Halt encountered'
+!
+
+deprecatedAPI
+	"Just a simple way to deprecate methods.
+	#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,
+	but it could in the future."
+	console warn: thisContext home asString, ' is deprecated!! (in ', thisContext home home asString, ')'
+! !
+
+!Object methodsFor: 'initialization'!
+
+initialize
+! !
+
+!Object methodsFor: 'message handling'!
+
+perform: aSymbol
+	^self perform: aSymbol withArguments: #()
+!
+
+perform: aSymbol withArguments: aCollection
+	^self basicPerform: aSymbol asSelector withArguments: aCollection
+!
+
+basicPerform: aSymbol 
+	^self basicPerform: aSymbol withArguments: #()
+!
+
+basicPerform: aSymbol withArguments: aCollection
+	<return self[aSymbol].apply(self, aCollection);>
+! !
+
+!Object methodsFor: 'printing'!
+
+printString
+	^'a ', self class name
+!
+
+printNl
+	<console.log(self)>
+!
+
+log: aString block: aBlock
+
+	| result |
+	console log:  aString,  ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.
+	^result
+!
+
+storeString
+	"Answer a String representation of the receiver from which the receiver 
+	can be reconstructed."
+
+	^ String streamContents: [:s | self storeOn: s]
+!
+
+storeOn: aStream
+	aStream nextPutAll: self printString
+! !
+
+!Object methodsFor: 'testing'!
+
+isKindOf: aClass
+	^(self isMemberOf: aClass)
+	    ifTrue: [true]
+	    ifFalse: [self class inheritsFrom: aClass]
+!
+
+isMemberOf: aClass
+	^self class = aClass
+!
+
+ifNil: aBlock
+	"inlined in the Compiler"
+	^self
+!
+
+ifNil: aBlock ifNotNil: anotherBlock
+	"inlined in the Compiler"
+	^anotherBlock value
+!
+
+ifNotNil: aBlock
+	"inlined in the Compiler"
+	^aBlock value
+!
+
+ifNotNil: aBlock ifNil: anotherBlock
+	"inlined in the Compiler"
+	^aBlock value
+!
+
+isNil
+	^false
+!
+
+notNil
+	^self isNil not
+!
+
+isClass
+	^false
+!
+
+isMetaclass
+	^false
+!
+
+isNumber
+	^false
+!
+
+isString
+	^false
+!
+
+isParseFailure
+	^false
+! !
+
+!Object class methodsFor: 'initialization'!
+
+initialize
+	"no op"
+! !
+
+Object subclass: #Smalltalk
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+
+!Smalltalk methodsFor: 'accessing'!
+
+classes
+	<return self.classes()>
+!
+
+at: aString
+	<return self[aString]>
+!
+
+basicParse: aString
+	<return smalltalk.parser.parse(aString)>
+!
+
+parse: aString
+	| result | 
+	self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].
+	^result
+!
+
+parseError: anException parsing: aString
+	| row col message lines badLine code |
+	<row = anException.line;
+	col = anException.column;
+	message = anException.message;>.
+	lines := aString lines.
+	badLine := lines at: row.
+	badLine := (badLine copyFrom: 1 to: col - 1), ' ===>', (badLine copyFrom:  col to: badLine size).
+	lines at: row put: badLine.
+	code := String streamContents: [:s |
+                  lines withIndexDo: [:l :i |
+                     s nextPutAll: i asString, ': ', l, String lf]].
+	^ Error new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)
+!
+
+reservedWords
+	"JavaScript reserved words"
+	<return self.reservedWords>
+!
+
+readJSObject: anObject
+	<return self.readJSObject(anObject)>
+! !
+
+!Smalltalk methodsFor: 'classes'!
+
+removeClass: aClass
+	aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!!'].
+	aClass methodDictionary values do: [:each |
+		aClass removeCompiledMethod: each].
+	aClass class methodDictionary values do: [:each |
+		aClass class removeCompiledMethod: each].
+	self basicDelete: aClass name
+! !
+
+!Smalltalk methodsFor: 'packages'!
+
+packages
+	"Return all Package instances in the system."
+
+	<return self.packages.all()>
+!
+
+packageAt: packageName
+       <return self.packages[packageName]>
+!
+
+packageAt: packageName ifAbsent: aBlock
+       ^(self packageAt: packageName) ifNil: aBlock
+!
+
+removePackage: packageName
+	"Removes a package and all its classes."
+
+	| pkg |
+	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
+	pkg classes do: [:each |
+        	self removeClass: each].
+	self deletePackage: packageName
+!
+
+renamePackage: packageName to: newName
+	"Rename a package."
+
+	| pkg |
+	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
+	(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].
+	<smalltalk.packages[newName] = smalltalk.packages[packageName]>.
+	pkg name: newName.
+	self deletePackage: packageName.
+! !
+
+!Smalltalk methodsFor: 'private'!
+
+createPackage: packageName
+	"Create and bind a new package with given name and return it."
+
+      <return smalltalk.addPackage(packageName, nil)>
+!
+
+deletePackage: packageName
+	"Deletes a package by deleting its binding, but does not check if it contains classes etc.
+	To remove a package, use #removePackage instead."
+
+       <delete smalltalk.packages[packageName]>
+!
+
+createPackage: packageName properties: aDict
+	"Create and bind a new package with given name and return it."
+
+	| object |
+	<object = {};>.
+	aDict keysAndValuesDo: [:key :value |
+		<object[key] = value>.
+	].
+       <return smalltalk.addPackage(packageName, object)>
+! !
+
+Smalltalk class instanceVariableNames: 'current'!
+
+!Smalltalk class methodsFor: 'accessing'!
+
+current
+	<return smalltalk>
+! !
+
+Object subclass: #Package
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+!Package commentStamp!
+A Package is 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.
+
+A Package has a name, an Array of "requires", a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.
+Packages are manipulated through "Smalltalk current", like for example finding one based on a name:
+
+	Smalltalk current packageAt: 'Kernel'
+
+...but you can also use:
+
+	Package named: 'Kernel'
+
+A 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 "class extensions" 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. This can easily be seen in for example class
+String where the method category "*IDE" defines #inspectOn: which thus is a method belonging to the IDE package.!
+
+!Package methodsFor: 'accessing'!
+
+name
+	<return self.pkgName>
+!
+
+name: aString
+	<return self.pkgName = aString>
+!
+
+dependencies
+	^self propertyAt: 'dependencies' ifAbsent: [#()]
+!
+
+dependencies: anArray
+	^self propertyAt: 'dependencies' put: anArray
+!
+
+properties
+	^Smalltalk current readJSObject: (self basicAt: 'properties')
+!
+
+properties: aDict
+	"We store it as a javascript object."
+	
+	| object |
+	<object = {};>.
+	aDict keysAndValuesDo: [:key :value |
+		<object[key] = value>.
+	].
+	<return self.properties = object>
+! !
+
+!Package methodsFor: 'classes'!
+
+classes
+	"We need to do a reverse scan."
+	^Smalltalk current classes select: [:c | c package == self]
+! !
+
+!Package methodsFor: 'printing'!
+
+printString
+	^self name
+! !
+
+!Package methodsFor: 'private'!
+
+propertiesAsJSON
+	<return JSON.stringify(self.properties)>
+!
+
+jsProperties
+	<return self.properties>
+!
+
+jsProperties: aJSObject
+	<return self.properties = aJSObject>
+! !
+
+!Package methodsFor: 'properties'!
+
+propertyAt: key
+
+	<return self.properties[key]>
+!
+
+propertyAt: key put: value
+
+	<return self.properties[key] = value>
+!
+
+propertyAt: key ifAbsent: block
+
+	^(self propertyAt: key) ifNil: [block value]
+! !
+
+!Package class methodsFor: 'not yet classified'!
+
+named: aPackageName
+
+	^Smalltalk current packageAt: aPackageName
+!
+
+named: aPackageName ifAbsent: aBlock
+
+	^Smalltalk current packageAt: aPackageName ifAbsent: aBlock
+! !
+
+Object subclass: #Number
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+
+!Number methodsFor: ''!
+
+
+! !
+
+!Number methodsFor: 'arithmetic'!
+
++ aNumber
+	"Inlined in the Compiler"
+	<return self + aNumber>
+!
+
+- aNumber
+	"Inlined in the Compiler"
+	<return self - aNumber>
+!
+
+* aNumber
+	"Inlined in the Compiler"
+	<return self * aNumber>
+!
+
+/ aNumber
+	"Inlined in the Compiler"
+	<return self / aNumber>
+!
+
+max: aNumber
+	<return Math.max(self, aNumber);>
+!
+
+min: aNumber
+	<return Math.min(self, aNumber);>
+!
+
+negated
+	^0 - self
+!
+
+\\ aNumber
+	<return self % aNumber>
+!
+
+sqrt
+	<return Math.sqrt(self)>
+!
+
+squared
+	^self * self
+! !
+
+!Number methodsFor: 'comparing'!
+
+= aNumber
+	aNumber class = self class ifFalse: [^false]. 
+	<return Number(self) == aNumber>
+!
+
+> aNumber
+	"Inlined in the Compiler"
+	<return self >> aNumber>
+!
+
+< aNumber
+	"Inlined in the Compiler"
+	<return self < aNumber>
+!
+
+>= aNumber
+	"Inlined in the Compiler"
+	<return self >>= aNumber>
+!
+
+<= aNumber
+	"Inlined in the Compiler"
+	<return self <= aNumber>
+!
+
+== aNumber
+	aNumber class = self class ifFalse: [^false]. 
+	<return Number(self) === Number(aNumber)>
+! !
+
+!Number methodsFor: 'converting'!
+
+rounded
+	<return Math.round(self);>
+!
+
+truncated
+|result|
+
+    self >= 0 
+        ifTrue: [<result = Math.floor(self);>]
+        ifFalse: [<result = (Math.floor(self * (-1)) * (-1));>].
+
+    ^ result
+!
+
+to: aNumber
+	| array first last count |
+	first := self truncated.
+	last := aNumber truncated + 1.
+	count := 1.
+	array := Array new.
+	(last - first) timesRepeat: [
+	    array at: count put: first.
+	    count := count + 1.
+	    first := first + 1].
+	^array
+!
+
+asString
+	^self printString
+!
+
+asJavascript
+	^'(', self printString, ')'
+!
+
+atRandom
+    ^(Random new next * self) truncated + 1
+!
+
+@ aNumber
+	^Point x: self y: aNumber
+!
+
+asPoint
+	^Point x: self y: self
+!
+
+to: stop by: step
+	| array value pos |
+	value := self.
+	array := Array new.
+	pos := 1.
+	step = 0 ifTrue: [self error: 'step must be non-zero'].
+	step < 0
+		ifTrue: [[ value >= stop ] whileTrue: [
+	    			array at: pos put: value.
+	    			pos := pos + 1.
+	    			value := value + step]]
+		ifFalse: [[ value <= stop ] whileTrue: [
+	    			array at: pos put: value.
+	  			pos := pos + 1.
+	    			value := value + step]].
+	^array
+! !
+
+!Number methodsFor: 'copying'!
+
+deepCopy
+	^self copy
+!
+
+copy
+	^self
+! !
+
+!Number methodsFor: 'enumerating'!
+
+timesRepeat: aBlock
+	| integer count |
+	integer := self truncated.
+	count := 1.
+	[count > self] whileFalse: [
+	    aBlock value.
+	    count := count + 1]
+!
+
+to: stop do: aBlock
+	"Evaluate aBlock for each number from self to aNumber."
+	| nextValue |
+	nextValue := self.
+	[nextValue <= stop]
+		whileTrue: 
+			[aBlock value: nextValue.
+			nextValue := nextValue + 1]
+!
+
+to: stop by: step do: aBlock
+	| value |
+	value := self.
+	step = 0 ifTrue: [self error: 'step must be non-zero'].
+	step < 0
+		ifTrue: [[ value >= stop ] whileTrue: [
+	    			aBlock value: value.
+	    			value := value + step]]
+		ifFalse: [[ value <= stop ] whileTrue: [
+	    			aBlock value: value.
+	    			value := value + step]]
+! !
+
+!Number methodsFor: 'printing'!
+
+printString
+	<return String(self)>
+!
+
+printShowingDecimalPlaces: placesDesired
+	<return self.toFixed(placesDesired)>
+! !
+
+!Number methodsFor: 'testing'!
+
+isNumber
+	^true
+!
+
+even
+	^ 0 = (self \\ 2)
+!
+
+odd
+	^ self even not
+! !
+
+!Number methodsFor: 'timeouts/intervals'!
+
+clearInterval
+	<clearInterval(Number(self))>
+!
+
+clearTimeout
+	<clearTimeout(Number(self))>
+! !
+
+!Number class methodsFor: 'instance creation'!
+
+pi
+	<return Math.PI>
+! !
+
+Object subclass: #Boolean
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+
+!Boolean methodsFor: 'comparing'!
+
+= aBoolean
+	aBoolean class = self class ifFalse: [^false].
+	<return Boolean(self == true) == aBoolean>
+!
+
+== aBoolean
+	aBoolean class = self class ifFalse: [^false].
+	<return Boolean(self == true) === Boolean(aBoolean == true)>
+! !
+
+!Boolean methodsFor: 'controlling'!
+
+ifTrue: aBlock
+	"inlined in the Compiler"
+	^self ifTrue: aBlock ifFalse: []
+!
+
+ifFalse: aBlock
+	"inlined in the Compiler"
+	^self ifTrue: [] ifFalse: aBlock
+!
+
+ifFalse: aBlock ifTrue: anotherBlock
+	"inlined in the Compiler"
+	^self ifTrue: anotherBlock ifFalse: aBlock
+!
+
+ifTrue: aBlock ifFalse: anotherBlock
+	"inlined in the Compiler"
+	<
+	    if(self == true) {
+		return aBlock();
+	    } else {
+		return anotherBlock();
+	    }
+	>
+!
+
+and: aBlock
+	^self = true
+	    ifTrue: aBlock
+	    ifFalse: [false]
+!
+
+or: aBlock
+	^self = true
+	    ifTrue: [true]
+	    ifFalse: aBlock
+!
+
+not
+	^self = false
+!
+
+& aBoolean
+	<
+	    if(self == true) {
+		return aBoolean;
+	    } else {
+		return false;
+	    }
+	>
+!
+
+| aBoolean
+	<
+	    if(self == true) {
+		return true;
+	    } else {
+		return aBoolean;
+	    }
+	>
+! !
+
+!Boolean methodsFor: 'copying'!
+
+shallowCopy
+	^self
+!
+
+deepCopy
+	^self
+! !
+
+!Boolean methodsFor: 'printing'!
+
+printString
+	<return self.toString()>
+! !
+
+Object subclass: #Date
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+!Date commentStamp!
+The Date class is used to work with dates and times.!
+
+!Date methodsFor: 'accessing'!
+
+year
+	<return self.getFullYear()>
+!
+
+month
+	<return self.getMonth() + 1>
+!
+
+month: aNumber
+	<self.setMonth(aNumber - 1)>
+!
+
+day
+	^self dayOfWeek
+!
+
+dayOfWeek
+	<return self.getDay() + 1>
+!
+
+dayOfWeek: aNumber
+	<return self.setDay(aNumber - 1)>
+!
+
+day: aNumber
+	self day: aNumber
+!
+
+year: aNumber
+	<self.setFullYear(aNumber)>
+!
+
+dayOfMonth
+	<return self.getDate()>
+!
+
+dayOfMonth: aNumber
+	<self.setDate(aNumber)>
+!
+
+time
+	<return self.getTime()>
+!
+
+time: aNumber
+	<self.setTime(aNumber)>
+!
+
+hours: aNumber
+	<self.setHours(aNumber)>
+!
+
+minutes: aNumber
+	<self.setMinutes(aNumber)>
+!
+
+seconds: aNumber
+	<self.setSeconds(aNumber)>
+!
+
+milliseconds: aNumber
+	<self.setMilliseconds(aNumber)>
+!
+
+hours
+	<return self.getHours()>
+!
+
+minutes
+	<return self.getMinutes()>
+!
+
+seconds
+	<return self.getSeconds()>
+!
+
+milliseconds
+	<return self.getMilliseconds()>
+! !
+
+!Date methodsFor: 'arithmetic'!
+
+- aDate
+	<return self - aDate>
+!
+
++ aDate
+	<return self + aDate>
+! !
+
+!Date methodsFor: 'comparing'!
+
+< aDate
+	<return self < aDate>
+!
+
+> aDate
+	<return self >> aDate>
+!
+
+<= aDate
+	<return self <= aDate>
+!
+
+>= aDate
+	<return self >>= aDate>
+! !
+
+!Date methodsFor: 'converting'!
+
+asString
+	<return self.toString()>
+!
+
+asMilliseconds
+	^self time
+!
+
+asDateString
+	<return self.toDateString()>
+!
+
+asTimeString
+	<return self.toTimeString()>
+!
+
+asLocaleString
+	<return self.toLocaleString()>
+!
+
+asNumber
+	^self asMilliseconds
+! !
+
+!Date methodsFor: 'printing'!
+
+printString
+	^self asString
+! !
+
+!Date class methodsFor: 'instance creation'!
+
+new: anObject
+	<return new Date(anObject)>
+!
+
+fromString: aString
+	"Example: Date fromString('2011/04/15 00:00:00')"
+	^self new: aString
+!
+
+fromSeconds: aNumber
+	^self fromMilliseconds: aNumber * 1000
+!
+
+fromMilliseconds: aNumber
+	^self new: aNumber
+!
+
+today
+	^self new
+!
+
+now
+	^self today
+!
+
+millisecondsToRun: aBlock
+	| t |
+	t := Date now.
+	aBlock value.
+	^Date now - t
+! !
+
+Object subclass: #UndefinedObject
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+
+!UndefinedObject methodsFor: 'class creation'!
+
+subclass: aString instanceVariableNames: anotherString
+	^self subclass: aString instanceVariableNames: anotherString package: nil
+!
+
+subclass: aString instanceVariableNames: aString2 category: aString3
+	"Kept for compatibility."
+	self deprecatedAPI.
+	^self subclass: aString instanceVariableNames: aString2 package: aString3
+!
+
+subclass: aString instanceVariableNames: aString2 package: aString3
+	^ClassBuilder new
+	    superclass: self subclass: aString instanceVariableNames: aString2 package: aString3
+! !
+
+!UndefinedObject methodsFor: 'copying'!
+
+shallowCopy
+	^self
+!
+
+deepCopy
+	^self
+! !
+
+!UndefinedObject methodsFor: 'printing'!
+
+printString
+    ^'nil'
+! !
+
+!UndefinedObject methodsFor: 'testing'!
+
+ifNil: aBlock
+	"inlined in the Compiler"
+	^self ifNil: aBlock ifNotNil: []
+!
+
+ifNotNil: aBlock
+	"inlined in the Compiler"
+	^self
+!
+
+ifNil: aBlock ifNotNil: anotherBlock
+	"inlined in the Compiler"
+	^aBlock value
+!
+
+ifNotNil: aBlock ifNil: anotherBlock
+	"inlined in the Compiler"
+	^anotherBlock value
+!
+
+isNil
+	^true
+!
+
+notNil
+	^false
+! !
+
+!UndefinedObject class methodsFor: 'instance creation'!
+
+new
+	    self error: 'You cannot create new instances of UndefinedObject. Use nil'
+! !
+
+Object subclass: #Random
+	instanceVariableNames: ''
+	category: 'Kernel-Objects'!
+
+!Random methodsFor: 'accessing'!
+
+next
+	<return Math.random()>
+!
+
+next: anInteger
+    ^(1 to: anInteger) collect: [:each | self next]
+! !
+
+Object subclass: #Point
+	instanceVariableNames: 'x y'
+	category: 'Kernel-Objects'!
+
+!Point methodsFor: 'accessing'!
+
+x
+	^x
+!
+
+y
+	^y
+!
+
+y: aNumber
+	y := aNumber
+!
+
+x: aNumber
+	x := aNumber
+! !
+
+!Point methodsFor: 'arithmetic'!
+
+* aPoint
+	^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y
+!
+
++ aPoint
+	^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y
+!
+
+- aPoint
+	^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y
+!
+
+/ aPoint
+	^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y
+!
+
+= aPoint
+	^aPoint class = self class and: [
+		(aPoint x = self x) & (aPoint y = self y)]
+! !
+
+!Point methodsFor: 'converting'!
+
+asPoint
+	^self
+! !
+
+!Point class methodsFor: 'instance creation'!
+
+x: aNumber y: anotherNumber
+	^self new
+		x: aNumber;
+		y: anotherNumber;
+		yourself
+! !
+
+Object subclass: #JSObjectProxy
+	instanceVariableNames: 'jsObject'
+	category: 'Kernel-Objects'!
+
+!JSObjectProxy methodsFor: 'accessing'!
+
+jsObject: aJSObject
+	jsObject := aJSObject
+!
+
+jsObject
+	^jsObject
+!
+
+at: aString
+	<return self['@jsObject'][aString]>
+!
+
+at: aString put: anObject
+	<self['@jsObject'][aString] = anObject>
+! !
+
+!JSObjectProxy methodsFor: 'proxy'!
+
+printString
+	^self jsObject toString
+!
+
+inspectOn: anInspector
+	| variables |
+	variables := Dictionary new.
+	variables at: '#self' put: self jsObject.
+	anInspector setLabel: self printString.
+	<for(var i in self['@jsObject']) {
+		variables._at_put_(i, self['@jsObject'][i]);
+	}>.
+	anInspector setVariables: variables
+!
+
+doesNotUnderstand: aMessage
+	| obj selector jsSelector arguments |
+	obj := self jsObject.
+	selector := aMessage selector.
+	jsSelector := selector asJavaScriptSelector.
+	arguments := aMessage arguments.
+	<if(obj[jsSelector] !!= undefined) {return smalltalk.send(obj, jsSelector, arguments)}>.
+	super doesNotUnderstand: aMessage
+! !
+
+!JSObjectProxy class methodsFor: 'instance creation'!
+
+on: aJSObject
+	^self new
+		jsObject: aJSObject;
+		yourself
+! !
+

+ 70 - 0
st/Kernel-Transcript.st

@@ -0,0 +1,70 @@
+Smalltalk current createPackage: 'Kernel-Transcript' properties: #{}!
+Object subclass: #Transcript
+	instanceVariableNames: 'textarea'
+	category: 'Kernel-Transcript'!
+
+Transcript class instanceVariableNames: 'current'!
+
+!Transcript class methodsFor: 'instance creation'!
+
+open
+    self current open
+!
+
+new
+    self shouldNotImplement
+!
+
+current
+    ^current
+!
+
+register: aTranscript
+	current := aTranscript
+! !
+
+!Transcript class methodsFor: 'printing'!
+
+show: anObject
+    self current show: anObject
+!
+
+cr
+    self current show: String cr
+!
+
+clear
+    self current clear
+! !
+
+Object subclass: #ConsoleTranscript
+	instanceVariableNames: 'textarea'
+	category: 'Kernel-Transcript'!
+
+!ConsoleTranscript methodsFor: 'actions'!
+
+open
+! !
+
+!ConsoleTranscript methodsFor: 'printing'!
+
+clear
+	"no op"
+!
+
+cr
+	"no op"
+!
+
+show: anObject
+	| string |
+	string := anObject asString.
+	<console.log(String(string))>
+! !
+
+!ConsoleTranscript class methodsFor: 'initialization'!
+
+initialize
+	Transcript register: self new
+! !
+

+ 0 - 3316
st/Kernel.st

@@ -1,3316 +0,0 @@
-Smalltalk current createPackage: 'Kernel' properties: #{}!
-nil subclass: #Object
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Object methodsFor: 'accessing'!
-
-yourself
-	^self
-!
-
-class
-	<return self.klass>
-!
-
-size
-	self error: 'Object not indexable'
-!
-
-instVarAt: aString
-	<return self['@'+aString]>
-!
-
-instVarAt: aString put: anObject
-	<self['@' + aString] = anObject>
-!
-
-basicAt: aString
-	<return self[aString]>
-!
-
-basicAt: aString put: anObject
-	<return self[aString] = anObject>
-!
-
-basicDelete: aString
-    <delete self[aString]; return aString>
-! !
-
-!Object methodsFor: 'comparing'!
-
-= anObject
-	^self == anObject
-!
-
-~= anObject
-	^(self = anObject) = false
-!
-
-== anObject
-	<return self === anObject>
-!
-
-~~ anObject
-	^(self == anObject) = false
-! !
-
-!Object methodsFor: 'converting'!
-
--> anObject
-	^Association key: self value: anObject
-!
-
-asString
-	^self printString
-!
-
-asJavascript
-	^self asString
-!
-
-asJSON
-	^JSON parse: self asJSONString
-!
-
-asJSONString
-	^JSON stringify: self
-! !
-
-!Object methodsFor: 'copying'!
-
-copy
-	^self shallowCopy postCopy
-!
-
-shallowCopy
-	<
-	    var copy = self.klass._new();
-	    for(var i in self) {
-		if(/^@.+/.test(i)) {
-		    copy[i] = self[i];
-		}
-	    }
-	    return copy;
-	>
-!
-
-deepCopy
-	<    
-	    var copy = self.klass._new();
-	    for(var i in self) {
-		if(/^@.+/.test(i)) {
-		    copy[i] = self[i]._deepCopy();
-		}
-	    }
-	    return copy;
-	>
-!
-
-postCopy
-! !
-
-!Object methodsFor: 'error handling'!
-
-error: aString
-	Error signal: aString
-!
-
-subclassResponsibility
-	self error: 'This method is a responsibility of a subclass'
-!
-
-shouldNotImplement
-	self error: 'This method should not be implemented in ', self class name
-!
-
-try: aBlock catch: anotherBlock
-	<try{aBlock()} catch(e) {anotherBlock(e)}>
-!
-
-doesNotUnderstand: aMessage
-	MessageNotUnderstood new
-		receiver: self;
-		message: aMessage;
-		signal
-!
-
-halt
-	self error: 'Halt encountered'
-!
-
-deprecatedAPI
-	"Just a simple way to deprecate methods.
-	#deprecatedAPI is in the 'error handling' protocol even if it doesn't throw an error,
-	but it could in the future."
-	console warn: thisContext home asString, ' is deprecated!! (in ', thisContext home home asString, ')'
-! !
-
-!Object methodsFor: 'initialization'!
-
-initialize
-! !
-
-!Object methodsFor: 'message handling'!
-
-perform: aSymbol
-	^self perform: aSymbol withArguments: #()
-!
-
-perform: aSymbol withArguments: aCollection
-	^self basicPerform: aSymbol asSelector withArguments: aCollection
-!
-
-basicPerform: aSymbol 
-	^self basicPerform: aSymbol withArguments: #()
-!
-
-basicPerform: aSymbol withArguments: aCollection
-	<return self[aSymbol].apply(self, aCollection);>
-! !
-
-!Object methodsFor: 'printing'!
-
-printString
-	^'a ', self class name
-!
-
-printNl
-	<console.log(self)>
-!
-
-log: aString block: aBlock
-
-	| result |
-	console log:  aString,  ' time: ', (Date millisecondsToRun: [result := aBlock value]) printString.
-	^result
-!
-
-storeString
-	"Answer a String representation of the receiver from which the receiver 
-	can be reconstructed."
-
-	^ String streamContents: [:s | self storeOn: s]
-!
-
-storeOn: aStream
-	aStream nextPutAll: self printString
-! !
-
-!Object methodsFor: 'testing'!
-
-isKindOf: aClass
-	^(self isMemberOf: aClass)
-	    ifTrue: [true]
-	    ifFalse: [self class inheritsFrom: aClass]
-!
-
-isMemberOf: aClass
-	^self class = aClass
-!
-
-ifNil: aBlock
-	"inlined in the Compiler"
-	^self
-!
-
-ifNil: aBlock ifNotNil: anotherBlock
-	"inlined in the Compiler"
-	^anotherBlock value
-!
-
-ifNotNil: aBlock
-	"inlined in the Compiler"
-	^aBlock value
-!
-
-ifNotNil: aBlock ifNil: anotherBlock
-	"inlined in the Compiler"
-	^aBlock value
-!
-
-isNil
-	^false
-!
-
-notNil
-	^self isNil not
-!
-
-isClass
-	^false
-!
-
-isMetaclass
-	^false
-!
-
-isNumber
-	^false
-!
-
-isString
-	^false
-!
-
-isParseFailure
-	^false
-! !
-
-!Object class methodsFor: 'initialization'!
-
-initialize
-	"no op"
-! !
-
-Object subclass: #Smalltalk
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Smalltalk methodsFor: 'accessing'!
-
-classes
-	<return self.classes()>
-!
-
-at: aString
-	<return self[aString]>
-!
-
-basicParse: aString
-	<return smalltalk.parser.parse(aString)>
-!
-
-parse: aString
-	| result | 
-	self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].
-	^result
-!
-
-parseError: anException parsing: aString
-	| row col message lines badLine code |
-	<row = anException.line;
-	col = anException.column;
-	message = anException.message;>.
-	lines := aString lines.
-	badLine := lines at: row.
-	badLine := (badLine copyFrom: 1 to: col - 1), ' ===>', (badLine copyFrom:  col to: badLine size).
-	lines at: row put: badLine.
-	code := String streamContents: [:s |
-                  lines withIndexDo: [:l :i |
-                     s nextPutAll: i asString, ': ', l, String lf]].
-	^ Error new messageText: ('Parse error on line ' , row , ' column ' , col , ' : ' , message , ' Below is code with line numbers and ===> marker inserted:' , String lf, code)
-!
-
-reservedWords
-	"JavaScript reserved words"
-	<return self.reservedWords>
-!
-
-readJSObject: anObject
-	<return self.readJSObject(anObject)>
-! !
-
-!Smalltalk methodsFor: 'classes'!
-
-removeClass: aClass
-	aClass isMetaclass ifTrue: [self error: aClass asString, ' is a Metaclass and cannot be removed!!'].
-	aClass methodDictionary values do: [:each |
-		aClass removeCompiledMethod: each].
-	aClass class methodDictionary values do: [:each |
-		aClass class removeCompiledMethod: each].
-	self basicDelete: aClass name
-! !
-
-!Smalltalk methodsFor: 'packages'!
-
-packages
-	"Return all Package instances in the system."
-
-	<return self.packages.all()>
-!
-
-packageAt: packageName
-       <return self.packages[packageName]>
-!
-
-packageAt: packageName ifAbsent: aBlock
-       ^(self packageAt: packageName) ifNil: aBlock
-!
-
-removePackage: packageName
-	"Removes a package and all its classes."
-
-	| pkg |
-	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
-	pkg classes do: [:each |
-        	self removeClass: each].
-	self deletePackage: packageName
-!
-
-renamePackage: packageName to: newName
-	"Rename a package."
-
-	| pkg |
-	pkg := self packageAt: packageName ifAbsent: [self error: 'Missing package: ', packageName].
-	(self packageAt: newName) ifNotNil: [self error: 'Already exists a package called: ', newName].
-	<smalltalk.packages[newName] = smalltalk.packages[packageName]>.
-	pkg name: newName.
-	self deletePackage: packageName.
-! !
-
-!Smalltalk methodsFor: 'private'!
-
-createPackage: packageName
-	"Create and bind a new package with given name and return it."
-
-      <return smalltalk.addPackage(packageName, nil)>
-!
-
-deletePackage: packageName
-	"Deletes a package by deleting its binding, but does not check if it contains classes etc.
-	To remove a package, use #removePackage instead."
-
-       <delete smalltalk.packages[packageName]>
-!
-
-createPackage: packageName properties: aDict
-	"Create and bind a new package with given name and return it."
-
-	| object |
-	<object = {};>.
-	aDict keysAndValuesDo: [:key :value |
-		<object[key] = value>.
-	].
-       <return smalltalk.addPackage(packageName, object)>
-! !
-
-Smalltalk class instanceVariableNames: 'current'!
-
-!Smalltalk class methodsFor: 'accessing'!
-
-current
-	<return smalltalk>
-! !
-
-Object subclass: #Package
-	instanceVariableNames: ''
-	category: 'Kernel'!
-!Package commentStamp!
-A Package is 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.
-
-A Package has a name, an Array of "requires", a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.
-Packages are manipulated through "Smalltalk current", like for example finding one based on a name:
-
-	Smalltalk current packageAt: 'Kernel'
-
-...but you can also use:
-
-	Package named: 'Kernel'
-
-A 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 "class extensions" 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. This can easily be seen in for example class
-String where the method category "*IDE" defines #inspectOn: which thus is a method belonging to the IDE package.!
-
-!Package methodsFor: 'accessing'!
-
-name
-	<return self.pkgName>
-!
-
-name: aString
-	<return self.pkgName = aString>
-!
-
-dependencies
-	^self propertyAt: 'dependencies' ifAbsent: [#()]
-!
-
-dependencies: anArray
-	^self propertyAt: 'dependencies' put: anArray
-!
-
-properties
-	^Smalltalk current readJSObject: (self basicAt: 'properties')
-!
-
-properties: aDict
-	"We store it as a javascript object."
-	
-	| object |
-	<object = {};>.
-	aDict keysAndValuesDo: [:key :value |
-		<object[key] = value>.
-	].
-	<return self.properties = object>
-! !
-
-!Package methodsFor: 'classes'!
-
-classes
-	"We need to do a reverse scan."
-	^Smalltalk current classes select: [:c | c package == self]
-! !
-
-!Package methodsFor: 'printing'!
-
-printString
-	^self name
-! !
-
-!Package methodsFor: 'private'!
-
-propertiesAsJSON
-	<return JSON.stringify(self.properties)>
-!
-
-jsProperties
-	<return self.properties>
-!
-
-jsProperties: aJSObject
-	<return self.properties = aJSObject>
-! !
-
-!Package methodsFor: 'properties'!
-
-propertyAt: key
-
-	<return self.properties[key]>
-!
-
-propertyAt: key put: value
-
-	<return self.properties[key] = value>
-!
-
-propertyAt: key ifAbsent: block
-
-	^(self propertyAt: key) ifNil: [block value]
-! !
-
-!Package class methodsFor: 'not yet classified'!
-
-named: aPackageName
-
-	^Smalltalk current packageAt: aPackageName
-!
-
-named: aPackageName ifAbsent: aBlock
-
-	^Smalltalk current packageAt: aPackageName ifAbsent: aBlock
-! !
-
-Object subclass: #Behavior
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Behavior methodsFor: 'accessing'!
-
-name
-	<return self.className || nil>
-!
-
-superclass
-	<return self.superclass || nil>
-!
-
-subclasses
-	<return smalltalk.subclasses(self)>
-!
-
-allSubclasses
-	| result |
-	result := self subclasses.
-	self subclasses do: [:each |
-	    result addAll: each allSubclasses].
-	^result
-!
-
-withAllSubclasses
-	^(Array with: self) addAll: self allSubclasses; yourself
-!
-
-prototype
-	<return self.fn.prototype>
-!
-
-methodDictionary
-	<var dict = smalltalk.Dictionary._new();
-	var methods = self.fn.prototype.methods;
-	for(var i in methods) {
-		if(methods[i].selector) {
-			dict._at_put_(methods[i].selector, methods[i]);
-		}
-	};
-	return dict>
-!
-
-methodsFor: aString
-	^ClassCategoryReader new
-	    class: self category: aString;
-	    yourself
-!
-
-addCompiledMethod: aMethod
-	<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>
-!
-
-instanceVariableNames
-	<return self.iVarNames>
-!
-
-comment
-    ^(self basicAt: 'comment') ifNil: ['']
-!
-
-comment: aString
-    self basicAt: 'comment' put: aString
-!
-
-commentStamp
-    ^ClassCommentReader new
-	class: self;
-	yourself
-!
-
-removeCompiledMethod: aMethod
-	<delete self.fn.prototype[aMethod.selector._asSelector()];
-	delete self.fn.prototype.methods[aMethod.selector];
-	smalltalk.init(self);>
-!
-
-protocols
-    | protocols |
-    protocols := Array new.
-    self methodDictionary do: [:each |
-	    (protocols includes: each category) ifFalse: [
-		protocols add: each category]].
-    ^protocols sort
-!
-
-protocolsDo: aBlock
-	"Execute aBlock for each method category with
-	its collection of methods in the sort order of category name."
-
-	| methodsByCategory |
-	methodsByCategory := Dictionary new.
-	self methodDictionary values do: [:m |
-		(methodsByCategory at: m category ifAbsentPut: [Array new])
- 			add: m]. 
-	self protocols do: [:category |
-		aBlock value: category value: (methodsByCategory at: category)]
-!
-
-allInstanceVariableNames
-	| result |
-	result := self instanceVariableNames copy.
-	self superclass ifNotNil: [
-	    result addAll: self superclass allInstanceVariableNames].
-	^result
-!
-
-methodAt: aString
-	<return smalltalk.methods(self)[aString]>
-!
-
-methodsFor: aString stamp: aStamp
-	"Added for compatibility, right now ignores stamp."
-	^self methodsFor: aString
-!
-
-commentStamp: aStamp prior: prior
-        ^self commentStamp
-! !
-
-!Behavior methodsFor: 'compiling'!
-
-compile: aString
-	self compile: aString category: ''
-!
-
-compile: aString category: anotherString
-	| method |
-	method := Compiler new load: aString forClass: self.
-	method category: anotherString.
-	self addCompiledMethod: method
-! !
-
-!Behavior methodsFor: 'instance creation'!
-
-new
-	^self basicNew initialize
-!
-
-basicNew
-	<return new self.fn()>
-!
-
-inheritsFrom: aClass
-	^aClass allSubclasses includes: self
-! !
-
-Behavior subclass: #Class
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Class methodsFor: 'accessing'!
-
-category
-	^self package ifNil: ['Unclassified'] ifNotNil: [self package name]
-!
-
-rename: aString
-	<
-		smalltalk[aString] = self;
-		delete smalltalk[self.className];
-		self.className = aString;
-	>
-!
-
-package
-	<return self.pkg>
-!
-
-package: aPackage
-	<self.pkg = aPackage>
-! !
-
-!Class methodsFor: 'class creation'!
-
-subclass: aString instanceVariableNames: anotherString
-	"Kept for compatibility."
-	^self subclass: aString instanceVariableNames: anotherString package: nil
-!
-
-subclass: aString instanceVariableNames: aString2 category: aString3
-	"Kept for compatibility."
-	self deprecatedAPI.
-	^self subclass: aString instanceVariableNames: aString2 package: aString3
-!
-
-subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3
-	"Just ignore class variables and pools. Added for compatibility."
-	^self subclass: aString instanceVariableNames: aString2 package: aString3
-!
-
-subclass: aString instanceVariableNames: aString2 package: aString3
-	^ClassBuilder new
-	    superclass: self subclass: aString instanceVariableNames: aString2 package: aString3
-! !
-
-!Class methodsFor: 'printing'!
-
-printString
-	^self name
-! !
-
-!Class methodsFor: 'testing'!
-
-isClass
-	^true
-! !
-
-Behavior subclass: #Metaclass
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Metaclass methodsFor: 'accessing'!
-
-instanceClass
-	<return self.instanceClass>
-!
-
-instanceVariableNames: aCollection
-	ClassBuilder new
-	    class: self instanceVariableNames: aCollection
-! !
-
-!Metaclass methodsFor: 'printing'!
-
-printString
-	^self instanceClass name, ' class'
-! !
-
-!Metaclass methodsFor: 'testing'!
-
-isMetaclass
-	^true
-! !
-
-Object subclass: #CompiledMethod
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!CompiledMethod methodsFor: 'accessing'!
-
-source
-	^(self basicAt: 'source') ifNil: ['']
-!
-
-source: aString
-	self basicAt: 'source' put: aString
-!
-
-category
-	^(self basicAt: 'category') ifNil: ['']
-!
-
-category: aString
-	self basicAt: 'category' put: aString
-!
-
-selector
-	^self basicAt: 'selector'
-!
-
-selector: aString
-	self basicAt: 'selector' put: aString
-!
-
-fn
-	^self basicAt: 'fn'
-!
-
-fn: aBlock
-	self basicAt: 'fn' put: aBlock
-!
-
-messageSends
-	^self basicAt: 'messageSends'
-!
-
-methodClass
-	^self basicAt: 'methodClass'
-!
-
-referencedClasses
-	^self basicAt: 'referencedClasses'
-!
-
-arguments
-	<return self.args || []>
-! !
-
-Object subclass: #Number
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Number methodsFor: ''!
-
-
-! !
-
-!Number methodsFor: 'arithmetic'!
-
-+ aNumber
-	"Inlined in the Compiler"
-	<return self + aNumber>
-!
-
-- aNumber
-	"Inlined in the Compiler"
-	<return self - aNumber>
-!
-
-* aNumber
-	"Inlined in the Compiler"
-	<return self * aNumber>
-!
-
-/ aNumber
-	"Inlined in the Compiler"
-	<return self / aNumber>
-!
-
-max: aNumber
-	<return Math.max(self, aNumber);>
-!
-
-min: aNumber
-	<return Math.min(self, aNumber);>
-!
-
-negated
-	^0 - self
-!
-
-\\ aNumber
-	<return self % aNumber>
-!
-
-sqrt
-	<return Math.sqrt(self)>
-!
-
-squared
-	^self * self
-! !
-
-!Number methodsFor: 'comparing'!
-
-= aNumber
-	aNumber class = self class ifFalse: [^false]. 
-	<return Number(self) == aNumber>
-!
-
-> aNumber
-	"Inlined in the Compiler"
-	<return self >> aNumber>
-!
-
-< aNumber
-	"Inlined in the Compiler"
-	<return self < aNumber>
-!
-
->= aNumber
-	"Inlined in the Compiler"
-	<return self >>= aNumber>
-!
-
-<= aNumber
-	"Inlined in the Compiler"
-	<return self <= aNumber>
-!
-
-== aNumber
-	aNumber class = self class ifFalse: [^false]. 
-	<return Number(self) === Number(aNumber)>
-! !
-
-!Number methodsFor: 'converting'!
-
-rounded
-	<return Math.round(self);>
-!
-
-truncated
-|result|
-
-    self >= 0 
-        ifTrue: [<result = Math.floor(self);>]
-        ifFalse: [<result = (Math.floor(self * (-1)) * (-1));>].
-
-    ^ result
-!
-
-to: aNumber
-	| array first last count |
-	first := self truncated.
-	last := aNumber truncated + 1.
-	count := 1.
-	array := Array new.
-	(last - first) timesRepeat: [
-	    array at: count put: first.
-	    count := count + 1.
-	    first := first + 1].
-	^array
-!
-
-asString
-	^self printString
-!
-
-asJavascript
-	^'(', self printString, ')'
-!
-
-atRandom
-    ^(Random new next * self) truncated + 1
-!
-
-@ aNumber
-	^Point x: self y: aNumber
-!
-
-asPoint
-	^Point x: self y: self
-!
-
-to: stop by: step
-	| array value pos |
-	value := self.
-	array := Array new.
-	pos := 1.
-	step = 0 ifTrue: [self error: 'step must be non-zero'].
-	step < 0
-		ifTrue: [[ value >= stop ] whileTrue: [
-	    			array at: pos put: value.
-	    			pos := pos + 1.
-	    			value := value + step]]
-		ifFalse: [[ value <= stop ] whileTrue: [
-	    			array at: pos put: value.
-	  			pos := pos + 1.
-	    			value := value + step]].
-	^array
-! !
-
-!Number methodsFor: 'copying'!
-
-deepCopy
-	^self copy
-!
-
-copy
-	^self
-! !
-
-!Number methodsFor: 'enumerating'!
-
-timesRepeat: aBlock
-	| integer count |
-	integer := self truncated.
-	count := 1.
-	[count > self] whileFalse: [
-	    aBlock value.
-	    count := count + 1]
-!
-
-to: stop do: aBlock
-	"Evaluate aBlock for each number from self to aNumber."
-	| nextValue |
-	nextValue := self.
-	[nextValue <= stop]
-		whileTrue: 
-			[aBlock value: nextValue.
-			nextValue := nextValue + 1]
-!
-
-to: stop by: step do: aBlock
-	| value |
-	value := self.
-	step = 0 ifTrue: [self error: 'step must be non-zero'].
-	step < 0
-		ifTrue: [[ value >= stop ] whileTrue: [
-	    			aBlock value: value.
-	    			value := value + step]]
-		ifFalse: [[ value <= stop ] whileTrue: [
-	    			aBlock value: value.
-	    			value := value + step]]
-! !
-
-!Number methodsFor: 'printing'!
-
-printString
-	<return String(self)>
-!
-
-printShowingDecimalPlaces: placesDesired
-	<return self.toFixed(placesDesired)>
-! !
-
-!Number methodsFor: 'testing'!
-
-isNumber
-	^true
-!
-
-even
-	^ 0 = (self \\ 2)
-!
-
-odd
-	^ self even not
-! !
-
-!Number methodsFor: 'timeouts/intervals'!
-
-clearInterval
-	<clearInterval(Number(self))>
-!
-
-clearTimeout
-	<clearTimeout(Number(self))>
-! !
-
-!Number class methodsFor: 'instance creation'!
-
-pi
-	<return Math.PI>
-! !
-
-Object subclass: #BlockClosure
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!BlockClosure methodsFor: 'accessing'!
-
-compiledSource
-	<return self.toString()>
-!
-
-numArgs
-	<return self.length>
-! !
-
-!BlockClosure methodsFor: 'controlling'!
-
-whileTrue: aBlock
-	"inlined in the Compiler"
-	<while(self()) {aBlock()}>
-!
-
-whileFalse: aBlock
-	"inlined in the Compiler"
-	<while(!!self()) {aBlock()}>
-!
-
-whileFalse
-	"inlined in the Compiler"
-	self whileFalse: []
-!
-
-whileTrue
-	"inlined in the Compiler"
-	self whileTrue: []
-! !
-
-!BlockClosure methodsFor: 'error handling'!
-
-on: anErrorClass do: aBlock
-	self try: self catch: [:error |
-	    (error isKindOf: anErrorClass) 
-	     ifTrue: [aBlock value: error]
-	     ifFalse: [error signal]]
-! !
-
-!BlockClosure methodsFor: 'evaluating'!
-
-value
-	"inlined in the Compiler"
-	<return self();>
-!
-
-value: anArg
-	"inlined in the Compiler"
-	<return self(anArg);>
-!
-
-value: firstArg value: secondArg
-	"inlined in the Compiler"
-	<return self(firstArg, secondArg);>
-!
-
-value: firstArg value: secondArg value: thirdArg
-	"inlined in the Compiler"
-	<return self(firstArg, secondArg, thirdArg);>
-!
-
-valueWithPossibleArguments: aCollection
-	<return self.apply(null, aCollection);>
-!
-
-new
-	"Use the receiver as a JS constructor. 
-	*Do not* use this method to instanciate Smalltalk objects!!"
-	<return new self()>
-!
-
-applyTo: anObject arguments: aCollection
-	<return self.apply(anObject, aCollection)>
-!
-
-timeToRun
-	"Answer the number of milliseconds taken to execute this block."
-
-	^ Date millisecondsToRun: self
-!
-
-ensure: aBlock
-	| success |
-	success := false.
-	[self value. success := true. aBlock value]
-		on: Error
-		do: [:ex |
-			success ifFalse: [aBlock value].
-			ex signal]
-! !
-
-!BlockClosure methodsFor: 'timeout/interval'!
-
-valueWithTimeout: aNumber
-	<return setTimeout(self, aNumber)>
-!
-
-valueWithInterval: aNumber
-	<return setInterval(self, aNumber)>
-! !
-
-Object subclass: #Boolean
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Boolean methodsFor: 'comparing'!
-
-= aBoolean
-	aBoolean class = self class ifFalse: [^false].
-	<return Boolean(self == true) == aBoolean>
-!
-
-== aBoolean
-	aBoolean class = self class ifFalse: [^false].
-	<return Boolean(self == true) === Boolean(aBoolean == true)>
-! !
-
-!Boolean methodsFor: 'controlling'!
-
-ifTrue: aBlock
-	"inlined in the Compiler"
-	^self ifTrue: aBlock ifFalse: []
-!
-
-ifFalse: aBlock
-	"inlined in the Compiler"
-	^self ifTrue: [] ifFalse: aBlock
-!
-
-ifFalse: aBlock ifTrue: anotherBlock
-	"inlined in the Compiler"
-	^self ifTrue: anotherBlock ifFalse: aBlock
-!
-
-ifTrue: aBlock ifFalse: anotherBlock
-	"inlined in the Compiler"
-	<
-	    if(self == true) {
-		return aBlock();
-	    } else {
-		return anotherBlock();
-	    }
-	>
-!
-
-and: aBlock
-	^self = true
-	    ifTrue: aBlock
-	    ifFalse: [false]
-!
-
-or: aBlock
-	^self = true
-	    ifTrue: [true]
-	    ifFalse: aBlock
-!
-
-not
-	^self = false
-!
-
-& aBoolean
-	<
-	    if(self == true) {
-		return aBoolean;
-	    } else {
-		return false;
-	    }
-	>
-!
-
-| aBoolean
-	<
-	    if(self == true) {
-		return true;
-	    } else {
-		return aBoolean;
-	    }
-	>
-! !
-
-!Boolean methodsFor: 'copying'!
-
-shallowCopy
-	^self
-!
-
-deepCopy
-	^self
-! !
-
-!Boolean methodsFor: 'printing'!
-
-printString
-	<return self.toString()>
-! !
-
-Object subclass: #Date
-	instanceVariableNames: ''
-	category: 'Kernel'!
-!Date commentStamp!
-The Date class is used to work with dates and times.!
-
-!Date methodsFor: 'accessing'!
-
-year
-	<return self.getFullYear()>
-!
-
-month
-	<return self.getMonth() + 1>
-!
-
-month: aNumber
-	<self.setMonth(aNumber - 1)>
-!
-
-day
-	^self dayOfWeek
-!
-
-dayOfWeek
-	<return self.getDay() + 1>
-!
-
-dayOfWeek: aNumber
-	<return self.setDay(aNumber - 1)>
-!
-
-day: aNumber
-	self day: aNumber
-!
-
-year: aNumber
-	<self.setFullYear(aNumber)>
-!
-
-dayOfMonth
-	<return self.getDate()>
-!
-
-dayOfMonth: aNumber
-	<self.setDate(aNumber)>
-!
-
-time
-	<return self.getTime()>
-!
-
-time: aNumber
-	<self.setTime(aNumber)>
-!
-
-hours: aNumber
-	<self.setHours(aNumber)>
-!
-
-minutes: aNumber
-	<self.setMinutes(aNumber)>
-!
-
-seconds: aNumber
-	<self.setSeconds(aNumber)>
-!
-
-milliseconds: aNumber
-	<self.setMilliseconds(aNumber)>
-!
-
-hours
-	<return self.getHours()>
-!
-
-minutes
-	<return self.getMinutes()>
-!
-
-seconds
-	<return self.getSeconds()>
-!
-
-milliseconds
-	<return self.getMilliseconds()>
-! !
-
-!Date methodsFor: 'arithmetic'!
-
-- aDate
-	<return self - aDate>
-!
-
-+ aDate
-	<return self + aDate>
-! !
-
-!Date methodsFor: 'comparing'!
-
-< aDate
-	<return self < aDate>
-!
-
-> aDate
-	<return self >> aDate>
-!
-
-<= aDate
-	<return self <= aDate>
-!
-
->= aDate
-	<return self >>= aDate>
-! !
-
-!Date methodsFor: 'converting'!
-
-asString
-	<return self.toString()>
-!
-
-asMilliseconds
-	^self time
-!
-
-asDateString
-	<return self.toDateString()>
-!
-
-asTimeString
-	<return self.toTimeString()>
-!
-
-asLocaleString
-	<return self.toLocaleString()>
-!
-
-asNumber
-	^self asMilliseconds
-! !
-
-!Date methodsFor: 'printing'!
-
-printString
-	^self asString
-! !
-
-!Date class methodsFor: 'instance creation'!
-
-new: anObject
-	<return new Date(anObject)>
-!
-
-fromString: aString
-	"Example: Date fromString('2011/04/15 00:00:00')"
-	^self new: aString
-!
-
-fromSeconds: aNumber
-	^self fromMilliseconds: aNumber * 1000
-!
-
-fromMilliseconds: aNumber
-	^self new: aNumber
-!
-
-today
-	^self new
-!
-
-now
-	^self today
-!
-
-millisecondsToRun: aBlock
-	| t |
-	t := Date now.
-	aBlock value.
-	^Date now - t
-! !
-
-Object subclass: #UndefinedObject
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!UndefinedObject methodsFor: 'class creation'!
-
-subclass: aString instanceVariableNames: anotherString
-	^self subclass: aString instanceVariableNames: anotherString package: nil
-!
-
-subclass: aString instanceVariableNames: aString2 category: aString3
-	"Kept for compatibility."
-	self deprecatedAPI.
-	^self subclass: aString instanceVariableNames: aString2 package: aString3
-!
-
-subclass: aString instanceVariableNames: aString2 package: aString3
-	^ClassBuilder new
-	    superclass: self subclass: aString instanceVariableNames: aString2 package: aString3
-! !
-
-!UndefinedObject methodsFor: 'copying'!
-
-shallowCopy
-	^self
-!
-
-deepCopy
-	^self
-! !
-
-!UndefinedObject methodsFor: 'printing'!
-
-printString
-    ^'nil'
-! !
-
-!UndefinedObject methodsFor: 'testing'!
-
-ifNil: aBlock
-	"inlined in the Compiler"
-	^self ifNil: aBlock ifNotNil: []
-!
-
-ifNotNil: aBlock
-	"inlined in the Compiler"
-	^self
-!
-
-ifNil: aBlock ifNotNil: anotherBlock
-	"inlined in the Compiler"
-	^aBlock value
-!
-
-ifNotNil: aBlock ifNil: anotherBlock
-	"inlined in the Compiler"
-	^anotherBlock value
-!
-
-isNil
-	^true
-!
-
-notNil
-	^false
-! !
-
-!UndefinedObject class methodsFor: 'instance creation'!
-
-new
-	    self error: 'You cannot create new instances of UndefinedObject. Use nil'
-! !
-
-Object subclass: #Collection
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Collection methodsFor: 'accessing'!
-
-size
-	self subclassResponsibility
-!
-
-readStream
-	^self stream
-!
-
-writeStream
-	^self stream
-!
-
-stream
-	^self streamClass on: self
-!
-
-streamClass
-	^self class streamClass
-! !
-
-!Collection methodsFor: 'adding/removing'!
-
-add: anObject
-	self subclassResponsibility
-!
-
-addAll: aCollection
-	aCollection do: [:each |
-	    self add: each].
-	^aCollection
-!
-
-remove: anObject
-    ^self remove: anObject ifAbsent: [self errorNotFound]
-!
-
-remove: anObject ifAbsent: aBlock
-    self subclassResponsibility
-! !
-
-!Collection methodsFor: 'converting'!
-
-asArray
-	| array index |
-	array := Array new.
-	index := 0.
-	self do: [:each |
-	    index := index + 1.
-	    array at: index put: each].
-	^array
-!
-
-asSet
-	^Set withAll: self
-! !
-
-!Collection methodsFor: 'copying'!
-
-, aCollection
-	^self copy 
-	    addAll: aCollection; 
-	    yourself
-!
-
-copyWith: anObject
-	^self copy add: anObject; yourself
-!
-
-copyWithAll: aCollection
-	^self copy addAll: aCollection; yourself
-!
-
-copyWithoutAll: aCollection
-	"Answer a copy of the receiver that does not contain any elements 
-	equal to those in aCollection."
-
-	^ self reject: [:each | aCollection includes: each]
-! !
-
-!Collection methodsFor: 'enumerating'!
-
-do: aBlock
-	<for(var i=0;i<self.length;i++){aBlock(self[i]);}>
-!
-
-collect: aBlock
-	| newCollection |
-	newCollection := self class new.
-	self do: [:each |
-	    newCollection add: (aBlock value: each)].
-	^newCollection
-!
-
-detect: aBlock
-	^self detect: aBlock ifNone: [self errorNotFound]
-!
-
-detect: aBlock ifNone: anotherBlock
-	<
-		for(var i = 0; i < self.length; i++)
-			if(aBlock(self[i]))
-				return self[i];
-		return anotherBlock();
-	>
-!
-
-do: aBlock separatedBy: anotherBlock
-    	| first |
-    	first := true.
-    	self do: [:each |
-    	    first
-    		ifTrue: [first := false]
-    		ifFalse: [anotherBlock value].
-    	    aBlock value: each]
-!
-
-inject: anObject into: aBlock
-	| result |
-	result := anObject.
-	self do: [:each | 
-	    result := aBlock value: result value: each].
-	^result
-!
-
-reject: aBlock
-	^self select: [:each | (aBlock value: each) = false]
-!
-
-select: aBlock
-	| stream |
-	stream := self class new writeStream.
-	self do: [:each |
-	    (aBlock value: each) ifTrue: [
-		stream nextPut: each]].
-	^stream contents
-! !
-
-!Collection methodsFor: 'error handling'!
-
-errorNotFound
-	self error: 'Object is not in the collection'
-! !
-
-!Collection methodsFor: 'testing'!
-
-includes: anObject
-	<
-		var i = self.length;
-		while (i--) {
-			if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}	
-		}
-		return false
-	>
-!
-
-notEmpty
-	^self isEmpty not
-!
-
-isEmpty
-	^self size = 0
-!
-
-ifNotEmpty: aBlock
-	self notEmpty ifTrue: aBlock.
-!
-
-ifEmpty: aBlock
-	self isEmpty ifTrue: aBlock.
-! !
-
-!Collection class methodsFor: 'accessing'!
-
-streamClass
-	    ^Stream
-! !
-
-!Collection class methodsFor: 'instance creation'!
-
-with: anObject
-	    ^self new
-		add: anObject;
-		yourself
-!
-
-with: anObject with: anotherObject
-	    ^self new
-		add: anObject;
-		add: anotherObject;
-		yourself
-!
-
-with: firstObject with: secondObject with: thirdObject
-	    ^self new
-		add: firstObject;
-		add: secondObject;
-		add: thirdObject;
-		yourself
-!
-
-withAll: aCollection
-	    ^self new
-		addAll: aCollection;
-		yourself
-! !
-
-Collection subclass: #SequenceableCollection
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!SequenceableCollection methodsFor: 'accessing'!
-
-at: anIndex
-	^self at: anIndex ifAbsent: [
-	    self errorNotFound]
-!
-
-at: anIndex ifAbsent: aBlock
-	self subclassResponsibility
-!
-
-at: anIndex put: anObject
-	self subclassResponsibility
-!
-
-first
-	^self at: 1
-!
-
-fourth
-	^self at: 4
-!
-
-last
-	^self at: self size
-!
-
-second
-	^self at: 2
-!
-
-third
-	^self at: 3
-!
-
-allButFirst
-	^self copyFrom: 2 to: self size
-!
-
-allButLast
-	^self copyFrom: 1 to: self size - 1
-!
-
-indexOf: anObject
-	^self indexOf: anObject ifAbsent: [self errorNotFound]
-!
-
-indexOf: anObject ifAbsent: aBlock
-	<
-		for(var i=0;i<self.length;i++){
-			if(self[i].__eq(anObject)) {return i+1}
-		}
-		return aBlock();
-	>
-!
-
-indexOf: anObject startingAt: start ifAbsent: aBlock
-	<
-		for(var i=start-1;i<self.length;i++){
-			if(self[i].__eq(anObject)) {return i+1}
-		}
-		return aBlock();
-	>
-!
-
-indexOf: anObject startingAt: start
-	"Answer the index of the first occurence of anElement after start
-	within the receiver. If the receiver does not contain anElement, 
-	answer 0."
-	^self indexOf: anObject startingAt: start ifAbsent: [0]
-!
-
-atRandom
-	^ self at: self size atRandom
-! !
-
-!SequenceableCollection methodsFor: 'adding'!
-
-removeLast
-	self remove: self last
-!
-
-addLast: anObject
-	self add: anObject
-! !
-
-!SequenceableCollection methodsFor: 'converting'!
-
-reversed
-	self subclassResponsibility
-! !
-
-!SequenceableCollection methodsFor: 'copying'!
-
-copyFrom: anIndex to: anotherIndex
-	self subclassResponsibility
-! !
-
-!SequenceableCollection methodsFor: 'enumerating'!
-
-withIndexDo: aBlock
-	<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>
-! !
-
-SequenceableCollection subclass: #String
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!String methodsFor: 'accessing'!
-
-size
-	<return self.length>
-!
-
-at: anIndex
-	<return self[anIndex - 1]>
-!
-
-at: anIndex put: anObject
-    	self errorReadOnly
-!
-
-at: anIndex ifAbsent: aBlock
-    	(self at: anIndex) ifNil: [aBlock]
-!
-
-escaped
-	<return escape(self)>
-!
-
-unescaped
-	<return unescape(self)>
-!
-
-asciiValue
-	<return self.charCodeAt(0);>
-! !
-
-!String methodsFor: 'adding'!
-
-add: anObject
-    	self errorReadOnly
-!
-
-remove: anObject
-	self errorReadOnly
-! !
-
-!String methodsFor: 'comparing'!
-
-= aString
-	aString class = self class ifFalse: [^false].
-	<return String(self) == aString>
-!
-
-> aString
-	<return String(self) >> aString>
-!
-
-< aString
-	<return String(self) < aString>
-!
-
->= aString
-	<return String(self) >>= aString>
-!
-
-<= aString
-	<return String(self) <= aString>
-!
-
-== aString
-	aString class = self class ifFalse: [^false].
-	<return String(self) === String(aString)>
-! !
-
-!String methodsFor: 'converting'!
-
-asSelector
-	"If you change this method, change smalltalk.convertSelector too (see js/boot.js file)"
-
-	| selector |
-	selector := '_', self.
-    	selector := selector replace: ':' with: '_'.
-    	selector := selector replace: '[+]' with: '_plus'.
-    	selector := selector replace: '-' with: '_minus'.
-    	selector := selector replace: '[*]' with: '_star'.
-    	selector := selector replace: '[/]' with: '_slash'.
-    	selector := selector replace: '>' with: '_gt'.
-    	selector := selector replace: '<' with: '_lt'.
-    	selector := selector replace: '=' with: '_eq'.
-    	selector := selector replace: ',' with: '_comma'.
-    	selector := selector replace: '[@]' with: '_at'.
-	^selector
-!
-
-asJavascript
-	<
-		if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
-			return "unescape(\"" + escape(self) + "\")";
-		else
-			return "\"" + self + "\"";
-	>
-!
-
-tokenize: aString
-	<return self.split(aString)>
-!
-
-asString
-    	^self
-!
-
-asNumber
-	<return Number(self)>
-!
-
-asLowercase
-	<return self.toLowerCase()>
-!
-
-asUppercase
-	<return self.toUpperCase()>
-!
-
-reversed
-	<return self.split("").reverse().join("")>
-!
-
-asJavaScriptSelector
-	^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.
-! !
-
-!String methodsFor: 'copying'!
-
-, aString
-	<return self + aString>
-!
-
-copyFrom: anIndex to: anotherIndex
-	<return self.substring(anIndex - 1, anotherIndex)>
-!
-
-shallowCopy
-    	^self class fromString: self
-!
-
-deepCopy
-    	^self shallowCopy
-! !
-
-!String methodsFor: 'error handling'!
-
-errorReadOnly
-    	self error: 'Object is read-only'
-! !
-
-!String methodsFor: 'printing'!
-
-printString
-    	^'''', self, ''''
-!
-
-printNl
-	<console.log(self)>
-! !
-
-!String methodsFor: 'regular expressions'!
-
-replace: aString with: anotherString
-    	^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString
-!
-
-replaceRegexp: aRegexp with: aString
-	<return self.replace(aRegexp, aString)>
-!
-
-match: aRegexp
-	<return self.search(aRegexp) !!= -1>
-!
-
-trimLeft: separators
-
-    	^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''
-!
-
-trimRight: separators
-
-    	^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''
-!
-
-trimLeft
-	^self trimLeft: '\s'
-!
-
-trimRight
-	^self trimRight: '\s'
-!
-
-trimBoth
-	^self trimBoth: '\s'
-!
-
-trimBoth: separators
-
-    	^(self trimLeft: separators) trimRight: separators
-! !
-
-!String methodsFor: 'split join'!
-
-join: aCollection 
-	^ String
-		streamContents: [:stream | aCollection
-				do: [:each | stream nextPutAll: each asString] 
-				separatedBy: [stream nextPutAll: self]]
-!
-
-lineIndicesDo: aBlock
-	"execute aBlock with 3 arguments for each line:
-	- start index of line
-	- end index of line without line delimiter
-	- end index of line including line delimiter(s) CR, LF or CRLF"
-	
-	| cr lf start sz nextLF nextCR |
-	start := 1.
-	sz := self size.
-	cr := String cr.
-	nextCR := self indexOf: cr startingAt: 1.
-	lf := String lf.
-	nextLF := self indexOf: lf startingAt: 1.
-	[ start <= sz ] whileTrue: [
-		(nextLF = 0 and: [ nextCR = 0 ])
-			ifTrue: [ "No more CR, nor LF, the string is over"
-					aBlock value: start value: sz value: sz.
-					^self ].
-		(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])
-			ifTrue: [ "Found a LF"
-					aBlock value: start value: nextLF - 1 value: nextLF.
-					start := 1 + nextLF.
-					nextLF := self indexOf: lf startingAt: start ]
-			ifFalse: [ 1 + nextCR = nextLF
-				ifTrue: [ "Found a CR-LF pair"
-					aBlock value: start value: nextCR - 1 value: nextLF.
-					start := 1 + nextLF.
-					nextCR := self indexOf: cr startingAt: start.
-					nextLF := self indexOf: lf startingAt: start ]
-				ifFalse: [ "Found a CR"
-					aBlock value: start value: nextCR - 1 value: nextCR.
-					start := 1 + nextCR.
-					nextCR := self indexOf: cr startingAt: start ]]]
-!
-
-linesDo: aBlock
-	"Execute aBlock with each line in this string. The terminating line
-	delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock"
-
-	self lineIndicesDo: [:start :endWithoutDelimiters :end |
-		aBlock value: (self copyFrom: start to: endWithoutDelimiters)]
-!
-
-lines
-	"Answer an array of lines composing this receiver without the line ending delimiters."
-
-	| lines |
-	lines := Array new.
-	self linesDo: [:aLine | lines add: aLine].
-	^lines
-!
-
-lineNumber: anIndex
-	"Answer a string containing the characters in the given line number."
-
-	| lineCount |
-	lineCount := 0.
-	self lineIndicesDo: [:start :endWithoutDelimiters :end |
-		(lineCount := lineCount + 1) = anIndex ifTrue: [^self copyFrom: start to: endWithoutDelimiters]].
-	^nil
-! !
-
-!String methodsFor: 'testing'!
-
-isString
-    	^true
-!
-
-includesSubString: subString
-	< return self.indexOf(subString) !!= -1 >
-! !
-
-!String class methodsFor: 'accessing'!
-
-streamClass
-	    ^StringStream
-!
-
-cr
-	<return '\r'>
-!
-
-lf
-	<return '\n'>
-!
-
-space
-	<return ' '>
-!
-
-tab
-	<return '\t'>
-!
-
-crlf
-	<return '\r\n'>
-! !
-
-!String class methodsFor: 'instance creation'!
-
-fromString: aString
-	    <return new self.fn(aString)>
-!
-
-streamContents: blockWithArg
-	|stream|
-	stream := (self streamClass on: String new).
-	blockWithArg value: stream.
-	^ stream contents
-!
-
-value: aUTFCharCode
-
-	<return String.fromCharCode(aUTFCharCode);>
-! !
-
-SequenceableCollection subclass: #Array
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Array methodsFor: 'accessing'!
-
-size
-	<return self.length>
-!
-
-at: anIndex put: anObject
-	<return self[anIndex - 1] = anObject>
-!
-
-at: anIndex ifAbsent: aBlock
-	<
-	    var value = self[anIndex - 1];
-	    if(value === undefined) {
-		return aBlock();
-	    } else {
-		return value;
-	    }
-	>
-! !
-
-!Array methodsFor: 'adding/removing'!
-
-add: anObject
-	<self.push(anObject); return anObject;>
-!
-
-remove: anObject
-	<
-		for(var i=0;i<self.length;i++) {
-			if(self[i] == anObject) {
-				self.splice(i,1);
-				break;
-			}
-		}
-	>
-!
-
-removeFrom: aNumber to: anotherNumber
-	<self.splice(aNumber - 1,anotherNumber - 1)>
-! !
-
-!Array methodsFor: 'comparing'!
-
-= aCollection
-	(self class = aCollection class and: [
-        	self size = aCollection size]) ifFalse: [^false].
-	self withIndexDo: [:each :i |
-                 (aCollection at: i) = each ifFalse: [^false]].
-	^true
-! !
-
-!Array methodsFor: 'converting'!
-
-asJavascript
-	^'[', ((self collect: [:each | each asJavascript]) join: ', '),  ']'
-!
-
-reversed
-	<return self._copy().reverse()>
-! !
-
-!Array methodsFor: 'copying'!
-
-shallowCopy
-	| newCollection |
-	newCollection := self class new.
-	self do: [:each | newCollection add: each].
-	^newCollection
-!
-
-deepCopy
-	| newCollection |
-	newCollection := self class new.
-	self do: [:each | newCollection add: each deepCopy].
-	^newCollection
-!
-
-copyFrom: anIndex to: anotherIndex
-	| array |
-	array := self class new.
-	anIndex to: anotherIndex do: [:each |
-	    array add: (self at: each)].
-	^array
-! !
-
-!Array methodsFor: 'enumerating'!
-
-join: aString
-	<return self.join(aString)>
-!
-
-sort
-    ^self basicPerform: 'sort'
-!
-
-sort: aBlock
-	<
-		return self.sort(function(a, b) {
-			if(aBlock(a,b)) {return -1} else {return 1}
-		})
-	>
-!
-
-sorted
-	^self copy sort
-!
-
-sorted: aBlock
-	^self copy sort: aBlock
-!
-
-printString
-	| str |
-	str := '' writeStream.
-	str nextPutAll: super printString, ' ('.
-	self 
-		do: [:each | str nextPutAll: each printString]
-		separatedBy: [str nextPutAll: ' '].
-	str nextPutAll: ')'.
-	^str contents
-! !
-
-Object subclass: #RegularExpression
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!RegularExpression methodsFor: 'evaluating'!
-
-compile: aString
-	<return self.compile(aString)>
-!
-
-exec: aString
-	<return self.exec(aString) || nil>
-!
-
-test: aString
-	<return self.test(aString)>
-! !
-
-!RegularExpression class methodsFor: 'instance creation'!
-
-fromString: aString flag: anotherString
-	<return new RegExp(aString, anotherString)>
-!
-
-fromString: aString
-	    ^self fromString: aString flag: ''
-! !
-
-Object subclass: #Error
-	instanceVariableNames: 'messageText'
-	category: 'Kernel'!
-
-!Error methodsFor: 'accessing'!
-
-messageText
-	^messageText
-!
-
-messageText: aString
-	messageText := aString
-!
-
-context
-	<return self.context>
-!
-
-jsStack
-	<return self.stack>
-! !
-
-!Error methodsFor: 'signaling'!
-
-signal
-	<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>
-! !
-
-!Error methodsFor: 'testing'!
-
-isSmalltalkError
-	<return self.smalltalkError === true>
-! !
-
-!Error class methodsFor: 'instance creation'!
-
-signal: aString
-	    ^self new
-		messageText: aString;
-		signal
-! !
-
-Object subclass: #MethodContext
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!MethodContext methodsFor: 'accessing'!
-
-receiver
-	<return self.receiver>
-!
-
-selector
-	<return smalltalk.convertSelector(self.selector)>
-!
-
-home
-	<return self.homeContext>
-!
-
-temps
-	<return self.temps>
-!
-
-printString
-	^super printString, '(', self asString, ')'
-!
-
-asString
-	^self receiver class printString, ' >> ', self selector
-! !
-
-Object subclass: #Association
-	instanceVariableNames: 'key value'
-	category: 'Kernel'!
-
-!Association methodsFor: 'accessing'!
-
-key: aKey
-	key := aKey
-!
-
-key
-	^key
-!
-
-value: aValue
-	value := aValue
-!
-
-value
-	^value
-! !
-
-!Association methodsFor: 'comparing'!
-
-= anAssociation
-	^self class = anAssociation class and: [
-	    self key = anAssociation key and: [
-		self value = anAssociation value]]
-!
-
-storeOn: aStream
-	"Store in the format (key->value)"
-
-	"aStream nextPutAll: '('."
-	key storeOn: aStream.
-	aStream nextPutAll: '->'.
-	value storeOn: aStream.
-	"aStream nextPutAll: ')'"
-! !
-
-!Association class methodsFor: 'instance creation'!
-
-key: aKey value: aValue
-	    ^self new
-		key: aKey;
-		value: aValue;
-		yourself
-! !
-
-Collection subclass: #Dictionary
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Dictionary methodsFor: 'accessing'!
-
-size
-	^self keys size
-!
-
-associations
-	| associations |
-	associations := #().
-	self keys do: [:each |
-	    associations add: (Association key: each value: (self at: each))].
-	^associations
-!
-
-keys
-	<
-		var keys = [];
-		for(var i in self) {
-			if(self.hasOwnProperty(i)) {
-				keys.push(i);
-			}
-		};
-		return keys;
-	>
-!
-
-values
-    	^self keys collect: [:each | self at: each]
-!
-
-at: aKey put: aValue
-	^self basicAt: aKey put: aValue
-!
-
-at: aKey ifAbsent: aBlock
-	^(self includesKey: aKey)
-		ifTrue: [self basicAt: aKey]
-		ifFalse: aBlock
-!
-
-at: aKey ifAbsentPut: aBlock
-    	^self at: aKey ifAbsent: [
-    	    self at: aKey put: aBlock value]
-!
-
-at: aKey ifPresent: aBlock
-	^(self basicAt: aKey) ifNotNil: [aBlock value: (self at: aKey)]
-!
-
-at: aKey ifPresent: aBlock ifAbsent: anotherBlock
-	^(self basicAt: aKey)
-	    ifNil: anotherBlock
-	    ifNotNil: [aBlock value: (self at: aKey)]
-!
-
-at: aKey
-	^self at: aKey ifAbsent: [self errorNotFound]
-! !
-
-!Dictionary methodsFor: 'adding/removing'!
-
-add: anAssociation
-    	self at: anAssociation key put: anAssociation value
-!
-
-addAll: aDictionary
-    	super addAll: aDictionary associations.
-    	^aDictionary
-!
-
-removeKey: aKey
-    self remove: aKey
-!
-
-remove: aKey ifAbsent: aBlock
-    ^self removeKey: aKey ifAbsent: aBlock
-!
-
-removeKey: aKey ifAbsent: aBlock
-	^(self includesKey: aKey) 
-		ifFalse: [aBlock value]
-		ifTrue: [self basicDelete: aKey]
-! !
-
-!Dictionary methodsFor: 'comparing'!
-
-= aDictionary
-	self class = aDictionary class ifFalse: [^false].
-	self size = aDictionary size ifFalse: [^false].
-	^self associations = aDictionary associations
-! !
-
-!Dictionary methodsFor: 'copying'!
-
-shallowCopy
-	| copy |
-	copy := self class new.
-	self associationsDo: [:each |
-	    copy at: each key  put: each value].
-	^copy
-!
-
-, aCollection
-	self shouldNotImplement
-!
-
-copyFrom: anIndex to: anotherIndex
-	self shouldNotImplement
-!
-
-deepCopy
-	| copy |
-	copy := self class new.
-	self associationsDo: [:each |
-	    copy at: each key  put: each value deepCopy].
-	^copy
-! !
-
-!Dictionary methodsFor: 'enumerating'!
-
-associationsDo: aBlock
-    	self associations do: aBlock
-!
-
-keysAndValuesDo: aBlock
-    	self associationsDo: [:each |
-    	    aBlock value: each key value: each value]
-!
-
-do: aBlock
-    	self values do: aBlock
-!
-
-select: aBlock
-    	| newDict |
-    	newDict := self class new.
-    	self keysAndValuesDo: [:key :value |
-    	    (aBlock value: value) ifTrue: [newDict at: key put: value]].
-    	^newDict
-!
-
-collect: aBlock
-    	| newDict |
-    	newDict := self class new.
-    	self keysAndValuesDo: [:key :value |
-    	    newDict at: key put: (aBlock value: value)].
-    	^newDict
-!
-
-detect: aBlock ifNone: anotherBlock
-	^self values detect: aBlock ifNone: anotherBlock
-!
-
-includes: anObject
-	^self values includes: anObject
-! !
-
-!Dictionary methodsFor: 'printing'!
-
-printString
-	^String streamContents: [:aStream|  
-		aStream 
-			nextPutAll: super printString;
-			nextPutAll: '('.
-				self associations 
-					do: [:anAssociation|  
-						aStream 
-							nextPutAll: anAssociation key printString;
-								nextPutAll: ' -> ';
-								nextPutAll: anAssociation value printString]
-							separatedBy: [aStream nextPutAll: ' , '].
-						aStream nextPutAll: ')']
-!
-
-storeOn: aStream
-	aStream nextPutAll: '#{'.
-	self associations
-		do: [:each | each storeOn: aStream]
-		separatedBy: [ aStream nextPutAll: '. '].
-	aStream nextPutAll: '}'
-! !
-
-!Dictionary methodsFor: 'testing'!
-
-includesKey: aKey
-	<return self.hasOwnProperty(aKey)>
-! !
-
-!Dictionary class methodsFor: 'instance creation'!
-
-fromPairs: aCollection
-	| dict |
-	dict := self new.
-	aCollection do: [:each | dict add: each].
-	^dict
-! !
-
-Object subclass: #ClassBuilder
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!ClassBuilder methodsFor: 'class creation'!
-
-superclass: aClass subclass: aString
-	^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil
-!
-
-class: aClass instanceVariableNames: aString
-	aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].
-	aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).
-	self setupClass: aClass
-!
-
-superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3
-	| newClass |
-	newClass := self addSubclassOf: aClass
-				named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
-				package: (aString3 ifNil: ['unclassified']).
-	self setupClass: newClass.
-	^newClass
-! !
-
-!ClassBuilder methodsFor: 'private'!
-
-instanceVariableNamesFor: aString
-	^(aString tokenize: ' ') reject: [:each | each isEmpty]
-!
-
-addSubclassOf: aClass named: aString instanceVariableNames: aCollection
-	<smalltalk.addClass(aString, aClass, aCollection);
-	    return smalltalk[aString]>
-!
-
-setupClass: aClass
-	<smalltalk.init(aClass);>
-!
-
-addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
-	<smalltalk.addClass(aString, aClass, aCollection, packageName);
-	    return smalltalk[aString]>
-!
-
-copyClass: aClass named: aString
-	| newClass |
-
-	newClass := self 
-		addSubclassOf: aClass superclass
-		named: aString 
-		instanceVariableNames: aClass instanceVariableNames 
-		package: aClass package name.
-
-	self setupClass: newClass.
-
-	aClass methodDictionary values do: [:each |
-		newClass addCompiledMethod: (Compiler new load: each source forClass: newClass).
-		(newClass methodDictionary at: each selector) category: each category].
-
-	aClass class methodDictionary values do: [:each |
-		newClass class addCompiledMethod: (Compiler new load: each source forClass: newClass class).
-		(newClass class methodDictionary at: each selector) category: each category].
-
-	self setupClass: newClass.
-	^newClass
-! !
-
-Object subclass: #ClassCategoryReader
-	instanceVariableNames: 'class category chunkParser'
-	category: 'Kernel'!
-
-!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]
-! !
-
-!ClassCategoryReader methodsFor: 'initialization'!
-
-initialize
-	super initialize.
-	chunkParser := ChunkParser new.
-! !
-
-!ClassCategoryReader methodsFor: 'private'!
-
-compileMethod: aString
-	| method |
-	method := Compiler new load: aString forClass: class.
-	method category: category.
-	class addCompiledMethod: method
-! !
-
-Object subclass: #Stream
-	instanceVariableNames: 'collection position streamSize'
-	category: 'Kernel'!
-
-!Stream methodsFor: 'accessing'!
-
-collection
-	^collection
-!
-
-setCollection: aCollection
-	collection := aCollection
-!
-
-position
-	^position ifNil: [position := 0]
-!
-
-position: anInteger
-	position := anInteger
-!
-
-streamSize
-	^streamSize
-!
-
-setStreamSize: anInteger
-	streamSize := anInteger
-!
-
-contents
-	^self collection
-	    copyFrom: 1 
-	    to: self streamSize
-!
-
-size
-	^self streamSize
-! !
-
-!Stream methodsFor: 'actions'!
-
-reset
-	self position: 0
-!
-
-close
-!
-
-flush
-!
-
-resetContents
-	self reset.
-	self setStreamSize: 0
-! !
-
-!Stream methodsFor: 'enumerating'!
-
-do: aBlock
-	[self atEnd] whileFalse: [aBlock value: self next]
-! !
-
-!Stream methodsFor: 'positioning'!
-
-setToEnd
-	self position: self size
-!
-
-skip: anInteger
-	self position: ((self position + anInteger) min: self size max: 0)
-! !
-
-!Stream methodsFor: 'reading'!
-
-next
-	self position: self position + 1. 
-	^collection at: self position
-!
-
-next: anInteger
-	| tempCollection |
-	tempCollection := self collection class new.
-	anInteger timesRepeat: [
-	    self atEnd ifFalse: [
-		tempCollection add: self next]].
-	^tempCollection
-!
-
-peek
-	^self atEnd ifFalse: [
-	    self collection at: self position + 1]
-! !
-
-!Stream methodsFor: 'testing'!
-
-atEnd
-	^self position = self size
-!
-
-atStart
-	^self position = 0
-!
-
-isEmpty
-	^self size = 0
-! !
-
-!Stream methodsFor: 'writing'!
-
-nextPut: anObject
-	self position: self position + 1.
-	self collection at: self position put: anObject.
-	self setStreamSize: (self streamSize max: self position)
-!
-
-nextPutAll: aCollection
-	aCollection do: [:each |
-	    self nextPut: each]
-! !
-
-!Stream class methodsFor: 'instance creation'!
-
-on: aCollection
-	    ^self new 
-		setCollection: aCollection;
-		setStreamSize: aCollection size;
-		yourself
-! !
-
-Stream subclass: #StringStream
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!StringStream methodsFor: 'reading'!
-
-next: anInteger
-	| tempCollection |
-	tempCollection := self collection class new.
-	anInteger timesRepeat: [
-	    self atEnd ifFalse: [
-		tempCollection := tempCollection, self next]].
-	^tempCollection
-! !
-
-!StringStream methodsFor: 'writing'!
-
-nextPut: aString
-	self nextPutAll: aString
-!
-
-nextPutAll: aString
-	self setCollection: 
-	    (self collection copyFrom: 1 to: self position),
-	    aString,
-	    (self collection copyFrom: (self position + 1 + aString size) to: self collection size).
-	self position: self position + aString size.
-	self setStreamSize: (self streamSize max: self position)
-!
-
-cr
-	^self nextPutAll: String cr
-!
-
-crlf
-	^self nextPutAll: String crlf
-!
-
-lf
-	^self nextPutAll: String lf
-!
-
-space
-	self nextPut: ' '
-! !
-
-Object subclass: #ClassCommentReader
-	instanceVariableNames: 'class chunkParser'
-	category: 'Kernel'!
-
-!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.
-	chunkParser := ChunkParser new.
-! !
-
-!ClassCommentReader methodsFor: 'private'!
-
-setComment: aString
-    class comment: aString
-! !
-
-Object subclass: #Random
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!Random methodsFor: 'accessing'!
-
-next
-	<return Math.random()>
-!
-
-next: anInteger
-    ^(1 to: anInteger) collect: [:each | self next]
-! !
-
-Object subclass: #Point
-	instanceVariableNames: 'x y'
-	category: 'Kernel'!
-
-!Point methodsFor: 'accessing'!
-
-x
-	^x
-!
-
-y
-	^y
-!
-
-y: aNumber
-	y := aNumber
-!
-
-x: aNumber
-	x := aNumber
-! !
-
-!Point methodsFor: 'arithmetic'!
-
-* aPoint
-	^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y
-!
-
-+ aPoint
-	^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y
-!
-
-- aPoint
-	^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y
-!
-
-/ aPoint
-	^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y
-!
-
-= aPoint
-	^aPoint class = self class and: [
-		(aPoint x = self x) & (aPoint y = self y)]
-! !
-
-!Point methodsFor: 'converting'!
-
-asPoint
-	^self
-! !
-
-!Point class methodsFor: 'instance creation'!
-
-x: aNumber y: anotherNumber
-	^self new
-		x: aNumber;
-		y: anotherNumber;
-		yourself
-! !
-
-Object subclass: #Message
-	instanceVariableNames: 'selector arguments'
-	category: 'Kernel'!
-
-!Message methodsFor: 'accessing'!
-
-selector
-	^selector
-!
-
-selector: aString
-	selector := aString
-!
-
-arguments: anArray
-	arguments := anArray
-!
-
-arguments
-	^arguments
-! !
-
-!Message methodsFor: 'printing'!
-
-printString
-	^ String streamContents: [:aStream|  
-                                  				aStream 
-                                  					nextPutAll: super printString;
-                                  					nextPutAll: '(';
-                                  					nextPutAll: selector;
-                                  					nextPutAll: ')' 				]
-! !
-
-!Message class methodsFor: 'instance creation'!
-
-selector: aString arguments: anArray
-	^self new
-		selector: aString;
-		arguments: anArray;
-		yourself
-! !
-
-Error subclass: #MessageNotUnderstood
-	instanceVariableNames: 'message receiver'
-	category: 'Kernel'!
-
-!MessageNotUnderstood methodsFor: 'accessing'!
-
-message
-	^message
-!
-
-message: aMessage
-	message := aMessage
-!
-
-receiver
-	^receiver
-!
-
-receiver: anObject
-	receiver := anObject
-!
-
-messageText
-	^self receiver asString, ' does not understand #', self message selector
-! !
-
-Object subclass: #ErrorHandler
-	instanceVariableNames: ''
-	category: 'Kernel'!
-
-!ErrorHandler methodsFor: 'error handling'!
-
-handleError: anError
-	anError context ifNotNil: [self logErrorContext: anError context].
-	self logError: anError
-! !
-
-!ErrorHandler methodsFor: 'private'!
-
-logContext: aContext
-	aContext home ifNotNil: [
-		self logContext: aContext home].
-	self log: aContext receiver asString, '>>', aContext selector
-!
-
-logErrorContext: aContext
-	aContext ifNotNil: [
-		aContext home ifNotNil: [
-			self logContext: aContext home]]
-!
-
-logError: anError
-	self log: anError messageText
-!
-
-log: aString
-	console log: aString
-! !
-
-ErrorHandler class instanceVariableNames: 'current'!
-
-!ErrorHandler class methodsFor: 'accessing'!
-
-current
-	^current ifNil: [current := self new]
-!
-
-setCurrent: anHandler
-	current := anHandler
-! !
-
-!ErrorHandler class methodsFor: 'initialization'!
-
-initialize
-	self register
-!
-
-register
-	ErrorHandler setCurrent: self new
-! !
-
-Object subclass: #JSObjectProxy
-	instanceVariableNames: 'jsObject'
-	category: 'Kernel'!
-
-!JSObjectProxy methodsFor: 'accessing'!
-
-jsObject: aJSObject
-	jsObject := aJSObject
-!
-
-jsObject
-	^jsObject
-!
-
-at: aString
-	<return self['@jsObject'][aString]>
-!
-
-at: aString put: anObject
-	<self['@jsObject'][aString] = anObject>
-! !
-
-!JSObjectProxy methodsFor: 'proxy'!
-
-printString
-	^self jsObject toString
-!
-
-inspectOn: anInspector
-	| variables |
-	variables := Dictionary new.
-	variables at: '#self' put: self jsObject.
-	anInspector setLabel: self printString.
-	<for(var i in self['@jsObject']) {
-		variables._at_put_(i, self['@jsObject'][i]);
-	}>.
-	anInspector setVariables: variables
-!
-
-doesNotUnderstand: aMessage
-	| obj selector jsSelector arguments |
-	obj := self jsObject.
-	selector := aMessage selector.
-	jsSelector := selector asJavaScriptSelector.
-	arguments := aMessage arguments.
-	<if(obj[jsSelector] !!= undefined) {return smalltalk.send(obj, jsSelector, arguments)}>.
-	super doesNotUnderstand: aMessage
-! !
-
-!JSObjectProxy class methodsFor: 'instance creation'!
-
-on: aJSObject
-	^self new
-		jsObject: aJSObject;
-		yourself
-! !
-
-Collection subclass: #Set
-	instanceVariableNames: 'elements'
-	category: 'Kernel'!
-
-!Set methodsFor: 'accessing'!
-
-size
-	^elements size
-! !
-
-!Set methodsFor: 'adding/removing'!
-
-add: anObject
-	<
-		var found;
-		for(var i in self['@elements']) {
-			if(anObject == self['@elements'][i]) {
-				found = true;
-				break;
-			}
-		}
-		if(!!found) {self['@elements'].push(anObject)}
-	>
-!
-
-remove: anObject
-	elements remove: anObject
-! !
-
-!Set methodsFor: 'comparing'!
-
-= aCollection
-	^self class = aCollection class and: [
-        	elements = aCollection asArray]
-! !
-
-!Set methodsFor: 'converting'!
-
-asArray
-	^elements copy
-! !
-
-!Set methodsFor: 'enumerating'!
-
-detect: aBlock ifNone: anotherBlock
-	^elements detect: aBlock ifNone: anotherBlock
-!
-
-do: aBlock
-	elements do: aBlock
-! !
-
-!Set methodsFor: 'initialization'!
-
-initialize
-	super initialize.
-	elements := #()
-! !
-
-!Set methodsFor: 'testing'!
-
-includes: anObject
-	^elements includes: anObject
-! !
-
-Object subclass: #Transcript
-	instanceVariableNames: 'textarea'
-	category: 'Kernel'!
-
-Transcript class instanceVariableNames: 'current'!
-
-!Transcript class methodsFor: 'instance creation'!
-
-open
-    self current open
-!
-
-new
-    self shouldNotImplement
-!
-
-current
-    ^current
-!
-
-register: aTranscript
-	current := aTranscript
-! !
-
-!Transcript class methodsFor: 'printing'!
-
-show: anObject
-    self current show: anObject
-!
-
-cr
-    self current show: String cr
-!
-
-clear
-    self current clear
-! !
-
-Object subclass: #ConsoleTranscript
-	instanceVariableNames: 'textarea'
-	category: 'Kernel'!
-
-!ConsoleTranscript methodsFor: 'actions'!
-
-open
-! !
-
-!ConsoleTranscript methodsFor: 'printing'!
-
-clear
-	"no op"
-!
-
-cr
-	"no op"
-!
-
-show: anObject
-	| string |
-	string := anObject asString.
-	<console.log(String(string))>
-! !
-
-!ConsoleTranscript class methodsFor: 'initialization'!
-
-initialize
-	Transcript register: self new
-! !
-

+ 21 - 5
st/Makefile

@@ -26,14 +26,30 @@ all: $(OBJECTS)
 boot.js init.js parser.js:
 	cp ../js/$@ .
 
-# Then we compile Kernel.st depending on having boot.js, init.js and parser.js
-# $< means the first dependency - in other words Kernel.st
-Kernel.js: Kernel.st boot.js init.js parser.js
+# Then we compile Kernel-*.st files depending on having boot.js, init.js and parser.js
+# $< means the first dependency - in other words Kernel-*.st
+Kernel-Objects.js: Kernel-Objects.st boot.js init.js parser.js
+	$(AMBERC) $(FLAGS) $<
+
+Kernel-Classes.js: Kernel-Classes.st boot.js init.js parser.js
+	$(AMBERC) $(FLAGS) $<
+
+Kernel-Methods.js: Kernel-Methods.st boot.js init.js parser.js
+	$(AMBERC) $(FLAGS) $<
+
+Kernel-Collections.js: Kernel-Collections.st boot.js init.js parser.js
+	$(AMBERC) $(FLAGS) $<
+
+Kernel-Exceptions.js: Kernel-Exceptions.st boot.js init.js parser.js
+	$(AMBERC) $(FLAGS) $<
+
+Kernel-Transcript.js: Kernel-Transcript.st boot.js init.js parser.js
 	$(AMBERC) $(FLAGS) $<
 
 # ...and Compiler, but using the new Kernel from above.
-# We only need to depend on Kernel.js since it in turn depends on boot.js etc
-Compiler.js: Compiler.st Kernel.js
+# We only need to depend on Kernel js files since it in turn depends on boot.js etc
+Compiler.js: Compiler.st Kernel-Objects.js Kernel-Classes.js Kernel-Methods.js Kernel-Collections.js \
+	Kernel-Exceptions.js Kernel-Transcript.js
 	$(AMBERC) $(FLAGS) $<
 
 # ...now that we have a new Kernel and Compiler we use them

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません