1
0
Преглед на файлове

Added implementations of & and | and also asciiValue and value: in String so that it can double as the Character class.

Göran Krampe преди 13 години
родител
ревизия
cfc82b5815
променени са 6 файла, в които са добавени 251 реда и са изтрити 165 реда
  1. 17 4
      js/Kernel-Tests.deploy.js
  2. 21 0
      js/Kernel-Tests.js
  3. 59 36
      js/Kernel.deploy.js
  4. 107 80
      js/Kernel.js
  5. 16 0
      st/Kernel-Tests.st
  6. 31 45
      st/Kernel.st

+ 17 - 4
js/Kernel-Tests.deploy.js

@@ -7,7 +7,6 @@ fn: function (){
 var self=this;
 smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
 return self;}
-]
 }),
 smalltalk.StringTest);
 
@@ -19,7 +18,6 @@ fn: function (){
 var self=this;
 smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(smalltalk.String, "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
 return self;}
-]
 }),
 smalltalk.StringTest);
 
@@ -32,7 +30,6 @@ var self=this;
 smalltalk.send(self, "_assert_", [smalltalk.send("jtalk", "_includesSubString_", ["alk"])]);
 smalltalk.send(self, "_deny_", [smalltalk.send("jtalk", "_includesSubString_", ["zork"])]);
 return self;}
-]
 }),
 smalltalk.StringTest);
 
@@ -47,9 +44,25 @@ fn: function (){
 var self=this;
 smalltalk.send(self, "_assert_equals_", [unescape("a%20Dictionary%28%27firstname%27%20-%3E%20%27James%27%20%2C%20%27lastname%27%20-%3E%20%27Bond%27%29"), (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send(smalltalk.Dictionary, "_new", []))]);
 return self;}
-]
 }),
 smalltalk.DictionaryTest);
 
 
 
+smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+'_testLogic',
+smalltalk.method({
+selector: 'testLogic',
+fn: function (){
+var self=this;
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
+return self;}
+}),
+smalltalk.BooleanTest);
+
+
+

+ 21 - 0
js/Kernel-Tests.js

@@ -65,3 +65,24 @@ smalltalk.DictionaryTest);
 
 
 
+smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+'_testLogic',
+smalltalk.method({
+selector: 'testLogic',
+category: 'not yet classified',
+fn: function (){
+var self=this;
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
+(function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
+return self;},
+source: unescape('testLogic%0A%0A%09%22Trivial%20logic%20table%22%0A%09self%20assert%3A%20%28true%20%26%20true%29%3B%20deny%3A%20%28true%20%26%20false%29%3B%20deny%3A%20%28false%20%26%20true%29%3B%20deny%3A%20%28false%20%26%20false%29.%0A%09self%20assert%3A%20%28true%20%7C%20true%29%3B%20assert%3A%20%28true%20%7C%20false%29%3B%20assert%3A%20%28false%20%7C%20true%29%3B%20deny%3A%20%28false%20%7C%20false%29.%0A%20%20%20%20%20%20%20%20%22Checking%20that%20expressions%20work%20fine%20too%22%0A%09self%20assert%3A%20%28true%20%26%20%281%20%3E%200%29%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20false%29%3B%20deny%3A%20%28%281%20%3E%200%29%20%26%20%281%20%3E%202%29%29.%0A%20%20%20%20%20%20%20%20self%20assert%3A%20%28false%20%7C%20%281%20%3E%200%29%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20false%29%3B%20assert%3A%20%28%281%20%3E%200%29%20%7C%20%281%20%3E%202%29%29%20'),
+messageSends: ["assert:", unescape("%26"), "deny:", unescape("%7C"), unescape("%3E")],
+referencedClasses: []
+}),
+smalltalk.BooleanTest);
+
+
+

+ 59 - 36
js/Kernel.deploy.js

@@ -858,7 +858,7 @@ smalltalk.method({
 selector: 'commentStamp:prior:',
 fn: function (aStamp, prior){
 var self=this;
-
+return smalltalk.send(self, "_commentStamp", []);
 return self;}
 }),
 smalltalk.Behavior);
