The Trunk: Environments-topa.55.mcz

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

The Trunk: Environments-topa.55.mcz

commits-2
Tobias Pape uploaded a new version of Environments to project The Trunk:
http://source.squeak.org/trunk/Environments-topa.55.mcz

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

Name: Environments-topa.55
Author: topa
Time: 21 January 2015, 11:15:37.19 am
UUID: ac4cd9b0-1628-4881-a2c2-f6d1e1a6f089
Ancestors: Environments-topa.54

3rd attempt at class-rename fixes.

This version
 a) avoids #becomeForward:
 b) fixes method homes after rename
 c) moves the obsolete binding to undeclared but keeps it working.

Effectively, this is the outcome:
| p |
p := Object subclass: #A instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Unknown'.
p compile: 'foo ^ A new'.
" literals of #foo {#A=>A . #foo . #A=>A}"
p rename: #B.
" literals of #foo {#A=>B . #foo . #B=>B}"
p new foo class == p.

=============== Diff against Environments-topa.54 ===============

Item was changed:
  ----- Method: Environment>>renameClass:from:to: (in category 'classes and traits') -----
  renameClass: aClass from: oldName to: newName
  "Rename the class, aClass, to have the title newName."
 
+ | oldBinding newBinding category |
- | binding category |
  category := self organization categoryOfElement: oldName.
  self organization classify: newName under: category suppressIfDefault: true.
  self organization removeElement: oldName.
 
+ oldBinding := self declarationOf: oldName.
- binding := self declarationOf: oldName.
  declarations removeKey: oldName.
+ self binding: oldBinding removedFrom: self.
+ " re-route now undeclared oldBinding "
+ oldBinding value: aClass.
- self binding: binding removedFrom: self.
- undeclared removeKey: oldName.
 
+ newBinding := newName => aClass.
+ aClass updateMethodBindingsTo: newBinding.
+ declarations add: newBinding.
+ self binding: newBinding addedTo: self.
- binding becomeForward: (newName => aClass).
- declarations add: binding.
- self binding: binding addedTo: self.
 
  Smalltalk renamedClass: aClass from: oldName to: newName.
  SystemChangeNotifier uniqueInstance
  classRenamed: aClass
  from: oldName
  to: newName
  inCategory: category!