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

commits at source.squeak.org commits at source.squeak.org
Mon Mar 14 22:48:26 UTC 2011


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

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

Name: Kernel-ul.551
Author: ul
Time: 14 March 2011, 11:47:55.756 pm
UUID: 45b96cce-d479-4b43-a043-2b9620f47a98
Ancestors: Kernel-ul.550

- implemented Behavior >> #instVarIndexFor:ifAbsent:, so it can be used from other methods in Behavior
- refactored Behavior >> #whichSelectorsAccess:

=============== Diff against Kernel-ul.550 ===============

Item was added:
+ ----- Method: Behavior>>instVarIndexFor:ifAbsent: (in category 'accessing instances and variables') -----
+ instVarIndexFor: instVarName ifAbsent: aBlock
+ 	"Answer the index of the named instance variable."
+ 	
+ 	^self allInstVarNames indexOf: #instVarName ifAbsent: aBlock!

Item was changed:
  ----- Method: Behavior>>whichSelectorsAccess: (in category 'testing method dictionary') -----
  whichSelectorsAccess: instVarName 
+ 	"Answer a collection of selectors whose methods access the argument, instVarName, as a named instance variable."
+ 	"Point whichSelectorsAccess: 'x'."
+ 	
- 	"Answer a collection of selectors whose methods access the argument, 
- 	instVarName, as a named instance variable."
- 
  	| instVarIndex |
+ 	instVarIndex := self instVarIndexFor: instVarName ifAbsent: [ ^Array new ].
+ 	^Array streamContents: [ :stream |
+ 		self selectorsAndMethodsDo: [ :selector :method |
+ 			((method readsField: instVarIndex) or: [
+ 				method writesField: instVarIndex ]) ifTrue: [
+ 					stream nextPut: selector ] ] ]
+ !
- 	instVarIndex := self allInstVarNames indexOf: instVarName ifAbsent: [^IdentitySet new].
- 	^ self methodDict keys select: 
- 		[:sel | 
- 		((self methodDict at: sel)
- 			readsField: instVarIndex)
- 			or: [(self methodDict at: sel) writesField: instVarIndex]]
- 
- 	"Point whichSelectorsAccess: 'x'."!




More information about the Squeak-dev mailing list