1
0
فهرست منبع

Fixed issue #216

Nicolas Petton 12 سال پیش
والد
کامیت
1631439126
3فایلهای تغییر یافته به همراه33 افزوده شده و 0 حذف شده
  1. 11 0
      js/Kernel-Collections.deploy.js
  2. 16 0
      js/Kernel-Collections.js
  3. 6 0
      st/Kernel-Collections.st

+ 11 - 0
js/Kernel-Collections.deploy.js

@@ -1948,6 +1948,17 @@ return self;}
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+"_do_",
+smalltalk.method({
+selector: "do:",
+fn: function (aBlock) {
+var self=this;
+for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
+return self;}
+}),
+smalltalk.String);
+
 smalltalk.addMethod(
 "_escaped",
 smalltalk.method({

+ 16 - 0
js/Kernel-Collections.js

@@ -2754,6 +2754,22 @@ referencedClasses: []
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+"_do_",
+smalltalk.method({
+selector: "do:",
+category: 'enumerating',
+fn: function (aBlock) {
+var self=this;
+for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
+return self;},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String);
+
 smalltalk.addMethod(
 "_escaped",
 smalltalk.method({

+ 6 - 0
st/Kernel-Collections.st

@@ -1054,6 +1054,12 @@ shallowCopy
 	^self class fromString: self
 ! !
 
+!String methodsFor: 'enumerating'!
+
+do: aBlock
+	<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>
+! !
+
 !String methodsFor: 'printing'!
 
 printNl