Colin Putney uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-cwp.44.mcz==================== Summary ====================
Name: Environments-cwp.44
Author: cwp
Time: 4 January 2014, 6:05:07.717 pm
UUID: b56ef524-2bcf-4efb-92ff-6c065b7cc771
Ancestors: Environments-cwp.43
Make #bindingOf:ifAbsent: ignore undeclared bindings, per Levente's insight.
=============== Diff against Environments-cwp.43 ===============
Item was changed:
----- Method: Environment>>bindingOf:ifAbsent: (in category 'binding') -----
bindingOf: aSymbol ifAbsent: aBlock
+ ^ bindings bindingOf: aSymbol ifAbsent: aBlock!
- ^ bindings bindingOf: aSymbol ifAbsent:
- [undeclared bindingOf: aSymbol ifAbsent: aBlock]!
Item was changed:
----- Method: Environment>>forgetClass:logged: (in category 'classes and traits') -----
forgetClass: aClass logged: aBool
| binding |
self flag: #review.
+ "The class might not bound to its name"
aBool ifTrue:
[SystemChangeNotifier uniqueInstance
classRemoved: aClass fromCategory: aClass category].
binding := declarations bindingOf: aClass name.
binding ifNotNil:
[self organization removeElement: aClass name.
Smalltalk removeFromStartUpList: aClass.
Smalltalk removeFromShutDownList: aClass.
undeclared declare: aClass name from: declarations.
declarations removeKey: aClass name ifAbsent: [].
[undeclared at: aClass name put: nil]
on: AttemptToWriteReadOnlyGlobal
do: [:n | n resume: true].
self binding: binding removedFrom: self]
!
Item was changed:
+ ----- Method: Environment>>poolUsers (in category 'emulating') -----
- ----- Method: Environment>>poolUsers (in category 'as yet unclassified') -----
poolUsers
"Answer a dictionary of pool name -> classes that refer to it.
Also includes any globally know dictionaries (such as
Smalltalk, Undeclared etc) which although not strictly
accurate is potentially useful information"
"Smalltalk poolUsers"
| poolUsers |
poolUsers := Dictionary new.
self keys
do: [:k | "yes, using isKindOf: is tacky but for reflective code like
this it is very useful. If you really object you can:-
a) go boil your head.
b) provide a better answer.
your choice."
| pool refs |
(((pool := self at: k) isKindOf: Dictionary)
or: [pool isKindOf: SharedPool class])
ifTrue: [refs := (self systemNavigation allClasses
select: [:c | c sharedPools identityIncludes: pool]
thenCollect: [:c | c name]) asOrderedCollection.
refs
add: (self systemNavigation
allCallsOn: (self associationAt: k)).
poolUsers at: k put: refs]].
^ poolUsers!