Andreas Raab uploaded a new version of Traits to project The Trunk:
http://source.squeak.org/trunk/Traits-ar.271.mcz
==================== Summary ====================
Name: Traits-ar.271
Author: ar
Time: 31 December 2009, 3:45:08 am
UUID: c7f78cfa-a551-ee4d-a4a5-f4f6da2bbad6
Ancestors: Traits-ar.270
Fix a few issues where we should operate on the elements of the trait transform instead of the transform itself.
=============== Diff against Traits-ar.270 ===============
Item was changed:
----- Method: ClassDescription>>installTraitsFrom: (in category '*Traits-NanoKernel') -----
installTraitsFrom: aTraitComposition
+ "Install the traits from the given composition. This method implements
+ the core composition method - all others are just optimizations for
+ particular cases. Consequently, the optimized versions can always fall
+ back to this method when things get too hairy."
- "Install the traits from the given composition"
| allTraits methods oldMethod removals oldCategories |
(self traitComposition isEmpty and: [aTraitComposition isEmpty]) ifTrue: [^self].
"Check for cycles"
allTraits := aTraitComposition gather: [:t | t allTraits copyWith: t].
(allTraits includes: self) ifTrue:[^self error: 'Cyclic trait definition detected'].
"XXXX: addUser/removeUser should be part of setter, but subclass
override prevents it until we've got rid of Traits mess."
+ self traitComposition do:[:tc| tc removeTraitUser: self].
- self traitComposition removeTraitUser: self.
self traitComposition: aTraitComposition.
+ aTraitComposition do:[:tc| tc addTraitUser: self].
- aTraitComposition addTraitUser: self.
"Assemble the methods in a new dictionary first.
Uses a Dictionary instead of a MethodDictionary for speed (MDs grow by #become:)"
methods := Dictionary new.
"Stick in the local methods first, since this avoids generating conflict methods unnecessarily"
self selectorsAndMethodsDo:[:sel :newMethod|
(self isLocalMethod: newMethod)
ifTrue:[methods at: sel put:newMethod]].
"Now assemble the traits methods"
aTraitComposition do:[:trait|
trait selectorsAndMethodsDo:[:sel :newMethod|
oldMethod := methods at: sel ifAbsentPut:[newMethod].
newMethod == oldMethod ifFalse:["a conflict"
(self isLocalMethod: oldMethod) ifFalse:[
methods at: sel put: (self resolveTraitsConflict: sel from: oldMethod to: newMethod).
].
].
].
].
"Apply the changes. We first add the new or changed methods."
oldCategories := Set new.
methods keysAndValuesDo:[:sel :newMethod|
oldMethod := self compiledMethodAt: sel ifAbsent:[nil].
oldMethod == newMethod ifFalse:[
self traitAddSelector: sel withMethod: newMethod.
(self organization categoryOfElement: sel) ifNotNil:[:cat| oldCategories add: cat].
self organization classify: sel under:
(newMethod methodHome organization categoryOfElement: newMethod selector).
]].
"Now remove the old or obsoleted ones"
removals := OrderedCollection new.
self selectorsDo:[:sel| (methods includesKey: sel) ifFalse:[removals add: sel]].
removals do:[:sel| self traitRemoveSelector: sel].
"Clean out empty categories"
oldCategories do:[:cat|
(self organization isEmptyCategoryNamed: cat)
ifTrue:[self organization removeCategory: cat]].
self isMeta ifFalse:[self classSide updateTraitsFrom: aTraitComposition].!
Item was changed:
----- Method: ClassDescription>>includesTrait: (in category '*Traits-NanoKernel') -----
includesTrait: aTrait
+ ^self traitComposition anySatisfy:[:each| each includesTrait: aTrait]!
- ^self traitComposition includesTrait: aTrait!
Item was removed:
- ----- Method: TraitComposition>>includesTrait: (in category 'testing') -----
- includesTrait: aTrait
- ^self anySatisfy:[:each| each includesTrait: aTrait]!
Item was removed:
- ----- Method: TraitComposition>>addTraitUser: (in category 'accessing') -----
- addTraitUser: aUser
- self do:[:each| each addTraitUser: aUser]!
Item was removed:
- ----- Method: TraitComposition>>removeTraitUser: (in category 'accessing') -----
- removeTraitUser: aUser
- self do:[:each| each removeTraitUser: aUser]!
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.360.mcz
==================== Summary ====================
Name: Kernel-ar.360
Author: ar
Time: 31 December 2009, 3:42:08 am
UUID: 64a98687-3714-f34f-abf5-0eef057762aa
Ancestors: Kernel-ar.359
Fix small typo in obsoletion - removeTraitUser: should be sent to the elements of the composition.
=============== Diff against Kernel-ar.359 ===============
Item was changed:
----- Method: ClassDescription>>obsolete (in category 'initialize-release') -----
obsolete
"Make the receiver obsolete."
self hasTraitComposition ifTrue: [
+ self traitComposition do: [:each |
- self traitComposition traits do: [:each |
each removeTraitUser: self]].
superclass removeSubclass: self.
self organization: nil.
super obsolete.!
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.360.mcz
==================== Summary ====================
Name: Kernel-ar.360
Author: ar
Time: 31 December 2009, 3:42:08 am
UUID: 64a98687-3714-f34f-abf5-0eef057762aa
Ancestors: Kernel-ar.359
Fix small typo in obsoletion - removeTraitUser: should be sent to the elements of the composition.
=============== Diff against Kernel-ar.359 ===============
Item was changed:
----- Method: ClassDescription>>obsolete (in category 'initialize-release') -----
obsolete
"Make the receiver obsolete."
self hasTraitComposition ifTrue: [
+ self traitComposition do: [:each |
- self traitComposition traits do: [:each |
each removeTraitUser: self]].
superclass removeSubclass: self.
self organization: nil.
super obsolete.!
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.360.mcz
==================== Summary ====================
Name: Kernel-ar.360
Author: ar
Time: 31 December 2009, 3:42:08 am
UUID: 64a98687-3714-f34f-abf5-0eef057762aa
Ancestors: Kernel-ar.359
Fix small typo in obsoletion - removeTraitUser: should be sent to the elements of the composition.
=============== Diff against Kernel-ar.359 ===============
Item was changed:
----- Method: ClassDescription>>obsolete (in category 'initialize-release') -----
obsolete
"Make the receiver obsolete."
self hasTraitComposition ifTrue: [
+ self traitComposition do: [:each |
- self traitComposition traits do: [:each |
each removeTraitUser: self]].
superclass removeSubclass: self.
self organization: nil.
super obsolete.!
Andreas Raab uploaded a new version of ScriptLoader to project The Trunk:
http://source.squeak.org/trunk/ScriptLoader-ar.329.mcz
==================== Summary ====================
Name: ScriptLoader-ar.329
Author: ar
Time: 31 December 2009, 3:16:19 am
UUID: 07e096f6-df09-e247-82f2-49ba916ff768
Ancestors: ScriptLoader-nice.328
Final trait cleanup touches: Avoid Undeclared references.
=============== Diff against ScriptLoader-nice.328 ===============
Item was changed:
----- Method: ScriptLoader>>flushCaches (in category 'cleaning') -----
flushCaches
MCFileBasedRepository flushAllCaches.
MCDefinition clearInstances.
Smalltalk garbageCollect.
"Initialization required for tests: strange why this is not a teardwon method"
+ Smalltalk at: #SendCaches ifPresent:[:aClass| aClass initializeAllInstances].!
- SendCaches initializeAllInstances.!
Andreas Raab uploaded a new version of ScriptLoader to project The Trunk:
http://source.squeak.org/trunk/ScriptLoader-ar.329.mcz
==================== Summary ====================
Name: ScriptLoader-ar.329
Author: ar
Time: 31 December 2009, 3:16:19 am
UUID: 07e096f6-df09-e247-82f2-49ba916ff768
Ancestors: ScriptLoader-nice.328
Final trait cleanup touches: Avoid Undeclared references.
=============== Diff against ScriptLoader-nice.328 ===============
Item was changed:
----- Method: ScriptLoader>>flushCaches (in category 'cleaning') -----
flushCaches
MCFileBasedRepository flushAllCaches.
MCDefinition clearInstances.
Smalltalk garbageCollect.
"Initialization required for tests: strange why this is not a teardwon method"
+ Smalltalk at: #SendCaches ifPresent:[:aClass| aClass initializeAllInstances].!
- SendCaches initializeAllInstances.!
Andreas Raab uploaded a new version of ScriptLoader to project The Trunk:
http://source.squeak.org/trunk/ScriptLoader-ar.329.mcz
==================== Summary ====================
Name: ScriptLoader-ar.329
Author: ar
Time: 31 December 2009, 3:16:19 am
UUID: 07e096f6-df09-e247-82f2-49ba916ff768
Ancestors: ScriptLoader-nice.328
Final trait cleanup touches: Avoid Undeclared references.
=============== Diff against ScriptLoader-nice.328 ===============
Item was changed:
----- Method: ScriptLoader>>flushCaches (in category 'cleaning') -----
flushCaches
MCFileBasedRepository flushAllCaches.
MCDefinition clearInstances.
Smalltalk garbageCollect.
"Initialization required for tests: strange why this is not a teardwon method"
+ Smalltalk at: #SendCaches ifPresent:[:aClass| aClass initializeAllInstances].!
- SendCaches initializeAllInstances.!