DebugView.st
changeset 13414 91c34e5eaf4e
parent 13412 23550f667aba
child 13415 3ed3e30cbf8e
--- a/DebugView.st	Fri Aug 30 10:27:36 2013 +0200
+++ b/DebugView.st	Fri Aug 30 14:37:02 2013 +0200
@@ -4107,18 +4107,37 @@
 browseBlocksHome
     "browse the receiver block's home method (if a value-like send is selected)"
 
-    |cls sel block|
+    |cls sel block mthd|
 
     selectedContext isNil ifTrue:[^ self].
     (block := selectedContext receiver) isBlock ifFalse:[ ^ self ].
 
-    cls := block method mclass.
-    sel := block method selector.
-
-    (cls includesSelector:sel) ifFalse:[
-        sel := nil
-    ].
-    cls browserClass openInClass:cls selector:sel.
+    mthd := block method.
+    cls := mthd mclass.
+    sel := mthd selector.
+
+    (cls notNil and:[(cls includesSelector:sel)]) ifTrue:[
+        cls browserClass openInClass:cls selector:sel.
+        ^ self
+    ].
+
+    mthd source notEmptyOrNil ifTrue:[
+        (Dialog confirm:'Block''s home method is (no longer) present in any class.\Do you want to browse the method instead?' withCRs)
+        ifTrue:[
+            UserPreferences current systemBrowserClass 
+                browseMethods:{ mthd } title:'Unbound Method' sort:false
+            "/ TextView openWith:mthd source title:'Unbound Method''s Source'.
+        ].
+        ^ self
+    ].
+    cls notNil ifTrue:[
+        (Dialog confirm:'Block''s home method is (no longer) present in any class and no source can be shown.\Do you want to browse the method''s last class instead?' withCRs)
+        ifTrue:[
+            cls browserClass openInClass:cls selector:nil.
+        ].
+        ^ self
+    ].
+    Dialog information:'Block''s home method is (no longer) present in any class.'.
 !
 
 browseClass
@@ -8868,15 +8887,15 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.624 2013-08-29 23:58:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.625 2013-08-30 12:37:02 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.624 2013-08-29 23:58:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.625 2013-08-30 12:37:02 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: DebugView.st,v 1.624 2013-08-29 23:58:12 cg Exp $'
+    ^ '$Id: DebugView.st,v 1.625 2013-08-30 12:37:02 cg Exp $'
 ! !