CustomNamespace.st
changeset 700 55a8d014066f
parent 697 78f447fe7837
child 704 340954b48789
--- a/CustomNamespace.st	Thu Oct 16 22:39:56 2014 +0200
+++ b/CustomNamespace.st	Fri Oct 17 10:50:37 2014 +0200
@@ -191,12 +191,31 @@
 createMethodImmediate: aClass protocol: aProtocol source: aSource
     "Much like createClassImmediate:superClassName:, but for method"
 
-    changes addChange: (InteractiveAddMethodChange compile: aSource in: aClass classified: aProtocol).
-
-    self execute
+    ^ self createMethodImmediate: aClass protocol: aProtocol source: aSource package: nil
 
     "Created: / 15-06-2014 / 16:06:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 21-09-2014 / 22:43:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 17-10-2014 / 09:58:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+createMethodImmediate: aClass protocol: aProtocol source: aSource package: aPackageId
+    "Much like createClassImmediate:superClassName:, but for method"
+
+    | selector change |
+
+    change := InteractiveAddMethodChange compile: aSource in: aClass classified: aProtocol.
+
+    (aPackageId notNil and: [ (change class canUnderstand: #package:) ]) ifTrue: [ 
+        change package: aPackageId  
+    ].
+
+    changes addChange: change.
+
+    self execute.
+
+    selector := (Parser parseMethodSpecification: aSource) selector.
+    ^ aClass compiledMethodAt: selector
+
+    "Created: / 17-10-2014 / 09:53:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 createMethodImmediate: aClass source: aSource