Skip to content

Commit

Permalink
SmalltalkImage >> at:ifAbsent: made consistent with at:[put:]
Browse files Browse the repository at this point in the history
  • Loading branch information
Herbert Vojčík committed Jul 30, 2014
1 parent a37e484 commit 6611c6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 5 additions & 9 deletions src/Kernel-Infrastructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -2940,18 +2940,14 @@ protocol: 'accessing',
fn: function (aKey,aBlock){
var self=this;
return smalltalk.withContext(function($ctx1) {
var $2,$1;
$2=self._includesKey_(aKey);
if(smalltalk.assert($2)){
$1=self._at_(aKey);
} else {
$1=_st(aBlock)._value();
};
var $1;
self._deprecatedAPI();
$1=_st(self._globals())._at_ifAbsent_(aKey,aBlock);
return $1;
}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)})},
args: ["aKey", "aBlock"],
source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:", "value"],
source: "at: aKey ifAbsent: aBlock\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aKey ifAbsent: aBlock",
messageSends: ["deprecatedAPI", "at:ifAbsent:", "globals"],
referencedClasses: []
}),
globals.SmalltalkImage);
Expand Down
5 changes: 2 additions & 3 deletions src/Kernel-Infrastructure.st
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,8 @@ at: aString
!

at: aKey ifAbsent: aBlock
^ (self includesKey: aKey)
ifTrue: [ self at: aKey ]
ifFalse: [ aBlock value ]
self deprecatedAPI.
^ self globals at: aKey ifAbsent: aBlock
!

at: aString put: anObject
Expand Down

0 comments on commit 6611c6c

Please sign in to comment.