allow compiling a method for a nil class
authorClaus Gittinger <cg@exept.de>
Mon, 24 Mar 2003 22:57:37 +0100
changeset 1378 01bd44f4360c
parent 1377 24f668298ef1
child 1379 7cbcca310b75
allow compiling a method for a nil class
ByteCodeCompiler.st
--- a/ByteCodeCompiler.st	Sun Mar 02 21:42:55 2003 +0100
+++ b/ByteCodeCompiler.st	Mon Mar 24 22:57:37 2003 +0100
@@ -3009,7 +3009,7 @@
         ].
     ].
 
-    selector notNil ifTrue:[
+    (aClass notNil and:[selector notNil]) ifTrue:[
         oldMethod := aClass compiledMethodAt:selector.
         oldMethod notNil ifTrue:[
             oldCategory := oldMethod category.
@@ -3274,18 +3274,19 @@
     newMethod source:newSource.
     newMethod setCategory:newCategory.
 
-    (install not
-    and:[(oldMethod := aClass compiledMethodAt:selector) notNil]) ifTrue:[
-        pkg := oldMethod package
-    ] ifFalse:[
-        (AllowExtensionsToPrivateClasses or:[aClass owningClass isNil]) ifTrue:[
-            pkg := Class packageQuerySignal query.
+    aClass notNil ifTrue:[
+        (install not
+        and:[(oldMethod := aClass compiledMethodAt:selector) notNil]) ifTrue:[
+            pkg := oldMethod package
         ] ifFalse:[
-            pkg := aClass owningClass package
+            (AllowExtensionsToPrivateClasses or:[aClass owningClass isNil]) ifTrue:[
+                pkg := Class packageQuerySignal query.
+            ] ifFalse:[
+                pkg := aClass owningClass package
+            ].
         ].
+        newMethod setPackage:pkg.
     ].
-    newMethod setPackage:pkg.
-
     (self contextMustBeReturnable) ifTrue:[
         newMethod contextMustBeReturnable:true
     ].
@@ -3829,7 +3830,7 @@
 !ByteCodeCompiler class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.212 2003-03-02 18:39:00 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.213 2003-03-24 21:57:37 cg Exp $'
 ! !
 
 ByteCodeCompiler initialize!