Browse Source

Fix: Set new add: 'foo'` now returns 'foo'

Herbert Vojčík 8 years ago
parent
commit
03b2cea1b0
2 changed files with 5 additions and 3 deletions
  1. 3 2
      src/Kernel-Collections.js
  2. 2 1
      src/Kernel-Collections.st

+ 3 - 2
src/Kernel-Collections.js

@@ -8057,7 +8057,8 @@ return $core.withContext(function($ctx1) {
 
 		if (anObject in anotherObject.store) { return false; }
 		self['@size']++;
-		return anotherObject.store[anObject] = true;
+		anotherObject.store[anObject] = true;
+		return anObject;
 	;
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -8066,7 +8067,7 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anObject", "anotherObject"],
-source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
+source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09>",
 referencedClasses: [],
 //>>excludeEnd("ide");
 messageSends: []

+ 2 - 1
src/Kernel-Collections.st

@@ -1969,7 +1969,8 @@ add: anObject in: anotherObject
 	<
 		if (anObject in anotherObject.store) { return false; }
 		self['@size']++;
-		return anotherObject.store[anObject] = true;
+		anotherObject.store[anObject] = true;
+		return anObject;
 	>
 !