Smalltalk.st
changeset 5246 2ca7b20c4108
parent 5214 f508b6911831
child 5247 4f2cdf6ceb29
equal deleted inserted replaced
5245:fb27aee25da6 5246:2ca7b20c4108
   967      renaming the classVariables (create & copy over values)
   967      renaming the classVariables (create & copy over values)
   968      and patching the classes methods to access the new variables."
   968      and patching the classes methods to access the new variables."
   969 
   969 
   970     |oldName oldSym newSym names oldCVSym newCVSym value oldNameToNewName
   970     |oldName oldSym newSym names oldCVSym newCVSym value oldNameToNewName
   971      oldNameSpace newNameSpace oldBaseName newBaseName privateClasses
   971      oldNameSpace newNameSpace oldBaseName newBaseName privateClasses
   972      oldBaseNameWithoutPrefix newBaseNameWithoutPrefix|
   972      oldBaseNameWithoutPrefix newBaseNameWithoutPrefix i1 i2 nm ns|
   973 
   973 
   974     oldName := aClass name.
   974     oldName := aClass name.
   975     aClass isPrivate ifTrue:[
   975     aClass isPrivate ifTrue:[
   976         oldNameSpace := aClass topOwningClass nameSpace.
   976         oldNameSpace := aClass topOwningClass nameSpace.
   977     ] ifFalse:[
   977     ] ifFalse:[
  1052 "/        ]
  1052 "/        ]
  1053     ].
  1053     ].
  1054 
  1054 
  1055     aClass addChangeRecordForClassRename:oldSym to:newSym.
  1055     aClass addChangeRecordForClassRename:oldSym to:newSym.
  1056 
  1056 
       
  1057     "/ create all intermediate namespaces
       
  1058     i1 := 1.
       
  1059     i2 := 1.
       
  1060     ns := self.
       
  1061     [i2 ~~ 0] whileTrue:[
       
  1062         i2 := aClass name indexOfSubCollection:'::' startingAt:i1.
       
  1063         i2 ~~ 0 ifTrue:[
       
  1064             nm := aClass name copyFrom:i1 to:i2-1.
       
  1065             (ns includesKey:nm asSymbol) ifFalse:[
       
  1066                 ns == Smalltalk ifTrue:[
       
  1067                     ns := Namespace name:nm.
       
  1068                 ] ifFalse:[
       
  1069                     ns := ns name:nm.
       
  1070                 ]
       
  1071             ].
       
  1072             i1 := i2 + 2.
       
  1073         ].
       
  1074     ].
       
  1075     aClass environment:ns.
       
  1076 
  1057     aClass isPrivate ifTrue:[
  1077     aClass isPrivate ifTrue:[
  1058         newNameSpace := aClass topOwningClass nameSpace.
  1078         newNameSpace := aClass topOwningClass nameSpace.
  1059     ] ifFalse:[    
  1079     ] ifFalse:[    
  1060         newNameSpace := aClass nameSpace.
  1080         newNameSpace := aClass nameSpace.
  1061     ].
  1081     ].
  1073                 except:nil.
  1093                 except:nil.
  1074         ]
  1094         ]
  1075     ].
  1095     ].
  1076 
  1096 
  1077     oldNameSpace ~~ newNameSpace ifTrue:[
  1097     oldNameSpace ~~ newNameSpace ifTrue:[
       
  1098 
  1078         "/ all those referencing the class from the old nameSpace
  1099         "/ all those referencing the class from the old nameSpace
  1079         "/ must be recompiled ...
  1100         "/ must be recompiled ...
  1080         "/ (to now access the global from smalltalk)
  1101         "/ (to now access the global from smalltalk)
  1081 
  1102 
  1082         oldNameSpace ~~ Smalltalk ifTrue:[
  1103         oldNameSpace ~~ Smalltalk ifTrue:[
  5480 ! !
  5501 ! !
  5481 
  5502 
  5482 !Smalltalk class methodsFor:'documentation'!
  5503 !Smalltalk class methodsFor:'documentation'!
  5483 
  5504 
  5484 version
  5505 version
  5485     ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.426 2000-01-26 15:55:56 cg Exp $'
  5506     ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.427 2000-02-08 15:26:06 cg Exp $'
  5486 ! !
  5507 ! !