'From Pharo3.0 of 18 March 2013 [Latest update: #30269] on 12 July 2013 at 5:13:28 pm'! !TClassDescription methodsFor: 'accessing comment' stamp: 'SebastianTleye 7/12/2013 16:38'! classCommentBlank | existingComment stream | existingComment := self theNonMetaClass organization classComment. existingComment isEmpty ifFalse: [^existingComment]. stream := (String new: 100) writeStream. stream nextPutAll: 'A'; nextPutAll: (self name first isVowel ifTrue: ['n '] ifFalse: [' ']); nextPutAll: self name; nextPutAll: ' is xxxxxxxxx.'. (self instVarNames size > 0) ifTrue: [stream cr; cr; nextPutAll: 'Instance Variables'. ]. self instVarNames asSortedCollection do: [:each | stream cr; tab; nextPutAll: each; nextPut: $:; tab; tab; nextPutAll: '']. stream cr. self instVarNames asSortedCollection do: [:each | stream cr; nextPutAll: each; cr; tab; nextPutAll: '- xxxxx'; cr]. ^stream contents! ! !TClassDescription methodsFor: 'accessing comment' stamp: 'SebastianTleye 7/12/2013 16:38'! classCommentBlank | existingComment stream | existingComment := self theNonMetaClass organization classComment. existingComment isEmpty ifFalse: [^existingComment]. stream := (String new: 100) writeStream. stream nextPutAll: 'A'; nextPutAll: (self name first isVowel ifTrue: ['n '] ifFalse: [' ']); nextPutAll: self name; nextPutAll: ' is xxxxxxxxx.'. (self instVarNames size > 0) ifTrue: [stream cr; cr; nextPutAll: 'Instance Variables'. ]. self instVarNames asSortedCollection do: [:each | stream cr; tab; nextPutAll: each; nextPut: $:; tab; tab; nextPutAll: '']. stream cr. self instVarNames asSortedCollection do: [:each | stream cr; nextPutAll: each; cr; tab; nextPutAll: '- xxxxx'; cr]. ^stream contents! ! !ClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:46'! updateOrganizationSelector: aSymbol oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil | changedCategories composition | changedCategories := IdentitySet new. composition := self hasTraitComposition ifTrue: [ self traitComposition ] ifFalse: [ TraitComposition new ]. (composition methodDescriptionsForSelector: aSymbol) do: [ :each | self updateOrganizationDescription: each oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil changedCategories: changedCategories ]. ^ changedCategories! ! !ClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:49'! noteChangesFrom: oldMethodDict "create notifications about the changes made to the method dictionary" "additions have already been notified in #addTraitSelector:withMethod:" " deal with removal / updates relative to the old method dictionary" oldMethodDict keysAndValuesDo: [ :selector :oldMethod| self methodDict at: selector ifPresent: [ :currentMethod| currentMethod == oldMethod ifFalse: [ self noteMethodChanged: oldMethod to: currentMethod]] ifAbsent: [ self noteMethodRemoved: oldMethod ]]. ! ! !ClassDescription methodsFor: 'accessing method dictionary' stamp: 'SebastianTleye 7/12/2013 16:47'! addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor | priorMethodOrNil priorOriginOrNil oldProtocol newProtocol | priorMethodOrNil := self compiledMethodAt: selector ifAbsent: [ nil ]. priorMethodOrNil ifNotNil: [ priorOriginOrNil := priorMethodOrNil origin ]. self addSelectorSilently: selector withMethod: compiledMethod. oldProtocol := self organization categoryOfElement: selector. SystemAnnouncer uniqueInstance suspendAllWhile: [ self organization classify: selector under: (category = Protocol unclassified ifTrue: [ oldProtocol ] ifFalse: [ category ]) ]. newProtocol := self organization categoryOfElement: selector. (priorMethodOrNil isNil or: [ priorOriginOrNil ~= compiledMethod origin ]) ifTrue: [ SystemAnnouncer uniqueInstance methodAdded: compiledMethod selector: selector inProtocol: category class: self requestor: requestor ] ifFalse: [ "If protocol changed and someone is from different package, I need to throw a method recategorized" self notifyRepackage: selector method: compiledMethod oldProtocol: oldProtocol newProtocol: newProtocol. SystemAnnouncer uniqueInstance methodChangedFrom: priorMethodOrNil to: compiledMethod selector: selector inClass: self oldProtocol: oldProtocol newProtocol: newProtocol requestor: requestor ]! ! !ClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:46'! updateOrganizationSelector: aSymbol oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil | changedCategories composition | changedCategories := IdentitySet new. composition := self hasTraitComposition ifTrue: [ self traitComposition ] ifFalse: [ TraitComposition new ]. (composition methodDescriptionsForSelector: aSymbol) do: [ :each | self updateOrganizationDescription: each oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil changedCategories: changedCategories ]. ^ changedCategories! ! !ClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:49'! noteChangesFrom: oldMethodDict "create notifications about the changes made to the method dictionary" "additions have already been notified in #addTraitSelector:withMethod:" " deal with removal / updates relative to the old method dictionary" oldMethodDict keysAndValuesDo: [ :selector :oldMethod| self methodDict at: selector ifPresent: [ :currentMethod| currentMethod == oldMethod ifFalse: [ self noteMethodChanged: oldMethod to: currentMethod]] ifAbsent: [ self noteMethodRemoved: oldMethod ]]. ! ! !ClassDescription methodsFor: 'accessing method dictionary' stamp: 'SebastianTleye 7/12/2013 16:47'! addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor | priorMethodOrNil priorOriginOrNil oldProtocol newProtocol | priorMethodOrNil := self compiledMethodAt: selector ifAbsent: [ nil ]. priorMethodOrNil ifNotNil: [ priorOriginOrNil := priorMethodOrNil origin ]. self addSelectorSilently: selector withMethod: compiledMethod. oldProtocol := self organization categoryOfElement: selector. SystemAnnouncer uniqueInstance suspendAllWhile: [ self organization classify: selector under: (category = Protocol unclassified ifTrue: [ oldProtocol ] ifFalse: [ category ]) ]. newProtocol := self organization categoryOfElement: selector. (priorMethodOrNil isNil or: [ priorOriginOrNil ~= compiledMethod origin ]) ifTrue: [ SystemAnnouncer uniqueInstance methodAdded: compiledMethod selector: selector inProtocol: category class: self requestor: requestor ] ifFalse: [ "If protocol changed and someone is from different package, I need to throw a method recategorized" self notifyRepackage: selector method: compiledMethod oldProtocol: oldProtocol newProtocol: newProtocol. SystemAnnouncer uniqueInstance methodChangedFrom: priorMethodOrNil to: compiledMethod selector: selector inClass: self oldProtocol: oldProtocol newProtocol: newProtocol requestor: requestor ]! ! TraitDescription removeSelector: #classCommentBlank! TraitDescription removeSelector: #extendingPackages! TraitDescription removeSelector: #isDefinedInPackage:! TraitDescription removeSelector: #isExtended! TraitDescription removeSelector: #isExtendedInPackage:! TraitDescription removeSelector: #package! TraitDescription removeSelector: #packageFromOrganizer:! TraitDescription removeSelector: #packageOrganizer! TraitDescription removeSelector: #packages! TraitDescription removeSelector: #packagesWithoutExtensions! BehaviorTest removeSelector: #testBehaviorSubclasses! !Behavior reorganize! (#'user interface' withAllSubAndSuperclassesDo: unreferencedInstanceVariables) (#'*System-Support' allCallsOn: allUnsentMessages allCallsOnIn: referencedClasses allCallsOn) (#'obsolete subclasses' allLocalCallsOn: basicObsoleteSubclasses addObsoleteSubclass: removeAllObsoleteSubclasses removeObsoleteSubclass: obsoleteSubclasses) (#'*Nautilus' realClass) (#'*Ring-Core-Kernel' protocols methodNamed: methodsInProtocol:) (#'*NativeBoost-Core' nbBindingOf: externalTypeAlias: nbFnArgument:generator:) (#naming environment) (#'initialize-release' initialize nonObsoleteClass superclass:methodDictionary:format:) (#'*ast-core' parseTreeFor:) (#queries whichSelectorsAssign: whichClassDefinesClassVar: whichClassDefinesInstVar: whichSuperclassSatisfies: copiesFromSuperclass: whichSelectorsRead: copiedFromSuperclass: copiesMethodsFromSuperclass copiedMethodsFromSuperclass) (#testing isObsolete isBytes instSize isAnonymous isBits hasAbstractMethods isWeak isCompact canZapMethodDictionary isPointers shouldNotBeRedefined isMeta isWords isVariable isBehavior sourceMatchesBytecodeAt: instSpec isFixed) (#'*Rpackage-Core' originalName) (#'instance creation' new: basicNew: basicNew new) (#enumerating allUnreferencedInstanceVariables subclassesDo: selectSubclasses: withAllSuperAndSubclassesDo: allSubclassesDo: withAllSuperclassesDo: allInstancesDo: allSubInstancesDo: selectSuperclasses: allSuperclassesDo:) (#'accessing class hierarchy' allSubclasses superclass: withAllSubclasses withAllSuperclasses allSuperclassesIncluding: withAllSubclassesDo: superclass allSubclassesWithLevelDo:startingLevel: allSuperclasses) (#'*Tools-Inspector' inspectAllInstances inspectSubInstances) (#traits addTraitSelector:withMethod: traits flattenDownAllTraits traitComposition: users flattenDown: classesComposedWithMe traitsProvidingSelector: users: traitOrClassOfSelector: notifyUsersOfChangedSelector: updateMethodDictionarySelector: removeUser: traitCompositionIncludes: purgeLocalSelectors noteChangedSelectors: traitComposition setTraitCompositionFrom: traitTransformations removeFromComposition: traitCompositionString removeTraitSelector: setTraitComposition: notifyUsersOfChangedSelectors: hasTraitComposition ensureLocalSelectors applyChangesOfNewTraitCompositionReplacing: addUser: addToComposition: addExclusionOf:to: removeAlias:of:) (#'testing class hierarchy' kindOfSubclass includesBehavior: inheritsFrom:) (#cleanup cleanUp cleanUp:) (#printing storeLiteral:on: printHierarchy literalScannedAs:notifying: longPrintOn: printOn:) (#private spaceUsed becomeUncompact flushCache checkCanBeUncompact becomeCompactSimplyAt: becomeCompact indexIfCompact setFormat:) (#'*Manifest-Core' isManifest) (#'accessing instances and variables' allInstVarNames includesSharedPoolNamed: allClassVarNames classVarNames instVarNames instanceCount allSharedPools allowsSubInstVars allSubInstances allInstances sharedPools someInstance subclassInstVarNames) (#'*Fuel' fuelNew fuelNew: fuelIgnoredInstanceVariableNames) (#'accessing method dictionary' allMethods compiledMethodAt:ifAbsent: selectors deregisterLocalSelector: methodDict: compress methodDictionary allSelectorsBelow: sourceCodeAt: allSelectorsAboveUntil: registerLocalSelector: basicLocalSelectors >> lookupSelector: nextQuotePosIn:startingFrom: allSelectorsAbove selectorsWithArgs: methodDictionary: supermostPrecodeCommentFor: basicLocalSelectors: changeRecordsAt: methods sourceCodeAt:ifAbsent: selectorsAndMethodsDo: firstCommentAt: zapAllMethods allSelectorsWithout: compiledMethodAt: classAndMethodFor:do:ifAbsent: firstPrecodeCommentFor: precodeCommentOrInheritedCommentFor: commentsAt: commentsIn: selectorsDo: methodsDo: ultimateSourceCodeAt:ifAbsent: allSelectors) (#'adding/removing methods' localSelectors: addSelectorSilently:withMethod: basicRemoveSelector: localSelectors addSelector:withMethod:notifying: removeSelector: basicAddSelector:withMethod: methodDictAddSelectorSilently:withMethod: addSelector:withMethod: removeSelectorSilently: adoptInstance:) (#'testing method dictionary' thoroughHasSelectorReferringTo:special:byte: isLocalAliasSelector: classBindingOf: canUnderstand: includesLocalSelector: whichSelectorsReferTo:special:byte: isDisabledSelector: thoroughWhichSelectorsReferTo:special:byte: whichSelectorsStoreInto: hasMethods canPerform: whichSelectorsAccess: whichSelectorsReferTo: whichClassIncludesSelector: isAliasSelector: includesSelector:) (#'*Compiler-Kernel' decompilerClass recompile: parserClass compile: bindingOf: compile:classified:notifying:trailer:ifFail: compiler defaultMethodTrailer evaluatorClass compile:notifying: compileAll compileAllFrom: evaluate: compilerClass recompile:from: sourceCodeTemplate recompileChanges binding) (#'memory usage' instancesSizeInMemory) (#initialization emptyMethodDictionary obsolete) (#compiling instVarNamesAndOffsetsDo: variablesAndOffsetsDo:) (#'system startup' shutDown: shutDown startUp startUp:) (#accessing isComposedBy: name classPool poolDictionaryNames numberOfInstanceVariables methodDict format subclassDefinerClass classDepth typeOfClass) (#copying deepCopy copyOfMethodDictionary postCopy) ! !TraitBehavior reorganize! (#'accessing instances and variables' subclassInstVarNames includesSharedPoolNamed: allClassVarNames classVarNames instVarNames instanceCount allSharedPools allowsSubInstVars allSubInstances allInstances sharedPools someInstance allInstVarNames) (#'*Compiler-Kernel' decompilerClass binding parserClass compile: bindingOf: compile:classified:notifying:trailer:ifFail: compiler defaultMethodTrailer evaluatorClass compile:notifying: compileAll evaluate: compileAllFrom: compilerClass recompile:from: sourceCodeTemplate recompileChanges recompile:) (#'*Tools-Browser' browse) (#'memory usage' instancesSizeInMemory) (#'initialize-release' initialize nonObsoleteClass superclass:methodDictionary:format:) (#'instance creation' new: basicNew: basicNew new) (#accessing isComposedBy: poolDictionaryNames classDepth typeOfClass numberOfInstanceVariables classPool) (#private spaceUsed becomeCompactSimplyAt: checkCanBeUncompact becomeCompact flushCache becomeUncompact indexIfCompact setFormat:) (#enumerating selectSuperclasses: subclassesDo: selectSubclasses: withAllSuperclassesDo: allSubclassesDo: withAllSuperAndSubclassesDo: allSubInstancesDo: allInstancesDo: allUnreferencedInstanceVariables allSuperclassesDo:) (#'*Tools-Inspector' inspectAllInstances inspectSubInstances) (#'*Ring-Core-Kernel' protocols methodNamed: methodsInProtocol:) (#'testing method dictionary' thoroughHasSelectorReferringTo:special:byte: isLocalAliasSelector: classBindingOf: whichClassIncludesSelector: whichSelectorsStoreInto: whichSelectorsReferTo:special:byte: isDisabledSelector: hasMethods canUnderstand: thoroughWhichSelectorsReferTo:special:byte: canPerform: whichSelectorsAccess: includesLocalSelector: whichSelectorsReferTo: isAliasSelector: includesSelector:) (#compiling instVarNamesAndOffsetsDo: variablesAndOffsetsDo:) (#naming environment name) (#'*System-Support' allCallsOn: allUnsentMessages allCallsOn allCallsOnIn: referencedClasses) (#'accessing class hierarchy' allSubclasses superclass: withAllSubclasses withAllSuperclasses superclass allSuperclassesIncluding: withAllSubclassesDo: allSubclassesWithLevelDo:startingLevel: allSuperclasses) (#printing printHierarchy literalScannedAs:notifying: storeLiteral:on: printOn: longPrintOn:) (#'*Rpackage-Core' originalName) (#'*Manifest-Core' isManifest) (#'class compatibility' subclassDefinerClass) (#queries whichSelectorsAssign: copiedMethodsFromSuperclass whichClassDefinesInstVar: whichSuperclassSatisfies: copiesFromSuperclass: whichSelectorsRead: copiedFromSuperclass: whichClassDefinesClassVar: copiesMethodsFromSuperclass) (#testing isObsolete instSize isBytes isTrait isAnonymous isBits hasAbstractMethods isWeak isCompact canZapMethodDictionary isPointers shouldNotBeRedefined isMeta isWords isVariable sourceMatchesBytecodeAt: isFixed instSpec) (#'system startup' shutDown: shutDown startUp startUp:) (#'*Nautilus' realClass) (#initialization emptyMethodDictionary obsolete) (#copying deepCopy copyOfMethodDictionary postCopy) (#'testing class hierarchy' kindOfSubclass inheritsFrom: includesBehavior:) (#'user interface' withAllSubAndSuperclassesDo: unreferencedInstanceVariables) (#'*ast-core' parseTreeFor:) (#'accessing method dictionary' ultimateSourceCodeAt:ifAbsent: allMethods compiledMethodAt:ifAbsent: deregisterLocalSelector: selectors methodDict: allSelectorsAboveUntil: allSelectorsBelow: methodDictionary compress sourceCodeAt: basicLocalSelectors removeSelector: registerLocalSelector: lookupSelector: methodDict nextQuotePosIn:startingFrom: allSelectorsAbove methodDictionary: selectorsWithArgs: basicLocalSelectors: supermostPrecodeCommentFor: changeRecordsAt: >> zapAllMethods allSelectorsWithout: methods firstCommentAt: selectorsAndMethodsDo: sourceCodeAt:ifAbsent: compiledMethodAt: classAndMethodFor:do:ifAbsent: firstPrecodeCommentFor: commentsAt: precodeCommentOrInheritedCommentFor: commentsIn: methodsDo: selectorsDo: addSelectorSilently:withMethod: allSelectors) (#cleanup cleanUp cleanUp:) (#'obsolete subclasses' basicObsoleteSubclasses allLocalCallsOn: addObsoleteSubclass: removeAllObsoleteSubclasses removeObsoleteSubclass: obsoleteSubclasses) (#'*NativeBoost-Core' nbBindingOf: externalTypeAlias: nbFnArgument:generator:) (#'adding/removing methods' removeSelectorSilently: localSelectors pureAddSelectorSilently:withMethod: basicRemoveSelector: addSelector:withMethod:notifying: methodDictAddSelectorSilently:withMethod: basicAddSelector:withMethod: addSelector:withMethod: pureRemoveSelector: adoptInstance: localSelectors:) (#traits addTraitSelector:withMethod: traitComposition: flattenDownAllTraits traits users flattenDown: classesComposedWithMe traitsProvidingSelector: users: traitOrClassOfSelector: removeUser: notifyUsersOfChangedSelector: traitCompositionIncludes: updateMethodDictionarySelector: purgeLocalSelectors traitComposition noteChangedSelectors: hasTraitComposition removeFromComposition: traitTransformations setTraitCompositionFrom: traitCompositionString setTraitComposition: notifyUsersOfChangedSelectors: removeTraitSelector: applyChangesOfNewTraitCompositionReplacing: ensureLocalSelectors addUser: addToComposition: addExclusionOf:to: removeAlias:of:) ! TBehavior removeSelector: #subclasses! !TClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:46'! updateOrganizationSelector: aSymbol oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil ^self explicitRequirement.! ! !TClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:50'! noteChangesFrom: oldMethodDict ^self explicitRequirement. ! ! !TClassDescription methodsFor: 'accessing method dictionary' stamp: 'SebastianTleye 7/12/2013 16:47'! addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor ^self explicitRequirement.! ! !TClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:46'! updateOrganizationSelector: aSymbol oldCategory: oldCategoryOrNil newCategory: newCategoryOrNil ^self explicitRequirement.! ! !TClassDescription methodsFor: 'organization updating' stamp: 'SebastianTleye 7/12/2013 16:50'! noteChangesFrom: oldMethodDict ^self explicitRequirement. ! ! !TClassDescription methodsFor: 'accessing method dictionary' stamp: 'SebastianTleye 7/12/2013 16:47'! addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor ^self explicitRequirement.! !