The Trunk: System-ar.226.mcz

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

The Trunk: System-ar.226.mcz

commits-2
Andreas Raab uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ar.226.mcz

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

Name: System-ar.226
Author: ar
Time: 6 January 2010, 11:59:21 am
UUID: fb917e8c-0f30-5541-9b25-47ce3e86772f
Ancestors: System-ul.224

Fixes a bug in mapUniclasses after unloading Etoys.

=============== Diff against System-ul.224 ===============

Item was changed:
  ----- Method: DeepCopier>>mapUniClasses (in category 'like fullCopy') -----
  mapUniClasses
  "For new Uniclasses, map their class vars to the new objects.  And their additional class instance vars.  (scripts slotInfo) and cross references like (player321)."
  "Players also refer to each other using associations in the References dictionary.  Search the methods of our Players for those.  Make new entries in References and point to them."
  | pp newKey |
 
  newUniClasses ifFalse: [^ self]. "All will be siblings.  uniClasses is empty"
  "Uniclasses use class vars to hold onto siblings who are referred to in code"
+ pp := (Smalltalk at: #Player ifAbsent:[^self]) class superclass instSize.
- pp := (Smalltalk at: #Player) class superclass instSize.
  uniClasses do: [:playersClass | "values = new ones"
  playersClass classPool associationsDo: [:assoc |
  assoc value: (assoc value veryDeepCopyWith: self)].
  playersClass scripts: (playersClass privateScripts veryDeepCopyWith: self). "pp+1"
  "(pp+2) slotInfo was deepCopied in copyUniClass and that's all it needs"
  pp+3 to: playersClass class instSize do: [:ii |
  playersClass instVarAt: ii put:
  ((playersClass instVarAt: ii) veryDeepCopyWith: self)].
  ].
 
  "Make new entries in References and point to them."
  References keys "copy" do: [:playerName | | oldPlayer |
  oldPlayer := References at: playerName.
  (references includesKey: oldPlayer) ifTrue: [
  newKey := (references at: oldPlayer) "new player" uniqueNameForReference.
  "now installed in References"
  (references at: oldPlayer) renameTo: newKey]].
  uniClasses "values" do: [:newClass | | newSelList oldSelList |
  oldSelList := OrderedCollection new.   newSelList := OrderedCollection new.
  newClass selectorsDo: [:sel |
  (newClass compiledMethodAt: sel) literals do: [:assoc | | newAssoc |
  assoc isVariableBinding ifTrue: [
  (References associationAt: assoc key ifAbsent: [nil]) == assoc ifTrue: [
  newKey := (references at: assoc value ifAbsent: [assoc value])
  externalName asSymbol.
  (assoc key ~= newKey) & (References includesKey: newKey) ifTrue: [
  newAssoc := References associationAt: newKey.
  newClass methodDictionary at: sel put:
  (newClass compiledMethodAt: sel) clone. "were sharing it"
  (newClass compiledMethodAt: sel)
  literalAt: ((newClass compiledMethodAt: sel) literals indexOf: assoc)
  put: newAssoc.
  (oldSelList includes: assoc key) ifFalse: [
  oldSelList add: assoc key.  newSelList add: newKey]]]]]].
  oldSelList with: newSelList do: [:old :new |
  newClass replaceSilently: old to: new]]. "This is text replacement and can be wrong"!