[squeak-dev] The Trunk: System-eem.1242.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Oct 10 00:56:52 UTC 2021
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.1242.mcz
==================== Summary ====================
Name: System-eem.1242
Author: eem
Time: 9 October 2021, 5:56:44.727952 pm
UUID: c64c4476-34da-4974-b440-833417d434a3
Ancestors: System-mt.1241
Make searching for unused class vars single-pass. With the new search for implicit literals multi-pass searches for unused class vars can be rather slow.
Provide a convenience to find all pragma selectors.
=============== Diff against System-mt.1241 ===============
Item was added:
+ ----- Method: SystemNavigation>>allPragmaSelectors (in category 'query') -----
+ allPragmaSelectors
+ "Answer the set of all pragma selectors."
+ "self systemNavigation allPragmaSelectors asArray sort"
+
+ | result |
+ result := Set new.
+ self allSelectorsAndMethodsDo:
+ [:behavior :selector :method |
+ method pragmas do:
+ [:pragma|
+ result add: pragma keyword]].
+ ^result!
Item was changed:
----- Method: SystemNavigation>>allUnreferencedClassVariablesOf: (in category 'query') -----
allUnreferencedClassVariablesOf: aClass
+ "Answer a list of the names of all the receiver's unreferenced class vars,
+ including those defined in superclasses."
+ | unusedClassVars sequence |
+ aClass isMeta ifTrue:
+ [^self allUnreferencedClassVariablesOf: aClass theNonMetaClass].
+ unusedClassVars := Set new.
+ aClass withAllSuperclasses do:
+ [:class| unusedClassVars addAll: class classPool associations].
+ (aClass includesBehavior: SharedPool)
+ ifTrue:
+ [self allSelectorsAndMethodsDo:
+ [:s :m|
+ m allLiteralsDo: [:l| l isVariableBinding ifTrue: [unusedClassVars remove: l ifAbsent: nil]]]]
+ ifFalse:
+ [aClass withAllSuperclasses, (aClass withAllSuperclasses collect: [:class| class class]) do:
+ [:behavior |
+ behavior selectorsAndMethodsDo:
+ [:s :m|
+ m allLiteralsDo: [:l| l isVariableBinding ifTrue: [unusedClassVars remove: l ifAbsent: nil]]].
+ unusedClassVars isEmpty ifTrue: [^OrderedCollection new]]].
+ "now compute the order in which to present the unused varables..."
+ sequence := OrderedCollection new.
+ aClass withAllSuperclasses reverseDo:
+ [:aSuperClass |
+ sequence addAll: (aSuperClass classVarNames select:
+ [:classVarName|
+ unusedClassVars includes: (aSuperClass classPool associationAt: classVarName)])].
+ ^sequence!
- "Answer a list of the names of all the receiver's unreferenced class
- vars, including those defined in superclasses"
- | aList |
- aList := OrderedCollection new.
- aClass withAllSuperclasses
- reverseDo: [:aSuperClass | aSuperClass classVarNames
- do: [:var | (self allCallsOn: (aSuperClass classPool associationAt: var)) isEmpty
- ifTrue: [aList add: var]]].
- ^ aList!
More information about the Squeak-dev
mailing list
|