1312 classes. |
1312 classes. |
1313 (maybe, autoloaded classes should unload themselfes when no |
1313 (maybe, autoloaded classes should unload themselfes when no |
1314 longer needed - for example, after some delay when the last instance |
1314 longer needed - for example, after some delay when the last instance |
1315 is gone ...)" |
1315 is gone ...)" |
1316 |
1316 |
1317 |nm newClass| |
1317 |nm newClass privateClasses| |
1318 |
1318 |
1319 self wasAutoloaded ifFalse:[ |
1319 self wasAutoloaded ifFalse:[ |
1320 " |
1320 " |
1321 can it be done ? |
1321 can it be done ? |
1322 (all of my methods must have a source) |
1322 (all of my methods must have a source) |
1326 aMethod hasPrimitiveCode ifTrue:[^ false]. |
1326 aMethod hasPrimitiveCode ifTrue:[^ false]. |
1327 ]. |
1327 ]. |
1328 ]. |
1328 ]. |
1329 |
1329 |
1330 "/ cannot unload, if non-autoloaded subclasses exist ... |
1330 "/ cannot unload, if non-autoloaded subclasses exist ... |
1331 self allSubclassesDo:[:aClass | |
1331 self allSubclassesDo:[:eachSubclass | |
1332 aClass wasAutoloaded ifFalse:[ |
1332 eachSubclass wasAutoloaded ifFalse:[ |
1333 aClass isPrivate ifFalse:[ |
1333 eachSubclass isPrivate ifFalse:[ |
1334 self warn:('cannot unload ' , self name , ' (' , aClass name , ' requires it)'). |
1334 self warn:('cannot unload ' , self name , ' (' , eachSubclass name , ' requires it)'). |
1335 ^ false. |
1335 ^ false. |
1336 ] |
1336 ] |
1337 ] |
1337 ] |
1338 ]. |
1338 ]. |
1339 |
1339 |
1340 self allSubclassesDo:[:aClass | |
1340 self allSubclassesDo:[:eachSubclass | |
1341 aClass wasAutoloaded ifTrue:[ |
1341 eachSubclass wasAutoloaded ifTrue:[ |
1342 aClass unload |
1342 eachSubclass unload |
1343 ] ifFalse:[ |
1343 ] ifFalse:[ |
1344 aClass removeFromSystem. |
1344 eachSubclass removeFromSystem. |
1345 ] |
1345 ] |
1346 ]. |
1346 ]. |
1347 self privateClasses do:[:aClass | |
1347 privateClasses := self privateClasses. |
1348 aClass removeFromSystem. |
1348 privateClasses notEmpty ifTrue:[ |
|
1349 self withoutUpdatingChangesDo:[ |
|
1350 privateClasses do:[:eachPrivateClass | |
|
1351 eachPrivateClass removeFromSystem. |
|
1352 ]. |
|
1353 ]. |
1349 ]. |
1354 ]. |
1350 Transcript showCR:'unloading ' , name , ' ...'. |
1355 Transcript showCR:'unloading ' , name , ' ...'. |
1351 |
1356 |
1352 "/ reinstall as autoloaded |
1357 "/ reinstall as autoloaded |
1353 Autoload removeClass:self. |
1358 Autoload removeClass:self. |