checkin from browser
authorClaus Gittinger <cg@exept.de>
Thu, 18 Mar 1999 17:26:35 +0100
changeset 4052 7b126a2f20ee
parent 4051 87de5a78e265
child 4053 eb3063f80058
checkin from browser
Autoload.st
Class.st
--- a/Autoload.st	Thu Mar 18 13:42:02 1999 +0100
+++ b/Autoload.st	Thu Mar 18 17:26:35 1999 +0100
@@ -112,9 +112,10 @@
 !Autoload class methodsFor:'adding/removing autoloaded classes'!
 
 addClass:aClassName
-    "given a name, install a corresponding autoload class stub for it"
+    "given a name, install a corresponding autoload class stub for it.
+     Return the (autoload-) stubClass or nil, if no new class was created."
 
-    self addClass:aClassName inCategory:'autoloaded-Classes'
+    ^ self addClass:aClassName inCategory:'autoloaded-Classes'
 
     "
      Autoload addClass:'Clock'
@@ -124,18 +125,22 @@
 !
 
 addClass:aClassName inCategory:aCategory
-    "given a name, install a corresponding autoload class stub for it"
+    "given a name, install a corresponding autoload class stub for it.
+     Return the (autoload-) stubClass or nil, if no new class was created."
 
-    |nameSymbol|
+    |nameSymbol cls|
 
     nameSymbol := aClassName asSymbol.
     (Smalltalk at:nameSymbol) isNil ifTrue:[
-	Autoload subclass:nameSymbol
-	     instanceVariableNames:''
-	     classVariableNames:''
-	     poolDictionaries:''
-	     category:aCategory.
-    ]
+        cls := Autoload 
+                subclass:nameSymbol
+                instanceVariableNames:''
+                classVariableNames:''
+                poolDictionaries:''
+                category:aCategory.
+    ].
+    ^ cls
+
     "
      Autoload addClass:'Clock' inCategory:'autoloaded-Demos'
     "
@@ -617,6 +622,6 @@
 !Autoload class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.87 1999-03-07 15:06:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.88 1999-03-18 16:26:20 cg Exp $'
 ! !
 Autoload initialize!
--- a/Class.st	Thu Mar 18 13:42:02 1999 +0100
+++ b/Class.st	Thu Mar 18 17:26:35 1999 +0100
@@ -1043,36 +1043,37 @@
       longer needed - for example, after some delay when the last instance 
       is gone ...)"
 
-    |nm|
+    |nm newClass|
 
     self wasAutoloaded ifFalse:[
-	"
-	 can it be done ?
-	 (all of my methods must have a source)
-	"
-	self methodDictionary do:[:aMethod |
-	    aMethod source isNil ifTrue:[^false].
-	    aMethod hasPrimitiveCode ifTrue:[^ false].
-	].
-	self class methodDictionary do:[:aMethod |
-	    aMethod source isNil ifTrue:[^false].
-	    aMethod hasPrimitiveCode ifTrue:[^ false].
-	].
+        "
+         can it be done ?
+         (all of my methods must have a source)
+        "
+        self methodDictionary do:[:aMethod |
+            aMethod source isNil ifTrue:[^false].
+            aMethod hasPrimitiveCode ifTrue:[^ false].
+        ].
+        self class methodDictionary do:[:aMethod |
+            aMethod source isNil ifTrue:[^false].
+            aMethod hasPrimitiveCode ifTrue:[^ false].
+        ].
     ].
 
     self allSubclassesDo:[:aClass |
-	aClass unload
+        aClass unload
     ].
     Transcript showCR:'unloading ' , name , ' ...'.
 
     Autoload removeClass:self.    
     nm := name.
     Smalltalk at:nm put:nil.
-"/    name := (nm , ' (leftover)') asSymbol.
     ObjectMemory flushInlineCaches.
     ObjectMemory flushMethodCache.
-    Autoload addClass:nm inCategory:category.
-"/  category := #unloaded.
+    newClass := Autoload addClass:nm inCategory:category.
+    newClass notNil ifTrue:[
+        newClass package:package
+    ].
     Smalltalk flushCachedClasses.
     ^ true
 
@@ -3915,5 +3916,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.333 1999-03-09 23:02:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.334 1999-03-18 16:26:35 cg Exp $'
 ! !