[Pkg] The Trunk: Tools-yo.404.mcz

commits at source.squeak.org commits at source.squeak.org
Sat May 5 12:20:10 UTC 2012

Bert Freudenberg uploaded a new version of Tools to project The Trunk:

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

Name: Tools-yo.404
Author: yo
Time: 4 May 2012, 9:11:23.233 pm
UUID: bfc2fb69-8de6-461f-a5ab-67e55498cb63
Ancestors: Tools-bf.403

Guard the case when there is a reference to obsolete classes.  One could imagine to have a pseudo package to show obsolete classes referenced from this package, but guarding againt an error is one step toward it anyway.

=============== Diff against Tools-bf.403 ===============

Item was changed:
  ----- Method: DependencyBrowser>>computePackageDependencies: (in category 'package deps') -----
  computePackageDependencies: pkgName
  	"Compute the dependencies for the given package"
  	| pi |
  	classDeps := Dictionary new.
  	packageDeps := Dictionary new.
  	pkgName ifNil:[^self].
  	pi := PackageOrganizer default packageNamed: pkgName ifAbsent:[^self]. "unloaded"
  	pi classes do:[:pkgClass| 
  		(classDeps at: (pkgClass superclass ifNil:[ProtoObject]) name
  			ifAbsentPut:[OrderedCollection new]) add: 
  				(MethodReference class: pkgClass selector: #Definition)].
  	pi methods do:[:mref| | cm |
  		cm := mref compiledMethod.
  		1 to: cm numLiterals do:[:i| | lit |
  			((lit := cm literalAt: i) isVariableBinding and:[lit value isBehavior]) ifTrue:[
  				(classDeps at: lit value name ifAbsentPut:[OrderedCollection new])
  					add: (MethodReference class: cm methodClass selector: cm selector)]]].
  	classDeps keys do:[:className| | aClass pkg |
  		aClass := Smalltalk classNamed: className.
+ 		pkg := aClass ifNil: [nil] ifNotNil: [PackageOrganizer default packageOfClass: aClass ifNone:[nil]].
- 		pkg := PackageOrganizer default packageOfClass: aClass ifNone:[nil].
  		pkg ifNil:[
  			Transcript cr; show: 'WARNING: No package for ', className.
  			(classDeps removeKey: className) do:[:each| Transcript crtab; show: each].
  		] ifNotNil:[
  			(packageDeps at: pkg name ifAbsentPut:[OrderedCollection new]) add: className.
  	(packageDeps removeKey: pkgName ifAbsent:[#()]) do:[:each|
  		classDeps removeKey: each ifAbsent:[].

More information about the Packages mailing list