[squeak-dev] The Trunk: Kernel-nice.582.mcz

commits at source.squeak.org commits at source.squeak.org
Fri May 6 21:03:16 UTC 2011


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.582.mcz

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

Name: Kernel-nice.582
Author: nice
Time: 6 May 2011, 11:02:30.631 pm
UUID: 1a8988c2-e42f-4e41-992e-9bcc200d85de
Ancestors: Kernel-cmm.581

1) Restore #whichSelectorsAssign: and #whichSelectorsStoreInto: because used by many tools (RB/OB/EC...)
2) While at it, extend their power to class variable names.
3) let'em always answer an Array, not an IdentitySet or an Array
4) correct #whichMethodsStoreInto: comment, they don't answer a selector
5) simplify #whichMethodsStoreInto: 

Maybe we shall deprecate the old selectors later, but for now, maintain 2 versions...

=============== Diff against Kernel-cmm.581 ===============

Item was changed:
  ----- Method: Behavior>>whichMethodsStoreInto: (in category 'testing method dictionary') -----
  whichMethodsStoreInto: instVarName 
+ 	"Answer a collection of CompiledMethod whose methods access the argument, 
- 	"Answer a collection of selectors whose methods access the argument, 
  	instVarName, as a named instance variable."
  	"Point whichMethodsStoreInto: 'x'."
  	| instVarIndex |
  	instVarIndex := self allInstVarNames
  		indexOf: instVarName
+ 		ifAbsent: [ ^ Array new ].
+ 	^self methodDict values select: [:eachMethod | eachMethod writesField: instVarIndex ]!
- 		ifAbsent: [ ^ IdentitySet new ].
- 	^ Array streamContents:
- 		[ : stream | self methodDict keysAndValuesDo:
- 			[ : eachSelector : eachMethod | (eachMethod writesField: instVarIndex) ifTrue: [ stream nextPut: eachMethod ] ] ]!

Item was added:
+ ----- Method: Behavior>>whichSelectorsAssign: (in category 'queries') -----
+ whichSelectorsAssign: instVarName 
+ 	"Answer a Set of selectors whose methods store into the argument, 
+ 	instVarName, as a named instance variable."
+ 	^self whichSelectorsStoreInto: instVarName!

Item was added:
+ ----- Method: Behavior>>whichSelectorsStoreInto: (in category 'testing method dictionary') -----
+ whichSelectorsStoreInto: instVarName 
+ 	"Answer a collection of selectors whose methods access the argument, 
+ 	instVarName, as a named instance variable."
+ 	| instVarIndex |
+ 	instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^Array new].
+ 	^ self methodDict keys select: 
+ 		[:sel | (self methodDict at: sel) writesField: instVarIndex]
+ 
+ 	"Point whichSelectorsStoreInto: 'x'."!

Item was changed:
  ----- Method: Class>>whichMethodsStoreInto: (in category 'testing') -----
  whichMethodsStoreInto: varName 
+ 	"Answer a collection of CompiledMethod whose methods access the argument, varName, as a named class variable. Or let super try with a named instance variable."
- 	"Answer a collection of selectors whose methods access the argument, varName, as a named class variable."
  	| ref |
  	ref := self classPool
  		associationAt: varName
  		ifAbsent: [ ^ super whichMethodsStoreInto: varName ].
+ 	^self methodDict values select: [:eachMethod | eachMethod writesRef: ref ]!
- 	^ Array streamContents:
- 		[ : stream | self class methodDict keysAndValuesDo:
- 			[ : eachSelector : eachMethod | (eachMethod writesRef: ref) ifTrue: [ stream nextPut: eachMethod ] ] ]!

Item was added:
+ ----- Method: Class>>whichSelectorsStoreInto: (in category 'testing') -----
+ whichSelectorsStoreInto: varName 
+ 	"Answer a collection of selectors whose methods access the argument, varName, as a named class variable. Or let super try with a named instance variable."
+ 	| ref |
+ 	ref := self classPool
+ 		associationAt: varName
+ 		ifAbsent: [ ^ super whichMethodsStoreInto: varName ].
+ 	^self methodDict keys select: [:eachMethod | eachMethod writesRef: ref ]!




More information about the Squeak-dev mailing list