The Trunk: System-mt.1073.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-mt.1073.mcz

commits-2
Marcel Taeumel uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-mt.1073.mcz

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

Name: System-mt.1073
Author: mt
Time: 22 July 2019, 11:44:51.098271 am
UUID: 03eef6f8-69b5-4a5b-8b2b-9e47fccae8f2
Ancestors: System-mt.1072

Adds support for class bindings to system navigation.

Not sure about "self environment" vs. "aClass environment" because tools will usually create a system navigation with the correct environment set.

=============== Diff against System-mt.1072 ===============

Item was changed:
  ----- Method: SystemNavigation>>allCallsOnClass: (in category 'query') -----
+ allCallsOnClass: aBehaviorOrBinding
- allCallsOnClass: aBehavior
  "Answer a sorted collection of all the methods that refer to aBehavior."
 
+ | binding thisClass result |
+ binding := aBehaviorOrBinding isBehavior
+ ifTrue: [self environment bindingOf: aBehaviorOrBinding theNonMetaClass name]
+ ifFalse: [aBehaviorOrBinding].
+ thisClass := binding value.
+
- | theClass result |
- theClass := aBehavior theNonMetaClass.
  result := self
+ allCallsOn: binding
- allCallsOn: (theClass environment bindingOf: theClass name)
  fromBehaviors: self allBehaviors
  sorted: false.
+
+ self environment allClassesDo: [:otherClass |
+ (otherClass sharedPools includes: thisClass) ifTrue: [
+ result add: (ClassReference class: otherClass) ] ].
+
+ ^ result sort!
- theClass environment allClassesDo: [ :class |
- (class sharedPools includes: theClass) ifTrue: [
- result add: (ClassReference class: class) ] ].
- ^result sort!

Item was changed:
  ----- Method: SystemNavigation>>browseAllCallsOnClass: (in category 'browse') -----
+ browseAllCallsOnClass: aBehaviorOrBinding
- browseAllCallsOnClass: aBehavior
  "Create and schedule a message browser on each method that refers to aBehavior."
  "self default browseAllCallsOnClass: Array"
 
  | behaviorName |
+ behaviorName := aBehaviorOrBinding isBehavior
+ ifTrue: [aBehaviorOrBinding theNonMetaClass name]
+ ifFalse: [aBehaviorOrBinding key].
- behaviorName := aBehavior theNonMetaClass name.
  self
+ browseMessageList: [ self allCallsOnClass: aBehaviorOrBinding ]
- browseMessageList: [ self allCallsOnClass: aBehavior ]
  name: 'Users of ', behaviorName
  autoSelect: behaviorName!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: System-mt.1073.mcz

Jakob Reschke
Am Mo., 22. Juli 2019 um 11:45 Uhr schrieb <[hidden email]>:

Not sure about "self environment" vs. "aClass environment" because tools will usually create a system navigation with the correct environment set.


An environment can have bindings to classes in other environments (via imports). When the imported name is different from the original class's name, then the binding in the importing environment will be an Alias and not the original Binding object. Then the SystemNavigation's environment could give you the Alias, while theClass environment will always give you the Binding. Does it make a difference to allCallsOn:fromBehaviors:sorted:?

The lower paragraph about sharedPools in either case only iterates the classes "owned" by the particular environment, so I think both the old code and the new code will not necessarily find all references to a class as a pool dictionary.
 
=============== Diff against System-mt.1072 ===============

Item was changed:
  ----- Method: SystemNavigation>>allCallsOnClass: (in category 'query') -----
+ allCallsOnClass: aBehaviorOrBinding
- allCallsOnClass: aBehavior
        "Answer a sorted collection of all the methods that refer to aBehavior."

+       | binding thisClass result |
+       binding := aBehaviorOrBinding isBehavior
+               ifTrue: [self environment bindingOf: aBehaviorOrBinding theNonMetaClass name]
+               ifFalse: [aBehaviorOrBinding].
+       thisClass := binding value.
+       
-       | theClass result |
-       theClass := aBehavior theNonMetaClass.
        result := self
+               allCallsOn: binding
-               allCallsOn: (theClass environment bindingOf: theClass name)
                fromBehaviors: self allBehaviors
                sorted: false.
+
+       self environment allClassesDo: [:otherClass |
+               (otherClass sharedPools includes: thisClass) ifTrue: [
+                       result add: (ClassReference class: otherClass) ] ].
+       
+       ^ result sort!
-       theClass environment allClassesDo: [ :class |
-               (class sharedPools includes: theClass) ifTrue: [
-                       result add: (ClassReference class: class) ] ].
-       ^result sort!

Item was changed:
  ----- Method: SystemNavigation>>browseAllCallsOnClass: (in category 'browse') -----
+ browseAllCallsOnClass: aBehaviorOrBinding
- browseAllCallsOnClass: aBehavior
        "Create and schedule a message browser on each method that refers to aBehavior."
        "self default browseAllCallsOnClass: Array"

        | behaviorName |
+       behaviorName := aBehaviorOrBinding isBehavior
+               ifTrue: [aBehaviorOrBinding theNonMetaClass name]
+               ifFalse: [aBehaviorOrBinding key].
-       behaviorName := aBehavior theNonMetaClass name.
        self
+               browseMessageList: [ self allCallsOnClass: aBehaviorOrBinding ]
-               browseMessageList: [ self allCallsOnClass: aBehavior ]
                name: 'Users of ', behaviorName
                autoSelect: behaviorName!