@@ -1611,39 +1611,6 @@ 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.addClass('Boolean', smalltalk.Object, [], 'Kernel');
@@ -1785,6 +1752,40 @@ return self;}
 }),
 smalltalk.Boolean);
 
+smalltalk.addMethod(
+'_&',
+smalltalk.method({
+selector: '&',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return aBoolean;
+	    } else {
+		return false;
+	    }
+	;
+return self;}
+}),
+smalltalk.Boolean);
+
+smalltalk.addMethod(
+'_|',
+smalltalk.method({
+selector: '|',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return true;
+	    } else {
+		return aBoolean;
+	    }
+	;
+return self;}
+}),
+smalltalk.Boolean);
+
 
 
 smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel');
@@ -3404,6 +3405,17 @@ return self;}
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+'_asciiValue',
+smalltalk.method({
+selector: 'asciiValue',
+fn: function (){
+var self=this;
+return self.charCodeAt(0);;
+return self;}
+}),
+smalltalk.String);
+
 
 smalltalk.addMethod(
 '_streamClass',
@@ -3496,6 +3508,17 @@ return self;}
 }),
 smalltalk.String.klass);
 
+smalltalk.addMethod(
+'_value_',
+smalltalk.method({
+selector: 'value:',
+fn: function (aUTFCharCode){
+var self=this;
+return String.fromCharCode(aUTFCharCode);;
+return self;}
+}),
+smalltalk.String.klass);
+
 
 smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel');
 smalltalk.addMethod(
@@ -3632,7 +3655,7 @@ fn: function (aBlock){
 var self=this;
 
 		return self.sort(function(a, b) {
-			if(aBlock(a,b)) {return -1} else {return 1}
+			if(aBlock(a,b)) {return 1} else {return -1}
 		})
 	;
 return self;}
@@ -3674,7 +3697,7 @@ smalltalk.method({
 selector: 'sorted:',
 fn: function (aBlock){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
+return smalltalk.send(smalltalk.send(self, "_copy", []), "_sorted_", [aBlock]);
 return self;}
 }),
 smalltalk.Array);

+ 107 - 80
js/Kernel.js

@@ -429,7 +429,7 @@ fn: function (aBlock){
 var self=this;
 return self;
 return self;},
-source: unescape('ifNil%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5Eself'),
+source: unescape('ifNil%3A%20aBlock%0A%09%5Eself'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -444,7 +444,7 @@ fn: function (aBlock, anotherBlock){
 var self=this;
 return smalltalk.send(anotherBlock, "_value", []);
 return self;},
-source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5EanotherBlock%20value'),
+source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value'),
 messageSends: ["value"],
 referencedClasses: []
 }),
@@ -459,7 +459,7 @@ fn: function (aBlock){
 var self=this;
 return smalltalk.send(aBlock, "_value", []);
 return self;},
-source: unescape('ifNotNil%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5EaBlock%20value'),
+source: unescape('ifNotNil%3A%20aBlock%0A%09%5EaBlock%20value'),
 messageSends: ["value"],
 referencedClasses: []
 }),
@@ -474,7 +474,7 @@ fn: function (aBlock, anotherBlock){
 var self=this;
 return smalltalk.send(aBlock, "_value", []);
 return self;},
-source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5EaBlock%20value'),
+source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EaBlock%20value'),
 messageSends: ["value"],
 referencedClasses: []
 }),
@@ -1151,10 +1151,10 @@ selector: 'commentStamp:prior:',
 category: 'accessing',
 fn: function (aStamp, prior){
 var self=this;
-
+return smalltalk.send(self, "_commentStamp", []);
 return self;},
-source: unescape('commentStamp%3A%20aStamp%20prior%3A%20prior%0A%20%20%20%20%20%20%20%20%20%22Ignored%20right%20now.%22'),
-messageSends: [],
+source: unescape('commentStamp%3A%20aStamp%20prior%3A%20prior%0A%20%20%20%20%20%20%20%20%20%22Stamp%20and%20prior%20ignored%20right%20now.%22%0A%09%5Eself%20commentStamp'),
+messageSends: ["commentStamp"],
 referencedClasses: []
 }),
 smalltalk.Behavior);
