[squeak-dev] The Trunk: Tools-mt.1085.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Dec 9 09:12:33 UTC 2021


Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1085.mcz

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

Name: Tools-mt.1085
Author: mt
Time: 9 December 2021, 10:12:31.310176 am
UUID: a5c416d3-2818-4a46-abfb-7c524be90692
Ancestors: Tools-mt.1084

Complements an earlier change in HierarchyBrowser to show traits in a hierarchy. Now, for classes, also show the traits they use along with their superclasses.

=============== Diff against Tools-mt.1084 ===============

Item was added:
+ ----- Method: HierarchyBrowser>>allAncestorsOfClass:withLevelDo: (in category 'hierarchy - classes') -----
+ allAncestorsOfClass: class withLevelDo: classAndLevelBlock
+ 
+ 	self
+ 		allAncestorsOfClass: class
+ 		withLevelDo: classAndLevelBlock
+ 		startingLevel: 1.!

Item was added:
+ ----- Method: HierarchyBrowser>>allAncestorsOfClass:withLevelDo:startingLevel: (in category 'hierarchy - classes') -----
+ allAncestorsOfClass: class withLevelDo: classAndLevelBlock startingLevel: level
+ 
+ 	(class superclass ifNil: [#()] ifNotNil: [:c | {c}]), class traits
+ 		do: [:ancestor |
+ 			ancestor isTrait
+ 				ifTrue: [
+ 					self
+ 						allAncestorsOfTrait: ancestor
+ 						withLevelDo: classAndLevelBlock
+ 						startingLevel: level + 1]
+ 				ifFalse: [
+ 					self
+ 						allAncestorsOfClass: ancestor
+ 						withLevelDo: classAndLevelBlock
+ 						startingLevel: level + 1].
+ 			classAndLevelBlock value: ancestor value: level].!

Item was changed:
+ ----- Method: HierarchyBrowser>>allAncestorsOfTrait:withLevelDo: (in category 'hierarchy - traits') -----
- ----- Method: HierarchyBrowser>>allAncestorsOfTrait:withLevelDo: (in category 'traits') -----
  allAncestorsOfTrait: trait withLevelDo: traitAndLevelBlock
  
  	self
  		allAncestorsOfTrait: trait
  		withLevelDo: traitAndLevelBlock
  		startingLevel: 1.!

Item was changed:
+ ----- Method: HierarchyBrowser>>allAncestorsOfTrait:withLevelDo:startingLevel: (in category 'hierarchy - traits') -----
- ----- Method: HierarchyBrowser>>allAncestorsOfTrait:withLevelDo:startingLevel: (in category 'traits') -----
  allAncestorsOfTrait: trait withLevelDo: traitAndLevelBlock startingLevel: level
  
  	trait traitComposition asTraitComposition traits
  		do: [:ancestor |
  			self
  				allAncestorsOfTrait: ancestor
  				withLevelDo: traitAndLevelBlock
  				startingLevel: level + 1.
  			traitAndLevelBlock value: ancestor value: level].!

Item was added:
+ ----- Method: HierarchyBrowser>>allSuccessorsOfClass:withLevelDo:startingLevel: (in category 'hierarchy - classes') -----
+ allSuccessorsOfClass: class withLevelDo: classAndLevelBlock startingLevel: level 
+ 
+ 	classAndLevelBlock value: class value: level.
+ 	(class subclasses sorted: #name ascending)
+ 		do: [:successor |
+ 			self
+ 				allSuccessorsOfClass: successor 
+ 				withLevelDo: classAndLevelBlock
+ 				startingLevel: level + 1].!

Item was changed:
+ ----- Method: HierarchyBrowser>>allSuccessorsOfTrait:withLevelDo:startingLevel: (in category 'hierarchy - traits') -----
- ----- Method: HierarchyBrowser>>allSuccessorsOfTrait:withLevelDo:startingLevel: (in category 'traits') -----
  allSuccessorsOfTrait: trait withLevelDo: traitAndLevelBlock startingLevel: level 
  
  	traitAndLevelBlock value: trait value: level.
+ 	(trait users "includes classes and traits" sorted: #name ascending)
- 	(trait users sorted: #name ascending)
  		do: [:user |
  			self
  				allSuccessorsOfTrait: user 
  				withLevelDo: traitAndLevelBlock
  				startingLevel: level + 1].!

Item was changed:
+ ----- Method: HierarchyBrowser>>defineClass:notifying: (in category 'hierarchy - classes') -----
- ----- Method: HierarchyBrowser>>defineClass:notifying: (in category 'class functions') -----
  defineClass: defString notifying: aController  
  
  	super defineClass: defString notifying: aController.
  	self updateAfterClassChange.!

Item was changed:
+ ----- Method: HierarchyBrowser>>defineTrait:notifying: (in category 'hierarchy - traits') -----
- ----- Method: HierarchyBrowser>>defineTrait:notifying: (in category 'traits') -----
  defineTrait: defString notifying: aController  
  
  	super defineTrait: defString notifying: aController.
  	self updateAfterClassChange.!

Item was changed:
+ ----- Method: HierarchyBrowser>>initHierarchyForClass: (in category 'hierarchy - classes') -----
- ----- Method: HierarchyBrowser>>initHierarchyForClass: (in category 'initialization') -----
  initHierarchyForClass: aClassOrMetaClass 
+ 
+ 	| nonMetaClass baseLevel |
- 	| nonMetaClass superclasses |
  	centralClass := aClassOrMetaClass.
  	nonMetaClass := aClassOrMetaClass theNonMetaClass.
  	self selectEnvironment: aClassOrMetaClass environment.
  	metaClassIndicated := aClassOrMetaClass isMeta.
  	classDisplayList := OrderedCollection new.
+ 	baseLevel := 0.
+ 	self
+ 		allAncestorsOfClass: nonMetaClass
+ 		withLevelDo: [ : each : level | baseLevel := baseLevel max: level ].
+ 	self
+ 		allAncestorsOfClass: nonMetaClass
+ 		withLevelDo:
+ 			[ : classOrTrait : level | | label |
+ 				label := (String streamContents:
+ 					[:stream | baseLevel - level timesRepeat: [ stream nextPutAll: '  ' ].
+ 					stream nextPutAll: classOrTrait name ]).
+ 				classOrTrait isTrait
+ 					ifTrue: [ label := label asText addAttribute: TextEmphasis italic ].
+ 				classDisplayList add: label ].
+ 	self
+ 		allSuccessorsOfClass: nonMetaClass
+ 		withLevelDo:
+ 			[ : each : level | classDisplayList add:
- 	(superclasses := nonMetaClass allSuperclasses reversed) withIndexDo:
- 		[ : each : indent | classDisplayList add:
- 			(String streamContents:
- 				[ : stream | indent - 1 timesRepeat: [ stream nextPutAll: '  ' ].
- 				stream nextPutAll: each name ]) ].
- 	nonMetaClass
- 		allSubclassesWithLevelDo:
- 			[ : eachClass : lvl | classDisplayList add:
  				(String streamContents:
+ 					[ : stream | level timesRepeat: [ stream nextPutAll: '  ' ].
+ 					stream nextPutAll: each name ]) ]
+ 		startingLevel: baseLevel.
- 					[ : stream | lvl timesRepeat: [ stream nextPutAll: '  ' ].
- 					stream nextPutAll: eachClass name ]) ]
- 		startingLevel: superclasses size.
  		
  	self changed: #classList.
+ 	self selectClass: nonMetaClass.!
- 	self selectClass: nonMetaClass!

Item was changed:
+ ----- Method: HierarchyBrowser>>initHierarchyForTrait: (in category 'hierarchy - traits') -----
- ----- Method: HierarchyBrowser>>initHierarchyForTrait: (in category 'traits') -----
  initHierarchyForTrait: baseTraitOrClassTrait
  
  	| baseTrait baseLevel |
  	centralClass := baseTraitOrClassTrait.
  	baseTrait := baseTraitOrClassTrait baseTrait.
  	self selectEnvironment: baseTraitOrClassTrait environment.
  	metaClassIndicated := baseTraitOrClassTrait isClassTrait.
  	classDisplayList := OrderedCollection new.
  	baseLevel := 0.
  	self
  		allAncestorsOfTrait: baseTrait
+ 		withLevelDo: [ : each : level | baseLevel := baseLevel max: level ].
- 		withLevelDo: [:each :level | baseLevel := baseLevel max: level].
  	self
  		allAncestorsOfTrait: baseTrait
  		withLevelDo:
  			[:each :level | classDisplayList add:
  				(String streamContents:
  					[ : stream | baseLevel - level timesRepeat: [ stream nextPutAll: '  ' ].
  					stream nextPutAll: each name ]) ].
  	self
  		allSuccessorsOfTrait: baseTrait
  		withLevelDo:
+ 			[:classOrTrait :level | | label |
+ 				label := (String streamContents:
- 			[:each :level | classDisplayList add:
- 				(String streamContents:
  					[ : stream | level timesRepeat: [ stream nextPutAll: '  ' ].
+ 					stream nextPutAll: classOrTrait name ]).
+ 				classOrTrait isTrait
+ 					ifFalse: [ label := label asText addAttribute: TextEmphasis italic ].
+ 				classDisplayList add: label ]
- 					stream nextPutAll: each name ]) ]
  		startingLevel: baseLevel.
  	
  	self changed: #classList.
  	self selectClass: baseTrait.!



More information about the Squeak-dev mailing list