Context.st
branchjv
changeset 18045 c0c600e0d3b3
parent 18017 7fef9e17913f
parent 15091 d7ec3bbf1a07
child 18056 ac63da6d9b6c
--- a/Context.st	Tue Apr 16 14:27:04 2013 +0200
+++ b/Context.st	Thu Apr 18 20:41:50 2013 +0200
@@ -597,6 +597,12 @@
     ^ self
 !
 
+methodSelector
+    "return the method's (or home method's) selector"
+
+    ^ self methodHome selector
+!
+
 ntemp
     "return the number of temporary variables of the Block/Method.
      (for debugging only).
@@ -822,6 +828,20 @@
     "Modified: / 21-07-2011 / 13:30:21 / cg"
 ! !
 
+!Context methodsFor:'enumerating'!
+
+withAllSendersDo:aBlock
+    "evaluate aBlock for me and all contexts of my sender chain"
+
+    |con|
+
+    con := self.
+    [ con notNil ] whileTrue:[
+        aBlock value:con.
+        con := con sender.
+    ]
+! !
+
 !Context methodsFor:'error handling'!
 
 invalidReturn:returnValue
@@ -922,13 +942,7 @@
     "print a full walkback starting at the receiver
      - used only for MiniDebuggers walkback print"
 
-    |context|
-
-    context := self.
-    [context notNil] whileTrue: [
-        context fullPrint.
-        context := context sender
-    ]
+    self withAllSendersDo:[:con | con fullPrint].
 
     "
      thisContext fullPrintAll
@@ -1543,14 +1557,7 @@
 fullPrintAllOn:aStream
     "print a full walkback (incl arguments) starting at the receiver"
 
-    |context|
-
-    context := self.
-    [context notNil] whileTrue: [
-        context fullPrintOn:aStream.
-        aStream cr.
-        context := context sender
-    ]
+    self withAllSendersDo:[:con | con fullPrintOn:aStream. aStream cr].
 
     "
      thisContext fullPrintAllOn:Transcript
@@ -1643,14 +1650,7 @@
 printAllOn:aStream
     "print a brief walkback (excl. arguments) starting at the receiver"
 
-    |context|
-
-    context := self.
-    [context notNil] whileTrue: [
-        context printOn:aStream.
-        aStream cr.
-        context := context sender
-    ]
+    self withAllSendersDo:[:con | con printOn:aStream. aStream cr].
 
     "
      thisContext printAllOn:Transcript
@@ -2474,11 +2474,11 @@
 !Context class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.179 2013-01-24 15:22:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.181 2013-04-15 15:28:48 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.179 2013-01-24 15:22:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.181 2013-04-15 15:28:48 cg Exp $'
 !
 
 version_SVN