@@ -1529,7 +1529,7 @@ fn: function (aNumber){
 var self=this;
 return Number(self) == aNumber;
 return self;},
-source: unescape('%3D%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20Number%28self%29%20%3D%3D%20aNumber%3E'),
+source: unescape('%3D%20aNumber%0A%09%3Creturn%20Number%28self%29%20%3D%3D%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1544,7 +1544,7 @@ fn: function (aNumber){
 var self=this;
 return self > aNumber;
 return self;},
-source: unescape('%3E%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20%3E%3E%20aNumber%3E'),
+source: unescape('%3E%20aNumber%0A%09%3Creturn%20self%20%3E%3E%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1559,7 +1559,7 @@ fn: function (aNumber){
 var self=this;
 return self < aNumber;
 return self;},
-source: unescape('%3C%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20%3C%20aNumber%3E'),
+source: unescape('%3C%20aNumber%0A%09%3Creturn%20self%20%3C%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1574,7 +1574,7 @@ fn: function (aNumber){
 var self=this;
 return self >= aNumber;
 return self;},
-source: unescape('%3E%3D%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20%3E%3E%3D%20aNumber%3E'),
+source: unescape('%3E%3D%20aNumber%0A%09%3Creturn%20self%20%3E%3E%3D%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1589,7 +1589,7 @@ fn: function (aNumber){
 var self=this;
 return self <= aNumber;
 return self;},
-source: unescape('%3C%3D%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20%3C%3D%20aNumber%3E'),
+source: unescape('%3C%3D%20aNumber%0A%09%3Creturn%20self%20%3C%3D%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1604,7 +1604,7 @@ fn: function (aNumber){
 var self=this;
 return self + aNumber;
 return self;},
-source: unescape('+%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20+%20aNumber%3E'),
+source: unescape('+%20aNumber%0A%09%3Creturn%20self%20+%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1619,7 +1619,7 @@ fn: function (aNumber){
 var self=this;
 return self - aNumber;
 return self;},
-source: unescape('-%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20-%20aNumber%3E'),
+source: unescape('-%20aNumber%0A%09%3Creturn%20self%20-%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1634,7 +1634,7 @@ fn: function (aNumber){
 var self=this;
 return self * aNumber;
 return self;},
-source: unescape('*%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20*%20aNumber%3E'),
+source: unescape('*%20aNumber%0A%09%3Creturn%20self%20*%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -1649,7 +1649,7 @@ fn: function (aNumber){
 var self=this;
 return self / aNumber;
 return self;},
-source: unescape('/%20aNumber%0A%09%22Inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%20/%20aNumber%3E'),
+source: unescape('/%20aNumber%0A%09%3Creturn%20self%20/%20aNumber%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2011,7 +2011,7 @@ fn: function (aBlock){
 var self=this;
 while(self()) {aBlock()};
 return self;},
-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'),
+source: unescape('whileTrue%3A%20aBlock%0A%09%3Cwhile%28self%28%29%29%20%7BaBlock%28%29%7D%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2026,7 +2026,7 @@ fn: function (aBlock){
 var self=this;
 while(!self()) {aBlock()};
 return self;},
-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'),
+source: unescape('whileFalse%3A%20aBlock%0A%09%3Cwhile%28%21self%28%29%29%20%7BaBlock%28%29%7D%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2041,7 +2041,7 @@ fn: function (){
 var self=this;
 return self();;
 return self;},
-source: unescape('value%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28%29%3B%3E'),
+source: unescape('value%0A%09%3Creturn%20self%28%29%3B%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2056,7 +2056,7 @@ fn: function (anArg){
 var self=this;
 return self(anArg);;
 return self;},
-source: unescape('value%3A%20anArg%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3Creturn%20self%28anArg%29%3B%3E'),
+source: unescape('value%3A%20anArg%0A%09%3Creturn%20self%28anArg%29%3B%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2071,7 +2071,7 @@ fn: function (firstArg, secondArg){
 var self=this;
 return self(firstArg, secondArg);;
 return self;},
