Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.478.mcz ==================== Summary ==================== Name: Kernel-ul.478 Author: ul Time: 21 August 2010, 7:33:03.97 pm UUID: ce807f45-d3ef-0a41-8094-245579694724 Ancestors: Kernel-eem.477 - use #cull:, #cull:cull: and #valueWithPossibleArgument: instead of #valueWithPossibleArgs: to avoid array creation =============== Diff against Kernel-eem.477 =============== Item was changed: ----- Method: BlockClosure>>onDNU:do: (in category 'exceptions') ----- onDNU: selector do: handleBlock "Catch MessageNotUnderstood exceptions but only those of the given selector (DNU stands for doesNotUnderstand:)" ^ self on: MessageNotUnderstood do: [:exception | exception message selector = selector + ifTrue: [handleBlock cull: exception] - ifTrue: [handleBlock valueWithPossibleArgs: {exception}] ifFalse: [exception pass] ]! Item was changed: ----- Method: ProtoObject>>ifNotNil: (in category 'testing') ----- ifNotNil: ifNotNilBlock "Evaluate the block, unless I'm == nil (q.v.)" + ^ ifNotNilBlock cull: self! - ^ ifNotNilBlock valueWithPossibleArgs: {self}! Item was changed: ----- Method: ProtoObject>>ifNil:ifNotNil: (in category 'testing') ----- ifNil: nilBlock ifNotNil: ifNotNilBlock "Evaluate the block, unless I'm == nil (q.v.)" + ^ ifNotNilBlock cull: self! - ^ ifNotNilBlock valueWithPossibleArgs: {self}! Item was changed: ----- Method: ProtoObject>>ifNotNil:ifNil: (in category 'testing') ----- ifNotNil: ifNotNilBlock ifNil: nilBlock "If I got here, I am not nil, so evaluate the block ifNotNilBlock" + ^ ifNotNilBlock cull: self! - ^ ifNotNilBlock valueWithPossibleArgs: {self}! Item was changed: ----- Method: BlockClosure>>ifError: (in category 'evaluating') ----- ifError: errorHandlerBlock "Evaluate the block represented by the receiver, and normally return it's value. If an error occurs, the errorHandlerBlock is evaluated, and it's value is instead returned. The errorHandlerBlock must accept zero, one, or two parameters (the error message and the receiver)." "Examples: [1 whatsUpDoc] ifError: [:err :rcvr | 'huh?']. [1 / 0] ifError: [:err :rcvr | 'ZeroDivide' = err ifTrue: [Float infinity] ifFalse: [self error: err]] " ^ self on: Error do: [:ex | + errorHandlerBlock cull: ex description cull: ex receiver ]! - errorHandlerBlock valueWithPossibleArgs: {ex description. ex receiver}]! Item was changed: ----- Method: ContextPart>>handleSignal: (in category 'private-exceptions') ----- handleSignal: exception "Sent to handler (on:do:) contexts only. If my exception class (first arg) handles exception then execute my handle block (second arg), otherwise forward this message to the next handler context. If none left, execute exception's defaultAction (see nil>>handleSignal:)." | val | (((self tempAt: 1) handles: exception) and: [self tempAt: 3]) ifFalse: [ ^ self nextHandlerContext handleSignal: exception]. exception privHandlerContext: self contextTag. self tempAt: 3 put: false. "disable self while executing handle block" + val := [(self tempAt: 2) valueWithPossibleArgument: exception ] - val := [(self tempAt: 2) valueWithPossibleArgs: {exception}] ensure: [self tempAt: 3 put: true]. self return: val. "return from self if not otherwise directed in handle block" ! |
Free forum by Nabble | Edit this page |