Bläddra i källkod

timesRepeat without truncated

Apostolis Xekoukoulotakis 11 år sedan
förälder
incheckning
54f05f12e4
3 ändrade filer med 27 tillägg och 22 borttagningar
  1. 12 9
      js/Kernel-Objects.deploy.js
  2. 14 11
      js/Kernel-Objects.js
  3. 1 2
      st/Kernel-Objects.st

+ 12 - 9
js/Kernel-Objects.deploy.js

@@ -2000,15 +2000,18 @@ smalltalk.addMethod(
 "_timesRepeat_",
 smalltalk.method({
 selector: "timesRepeat:",
-fn: function (aBlock) {
-    var self = this;
-    var integer;
-    var count;
-    integer = smalltalk.send(self, "_truncated", []);
-    count = 1;
-    smalltalk.send(function () {return smalltalk.send(count, "__gt", [self]);}, "_whileFalse_", [function () {smalltalk.send(aBlock, "_value", []);count = smalltalk.send(count, "__plus", [1]);return count;}]);
-    return self;
-}
+fn: function (aBlock){
+var self=this;
+var count;
+count=(1);
+smalltalk.send((function(){
+return smalltalk.send(count,"__gt",[self]);
+}),"_whileFalse_",[(function(){
+smalltalk.send(aBlock,"_value",[]);
+count=smalltalk.send(count,"__plus",[(1)]);
+return count;
+})]);
+return self}
 }),
 smalltalk.Number);
 

+ 14 - 11
js/Kernel-Objects.js

@@ -2781,18 +2781,21 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "timesRepeat:",
 category: 'enumerating',
-fn: function (aBlock) {
-    var self = this;
-    var integer;
-    var count;
-    integer = smalltalk.send(self, "_truncated", []);
-    count = 1;
-    smalltalk.send(function () {return smalltalk.send(count, "__gt", [self]);}, "_whileFalse_", [function () {smalltalk.send(aBlock, "_value", []);count = smalltalk.send(count, "__plus", [1]);return count;}]);
-    return self;
-},
+fn: function (aBlock){
+var self=this;
+var count;
+count=(1);
+smalltalk.send((function(){
+return smalltalk.send(count,"__gt",[self]);
+}),"_whileFalse_",[(function(){
+smalltalk.send(aBlock,"_value",[]);
+count=smalltalk.send(count,"__plus",[(1)]);
+return count;
+})]);
+return self},
 args: ["aBlock"],
-source: "timesRepeat: aBlock\x0a\x09| integer count |\x0a\x09integer := self truncated.\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09    aBlock value.\x0a\x09    count := count + 1]",
-messageSends: ["truncated", "whileFalse:", "value", "+", ">"],
+source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09    aBlock value.\x0a\x09    count := count + 1]",
+messageSends: ["whileFalse:", "value", "+", ">"],
 referencedClasses: []
 }),
 smalltalk.Number);

+ 1 - 2
st/Kernel-Objects.st

@@ -902,8 +902,7 @@ deepCopy
 !Number methodsFor: 'enumerating'!
 
 timesRepeat: aBlock
-	| integer count |
-	integer := self truncated.
+	| count |
 	count := 1.
 	[count > self] whileFalse: [
 	    aBlock value.