-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'),
+source: unescape('value%3A%20firstArg%20value%3A%20secondArg%0A%09%3Creturn%20self%28firstArg%2C%20secondArg%29%3B%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2086,7 +2086,7 @@ fn: function (firstArg, secondArg, thirdArg){
 var self=this;
 return self(firstArg, secondArg, thirdArg);;
 return self;},
-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'),
+source: unescape('value%3A%20firstArg%20value%3A%20secondArg%20value%3A%20thirdArg%0A%09%3Creturn%20self%28firstArg%2C%20secondArg%2C%20thirdArg%29%3B%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2167,51 +2167,6 @@ referencedClasses: [smalltalk.String]
 }),
 smalltalk.BlockClosure);
 
-smalltalk.addMethod(
-'_whileFalse',
-smalltalk.method({
-selector: 'whileFalse',
-category: 'controlling',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_whileFalse_", [(function(){return nil;})]);
-return self;},
-source: unescape('whileFalse%0A%09%22inlined%20in%20the%20Compiler%22%0A%09self%20whileFalse%3A%20%5B%5D'),
-messageSends: ["whileFalse:"],
-referencedClasses: []
-}),
-smalltalk.BlockClosure);
-
-smalltalk.addMethod(
-'_whileTrue',
-smalltalk.method({
-selector: 'whileTrue',
-category: 'controlling',
-fn: function (){
-var self=this;
-smalltalk.send(self, "_whileTrue_", [(function(){return nil;})]);
-return self;},
-source: unescape('whileTrue%0A%09%22inlined%20in%20the%20Compiler%22%0A%09self%20whileTrue%3A%20%5B%5D'),
-messageSends: ["whileTrue:"],
-referencedClasses: []
-}),
-smalltalk.BlockClosure);
-
-smalltalk.addMethod(
-'_new',
-smalltalk.method({
-selector: 'new',
-category: 'evaluating',
-fn: function (){
-var self=this;
-return new self();
-return self;},
-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.addClass('Boolean', smalltalk.Object, [], 'Kernel');
@@ -2269,7 +2224,7 @@ fn: function (aBlock){
 var self=this;
 return smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, (function(){return nil;})]);
 return self;},
-source: unescape('ifTrue%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5Eself%20ifTrue%3A%20aBlock%20ifFalse%3A%20%5B%5D'),
+source: unescape('ifTrue%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20aBlock%20ifFalse%3A%20%5B%5D'),
 messageSends: ["ifTrue:ifFalse:"],
 referencedClasses: []
 }),
@@ -2284,7 +2239,7 @@ fn: function (aBlock){
 var self=this;
 return smalltalk.send(self, "_ifTrue_ifFalse_", [(function(){return nil;}), aBlock]);
 return self;},
-source: unescape('ifFalse%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5Eself%20ifTrue%3A%20%5B%5D%20ifFalse%3A%20aBlock'),
+source: unescape('ifFalse%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20%5B%5D%20ifFalse%3A%20aBlock'),
 messageSends: ["ifTrue:ifFalse:"],
 referencedClasses: []
 }),
@@ -2299,7 +2254,7 @@ fn: function (aBlock, anotherBlock){
 var self=this;
 return smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
 return self;},
-source: unescape('ifFalse%3A%20aBlock%20ifTrue%3A%20anotherBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5Eself%20ifTrue%3A%20anotherBlock%20ifFalse%3A%20aBlock'),
+source: unescape('ifFalse%3A%20aBlock%20ifTrue%3A%20anotherBlock%0A%09%5Eself%20ifTrue%3A%20anotherBlock%20ifFalse%3A%20aBlock'),
 messageSends: ["ifTrue:ifFalse:"],
 referencedClasses: []
 }),
@@ -2320,7 +2275,7 @@ var self=this;
 	    }
 	;
 return self;},
