WrappedMethod.st
changeset 3306 b4017262b2cd
parent 3296 b35d12f98716
child 3329 a4cbc797038b
child 3366 ec8284efff96
--- a/WrappedMethod.st	Fri Jun 14 03:25:20 2013 +0000
+++ b/WrappedMethod.st	Fri Jun 14 14:25:03 2013 +0200
@@ -53,7 +53,7 @@
 !WrappedMethod class methodsFor:'others'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/WrappedMethod.st,v 1.34 2013-06-09 13:32:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/WrappedMethod.st,v 1.35 2013-06-14 12:25:03 cg Exp $'
 ! !
 
 !WrappedMethod class methodsFor:'registration'!
@@ -195,6 +195,21 @@
     ^ self originalMethod programmingLanguage
 !
 
+replaceOriginalMethodWith:aNewMethod
+    "change the original method which is going to be invoked by this wrapper.
+     The only place where this makes sense is when the original method has to be 
+     replaced by a recompiled breakpointed method (in the debugger)."
+
+    "a kludge: it is in my literal array somewhere"
+    1 to:(super numLiterals) do:[:i |
+        (super literalAt:i) isMethod ifTrue:[
+            super literalAt:i put:aNewMethod.
+            ^ self.
+        ]
+    ].
+    ^ self
+!
+
 restricted:aBoolean
     ^ self originalMethod restricted:aBoolean
 !
@@ -235,6 +250,19 @@
     "Created: / 01-07-2011 / 10:03:32 / cg"
 ! !
 
+!WrappedMethod methodsFor:'printing and storing'!
+
+printOn:aStream
+    "put a printed representation of the receiver onto aStream.
+     Since methods do not store their class/selector, we have to search
+     for it here."
+
+    self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle).
+    aStream nextPutAll:'(for '.
+    aStream nextPutAll:self originalMethod whoString.
+    aStream nextPutAll:')'.
+! !
+
 !WrappedMethod methodsFor:'private'!
 
 annotationAtIndex: index
@@ -355,6 +383,6 @@
 !WrappedMethod class methodsFor:'documentation'!
 
 version_SVN
-    ^ '$Id: WrappedMethod.st,v 1.34 2013-06-09 13:32:56 cg Exp $'
+    ^ '$Id: WrappedMethod.st,v 1.35 2013-06-14 12:25:03 cg Exp $'
 ! !