1
0
Nicolas Petton 12 rokov pred
rodič
commit
1631439126

+ 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