-source: unescape('ifTrue%3A%20aBlock%20ifFalse%3A%20anotherBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%3C%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20anotherBlock%28%29%3B%0A%09%20%20%20%20%7D%0A%09%3E'),
+source: unescape('ifTrue%3A%20aBlock%20ifFalse%3A%20anotherBlock%0A%09%3C%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20anotherBlock%28%29%3B%0A%09%20%20%20%20%7D%0A%09%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -2401,6 +2356,48 @@ referencedClasses: []
 }),
 smalltalk.Boolean);
 
+smalltalk.addMethod(
+'_&',
+smalltalk.method({
+selector: '&',
+category: 'controlling',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return aBoolean;
+	    } else {
+		return false;
+	    }
+	;
+return self;},
+source: unescape('%26%20aBoolean%0A%09%3C%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBoolean%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20false%3B%0A%09%20%20%20%20%7D%0A%09%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Boolean);
+
+smalltalk.addMethod(
+'_|',
+smalltalk.method({
+selector: '|',
+category: 'controlling',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return true;
+	    } else {
+		return aBoolean;
+	    }
+	;
+return self;},
+source: unescape('%7C%20aBoolean%0A%09%3C%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20true%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20aBoolean%3B%0A%09%20%20%20%20%7D%0A%09%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Boolean);
+
 
 
 smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel');
@@ -3095,7 +3092,7 @@ fn: function (aBlock){
 var self=this;
 return smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, (function(){return nil;})]);
 return self;},
-source: unescape('ifNil%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5Eself%20ifNil%3A%20aBlock%20ifNotNil%3A%20%5B%5D'),
+source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%20ifNil%3A%20aBlock%20ifNotNil%3A%20%5B%5D'),
 messageSends: ["ifNil:ifNotNil:"],
 referencedClasses: []
 }),
@@ -3110,7 +3107,7 @@ fn: function (aBlock){
 var self=this;
 return self;
 return self;},
-source: unescape('ifNotNil%3A%20aBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5Eself'),
+source: unescape('ifNotNil%3A%20aBlock%0A%09%5Eself'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -3125,7 +3122,7 @@ fn: function (aBlock, anotherBlock){
 var self=this;
 return smalltalk.send(aBlock, "_value", []);
 return self;},
-source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5EaBlock%20value'),
+source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EaBlock%20value'),
 messageSends: ["value"],
 referencedClasses: []
 }),
@@ -3140,7 +3137,7 @@ fn: function (aBlock, anotherBlock){
 var self=this;
 return smalltalk.send(anotherBlock, "_value", []);
 return self;},
-source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%22inlined%20in%20the%20Compiler%22%0A%09%5EanotherBlock%20value'),
+source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value'),
 messageSends: ["value"],
 referencedClasses: []
 }),
@@ -4585,6 +4582,21 @@ referencedClasses: []
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+'_asciiValue',
+smalltalk.method({
+selector: 'asciiValue',
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.charCodeAt(0);;
+return self;},
+source: unescape('asciiValue%0A%09%3Creturn%20self.charCodeAt%280%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String);
+
 
 smalltalk.addMethod(
 '_streamClass',
@@ -4709,6 +4721,21 @@ referencedClasses: [smalltalk.String]
 }),
 smalltalk.String.klass);
 
