Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.351.mcz ==================== Summary ==================== Name: Kernel-ar.351 Author: ar Time: 29 December 2009, 4:53:50 am UUID: adffc800-4eb7-2f43-a55d-f827d0627605 Ancestors: Kernel-ar.350 Shipping NanoTraits part 3: A hand ful of small changes that pave the way for the (major) follow-on cleanup. =============== Diff against Kernel-ar.350 =============== Item was changed: ----- Method: Behavior>>removeSelector: (in category 'adding/removing methods') ----- removeSelector: aSelector "Assuming that the argument, selector (a Symbol), is a message selector + in my method dictionary, remove it and its method." + ^self basicRemoveSelector: aSelector - in my method dictionary, remove it and its method. - - If the method to remove will be replaced by a method from my trait composition, - the current method does not have to be removed because we mark it as non-local. - If it is not identical to the actual method from the trait it will be replaced automatically - by #noteChangedSelectors:. - - This is useful to avoid bootstrapping problems when moving methods to a trait - (e.g., from TPureBehavior to TMethodDictionaryBehavior). Manual moving (implementing - the method in the trait and then remove it from the class) does not work if the methods - themselves are used for this process (such as compiledMethodAt:, includesLocalSelector: or - addTraitSelector:withMethod:)" - - | changeFromLocalToTraitMethod | - - "-- support for alternative trait implementation --" - (self traitComposition isKindOf: TraitComposition) - ifFalse:[^self basicRemoveSelector: aSelector]. - - changeFromLocalToTraitMethod := (self includesLocalSelector: aSelector) - and: [self hasTraitComposition] - and: [self traitComposition includesMethod: aSelector]. - - changeFromLocalToTraitMethod - ifFalse: [self basicRemoveSelector: aSelector] - ifTrue: [self ensureLocalSelectors]. - self deregisterLocalSelector: aSelector. - self noteChangedSelectors: (Array with: aSelector) - ! Item was changed: ----- Method: ClassDescription>>removeSelector: (in category 'accessing method dictionary') ----- removeSelector: selector "Remove the message whose selector is given from the method dictionary of the receiver, if it is there. Answer nil otherwise." | priorMethod priorProtocol | priorMethod := self compiledMethodAt: selector ifAbsent: [^ nil]. priorProtocol := self whichCategoryIncludesSelector: selector. + SystemChangeNotifier uniqueInstance doSilently: [ + self organization removeElement: selector]. - "-- support for alternative trait implementation --" - (self traitComposition isKindOf: TraitComposition) ifFalse:[ - SystemChangeNotifier uniqueInstance doSilently: [ - self organization removeElement: selector]. - ]. super removeSelector: selector. + - (self traitComposition isKindOf: TraitComposition) ifTrue:[ - SystemChangeNotifier uniqueInstance doSilently: [self updateOrganizationSelector: selector oldCategory: priorProtocol newCategory: nil]. - ]. SystemChangeNotifier uniqueInstance methodRemoved: priorMethod selector: selector inProtocol: priorProtocol class: self.! Item was changed: ----- Method: Behavior>>addSelector:withMethod:notifying: (in category 'adding/removing methods') ----- addSelector: selector withMethod: compiledMethod notifying: requestor + ^ self basicAddSelector: selector withMethod: compiledMethod! - ^ self addSelectorSilently: selector withMethod: compiledMethod! Item was removed: - ----- Method: Behavior>>setTraitComposition: (in category 'traits') ----- - setTraitComposition: aTraitComposition - | oldComposition | - (self hasTraitComposition not and: [aTraitComposition isEmpty]) ifTrue: [^self]. - aTraitComposition assertValidUser: self. - - oldComposition := self traitComposition. - self traitComposition: aTraitComposition. - self applyChangesOfNewTraitCompositionReplacing: oldComposition. - - oldComposition traits do: [:each | each removeUser: self]. - aTraitComposition traits do: [:each | each addUser: self]! Item was removed: - ----- Method: ClassDescription>>noteRecategorizedSelectors:oldComposition: (in category 'organization updating') ----- - noteRecategorizedSelectors: aCollection oldComposition: aTraitComposition - - aCollection do: [:each | | oldCategory newCategory | - oldCategory := self organization categoryOfElement: each. - newCategory := (self traitComposition methodDescriptionForSelector: each) effectiveMethodCategory. - self noteRecategorizedSelector: each from: oldCategory to: newCategory]! Item was removed: - ----- Method: ClassDescription>>applyChangesOfNewTraitCompositionReplacing: (in category 'organization updating') ----- - applyChangesOfNewTraitCompositionReplacing: oldComposition - | changedSelectors | - changedSelectors := super applyChangesOfNewTraitCompositionReplacing: oldComposition. - self noteRecategorizedSelectors: changedSelectors oldComposition: oldComposition. - ^ changedSelectors.! Item was removed: - ----- Method: Class>>applyChangesOfNewTraitCompositionReplacing: (in category 'traits') ----- - applyChangesOfNewTraitCompositionReplacing: oldComposition - "See Trait>>applyChangesOfNewTraitCompositionReplacing:" - | changedSelectors | - changedSelectors := super applyChangesOfNewTraitCompositionReplacing: oldComposition. - self classSide - noteNewBaseTraitCompositionApplied: self traitComposition. - ^ changedSelectors! Item was removed: - ----- Method: ClassDescription>>updateOrganizationSelector:oldCategory:newCategory: (in category 'organization updating') ----- - updateOrganizationSelector: aSymbol oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil - | currentCategory effectiveCategory sel changedCategories composition | - changedCategories := IdentitySet new. - composition := self hasTraitComposition - ifTrue: [self traitComposition] - ifFalse: [TraitComposition new]. - - "-- support for alternative trait implementation --" - (composition isKindOf: TraitComposition) ifFalse:[^self]. - - (composition methodDescriptionsForSelector: aSymbol) do: [:each | - sel := each selector. - (self includesLocalSelector: sel) ifFalse: [ - currentCategory := self organization categoryOfElement: sel. - effectiveCategory := each effectiveMethodCategoryCurrent: currentCategory new: newCategoryOrNil. - effectiveCategory isNil ifTrue: [ - currentCategory ifNotNil: [changedCategories add: currentCategory]. - self organization removeElement: sel. - ] ifFalse: [ - ((currentCategory isNil or: [currentCategory == ClassOrganizer ambiguous or: [currentCategory == oldCategoryOrNil]]) and: [currentCategory ~~ effectiveCategory]) ifTrue: [ - currentCategory ifNotNil: [changedCategories add: currentCategory]. - self organization - classify: sel - under: effectiveCategory - suppressIfDefault: false]]]]. - ^ changedCategories! Item was removed: - ----- Method: ClassDescription>>noteRecategorizedSelector:from:to: (in category 'organization updating') ----- - noteRecategorizedSelector: aSymbol from: oldCategoryOrNil to: newCategoryOrNil - | changedCategories | - changedCategories := self updateOrganizationSelector: aSymbol oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil. - changedCategories do: [:each | - (self organization isEmptyCategoryNamed: each) ifTrue: [self organization removeCategory: each]]! |
Free forum by Nabble | Edit this page |