[squeak-dev] The Trunk: Kernel-ul.552.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Mar 15 00:57:41 UTC 2011


Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.552.mcz

==================== Summary ====================

Name: Kernel-ul.552
Author: ul
Time: 15 March 2011, 1:57:10.411 am
UUID: 9200081a-9eb0-7042-b9b5-3a792061f53d
Ancestors: Kernel-ul.551

- make sure that blocks and MessageSends are exchangable in more situations, by implementing #cull:* #value:* and #valueWithPossibleArgs: in MessageSend
- refactored Object >> #perform:withEnoughArguments:

=============== Diff against Kernel-ul.551 ===============

Item was added:
+ ----- Method: MessageSend>>cull: (in category 'evaluating') -----
+ cull: firstArg
+ 	"Send the message with these optional arguments and answer the return value"
+ 
+ 	selector numArgs >= 1 ifTrue: [ ^self value: firstArg ].
+ 	^self value!

Item was added:
+ ----- Method: MessageSend>>cull:cull: (in category 'evaluating') -----
+ cull: firstArg cull: secondArg
+ 	"Send the message with these optional arguments and answer the return value"
+ 
+ 	| numArgs |
+ 	(numArgs := selector numArgs) >= 2 ifTrue: [ ^self value: firstArg value: secondArg ].	
+ 	numArgs = 1 ifTrue: [ ^self value: firstArg ].
+ 	^self value!

Item was added:
+ ----- Method: MessageSend>>cull:cull:cull: (in category 'evaluating') -----
+ cull: firstArg cull: secondArg cull: thirdArg
+ 	"Send the message with these optional arguments and answer the return value"
+ 
+ 	| numArgs |
+ 	(numArgs := selector numArgs) >= 2 ifTrue: [ 
+ 		numArgs >= 3 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg ].
+ 		^self value: firstArg value: secondArg ].
+ 	numArgs = 1 ifTrue: [ ^self value: firstArg ].
+ 	^self value!

Item was added:
+ ----- Method: MessageSend>>cull:cull:cull:cull: (in category 'evaluating') -----
+ cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg
+ 	"Send the message with these optional arguments and answer the return value"
+ 
+ 	| numArgs |
+ 	(numArgs := selector numArgs) >= 3 ifTrue: [
+ 		numArgs >= 4 ifTrue: [
+ 			^self value: firstArg value: secondArg value: thirdArg value: fourthArg ].
+ 		^self value: firstArg value: secondArg value: thirdArg ].
+ 	numArgs = 2 ifTrue: [ ^self value: firstArg value: secondArg ].	
+ 	numArgs = 1 ifTrue: [ ^self value: firstArg ].
+ 	^self value!

Item was added:
+ ----- Method: MessageSend>>value: (in category 'evaluating') -----
+ value: firstArg
+ 	"Send the message with these arguments and answer the return value"
+ 
+ 	^receiver perform: selector with: firstArg!

Item was added:
+ ----- Method: MessageSend>>value:value: (in category 'evaluating') -----
+ value: firstArg value: secondArg
+ 	"Send the message with these arguments and answer the return value"
+ 
+ 	^receiver perform: selector with: firstArg with: secondArg!

Item was added:
+ ----- Method: MessageSend>>value:value:value: (in category 'evaluating') -----
+ value: firstArg value: secondArg value: thirdArg
+ 	"Send the message with these arguments and answer the return value"
+ 
+ 	^receiver perform: selector with: firstArg with: secondArg with: thirdArg!

Item was added:
+ ----- Method: MessageSend>>value:value:value:value: (in category 'evaluating') -----
+ value: firstArg value: secondArg value: thirdArg value: fourthArg
+ 	"Send the message with these arguments and answer the return value"
+ 
+ 	^receiver perform: selector withArguments: { firstArg. secondArg. thirdArg. fourthArg }!

Item was added:
+ ----- Method: MessageSend>>valueWithPossibleArgs: (in category 'evaluating') -----
+ valueWithPossibleArgs: anArray
+ 	"Send selector to the receiver with arguments in anArray. Only use enough arguments for the arity of the selector; supply nils for missing ones."
+ 	
+ 	^receiver perform: selector withEnoughArguments: anArray!

Item was changed:
  ----- Method: Object>>perform:withEnoughArguments: (in category 'message handling') -----
  perform: selector withEnoughArguments: anArray
+ 	"Send selector to the receiver with arguments in anArray. Only use enough arguments for the arity of the selector; supply nils for missing ones."
+ 	
- 	"Send the selector, aSymbol, to the receiver with arguments in argArray.
- 	Only use enough arguments for the arity of the selector; supply nils for missing ones."
  	| numArgs args |
+ 	(numArgs := selector numArgs) = anArray size 
+ 		ifTrue: [ args := anArray asArray ]
+ 		ifFalse: [
+ 			args := Array new: numArgs.
+ 			args 
+ 				replaceFrom: 1
+ 				to: (anArray size min: args size)
+ 				with: anArray
+ 				startingAt: 1 ].
+ 	^self perform: selector withArguments: args!
- 	numArgs := selector numArgs.
- 	anArray size == numArgs
- 		ifTrue: [ ^self perform: selector withArguments: anArray asArray ].
- 
- 	args := Array new: numArgs.
- 	args replaceFrom: 1
- 		to: (anArray size min: args size)
- 		with: anArray
- 		startingAt: 1.
- 
- 	^ self perform: selector withArguments: args!




More information about the Squeak-dev mailing list