+smalltalk.addMethod(
+'_value_',
+smalltalk.method({
+selector: 'value:',
+category: 'instance creation',
+fn: function (aUTFCharCode){
+var self=this;
+return String.fromCharCode(aUTFCharCode);;
+return self;},
+source: unescape('value%3A%20aUTFCharCode%0A%0A%09%3Creturn%20String.fromCharCode%28aUTFCharCode%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String.klass);
+
 
 smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel');
 smalltalk.addMethod(
@@ -4886,11 +4913,11 @@ fn: function (aBlock){
 var self=this;
 
 		return self.sort(function(a, b) {
-			if(aBlock(a,b)) {return -1} else {return 1}
+			if(aBlock(a,b)) {return 1} else {return -1}
 		})
 	;
 return self;},
-source: unescape('sort%3A%20aBlock%0A%09%3C%0A%09%09return%20self.sort%28function%28a%2C%20b%29%20%7B%0A%09%09%09if%28aBlock%28a%2Cb%29%29%20%7Breturn%20-1%7D%20else%20%7Breturn%201%7D%0A%09%09%7D%29%0A%09%3E'),
+source: unescape('sort%3A%20aBlock%0A%09%3C%0A%09%09return%20self.sort%28function%28a%2C%20b%29%20%7B%0A%09%09%09if%28aBlock%28a%2Cb%29%29%20%7Breturn%201%7D%20else%20%7Breturn%20-1%7D%0A%09%09%7D%29%0A%09%3E'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -4940,10 +4967,10 @@ selector: 'sorted:',
 category: 'enumerating',
 fn: function (aBlock){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
+return smalltalk.send(smalltalk.send(self, "_copy", []), "_sorted_", [aBlock]);
 return self;},
-source: unescape('sorted%3A%20aBlock%0A%09%5Eself%20copy%20sort%3A%20aBlock'),
-messageSends: ["sort:", "copy"],
+source: unescape('sorted%3A%20aBlock%0A%09%5Eself%20copy%20sorted%3A%20aBlock'),
+messageSends: ["sorted:", "copy"],
 referencedClasses: []
 }),
 smalltalk.Array);

+ 16 - 0
st/Kernel-Tests.st

@@ -36,3 +36,19 @@ testPrintString
                         	printString)
 ! !
 
+TestCase subclass: #BooleanTest
+	instanceVariableNames: ''
+	category: 'Kernel-Tests'!
+
+!BooleanTest methodsFor: 'not yet classified'!
+
+testLogic
+
+	"Trivial logic table"
+	self assert: (true & true); deny: (true & false); deny: (false & true); deny: (false & false).
+	self assert: (true | true); assert: (true | false); assert: (false | true); deny: (false | false).
+        "Checking that expressions work fine too"
+	self assert: (true & (1 > 0)); deny: ((1 > 0) & false); deny: ((1 > 0) & (1 > 2)).
+        self assert: (false | (1 > 0)); assert: ((1 > 0) | false); assert: ((1 > 0) | (1 > 2))
+! !
+

+ 31 - 45
st/Kernel.st

@@ -180,22 +180,18 @@ isMemberOf: 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
 !
 
@@ -539,22 +535,18 @@ Object subclass: #Number
 !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>
 !
 
@@ -573,27 +565,22 @@ modulo: aNumber
 !Number methodsFor: 'comparing'!
 
 = aNumber
-	"Inlined in the Compiler"
 	<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>
 ! !
 
@@ -709,23 +696,11 @@ compiledSource
 !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'!
@@ -740,33 +715,23 @@ on: anErrorClass do: aBlock
 !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()>
 ! !
 
 !BlockClosure methodsFor: 'printing'!
@@ -809,22 +774,18 @@ asJSONObject
 !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();
@@ -848,6 +809,26 @@ or: 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'!
@@ -1086,22 +1067,18 @@ printString
 !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
 !
 
@@ -1418,6 +1395,10 @@ escaped
 
 unescaped
 	<return unescape(self)>
+!
+
+asciiValue
+	<return self.charCodeAt(0);>
 ! !
 
 !String methodsFor: 'adding'!
@@ -1648,6 +1629,11 @@ streamContents: blockWithArg
 	stream := (self streamClass on: String new).
 	blockWithArg value: stream.
 	^ stream contents
+!
+
+value: aUTFCharCode
+
+	<return String.fromCharCode(aUTFCharCode);>
 ! !
 
 SequenceableCollection subclass: #Array
@@ -1743,7 +1729,7 @@ sort
 sort: aBlock
 	<
 		return self.sort(function(a, b) {
-			if(aBlock(a,b)) {return -1} else {return 1}
+			if(aBlock(a,b)) {return 1} else {return -1}
 		})
 	>
 !
@@ -1753,7 +1739,7 @@ sorted
 !
 
 sorted: aBlock
-	^self copy sort: aBlock
+	^self copy sorted: aBlock
 !
 
 printString