[squeak-dev] The Trunk: EToys-nice.36.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Oct 19 23:21:37 UTC 2009
Nicolas Cellier uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-nice.36.mcz
==================== Summary ====================
Name: EToys-nice.36
Author: nice
Time: 19 October 2009, 11:20:31 am
UUID: 9f11b689-fee1-2347-a7c5-53ae8326942b
Ancestors: EToys-tfel.35
Use #fasterKeys
and correct a bug in
#includesSelector:forInstance:ofClass:limitClass:
Observe the old code:
What you see, in the second loop:
theKeys collect: [anInstVarNames | Utilities setterSelectorFor: anInstVarName]
Is not what you get, because at this stage, keys contains the (Utilities getterSelectorFor: anInstVarName), that is #getFoo for anInstVarName #foo
So the second loop did collect #setGetFoo: ...
I didn't try it, but that's how I read it.
=============== Diff against EToys-tfel.35 ===============
Item was changed:
----- Method: PasteUpMorph>>userCustomEventNames (in category '*eToys-customevents-scripting') -----
userCustomEventNames
| reg |
reg := self valueOfProperty: #userCustomEventsRegistry ifAbsent: [ ^#() ].
+ ^reg fasterKeys sort!
- ^reg keys asArray sort!
Item was changed:
----- Method: KedamaTurtleVectorPlayer>>compileAllAccessors (in category 'player protocol') -----
compileAllAccessors
+ info fasterKeys do: [:k |
- info keys asArray do: [:k |
(#(who x y heading color visible) includes: k) ifFalse: [
self compileVectorInstVarAccessorsFor: k.
].
].
!
Item was changed:
----- Method: KedamaSequenceExecutionStub>>compileAllAccessors (in category 'method management') -----
compileAllAccessors
+ turtles info fasterKeys do: [:k |
- turtles info keys asArray do: [:k |
(#(who x y heading color visible normal) includes: k) ifFalse: [
self compileScalarInstVarAccessorsFor: k.
].
].
!
Item was changed:
----- Method: EToyVocabulary>>includesSelector:forInstance:ofClass:limitClass: (in category 'initialization') -----
includesSelector: aSelector forInstance: anInstance ofClass: aTargetClass limitClass: mostGenericClass
"Answer whether the vocabulary includes the given selector for the given class (and instance, if provided), only considering method implementations in mostGenericClass and lower"
+ | classToUse aClass |
- | classToUse aClass theKeys |
(aTargetClass isUniClass and:
[(aTargetClass namedTileScriptSelectors includes: aSelector) or:
+ [aTargetClass slotInfo fasterKeys anySatisfy:
+ [:anInstVarName | (Utilities getterSelectorFor: anInstVarName) = aSelector or: [(Utilities setterSelectorFor: anInstVarName) = aSelector]]]])
+ ifTrue: [^ true].
- [(((theKeys := aTargetClass slotInfo keys collect:
- [:anInstVarName | Utilities getterSelectorFor: anInstVarName])) includes: aSelector)
- or:
- [(theKeys collect: [:anInstVarName | Utilities setterSelectorFor: anInstVarName]) includes: aSelector]]]) ifTrue: [^ true].
(methodInterfaces includesKey: aSelector) ifFalse: [^ false].
classToUse := self classToUseFromInstance: anInstance ofClass: aTargetClass.
^ (aClass := classToUse whichClassIncludesSelector: aSelector)
ifNil:
[false]
ifNotNil:
[aClass includesBehavior: mostGenericClass]
!
Item was changed:
----- Method: StandardScriptingSystem>>globalCustomEventNames (in category '*eToys-customevents-custom events') -----
globalCustomEventNames
+ ^self customEventsRegistry fasterKeys sort!
- ^self customEventsRegistry keys asArray sort!
Item was changed:
----- Method: EToyVocabulary>>allMethodsInCategory:forInstance:ofClass: (in category 'method list') -----
allMethodsInCategory: aCategoryName forInstance: anObject ofClass: aClass
"Answer a list of all methods in the etoy interface which are in the given category, on behalf of anObject, or if it is nil, aClass"
| aCategory unfiltered suitableSelectors isAll |
aCategoryName ifNil: [^ OrderedCollection new].
aClass isUniClass ifTrue:
[aCategoryName = ScriptingSystem nameForScriptsCategory ifTrue:
[^ aClass namedTileScriptSelectors].
aCategoryName = ScriptingSystem nameForInstanceVariablesCategory ifTrue:
+ [^ aClass slotInfo fasterKeys sort collect:
- [^ aClass slotInfo keys asSortedArray collect:
[:anInstVarName | Utilities getterSelectorFor: anInstVarName]]].
unfiltered := (isAll := aCategoryName = self allCategoryName)
ifTrue:
[methodInterfaces collect: [:anInterface | anInterface selector]]
ifFalse:
[aCategory := categories detect: [:cat | cat categoryName = aCategoryName]
ifNone: [^ OrderedCollection new].
aCategory elementsInOrder collect: [:anElement | anElement selector]].
(anObject isKindOf: Player) ifTrue:
[suitableSelectors := anObject costume selectorsForViewer.
unfiltered := unfiltered select:
[:aSelector | suitableSelectors includes: aSelector]].
(isAll and: [aClass isUniClass]) ifTrue:
[unfiltered addAll: aClass namedTileScriptSelectors.
+ unfiltered addAll: (aClass slotInfo fasterKeys sort collect:
- unfiltered addAll: (aClass slotInfo keys asSortedArray collect:
[:anInstVarName | Utilities getterSelectorFor: anInstVarName])].
^ (unfiltered copyWithoutAll: #(dummy unused)) asSortedArray!
More information about the Squeak-dev
mailing list
|