--- a/Method.st Mon Dec 11 18:29:59 1995 +0100
+++ b/Method.st Mon Dec 11 18:30:57 1995 +0100
@@ -36,7 +36,7 @@
!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.61 1995-12-07 15:16:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.62 1995-12-11 17:30:57 cg Exp $'
!
documentation
@@ -222,7 +222,7 @@
source
"return the sourcestring for the receiver"
- |aStream fileName junk w myClass mgr|
+ |aStream fileName junk w myClass mgr className|
source notNil ifTrue:[
"
@@ -271,10 +271,12 @@
myClass := w at:1.
aStream := myClass sourceStream.
].
- "/
- "/ nope - look in standard places (if there is a source-code manager)
- "/
+
aStream isNil ifTrue:[
+ "/
+ "/ nope - look in standard places
+ "/ (if there is a source-code manager - otherwise, we already did that)
+ "/
mgr notNil ifTrue:[
fileName := Smalltalk getSourceFileName:source.
fileName notNil ifTrue:[
@@ -288,6 +290,23 @@
aStream := source asFilename readStream.
]
].
+
+ (aStream isNil and:[w isNil and:[source notNil]]) ifTrue:[
+ "/
+ "/ mhmh - seems to be a method which used to be in some
+ "/ class, but has been overwritten by another or removed.
+ "/ (i.e. it has no containing class anyMore)
+ "/ try to guess the class from the sourceFileName.
+ "/ and retry.
+ "/
+ className := Smalltalk classNameForFile:source.
+ className knownAsSymbol ifTrue:[
+ myClass := Smalltalk at:className asSymbol ifAbsent:nil.
+ myClass notNil ifTrue:[
+ aStream := myClass sourceStream.
+ ]
+ ]
+ ]
]
].
@@ -296,7 +315,7 @@
junk := aStream nextChunk.
"
- keep a weak reference - maybe its needed again soon ...
+ keep a weak reference - it may be needed again soon ...
"
LastFileReference isNil ifTrue:[
LastFileReference := WeakArray new:1
@@ -307,7 +326,7 @@
].
^ junk
- "Modified: 7.12.1995 / 13:22:32 / cg"
+ "Modified: 11.12.1995 / 14:53:40 / cg"
!
source:aString