equal
deleted
inserted
replaced
21 |
21 |
22 Method comment:' |
22 Method comment:' |
23 COPYRIGHT (c) 1989 by Claus Gittinger |
23 COPYRIGHT (c) 1989 by Claus Gittinger |
24 All Rights Reserved |
24 All Rights Reserved |
25 |
25 |
26 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.49 1995-09-17 17:56:43 claus Exp $ |
26 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.50 1995-10-23 16:54:01 cg Exp $ |
27 '! |
27 '! |
28 |
28 |
29 !Method class methodsFor:'documentation'! |
29 !Method class methodsFor:'documentation'! |
30 |
30 |
31 copyright |
31 copyright |
42 " |
42 " |
43 ! |
43 ! |
44 |
44 |
45 version |
45 version |
46 " |
46 " |
47 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.49 1995-09-17 17:56:43 claus Exp $ |
47 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.50 1995-10-23 16:54:01 cg Exp $ |
48 " |
48 " |
49 ! |
49 ! |
50 |
50 |
51 documentation |
51 documentation |
52 " |
52 " |
215 !Method methodsFor:'accessing'! |
215 !Method methodsFor:'accessing'! |
216 |
216 |
217 source |
217 source |
218 "return the sourcestring for the receiver" |
218 "return the sourcestring for the receiver" |
219 |
219 |
220 |aStream fileName junk| |
220 |aStream fileName junk w myClass| |
221 |
221 |
222 source notNil ifTrue:[ |
222 source notNil ifTrue:[ |
223 " |
223 " |
224 if sourcePosition is nonNil, its the fileName and |
224 if sourcePosition is nonNil, its the fileName and |
225 sourcePosition is the offset. |
225 sourcePosition is the offset. |
250 fileName := Smalltalk getSourceFileName:source. |
250 fileName := Smalltalk getSourceFileName:source. |
251 fileName isNil ifTrue:[ |
251 fileName isNil ifTrue:[ |
252 fileName := source |
252 fileName := source |
253 ]. |
253 ]. |
254 aStream := fileName asFilename readStream. |
254 aStream := fileName asFilename readStream. |
|
255 aStream isNil ifTrue:[ |
|
256 "/ |
|
257 "/ hard case - there is no source file for this class |
|
258 "/ (neither in the source-dir-path, nor in the current directory). |
|
259 "/ |
|
260 self dynamic ifTrue:[ |
|
261 "/ |
|
262 "/ we look if my binary is from a dynamically loaded module, |
|
263 "/ and, if so, look in the modules directory for the |
|
264 "/ source file. |
|
265 "/ |
|
266 w := self who. |
|
267 w notNil ifTrue:[ |
|
268 myClass := w at:1. |
|
269 ObjectFileLoader notNil ifTrue:[ |
|
270 ObjectFileLoader loadedObjectHandlesDo:[:h | |
|
271 |f| |
|
272 |
|
273 (h classes includes:myClass) ifTrue:[ |
|
274 f := h pathName. |
|
275 f := f asFilename directory. |
|
276 f := f construct:source. |
|
277 f exists ifTrue:[ |
|
278 aStream := f readStream. |
|
279 ]. |
|
280 ] |
|
281 ]. |
|
282 ]. |
|
283 ] |
|
284 ] |
|
285 ] |
|
286 |
255 ]. |
287 ]. |
256 |
288 |
257 aStream notNil ifTrue:[ |
289 aStream notNil ifTrue:[ |
258 aStream position:sourcePosition. |
290 aStream position:sourcePosition. |
259 junk := aStream nextChunk. |
291 junk := aStream nextChunk. |