author | Claus Gittinger <cg@exept.de> |
Fri, 24 Sep 1999 20:19:38 +0200 | |
changeset 4811 | a71c422eadc8 |
parent 4751 | 174a92d4ba3f |
child 4817 | 097ef6d01ce6 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
159 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3934 | 13 |
CompiledCode variableSubclass:#Method |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
14 |
instanceVariableNames:'source sourcePosition category package' |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
15 |
classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
16 |
LastWhoClass LastFileLock LastMethodSources CompilationLock' |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
17 |
poolDictionaries:'' |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
18 |
category:'Kernel-Methods' |
1 | 19 |
! |
20 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
21 |
Object subclass:#MethodWhoInfo |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
22 |
instanceVariableNames:'myClass mySelector' |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
23 |
classVariableNames:'' |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
24 |
poolDictionaries:'' |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
25 |
privateIn:Method |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
26 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
27 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
28 |
!Method class methodsFor:'documentation'! |
42 | 29 |
|
88 | 30 |
copyright |
31 |
" |
|
32 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
159 | 33 |
All Rights Reserved |
88 | 34 |
|
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
42 | 44 |
documentation |
45 |
" |
|
68 | 46 |
this class defines protocol for executable methods; |
47 |
both compiled and interpreted methods are represented by this class. |
|
48 |
Compiled methods have a non-nil code field, while interpreted methods have |
|
49 |
a nil code field and non-nil byteCode field. |
|
88 | 50 |
If there are both non-nil code and bytecode fields, the VM will execute |
227 | 51 |
the machine-code of a method. If both are nil when executed, a noByteCode |
52 |
message is sent by the VM to the method where a signal is raised. |
|
1 | 53 |
|
227 | 54 |
The methods sourcecode is represented by source and sourcePosition: |
55 |
- if sourcePosition is a Number, the source-field is the fileName and |
|
56 |
sourcePosition is the character offset of the source-chunk in this source file. |
|
57 |
- If sourcePosition is nil, the source is the string in the source field. |
|
58 |
(an old version used ExternalString instances here, but that lead to |
|
59 |
10000 additional little objects ...) |
|
1 | 60 |
|
68 | 61 |
The flags field defines things like the number of method-locals, |
227 | 62 |
method arguments and stack requirements (for interpreted methods). |
68 | 63 |
Do not depend on any value in the flags field - it may change without |
64 |
notice. |
|
1 | 65 |
|
438 | 66 |
Notice, that in ST/X, method can be subclassed; executable code is |
67 |
identified not by being a subclass of Block or Method, but instead by |
|
68 |
having the executable flag bit set in the class. The VM can execute anything |
|
69 |
which is identified as executable (assuming that the first instance variable |
|
70 |
is the machine-code address) - this allows for easy future extension. |
|
71 |
||
1293 | 72 |
[Instance variables:] |
93 | 73 |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
74 |
source <String> the source itself (if sourcePosition isNil) |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
75 |
or the fileName where the source is found |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
76 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
77 |
sourcePosition <Integer> the position of the methods chunk in the file |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
78 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
79 |
category <Symbol> the methods category |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
80 |
package <Symbol> the package, in which the methods was defined |
227 | 81 |
|
82 |
||
1293 | 83 |
[Class variables:] |
227 | 84 |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
85 |
PrivateMethodSignal raised on privacy violation (see docu) |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
86 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
87 |
LastFileReference weak reference to the last sourceFile |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
88 |
LastSourceFileName to speedup source access via NFS |
93 | 89 |
|
68 | 90 |
WARNING: layout known by compiler and runtime system - dont change |
1293 | 91 |
|
92 |
[author:] |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
93 |
Claus Gittinger |
42 | 94 |
" |
176 | 95 |
! |
96 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
97 |
dynamicMethods |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
98 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
99 |
On systems which support dynamic loading of machine code (SYS5.4, Linux), |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
100 |
methods may now be compiled to machine code from within the browser, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
101 |
and the resulting machine code object be loaded in. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
102 |
The ObjectFileLoader keeps (weak) handles to the resulting methods and |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
103 |
invalidates the corresponding method objects, if the underlying methods |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
104 |
object code is unloaded. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
105 |
Invalid methods will trap into the debugger when executed; |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
106 |
also, the browser marks them as '(* not executable *)' in its method list. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
107 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
108 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
109 |
|
176 | 110 |
privacy |
111 |
" |
|
112 |
ST/X includes an EXPERIMENTAL implementation of method privacy. |
|
113 |
Individual methods may be set to private or protected via the |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
114 |
#privacy:#private and #privacy:#protected messages. Also, categories may be |
202 | 115 |
filedIn as a whole as private using #privateMethodsFor: or as |
116 |
protected using #protectedMethodsFor: instead of the well known #methodsFor:. |
|
117 |
||
176 | 118 |
The additional #publicMethodsFor: is for documentation purposes, and |
227 | 119 |
is equivalent to #methodsFor: (also to support fileIn of ENVY methods). |
176 | 120 |
|
121 |
Private methods may be executed only when called via a self or super-send |
|
122 |
from the superclass, the class itself or subclasses. |
|
415 | 123 |
Protected methods may not be called from subclasses, i.e. they may only |
124 |
be called via self sends from within the current class. |
|
125 |
(i.e. private methods are less private than protected ones) |
|
176 | 126 |
|
127 |
When such a situation arises, the VM (runtime system) will raise the |
|
128 |
PrivateMethodSignal exception (if nonNil), which usually brings you into the |
|
129 |
debugger. |
|
130 |
||
227 | 131 |
If PrivateMethodSignal is nil, the VM will not check for this, and |
176 | 132 |
execution is as usual. (you may want to nil-it for production code, |
133 |
and leave it non nil during development). |
|
134 |
||
135 |
NOTICE: there is no (not yet ?) standard defined for method privacy, |
|
136 |
however, the interface was designed to be somewhat ENVY compatible (from |
|
137 |
what can be deduced by reading PD code). |
|
138 |
Also, the usability of privacy is still to be tested. |
|
415 | 139 |
This interface, the implementation and the rules for when a privacy violation |
140 |
may change (in case of some ANSI standard being defined). |
|
227 | 141 |
Be warned and send me suggestions & critics (constructive ;-) |
176 | 142 |
" |
42 | 143 |
! ! |
1 | 144 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
145 |
!Method class methodsFor:'initialization'! |
109 | 146 |
|
147 |
initialize |
|
1254 | 148 |
"create signals" |
149 |
||
109 | 150 |
PrivateMethodSignal isNil ifTrue:[ |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
151 |
"EXPERIMENTAL" |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
152 |
PrivateMethodSignal := ExecutionErrorSignal newSignalMayProceed:true. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
153 |
PrivateMethodSignal nameClass:self message:#privateMethodSignal. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
154 |
PrivateMethodSignal notifierString:'attempt to execute private/protected method'. |
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
155 |
]. |
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
156 |
|
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
157 |
LastFileLock isNil ifTrue:[ |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
158 |
LastFileLock := Semaphore forMutualExclusion name:'LastFileLock'. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
159 |
LastFileReference := WeakArray new:1. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
160 |
LastFileReference at:1 put:0. |
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
161 |
]. |
1254 | 162 |
|
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
163 |
CompilationLock := Semaphore forMutualExclusion name:'MethodCompilation'. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
164 |
|
1254 | 165 |
"Modified: 22.4.1996 / 16:34:38 / cg" |
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
166 |
"Modified: 3.1.1997 / 16:58:16 / stefan" |
109 | 167 |
! ! |
168 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
169 |
!Method class methodsFor:'Signal constants'! |
159 | 170 |
|
171 |
privateMethodSignal |
|
176 | 172 |
"return the signal raised when a private/protected method is called |
173 |
by some other object (i.e. not a self- or super send)" |
|
174 |
||
159 | 175 |
^ PrivateMethodSignal |
176 |
! ! |
|
177 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
178 |
!Method class methodsFor:'binary storage'! |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
179 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
180 |
binaryDefinitionFrom: stream manager: manager |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
181 |
"read my definition from stream." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
182 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
183 |
|cls sel| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
184 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
185 |
"type-byte" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
186 |
stream nextByte == 0 ifTrue:[ |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
187 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
188 |
built-in method |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
189 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
190 |
cls := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
191 |
sel := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
192 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
193 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
194 |
mhmh - on the source system, this was a machinecode |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
195 |
method, while here its an interpreted one ... |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
196 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
197 |
cls isLoaded ifFalse:[ |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
198 |
cls autoload |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
199 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
200 |
^ cls compiledMethodAt:sel |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
201 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
202 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
203 |
bytecode method |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
204 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
205 |
^ super binaryDefinitionFrom:stream manager:manager |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
206 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
207 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
208 |
binaryFullDefinitionFrom:stream manager:manager |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
209 |
"retrieve a full bytecoded-method." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
210 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
211 |
|snapId cat flags code lits m sourceFilename sourcePos source| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
212 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
213 |
snapId := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
214 |
cat := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
215 |
flags := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
216 |
lits := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
217 |
sourceFilename := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
218 |
sourcePos := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
219 |
sourcePos isNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
220 |
source := manager nextObject. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
221 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
222 |
code := manager nextObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
223 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
224 |
snapId == ObjectMemory snapshotID ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
225 |
ObjectMemory incrementSnapshotID |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
226 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
227 |
|
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1477
diff
changeset
|
228 |
m := Method basicNew:(lits size). |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
229 |
cat notNil ifTrue:[m category:cat]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
230 |
m flags:flags. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
231 |
m literals:lits. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
232 |
m byteCode:code. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
233 |
sourcePos isNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
234 |
m source:source |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
235 |
] ifFalse:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
236 |
m sourceFilename:sourceFilename position:sourcePos |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
237 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
238 |
^ m |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
239 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
240 |
"Created: 16.1.1996 / 14:44:08 / cg" |
1493
33e226c7d187
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
1477
diff
changeset
|
241 |
"Modified: 24.6.1996 / 12:29:35 / stefan" |
2064 | 242 |
"Modified: 5.1.1997 / 01:09:56 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
243 |
! ! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
244 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
245 |
!Method class methodsFor:'queries'! |
3 | 246 |
|
247 |
isBuiltInClass |
|
1264 | 248 |
"return true if this class is known by the run-time-system. |
249 |
Here, true is returned for myself, false for subclasses." |
|
3 | 250 |
|
251 |
^ self == Method |
|
1264 | 252 |
|
253 |
"Modified: 23.4.1996 / 15:59:50 / cg" |
|
44 | 254 |
! |
255 |
||
747 | 256 |
methodPrivacySupported |
257 |
"return true, if the system was compiled to support methodPrivacy. |
|
258 |
You should not depend on that feature being available." |
|
259 |
||
260 |
%{ /* NOCONTEXT */ |
|
261 |
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE) |
|
262 |
RETURN (true); |
|
263 |
#else |
|
264 |
RETURN (false); |
|
265 |
#endif |
|
266 |
%} |
|
3342 | 267 |
! |
268 |
||
269 |
resourceTypes |
|
270 |
"get the types of resources for which a spec definition and corresponding editor exist" |
|
271 |
||
3343 | 272 |
^#(canvas menu image fileImage help hierarchicalList tabList tableColumns) |
3 | 273 |
! ! |
274 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
275 |
!Method class methodsFor:'special'! |
957 | 276 |
|
277 |
flushSourceStreamCache |
|
278 |
LastSourceFileName := nil |
|
279 |
||
280 |
"Created: 9.2.1996 / 19:05:28 / cg" |
|
281 |
! ! |
|
282 |
||
1 | 283 |
!Method methodsFor:'accessing'! |
284 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
285 |
category |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
286 |
"return the methods category or nil" |
737
4ed893ad3f0f
try more to find source of obsolete methods
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
287 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
288 |
^ category |
1 | 289 |
! |
290 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
291 |
category:aStringOrSymbol |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
292 |
"set the methods category" |
1 | 293 |
|
3934 | 294 |
aStringOrSymbol notNil ifTrue:[ |
295 |
category := aStringOrSymbol asSymbol |
|
296 |
] |
|
297 |
||
298 |
"Modified: / 13.11.1998 / 23:55:05 / cg" |
|
1 | 299 |
! |
300 |
||
39 | 301 |
comment |
302 |
"return the methods comment. |
|
68 | 303 |
This is done by searching for and returning the first comment |
159 | 304 |
from the methods source (excluding any double-quotes). |
68 | 305 |
Returns nil if there is no comment (or source is not available)." |
39 | 306 |
|
3297
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
307 |
|src comment comments parser| |
39 | 308 |
|
159 | 309 |
src := self source. |
310 |
src isNil ifTrue:[^ nil]. |
|
93 | 311 |
|
1236
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
312 |
parser := Parser for:src in:nil. |
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
313 |
parser ignoreErrors; ignoreWarnings; saveComments:true. |
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
314 |
parser parseMethodSpec. |
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
315 |
comments := parser comments. |
3297
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
316 |
comments size ~~ 0 ifTrue:[ |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
317 |
comment := comments first string. |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
318 |
(comment withoutSpaces endsWith:'}') ifTrue:[ |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
319 |
"if first comment is a pragma, take next comment" |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
320 |
comment := comments at:2 ifAbsent:nil. |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
321 |
comment notNil ifTrue:[ |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
322 |
comment := comment string. |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
323 |
]. |
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
324 |
]. |
1254 | 325 |
]. |
3297
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
326 |
^ comment. |
93 | 327 |
|
328 |
" |
|
1236
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
329 |
(Method compiledMethodAt:#comment) comment |
1254 | 330 |
(Object class compiledMethodAt:#infoPrinting:) comment |
93 | 331 |
" |
1236
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
332 |
|
3289 | 333 |
"Modified: / 17.2.1998 / 14:50:00 / cg" |
3297
309058293d49
Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents:
3289
diff
changeset
|
334 |
"Modified: / 23.2.1998 / 10:26:08 / stefan" |
39 | 335 |
! |
336 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
337 |
getSource |
3160 | 338 |
"low-level access to the source instance-variable. |
4751 | 339 |
For internal (compiler) use only. |
3160 | 340 |
This is NOT always the methods source string" |
341 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
342 |
^ source |
414 | 343 |
! |
344 |
||
4751 | 345 |
getSourcePosition |
346 |
"low-level access to the sourcePosition instance-variable. |
|
347 |
For internal (compiler) use only. |
|
348 |
This is NOT always the methods sourcePosition" |
|
349 |
||
350 |
^ sourcePosition |
|
351 |
! |
|
352 |
||
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
353 |
localSourceFilename:aFileName position:aNumber |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
354 |
"set the methods sourcefile/position indicating, that |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
355 |
this is a local file." |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
356 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
357 |
source := aFileName. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
358 |
sourcePosition := aNumber negated |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
359 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
360 |
"Created: 16.1.1997 / 01:25:52 / cg" |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
361 |
! |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
362 |
|
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
363 |
localSourceStream |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
364 |
"try to open a stream from a local source file, |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
365 |
searching in standard places." |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
366 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
367 |
|fileName aStream| |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
368 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
369 |
package notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
370 |
fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
371 |
fileName notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
372 |
aStream := fileName asFilename readStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
373 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
374 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
375 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
376 |
fileName := Smalltalk getSourceFileName:source. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
377 |
fileName notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
378 |
aStream := fileName asFilename readStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
379 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
380 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
381 |
^ nil |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
382 |
! |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
383 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
384 |
package |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
385 |
"return the package-symbol" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
386 |
|
3950 | 387 |
^ package ? ' ' |
388 |
||
389 |
"Modified: / 29.12.1998 / 01:16:05 / cg" |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
390 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
391 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
392 |
package:aSymbol |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
393 |
"set the package-symbol" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
394 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
395 |
package := aSymbol |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
396 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
397 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
398 |
source |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
399 |
"return the sourcestring for the receiver" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
400 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
401 |
|aStream fileName junk who myClass mgr className| |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
402 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
403 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
404 |
if sourcePosition is nonNil, its the fileName and |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
405 |
abs(sourcePosition) is the offset. |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
406 |
Otherwise, source is the real source |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
407 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
408 |
sourcePosition isNil ifTrue:[^ source]. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
409 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
410 |
source notNil ifTrue:[ |
3370
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
411 |
LastMethodSources notNil ifTrue:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
412 |
junk := LastMethodSources at:self ifAbsent:nil. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
413 |
junk notNil ifTrue:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
414 |
^ junk |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
415 |
] |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
416 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
417 |
|
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
418 |
"/ keep the last source file open, because open/close |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
419 |
"/ operations maybe slow on NFS-mounted file systems. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
420 |
"/ Since the reference to the file is weak, it will be closed |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
421 |
"/ automatically if the file is not referenced for a while. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
422 |
"/ Neat trick. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
423 |
|
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
424 |
LastFileLock critical:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
425 |
aStream := LastFileReference at:1. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
426 |
LastFileReference at:1 put:0. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
427 |
|
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
428 |
aStream == 0 ifTrue:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
429 |
aStream := nil. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
430 |
] ifFalse:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
431 |
LastSourceFileName = source ifFalse:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
432 |
aStream close. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
433 |
aStream := nil. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
434 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
435 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
436 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
437 |
|
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
438 |
aStream := self sourceStream. |
3370
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
439 |
aStream notNil ifTrue:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
440 |
Stream positionErrorSignal handle:[:ex | |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
441 |
^ nil |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
442 |
] do:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
443 |
aStream position:sourcePosition abs. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
444 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
445 |
junk := aStream nextChunk. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
446 |
|
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
447 |
" |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
448 |
keep a weak reference - it may be needed again soon ... |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
449 |
" |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
450 |
LastFileLock critical:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
451 |
(LastFileReference at:1) == 0 ifTrue:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
452 |
LastFileReference at:1 put:aStream. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
453 |
LastSourceFileName := source. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
454 |
] ifFalse:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
455 |
aStream close. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
456 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
457 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
458 |
] |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
459 |
]. |
2979 | 460 |
|
461 |
junk notNil ifTrue:[ |
|
3370
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
462 |
LastMethodSources isNil ifTrue:[ |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
463 |
LastMethodSources := CacheDictionary new:20. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
464 |
]. |
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
465 |
LastMethodSources at:self put:junk. |
2979 | 466 |
]. |
467 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
468 |
^ junk |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
469 |
|
3160 | 470 |
"Modified: / 7.1.1997 / 16:20:09 / stefan" |
3370
be1b59238c4c
care for position-error when extracting source
Claus Gittinger <cg@exept.de>
parents:
3343
diff
changeset
|
471 |
"Modified: / 9.4.1998 / 12:37:41 / cg" |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
472 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
473 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
474 |
source:aString |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
475 |
"set the methods sourcestring" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
476 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
477 |
source := aString. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
478 |
sourcePosition := nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
479 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
480 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
481 |
sourceFilename |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
482 |
"return the sourcefilename if source is extern; nil otherwise" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
483 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
484 |
sourcePosition notNil ifTrue:[^ source]. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
485 |
^ nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
486 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
487 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
488 |
sourceFilename:aFileName position:aNumber |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
489 |
"set the methods sourcefile/position" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
490 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
491 |
source := aFileName. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
492 |
sourcePosition := aNumber |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
493 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
494 |
|
2812 | 495 |
sourceLineNumber |
496 |
"return the lineNumber of my source within the returned |
|
497 |
source sourcestring. |
|
498 |
For ST methods, the returned sourceString is always the |
|
499 |
methods pure source; therefore, the lineNumber is always 1." |
|
500 |
||
501 |
^ 1 |
|
502 |
||
503 |
"Created: 30.7.1997 / 15:42:01 / cg" |
|
504 |
! |
|
505 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
506 |
sourcePosition |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
507 |
"return the sourceposition if source is extern; nil otherwise" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
508 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
509 |
sourcePosition isNil ifTrue:[^ sourcePosition]. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
510 |
^ sourcePosition abs |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
511 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
512 |
"Modified: 16.1.1997 / 01:28:25 / cg" |
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
513 |
! |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
514 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
515 |
sourceStream |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
516 |
"return an open sourceStream (needs positioning)" |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
517 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
518 |
|aStream fileName junk who myClass mgr className sep dir mod| |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
519 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
520 |
" |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
521 |
if sourcePosition is nonNil, its the fileName and |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
522 |
abs(sourcePosition) is the offset. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
523 |
Otherwise, source is the real source |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
524 |
" |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
525 |
source isNil ifTrue:[^ nil]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
526 |
sourcePosition isNil ifTrue:[^ nil]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
527 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
528 |
"/ keep the last source file open, because open/close |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
529 |
"/ operations maybe slow on NFS-mounted file systems. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
530 |
"/ Since the reference to the file is weak, it will be closed |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
531 |
"/ automatically if the file is not referenced for a while. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
532 |
"/ Neat trick. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
533 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
534 |
LastFileLock critical:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
535 |
aStream := LastFileReference at:1. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
536 |
LastFileReference at:1 put:0. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
537 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
538 |
aStream == 0 ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
539 |
aStream := nil. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
540 |
] ifFalse:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
541 |
LastSourceFileName = source ifFalse:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
542 |
aStream close. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
543 |
aStream := nil. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
544 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
545 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
546 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
547 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
548 |
"/ a negative sourcePosition indicates |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
549 |
"/ that this is a local file (not to be requested |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
550 |
"/ via the sourceCodeManager) |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
551 |
"/ This kludge was added, to allow sourceCode to be |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
552 |
"/ saved to a local source file (i.e. 'st.src') |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
553 |
"/ and having a clue for which file is meant later. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
554 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
555 |
sourcePosition < 0 ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
556 |
aStream := source asFilename readStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
557 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
558 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
559 |
fileName := Smalltalk getSourceFileName:source. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
560 |
fileName notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
561 |
aStream := fileName asFilename readStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
562 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
563 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
564 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
565 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
566 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
567 |
"/ if there is no SourceManager, look in local standard places first |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
568 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
569 |
(mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
570 |
aStream := self localSourceStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
571 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
572 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
573 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
574 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
575 |
"/ nope - ask my class for the source (this also invokes the SCMgr) |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
576 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
577 |
who := self who. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
578 |
who notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
579 |
myClass := who methodClass. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
580 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
581 |
(package notNil and:[package ~= myClass package]) ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
582 |
mgr notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
583 |
"/ try to get the source using my package information ... |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
584 |
sep := package indexOfAny:'/\:'. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
585 |
sep ~~ 0 ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
586 |
mod := package copyTo:sep - 1. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
587 |
dir := package copyFrom:sep + 1. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
588 |
aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
589 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
590 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
591 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
592 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
593 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
594 |
aStream := myClass sourceStreamFor:source. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
595 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
596 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
597 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
598 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
599 |
"/ nope - look in standard places |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
600 |
"/ (if there is a source-code manager - otherwise, we already did that) |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
601 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
602 |
mgr notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
603 |
aStream := self localSourceStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
604 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
605 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
606 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
607 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
608 |
"/ final chance: try current directory |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
609 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
610 |
aStream isNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
611 |
aStream := source asFilename readStream. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
612 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
613 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
614 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
615 |
(who isNil and:[source notNil]) ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
616 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
617 |
"/ mhmh - seems to be a method which used to be in some |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
618 |
"/ class, but has been overwritten by another or removed. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
619 |
"/ (i.e. it has no containing class anyMore) |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
620 |
"/ try to guess the class from the sourceFileName. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
621 |
"/ and retry. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
622 |
"/ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
623 |
className := Smalltalk classNameForFile:source. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
624 |
className knownAsSymbol ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
625 |
myClass := Smalltalk at:className asSymbol ifAbsent:nil. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
626 |
myClass notNil ifTrue:[ |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
627 |
aStream := myClass sourceStreamFor:source. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
628 |
aStream notNil ifTrue:[^ aStream]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
629 |
] |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
630 |
] |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
631 |
]. |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
632 |
|
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
633 |
^ nil |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
634 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
635 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
636 |
!Method methodsFor:'accessing-visibility'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
637 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
638 |
isIgnored |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
639 |
"return true, if this is an ignored method. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
640 |
Ignored methods are physically present in the source file, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
641 |
but no code is generated for it by stc, and the VM does not see |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
642 |
it in its message lookup. |
747 | 643 |
(i.e. setting a method to #ignored, and sending that selector, |
644 |
leads to either the superclasses implementation to be called, |
|
645 |
or a doesNotUnderstand exception to be raised) |
|
646 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
647 |
Notice: this is a nonstandard feature, not supported |
747 | 648 |
by other smalltalk implementations and not specified in the ANSI spec. |
649 |
||
650 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
651 |
It may change or even vanish (if it shows to be not useful)." |
|
652 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
653 |
^ self privacy == #ignored |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
654 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
655 |
"Modified: / 23.1.1998 / 15:23:02 / stefan" |
176 | 656 |
! |
657 |
||
658 |
isPrivate |
|
659 |
"return true, if this is a private method. |
|
660 |
Execution of private methods is only allowed via self/super sends |
|
661 |
from superclasses, the class itself or subclasses. |
|
662 |
If a private method is called by some other class, a runtime |
|
663 |
error (PrivateMethodSignal) is raised. |
|
664 |
Notice: method privacy is a nonstandard feature, not supported |
|
665 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 666 |
|
176 | 667 |
This is EXPERIMENTAL - and being evaluated for usability. |
668 |
It may change or even vanish (if it shows to be not useful)." |
|
669 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
670 |
^ self privacy == #private |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
671 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
672 |
"Modified: / 23.1.1998 / 15:23:13 / stefan" |
68 | 673 |
! |
674 |
||
176 | 675 |
isProtected |
676 |
"return true, if this is a protected method. |
|
677 |
Execution of protected methods is only allowed via self sends |
|
678 |
from superclasses or the class itself. |
|
679 |
If a protected method is called by some other class, a runtime |
|
680 |
error (PrivateMethodSignal) is raised. |
|
747 | 681 |
|
176 | 682 |
Notice: method privacy is a nonstandard feature, not supported |
683 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 684 |
|
176 | 685 |
This is EXPERIMENTAL - and being evaluated for usability. |
686 |
It may change or even vanish (if it shows to be not useful)." |
|
687 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
688 |
^ self privacy == #protected |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
689 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
690 |
"Modified: / 23.1.1998 / 15:23:27 / stefan" |
176 | 691 |
! |
692 |
||
693 |
isPublic |
|
694 |
"return true, if this is a public method - I.e. can be executed via any send. |
|
747 | 695 |
This is the default and how other smalltalk implementations treat all methods. |
696 |
||
360 | 697 |
Notice: method privacy is a nonstandard feature, not supported |
698 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 699 |
|
360 | 700 |
This is EXPERIMENTAL - and being evaluated for usability. |
701 |
It may change or even vanish (if it shows to be not useful)." |
|
176 | 702 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
703 |
^ self privacy == #public |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
704 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
705 |
"Modified: / 23.1.1998 / 15:23:40 / stefan" |
176 | 706 |
! |
707 |
||
747 | 708 |
isRestricted |
709 |
"return the flag bit stating that this method is restricted. |
|
710 |
Execution of the receiver will only be allowed if the system is not in |
|
711 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
|
712 |
error (PrivateMethodSignal) is raised. |
|
713 |
||
714 |
Notice: method restriction is a nonstandard feature, not supported |
|
715 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
716 |
||
717 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
718 |
It may change or even vanish (if it shows to be not useful)." |
|
719 |
||
720 |
%{ /* NOCONTEXT */ |
|
721 |
#ifdef F_RESTRICTED |
|
2868 | 722 |
INT f = __intVal(__INST(flags)); |
747 | 723 |
|
724 |
if (f & F_RESTRICTED) { |
|
725 |
RETURN (true); |
|
726 |
} |
|
727 |
#endif |
|
728 |
%}. |
|
729 |
^ false |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
730 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
731 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
732 |
privacy |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
733 |
"return a symbol describing the methods access rights (privacy); |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
734 |
Currently, this is one of #private, #protected, #public or #ignored. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
735 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
736 |
Notice: method privacy is a nonstandard feature, not supported |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
737 |
by other smalltalk implementations and not specified in the ANSI spec. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
738 |
If at all, use it for debugging purposes, to catch messagesends |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
739 |
which are not supposed to be sent by others. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
740 |
(especially, if working in a team, while integrating other peoples work) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
741 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
742 |
This is EXPERIMENTAL - and being evaluated for usability. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
743 |
It may change or even vanish (if it shows to be not useful)." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
744 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
745 |
%{ /* NOCONTEXT */ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
746 |
/* I made this a primitive to get the define constant from stc.h */ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
747 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
748 |
#if defined(M_PRIVACY) && (defined(F_PRIVATE) || defined(F_CLASSPRIVATE) || defined(F_IGNORED)) |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
749 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
750 |
INT f = __intVal(__INST(flags)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
751 |
switch (f & M_PRIVACY) { |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
752 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
753 |
# ifdef F_PRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
754 |
case F_PRIVATE: |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
755 |
RETURN (@symbol(private)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
756 |
break; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
757 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
758 |
# ifdef F_CLASSPRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
759 |
case F_CLASSPRIVATE: |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
760 |
RETURN (@symbol(protected)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
761 |
break; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
762 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
763 |
# ifdef F_IGNORED |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
764 |
case F_IGNORED: |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
765 |
RETURN (@symbol(ignored)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
766 |
break; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
767 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
768 |
} |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
769 |
#endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
770 |
%}. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
771 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
772 |
^ #public |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
773 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
774 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
775 |
privacy:aSymbol |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
776 |
"set the methods access rights (privacy) from a symbol; |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
777 |
Currently, this must be one of #private, #protected, #public or #ignored. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
778 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
779 |
Notice: method privacy is a nonstandard feature, not supported |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
780 |
by other smalltalk implementations and not specified in the ANSI spec. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
781 |
If at all, use it for debugging purposes, to catch messagesends |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
782 |
which are not supposed to be sent by others. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
783 |
(especially, if working in a team, while integrating other peoples work) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
784 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
785 |
This is EXPERIMENTAL - and being evaluated for usability. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
786 |
It may change or even vanish (if it shows to be not useful)." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
787 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
788 |
|old| |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
789 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
790 |
old := self privacy. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
791 |
self setPrivacy:aSymbol. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
792 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
793 |
"/ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
794 |
"/ no need to flush, if changing from private to public |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
795 |
"/ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
796 |
(aSymbol == #public and:[old ~~ #ignored]) ifFalse:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
797 |
ObjectMemory flushCaches. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
798 |
] |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
799 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
800 |
"Modified: / 27.8.1995 / 22:58:08 / claus" |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
801 |
"Modified: / 23.1.1998 / 15:19:07 / stefan" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
802 |
! |
747 | 803 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
804 |
restricted:aBoolean |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
805 |
"set or clear the flag bit stating that this method is restricted. |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
806 |
Execution of the receiver will only be allowed if the system is not in |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
807 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
808 |
error (PrivateMethodSignal) is raised. |
747 | 809 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
810 |
Notice: method restriction is a nonstandard feature, not supported |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
811 |
by other smalltalk implementations and not specified in the ANSI spec. |
747 | 812 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
813 |
This is EXPERIMENTAL - and being evaluated for usability. |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
814 |
It may change or even vanish (if it shows to be not useful)." |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
815 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
816 |
%{ /* NOCONTEXT */ |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
817 |
/* I made this a primitive to get the define constant from stc.h */ |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
818 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
819 |
#ifdef F_RESTRICTED |
2868 | 820 |
INT f = __intVal(__INST(flags)); |
821 |
INT old; |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
822 |
|
747 | 823 |
old = f; |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
824 |
if (aBoolean == true) |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
825 |
f |= F_RESTRICTED; |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
826 |
else |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
827 |
f &= ~F_RESTRICTED; |
1133 | 828 |
__INST(flags) = __MKSMALLINT(f); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
829 |
if (old & F_RESTRICTED) |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
830 |
RETURN(true); |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
831 |
#endif |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
832 |
%}. |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
833 |
^ false |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
834 |
|
747 | 835 |
" |
836 |
(ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true |
|
837 |
" |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
838 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
839 |
"Created: 7.11.1995 / 20:36:19 / stefan" |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
840 |
! |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
841 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
842 |
setPrivacy:aSymbol |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
843 |
"set the methods access rights (privacy) from a symbol; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
844 |
Currently, this must be one of #private, #protected, #public or #ignored. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
845 |
#setPrivacy: simply sets the attribute. When changing methods, that |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
846 |
have already been called, #privacy: should be used. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
847 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
848 |
Notice: method privacy is a nonstandard feature, not supported |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
849 |
by other smalltalk implementations and not specified in the ANSI spec. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
850 |
If at all, use it for debugging purposes, to catch messagesends |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
851 |
which are not supposed to be sent by others. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
852 |
(especially, if working in a team, while integrating other peoples work) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
853 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
854 |
This is EXPERIMENTAL - and being evaluated for usability. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
855 |
It may change or even vanish (if it shows to be not useful)." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
856 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
857 |
%{ /* NOCONTEXT */ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
858 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
859 |
#if defined(M_PRIVACY) |
2868 | 860 |
INT f = __intVal(__INST(flags)); |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
861 |
INT p; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
862 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
863 |
if (aSymbol == @symbol(public)) |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
864 |
p = 0; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
865 |
else if (aSymbol == @symbol(private)) |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
866 |
p = F_PRIVATE; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
867 |
else if (aSymbol == @symbol(protected)) |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
868 |
p = F_CLASSPRIVATE; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
869 |
else if (aSymbol == @symbol(ignored)) |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
870 |
p = F_IGNORED; |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
871 |
else |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
872 |
RETURN(false); /* illegal symbol */ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
873 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
874 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
875 |
f = (f & ~M_PRIVACY) | p; |
1133 | 876 |
__INST(flags) = __MKSMALLINT(f); |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
877 |
#endif |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
878 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
879 |
%}. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
880 |
^ true |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
881 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
882 |
"Modified: 27.8.1995 / 22:58:08 / claus" |
1 | 883 |
! ! |
884 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
885 |
!Method methodsFor:'binary storage'! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
886 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
887 |
asByteCodeMethod |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
888 |
"if the receiver has no bytecodes, create & return a method having |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
889 |
the same semantics as the receiver, but uses interpreted bytecodes. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
890 |
Otherwise, return the receiver. The new method is not installed in |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
891 |
the methodDictionary of any class - just returned. |
2064 | 892 |
If the method contains primitive code, this may return a method |
893 |
without bytecode. |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
894 |
Can be used to obtain a bytecode version of a machine-code method, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
895 |
for binary storage or dynamic recompilation (which is not yet finished) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
896 |
or to compile lazy methods down to executable ones." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
897 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
898 |
|doMachineCode mthd| |
1 | 899 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
900 |
byteCode notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
901 |
" |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
902 |
is already a bytecoded method |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
903 |
" |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
904 |
^ self |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
905 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
906 |
doMachineCode := Compiler stcCompilation:#never. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
907 |
[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
908 |
mthd := self asExecutableMethod. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
909 |
] valueNowOrOnUnwindDo:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
910 |
Compiler stcCompilation:doMachineCode. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
911 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
912 |
^ mthd |
68 | 913 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
914 |
"Created: 24.10.1995 / 14:02:32 / cg" |
2064 | 915 |
"Modified: 5.1.1997 / 01:01:53 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
916 |
! |
306 | 917 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
918 |
asExecutableMethod |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
919 |
"if the receiver has neither bytecodes nor machinecode, create & return a |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
920 |
method having semantics as the receivers source. This may be machine code, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
921 |
if the system supports dynamic loading of object code and the source includes |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
922 |
primitive code. However, bytecode is preferred, since it compiles faster. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
923 |
Otherwise, return the receiver. The new method is not installed in |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
924 |
the methodDictionary of any class - just returned. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
925 |
Can be used to compile lazy methods down to executable ones." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
926 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
927 |
|temporaryMethod cls sourceString silent lazy| |
306 | 928 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
929 |
byteCode notNil ifTrue:[ |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
930 |
" |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
931 |
is already a bytecoded method |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
932 |
" |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
933 |
^ self |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
934 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
935 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
936 |
cls := self containingClass. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
937 |
cls isNil ifTrue:[ |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
938 |
'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
939 |
^ nil |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
940 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
941 |
sourceString := self source. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
942 |
sourceString isNil ifTrue:[ |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
943 |
'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
944 |
^ nil |
306 | 945 |
]. |
1 | 946 |
|
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
947 |
"we have to sequentialize this using a lock-semaphore, |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
948 |
to make sure only one method is compiled at a time. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
949 |
Otherwise, we might get into trouble, if (due to a timeout) |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
950 |
another recompile is forced while compiling this one ... |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
951 |
(happened when autoloading animation demos) |
176 | 952 |
" |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
953 |
CompilationLock critical:[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
954 |
" |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
955 |
dont want this to go into the changes file, |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
956 |
dont want output on Transcript and definitely |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
957 |
dont want a lazy method ... |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
958 |
" |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
959 |
Class withoutUpdatingChangesDo:[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
960 |
silent := Smalltalk silentLoading:true. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
961 |
lazy := Compiler compileLazy:false. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
962 |
|
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
963 |
[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
964 |
|compiler| |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
965 |
|
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
966 |
Class nameSpaceQuerySignal answer:(cls nameSpace) |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
967 |
do:[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
968 |
compiler := cls compilerClass. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
969 |
|
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
970 |
"/ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
971 |
"/ kludge - have to make ST/X's compiler protocol |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
972 |
"/ be compatible to ST-80's |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
973 |
"/ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
974 |
(compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:) |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
975 |
ifTrue:[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
976 |
temporaryMethod := compiler |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
977 |
compile:sourceString |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
978 |
forClass:cls |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
979 |
inCategory:(self category) |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
980 |
notifying:nil |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
981 |
install:false. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
982 |
] ifFalse:[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
983 |
temporaryMethod := compiler new |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
984 |
compile:sourceString |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
985 |
in:cls |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
986 |
notifying:nil |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
987 |
ifFail:nil |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
988 |
]. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
989 |
]. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
990 |
] valueNowOrOnUnwindDo:[ |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
991 |
Compiler compileLazy:lazy. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
992 |
Smalltalk silentLoading:silent. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
993 |
] |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
994 |
]. |
463
447ead9f870c
be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents:
444
diff
changeset
|
995 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
996 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
997 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
998 |
^ nil. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
999 |
]. |
227 | 1000 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1001 |
try to save a bit of memory, by sharing the source (whatever it is) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1002 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1003 |
temporaryMethod sourceFilename:source position:sourcePosition. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1004 |
^ temporaryMethod |
1 | 1005 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1006 |
"Created: 24.10.1995 / 14:02:30 / cg" |
2132
05d2be2d280e
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
2079
diff
changeset
|
1007 |
"Modified: 10.1.1997 / 17:55:33 / cg" |
1 | 1008 |
! |
1009 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1010 |
readBinaryContentsFrom: stream manager: manager |
3934 | 1011 |
self hasCode ifTrue:[ |
1012 |
"built-in method - already complete" |
|
1013 |
^ self |
|
1 | 1014 |
]. |
1015 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1016 |
^ super readBinaryContentsFrom: stream manager: manager |
2064 | 1017 |
|
3934 | 1018 |
"Modified: / 13.11.1998 / 23:21:26 / cg" |
1 | 1019 |
! |
1020 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1021 |
storeBinaryDefinitionOn:stream manager:manager |
1260 | 1022 |
"store the receiver in a binary format on stream. |
1023 |
This is an internal interface for binary storage mechanism. |
|
1024 |
only store bytecode-methods - machinecode methods are stored |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1025 |
as class/selector pair and a lookup is done when restored. |
1 | 1026 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1027 |
If the receiver method is a built-in (i.e. machine coded) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1028 |
method, a temporary interpreted byte code method is created, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1029 |
and its bytecode stored. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1030 |
This works only, if the source of the method is available and the |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1031 |
method does not contain primitive code." |
77 | 1032 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1033 |
|storedMethod who| |
93 | 1034 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1035 |
byteCode isNil ifTrue:[ |
3934 | 1036 |
self hasCode ifTrue:[ |
1037 |
(who := self who) notNil ifTrue:[ |
|
1038 |
" |
|
1039 |
machine code only - assume its a built-in method, |
|
1040 |
and store the class/selector information. |
|
1041 |
The restored method may not be exactly the same ... |
|
1042 |
" |
|
1043 |
manager putIdOfClass:(self class) on:stream. |
|
1044 |
stream nextPutByte:0. "means: built-in method" |
|
1045 |
manager putIdOf:(who methodClass) on:stream. |
|
1046 |
manager putIdOf:(who methodSelector) on:stream. |
|
1047 |
^ self |
|
1048 |
] |
|
1049 |
]. |
|
1050 |
||
1051 |
storedMethod := self asByteCodeMethod. |
|
1052 |
storedMethod isNil ifTrue:[ |
|
1053 |
self error:'store of built-in method failed'. |
|
1054 |
]. |
|
1055 |
^ storedMethod storeBinaryDefinitionOn:stream manager:manager |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1056 |
]. |
93 | 1057 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1058 |
manager putIdOfClass:(self class) on:stream. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1059 |
stream nextPutByte:1. "means: byte-coded method" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1060 |
self storeBinaryDefinitionBodyOn:stream manager:manager |
1260 | 1061 |
|
3934 | 1062 |
"Modified: / 13.11.1998 / 23:21:42 / cg" |
227 | 1063 |
! |
1064 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1065 |
storeFullBinaryDefinitionOn:stream manager:manager |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1066 |
"store full bytecoded-method." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1067 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1068 |
|m code srcPos| |
93 | 1069 |
|
2063
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1070 |
"/ need a byteCode version of myself ... |
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1071 |
m := self. |
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1072 |
code := byteCode. |
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1073 |
code isNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1074 |
m := self asByteCodeMethod. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1075 |
code := m byteCode. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1076 |
code isNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1077 |
m := self |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1078 |
] |
2063
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1079 |
]. |
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1080 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1081 |
ObjectMemory snapshotID storeBinaryOn:stream manager:manager. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1082 |
category storeBinaryOn:stream manager:manager. |
362 | 1083 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1084 |
m flags storeBinaryOn:stream manager:manager. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1085 |
m literals storeBinaryOn:stream manager:manager. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1086 |
manager sourceMode == #discard ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1087 |
"/ add nil, nil, nil |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1088 |
nil storeBinaryOn:stream manager:manager. "/ sourceFileName |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1089 |
nil storeBinaryOn:stream manager:manager. "/ sourcePosition |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1090 |
nil storeBinaryOn:stream manager:manager. "/ source |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1091 |
] ifFalse:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1092 |
"/ add sourceFilename, srcPos |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1093 |
"/ or nil, nil, source |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1094 |
m sourceFilename storeBinaryOn:stream manager:manager. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1095 |
manager sourceMode == #reference ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1096 |
srcPos := m sourcePosition. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1097 |
] ifFalse:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1098 |
srcPos := nil |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1099 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1100 |
srcPos storeBinaryOn:stream manager:manager. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1101 |
srcPos isNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1102 |
m source storeBinaryOn:stream manager:manager. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1103 |
]. |
391 | 1104 |
]. |
2063
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1105 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1106 |
code storeBinaryOn:stream manager:manager. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1107 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1108 |
"Created: 16.1.1996 / 14:41:45 / cg" |
2063
1b5c3afb5122
fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents:
2023
diff
changeset
|
1109 |
"Modified: 5.1.1997 / 00:39:29 / cg" |
1 | 1110 |
! ! |
1111 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1112 |
!Method methodsFor:'copying'! |
438 | 1113 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1114 |
copy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1115 |
"redefined to change a source ref into a real string" |
438 | 1116 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1117 |
|aCopy| |
438 | 1118 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1119 |
aCopy := super copy. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1120 |
sourcePosition notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1121 |
aCopy source:(self source) |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1122 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1123 |
^ aCopy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1124 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1125 |
"Modified: 16.1.1997 / 01:27:25 / cg" |
438 | 1126 |
! ! |
1127 |
||
1 | 1128 |
!Method methodsFor:'error handling'! |
1129 |
||
328 | 1130 |
invalidCodeObject |
1873 | 1131 |
"{ Pragma: +optSpace }" |
1132 |
||
93 | 1133 |
"this method is triggered by the interpreter when a nil or non method |
1134 |
is about to be executed. |
|
1135 |
In this case, the VM sends this to the bad method (the receiver). |
|
1136 |
||
1137 |
Also, the Compiler creates methods with their code/bytecode set to |
|
1138 |
this method if - after a class change - a method cannot be compiled |
|
1139 |
and is therefore no longer executable (for example, after an instvar |
|
68 | 1140 |
has been removed, and a method still tries to access this instvar) |
44 | 1141 |
|
93 | 1142 |
Thus, we arrive here, when playing around in a classes methodArray, |
1143 |
or compiler/runtime system is broken :-(, |
|
1144 |
or you ignore the error messages during some recompile." |
|
1 | 1145 |
|
1873 | 1146 |
%{ |
1147 |
/* |
|
1148 |
* for reasons too far from being explained here, |
|
1149 |
* this MUST be a compiled method |
|
1150 |
*/ |
|
1151 |
%}. |
|
142 | 1152 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1153 |
raiseErrorString:'invalid method - not executable'. |
1873 | 1154 |
|
1155 |
"Modified: 4.11.1996 / 22:45:06 / cg" |
|
1 | 1156 |
! |
1157 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1158 |
invalidCodeObjectWith:arg |
1873 | 1159 |
"{ Pragma: +optSpace }" |
1160 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1161 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1162 |
uncompilable methods (with 1 arg) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1163 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1164 |
|
1873 | 1165 |
%{ |
1166 |
/* |
|
1167 |
* for reasons too far from being explained here, |
|
1168 |
* this MUST be a compiled method |
|
1169 |
*/ |
|
1170 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1171 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1172 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1173 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1174 |
"Created: 4.11.1996 / 21:16:16 / cg" |
1873 | 1175 |
"Modified: 4.11.1996 / 22:45:12 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1176 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1177 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1178 |
invalidCodeObjectWith:arg with:arg2 |
1873 | 1179 |
"{ Pragma: +optSpace }" |
1180 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1181 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1182 |
uncompilable methods (with 2 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1183 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1184 |
|
1873 | 1185 |
%{ |
1186 |
/* |
|
1187 |
* for reasons too far from being explained here, |
|
1188 |
* this MUST be a compiled method |
|
1189 |
*/ |
|
1190 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1191 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1192 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1193 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1194 |
"Created: 4.11.1996 / 21:16:41 / cg" |
1873 | 1195 |
"Modified: 4.11.1996 / 22:45:15 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1196 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1197 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1198 |
invalidCodeObjectWith:arg with:arg2 with:arg3 |
1873 | 1199 |
"{ Pragma: +optSpace }" |
1200 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1201 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1202 |
uncompilable methods (with 3 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1203 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1204 |
|
1873 | 1205 |
%{ |
1206 |
/* |
|
1207 |
* for reasons too far from being explained here, |
|
1208 |
* this MUST be a compiled method |
|
1209 |
*/ |
|
1210 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1211 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1212 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1213 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1214 |
"Created: 4.11.1996 / 21:16:51 / cg" |
1873 | 1215 |
"Modified: 4.11.1996 / 22:45:18 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1216 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1217 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1218 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 |
1873 | 1219 |
"{ Pragma: +optSpace }" |
1220 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1221 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1222 |
uncompilable methods (with 4 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1223 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1224 |
|
1873 | 1225 |
%{ |
1226 |
/* |
|
1227 |
* for reasons too far from being explained here, |
|
1228 |
* this MUST be a compiled method |
|
1229 |
*/ |
|
1230 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1231 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1232 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1233 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1234 |
"Created: 4.11.1996 / 21:17:00 / cg" |
1873 | 1235 |
"Modified: 4.11.1996 / 22:45:22 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1236 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1237 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1238 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 |
1873 | 1239 |
"{ Pragma: +optSpace }" |
1240 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1241 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1242 |
uncompilable methods (with 5 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1243 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1244 |
|
1873 | 1245 |
%{ |
1246 |
/* |
|
1247 |
* for reasons too far from being explained here, |
|
1248 |
* this MUST be a compiled method |
|
1249 |
*/ |
|
1250 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1251 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1252 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1253 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1254 |
"Created: 4.11.1996 / 21:17:09 / cg" |
1873 | 1255 |
"Modified: 4.11.1996 / 22:45:25 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1256 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1257 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1258 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
1873 | 1259 |
"{ Pragma: +optSpace }" |
1260 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1261 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1262 |
uncompilable methods (with 6 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1263 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1264 |
|
1873 | 1265 |
%{ |
1266 |
/* |
|
1267 |
* for reasons too far from being explained here, |
|
1268 |
* this MUST be a compiled method |
|
1269 |
*/ |
|
1270 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1271 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1272 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1273 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1274 |
"Created: 4.11.1996 / 21:17:17 / cg" |
1873 | 1275 |
"Modified: 4.11.1996 / 22:45:28 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1276 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1277 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1278 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 |
1873 | 1279 |
"{ Pragma: +optSpace }" |
1280 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1281 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1282 |
uncompilable methods (with 7 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1283 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1284 |
|
1873 | 1285 |
%{ |
1286 |
/* |
|
1287 |
* for reasons too far from being explained here, |
|
1288 |
* this MUST be a compiled method |
|
1289 |
*/ |
|
1290 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1291 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1292 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1293 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1294 |
"Created: 4.11.1996 / 21:17:25 / cg" |
1873 | 1295 |
"Modified: 4.11.1996 / 22:45:31 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1296 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1297 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1298 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 |
1873 | 1299 |
"{ Pragma: +optSpace }" |
1300 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1301 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1302 |
uncompilable methods (with 8 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1303 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1304 |
|
1873 | 1305 |
%{ |
1306 |
/* |
|
1307 |
* for reasons too far from being explained here, |
|
1308 |
* this MUST be a compiled method |
|
1309 |
*/ |
|
1310 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1311 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1312 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1313 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1314 |
"Created: 4.11.1996 / 21:17:32 / cg" |
1873 | 1315 |
"Modified: 4.11.1996 / 22:45:38 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1316 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1317 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1318 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 |
1873 | 1319 |
"{ Pragma: +optSpace }" |
1320 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1321 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1322 |
uncompilable methods (with 9 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1323 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1324 |
|
1873 | 1325 |
%{ |
1326 |
/* |
|
1327 |
* for reasons too far from being explained here, |
|
1328 |
* this MUST be a compiled method |
|
1329 |
*/ |
|
1330 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1331 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1332 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1333 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1334 |
"Created: 4.11.1996 / 21:17:37 / cg" |
1873 | 1335 |
"Modified: 4.11.1996 / 22:45:41 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1336 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1337 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1338 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 |
1873 | 1339 |
"{ Pragma: +optSpace }" |
1340 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1341 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1342 |
uncompilable methods (with 10 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1343 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1344 |
|
1873 | 1345 |
%{ |
1346 |
/* |
|
1347 |
* for reasons too far from being explained here, |
|
1348 |
* this MUST be a compiled method |
|
1349 |
*/ |
|
1350 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1351 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1352 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1353 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1354 |
"Created: 4.11.1996 / 21:17:45 / cg" |
1873 | 1355 |
"Modified: 4.11.1996 / 22:45:44 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1356 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1357 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1358 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 |
1873 | 1359 |
"{ Pragma: +optSpace }" |
1360 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1361 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1362 |
uncompilable methods (with 11 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1363 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1364 |
|
1873 | 1365 |
%{ |
1366 |
/* |
|
1367 |
* for reasons too far from being explained here, |
|
1368 |
* this MUST be a compiled method |
|
1369 |
*/ |
|
1370 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1371 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1372 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1373 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1374 |
"Created: 4.11.1996 / 21:17:52 / cg" |
1873 | 1375 |
"Modified: 4.11.1996 / 22:45:47 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1376 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1377 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1378 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 |
1873 | 1379 |
"{ Pragma: +optSpace }" |
1380 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1381 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1382 |
uncompilable methods (with 12 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1383 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1384 |
|
1873 | 1385 |
%{ |
1386 |
/* |
|
1387 |
* for reasons too far from being explained here, |
|
1388 |
* this MUST be a compiled method |
|
1389 |
*/ |
|
1390 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1391 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1392 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1393 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1394 |
"Created: 4.11.1996 / 20:51:28 / cg" |
1873 | 1395 |
"Modified: 4.11.1996 / 22:46:01 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1396 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1397 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1398 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 |
1873 | 1399 |
"{ Pragma: +optSpace }" |
1400 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1401 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1402 |
uncompilable methods (with 13 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1403 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1404 |
|
1873 | 1405 |
%{ |
1406 |
/* |
|
1407 |
* for reasons too far from being explained here, |
|
1408 |
* this MUST be a compiled method |
|
1409 |
*/ |
|
1410 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1411 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1412 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1413 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1414 |
"Created: 4.11.1996 / 21:18:09 / cg" |
1873 | 1415 |
"Modified: 4.11.1996 / 22:45:57 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1416 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1417 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1418 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 with:arg14 |
1873 | 1419 |
"{ Pragma: +optSpace }" |
1420 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1421 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1422 |
uncompilable methods (with 14 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1423 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1424 |
|
1873 | 1425 |
%{ |
1426 |
/* |
|
1427 |
* for reasons too far from being explained here, |
|
1428 |
* this MUST be a compiled method |
|
1429 |
*/ |
|
1430 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1431 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1432 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1433 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1434 |
"Created: 4.11.1996 / 21:18:17 / cg" |
1873 | 1435 |
"Modified: 4.11.1996 / 22:45:55 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1436 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1437 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1438 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 with:arg14 with:arg15 |
1873 | 1439 |
"{ Pragma: +optSpace }" |
1440 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1441 |
"When recompiling classes after a definition-change, all |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1442 |
uncompilable methods (with 15 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1443 |
so that evaluating such an uncompilable method will trigger an error." |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1444 |
|
1873 | 1445 |
%{ |
1446 |
/* |
|
1447 |
* for reasons too far from being explained here, |
|
1448 |
* this MUST be a compiled method |
|
1449 |
*/ |
|
1450 |
%}. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1451 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1452 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1453 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1454 |
"Created: 4.11.1996 / 21:18:22 / cg" |
1873 | 1455 |
"Modified: 4.11.1996 / 22:45:52 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1456 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1457 |
|
109 | 1458 |
privateMethodCalled |
1873 | 1459 |
"{ Pragma: +optSpace }" |
1460 |
||
980 | 1461 |
"this error is triggered, if a private or protected method is called. |
1462 |
||
360 | 1463 |
If you continue in the debugger, the method will be called, |
415 | 1464 |
and further privacy exceptions will NOT be reported at this call location, |
360 | 1465 |
until any new method is compiled, or the privacy of any method changes, |
1466 |
or the caches are flushed. |
|
1467 |
(the reason is that after the continue, the method is enterred into the |
|
1468 |
calling cache, for which method privacy is not checked. |
|
1469 |
Any of the above actions flushes this cache and a privacy check |
|
1470 |
is performed again.) |
|
1471 |
Future versions may not enter private methods into the cache, to fix this |
|
1472 |
(unobvious) behavior. However, then you will get an exception for EVERY |
|
1473 |
call to a private method ... |
|
1474 |
||
1475 |
Notice: method privacy is a nonstandard feature, not supported |
|
1476 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1477 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1478 |
It may change or even vanish (if it shows to be not useful)." |
|
68 | 1479 |
|
142 | 1480 |
^ PrivateMethodSignal raise |
1873 | 1481 |
|
1482 |
"Modified: 4.11.1996 / 22:46:09 / cg" |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1483 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1484 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1485 |
uncompiledCodeObject |
1873 | 1486 |
"{ Pragma: +optSpace }" |
1487 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1488 |
"this method is invoked by methods which contain primitive code, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1489 |
but have not been compiled to machine code (either due to an error |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1490 |
when compiling, or simply because no stc is available. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1491 |
For those methods, the compiler generated a method object consisting |
1873 | 1492 |
of the original source code, but with this methods machine/byte code." |
1493 |
||
1494 |
%{ |
|
1495 |
/* |
|
1496 |
* for reasons too far from being explained here, |
|
1497 |
* this MUST be a compiled method |
|
1498 |
*/ |
|
1499 |
%}. |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1500 |
^ InvalidCodeSignal |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1501 |
raiseRequestWith:self |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1502 |
errorString:'invalid method - not compiled'. |
1873 | 1503 |
|
1504 |
"Modified: 4.11.1996 / 22:58:02 / cg" |
|
1505 |
! |
|
1506 |
||
1507 |
unloadedCodeObject |
|
1508 |
"{ Pragma: +optSpace }" |
|
1509 |
||
1510 |
"this method is invoked by methods which have been binary-unloaded |
|
1511 |
For those the source info consists |
|
1512 |
of the original source code, but with this methods machine/byte code." |
|
1513 |
||
1514 |
%{ |
|
1515 |
/* |
|
1516 |
* for reasons too far from being explained here, |
|
1517 |
* this MUST be a compiled method |
|
1518 |
*/ |
|
1519 |
%}. |
|
1520 |
^ InvalidCodeSignal |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1521 |
raiseRequestWith:self |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1522 |
errorString:'invalid method - unloaded'. |
1873 | 1523 |
|
1524 |
"Created: 4.11.1996 / 22:57:54 / cg" |
|
1525 |
"Modified: 4.11.1996 / 22:58:28 / cg" |
|
1 | 1526 |
! ! |
1527 |
||
93 | 1528 |
!Method methodsFor:'printing & storing'! |
1 | 1529 |
|
1530 |
printOn:aStream |
|
56 | 1531 |
"put a printed representation of the receiver onto aStream. |
1532 |
Since methods do not store their class/selector, we have to search |
|
1533 |
for it here." |
|
1 | 1534 |
|
227 | 1535 |
|classAndSelector m wrapped| |
1 | 1536 |
|
253 | 1537 |
wrapped := false. |
1538 |
||
159 | 1539 |
aStream nextPutAll:(self classNameWithArticle). |
1540 |
aStream nextPut:$(. |
|
227 | 1541 |
|
176 | 1542 |
classAndSelector := self who. |
227 | 1543 |
classAndSelector isNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1544 |
" |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1545 |
not anchored in any class. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1546 |
check if wrapped (to be more informative in inspectors) |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1547 |
" |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1548 |
m := self wrapper. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1549 |
m notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1550 |
classAndSelector := m who. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1551 |
wrapped := true. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1552 |
] |
227 | 1553 |
]. |
176 | 1554 |
classAndSelector notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1555 |
(classAndSelector methodClass) name printOn:aStream. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1556 |
aStream nextPutAll:' '. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1557 |
(classAndSelector methodSelector) printOn:aStream. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1558 |
wrapped ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1559 |
aStream nextPutAll:'; wrapped' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1560 |
]. |
1 | 1561 |
] ifFalse:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1562 |
" |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1563 |
sorry, a method which is nowhere anchored |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1564 |
" |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1565 |
aStream nextPutAll:'unbound' |
56 | 1566 |
]. |
1567 |
aStream nextPut:$) |
|
176 | 1568 |
|
1569 |
" |
|
253 | 1570 |
(Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr. |
1571 |
(Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr. |
|
176 | 1572 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1573 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1574 |
"Modified: 1.11.1996 / 16:25:34 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1575 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1576 |
|
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1577 |
printStringForBrowserWithSelector:selector |
1436 | 1578 |
"return a printString to represent myself to the user in a browser. |
1579 |
Defined here to allow for browsers to deal with nonStandard pseudoMethods" |
|
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1580 |
|
3693
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1581 |
|s privInfo moreInfo p i n| |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1582 |
|
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1583 |
moreInfo := ''. |
1800 | 1584 |
privInfo := ''. |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1585 |
|
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1586 |
self isWrapped ifTrue:[ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1587 |
(MessageTracer isCounting:self) ifTrue:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1588 |
(MessageTracer isCountingMemoryUsage:self) ifTrue:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1589 |
moreInfo := moreInfo , |
3697 | 1590 |
' (mem usage avg: ' , (MessageTracer memoryUsageOfMethod:self) printString asText allBold , ' bytes)'. |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1591 |
] ifFalse:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1592 |
moreInfo := moreInfo , |
3693
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1593 |
' (called ' , (MessageTracer executionCountOfMethod:self) printString asText allBold , ' times)'. |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1594 |
] |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1595 |
] ifFalse:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1596 |
(MessageTracer isTiming:self) ifTrue:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1597 |
i := MessageTracer executionTimesOfMethod:self. |
3693
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1598 |
(i isNil or:[(n := i at:#count) == 0]) ifTrue:[ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1599 |
moreInfo := moreInfo , |
3693
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1600 |
' (cnt: ' , (i at:#count) printString , ')' |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1601 |
] ifFalse:[ |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1602 |
n == 1 ifTrue:[ |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1603 |
moreInfo := moreInfo , |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1604 |
' (t: ' , (i at:#avgTime) printString asText allBold, |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1605 |
'ms cnt: ' , (i at:#count) printString , ')' |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1606 |
] ifFalse:[ |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1607 |
moreInfo := moreInfo , |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1608 |
' (avg: ' , (i at:#avgTime) printString asText allBold, |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1609 |
'ms min: ' , (i at:#minTime) printString , |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1610 |
' max: ' , (i at:#maxTime) printString , |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1611 |
' cnt: ' , (i at:#count) printString , ')' |
50eebf89cf0e
added reset-statistic protocol.
Claus Gittinger <cg@exept.de>
parents:
3675
diff
changeset
|
1612 |
]. |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1613 |
]. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1614 |
] ifFalse:[ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1615 |
moreInfo := ' !!' |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1616 |
] |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1617 |
]. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1618 |
]. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1619 |
p := self privacy. |
1805 | 1620 |
|
1621 |
p ~~ #public ifTrue:[ |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1622 |
privInfo := (' (* ' , p , ' *)') asText emphasizeAllWith:#italic. |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1623 |
]. |
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1624 |
|
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1625 |
self isInvalid ifTrue:[ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1626 |
moreInfo := ' (** not executable **)'. |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1627 |
]. |
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1628 |
|
1806 | 1629 |
(self isLazyMethod not and:[self isUnloaded]) ifTrue:[ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1630 |
moreInfo := ' (** unloaded **)' |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1631 |
]. |
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1632 |
|
1800 | 1633 |
privInfo size ~~ 0 ifTrue:[ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1634 |
moreInfo := privInfo , ' ' , moreInfo |
1800 | 1635 |
]. |
1636 |
||
4581
9b807b6f7265
show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
1637 |
s := selector. |
9b807b6f7265
show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
1638 |
self package ~= self containingClass package ifTrue:[ |
4595 | 1639 |
s := s , ' [' , (self package asText emphasizeAllWith:#italic), ']' |
4581
9b807b6f7265
show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
1640 |
]. |
9b807b6f7265
show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
1641 |
|
9b807b6f7265
show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
1642 |
moreInfo size == 0 ifTrue:[^ s]. |
1805 | 1643 |
|
1436 | 1644 |
s := selector , moreInfo. |
4581
9b807b6f7265
show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents:
4522
diff
changeset
|
1645 |
|
1813 | 1646 |
self isInvalid ifTrue:[ |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1647 |
s := s asText emphasizeAllWith:#color->Color red. |
1813 | 1648 |
]. |
1436 | 1649 |
^ s |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1650 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1651 |
"Created: / 16.4.1996 / 20:11:12 / cg" |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1652 |
"Modified: / 23.1.1998 / 13:15:15 / stefan" |
3697 | 1653 |
"Modified: / 31.7.1998 / 00:37:47 / cg" |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1654 |
! |
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1655 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1656 |
whoString |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1657 |
"return a string as className>>selector, if this is not an unbound |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1658 |
method. Otherwise return 'unbound'. Used with debugging." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1659 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1660 |
|who| |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1661 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1662 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1663 |
who notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1664 |
^ (who methodClass) name , '>>' , (who methodSelector) |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1665 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1666 |
^ 'unbound' |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1667 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1668 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1669 |
Method new whoString |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1670 |
(Method compiledMethodAt:#whoString) whoString |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1671 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1672 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1673 |
"Modified: 1.11.1996 / 16:27:04 / cg" |
1 | 1674 |
! ! |
1675 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1676 |
!Method methodsFor:'private-compiler interface'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1677 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1678 |
setResourceFlag |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1679 |
"mark the method as having a <resource> definition in its |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1680 |
source. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1681 |
These resource definitions were found in ST-80 methods, and are |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1682 |
currently not supported by ST/X (except for remembering this flag). |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1683 |
It can be used to find resource-flagged methods quicker." |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1684 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1685 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1686 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1687 |
#ifdef F_RESOURCE |
2868 | 1688 |
INT f = __intVal(__INST(flags)); |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1689 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1690 |
f |= F_RESOURCE; |
1133 | 1691 |
__INST(flags) = __MKSMALLINT(f); |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1692 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1693 |
%} |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1694 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1695 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1696 |
!Method methodsFor:'queries'! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1697 |
|
2702 | 1698 |
accessedInstVars |
1699 |
"return a collection of instVarNames, which are accessed by |
|
1700 |
the receiver method" |
|
1701 |
||
1702 |
|src parser| |
|
1703 |
||
1704 |
src := self source. |
|
1705 |
src notNil ifTrue:[ |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1706 |
parser := Parser |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1707 |
parseMethod:src |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1708 |
in:self containingClass |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1709 |
ignoreErrors:true |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1710 |
ignoreWarnings:true. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1711 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1712 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1713 |
^ parser usedInstVars |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1714 |
]. |
2702 | 1715 |
]. |
1716 |
^ #() "/ actually: unknown |
|
1717 |
||
1718 |
"Modified: 19.6.1997 / 17:54:09 / cg" |
|
1719 |
! |
|
1720 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1721 |
containingClass |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1722 |
"return the class I am defined in. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1723 |
See comment in who." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1724 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1725 |
"based on who, which has been added for ST-80 compatibility" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1726 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1727 |
|who| |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1728 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1729 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1730 |
who notNil ifTrue:[^ who methodClass]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1731 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1732 |
none found - sorry |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1733 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1734 |
^ nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1735 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1736 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1737 |
|m| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1738 |
m := Object compiledMethodAt:#at:. |
1855 | 1739 |
m containingClass |
1740 |
||
1741 |
|m| |
|
1742 |
m := Object class compiledMethodAt:#version. |
|
1743 |
m containingClass |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1744 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1745 |
|
1855 | 1746 |
"Modified: 1.11.1996 / 17:47:06 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1747 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1748 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1749 |
hasPrimitiveCode |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1750 |
"return true, if the method contains primitive code; false if not. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1751 |
Uses Parser to parse methods source and get the information." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1752 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1753 |
|src| |
159 | 1754 |
|
2218 | 1755 |
"/ first a trivial reject, if the source does not |
1756 |
"/ contain a '%{' |
|
1757 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1758 |
src := self source. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1759 |
src notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1760 |
(src includesString:'%{' ) ifFalse:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1761 |
"/ cannot contain primitive code. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1762 |
^ false |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1763 |
] |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1764 |
]. |
2218 | 1765 |
|
1766 |
"/ ok; it may or may not ... |
|
1767 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1768 |
^ self parse:#'parseMethodSilent:' return:#hasPrimitiveCode or:false |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1769 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1770 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1771 |
(Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1772 |
(Object compiledMethodAt:#at:) hasPrimitiveCode |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1773 |
(Object compiledMethodAt:#basicAt:) hasPrimitiveCode |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1774 |
" |
159 | 1775 |
|
2218 | 1776 |
"Modified: 22.1.1997 / 00:03:45 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1777 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1778 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1779 |
hasResource |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1780 |
"return true if the method had a <resource> definition in its |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1781 |
source. This was found in ST-80 methods, and currently not supported |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1782 |
by ST/X (except for remembering this flag). |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1783 |
It can be used to find resource-flagged methods quicker." |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1784 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1785 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1786 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1787 |
#ifdef F_RESOURCE |
1133 | 1788 |
RETURN (((INT)__INST(flags) & __MASKSMALLINT(F_RESOURCE)) ? true : false); |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1789 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1790 |
%}. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1791 |
^ false |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1792 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1793 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1794 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1795 |
|
2694
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1796 |
homeMethod |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1797 |
"for common protocol with blocks: if the receiver is a method, |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1798 |
return the receiver; otherwise, if its a block, return its home |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1799 |
method." |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1800 |
|
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1801 |
^ self |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1802 |
|
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1803 |
"Created: 19.6.1997 / 16:13:12 / cg" |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1804 |
! |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
1805 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1806 |
isInvalid |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1807 |
"return true, if this method is not executable due to |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1808 |
a (re)-compilation error. Since invalidation is by patching the |
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1809 |
methods code-pointer to a trap function, check for that here. |
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1810 |
(see comment in Method>>invalidCodeObject)." |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1811 |
|
2558 | 1812 |
|m myCode| |
1873 | 1813 |
|
1814 |
myCode := self code. |
|
1815 |
||
1816 |
m := self trapMethodForNumArgs:(self numArgs). |
|
1817 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1818 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1819 |
(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1820 |
]. |
159 | 1821 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1822 |
m := Method compiledMethodAt:#uncompiledCodeObject. |
1873 | 1823 |
(m notNil and:[self ~~ m]) ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1824 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1825 |
(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1826 |
]. |
1873 | 1827 |
|
1828 |
m := Method compiledMethodAt:#unloadedCodeObject. |
|
1829 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1830 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1831 |
(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1832 |
]. |
1873 | 1833 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1834 |
^ false |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
1835 |
|
1873 | 1836 |
"Modified: 4.11.1996 / 23:34:24 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1837 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1838 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1839 |
isMethod |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1840 |
"return true, if the receiver is some kind of method; |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1841 |
true returned here - the method is redefined from Object." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1842 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1843 |
^ true |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1844 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1845 |
|
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1846 |
mclass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1847 |
"return the class in which the receiver was compiled. |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1848 |
Same as #containingClass, for ST80 compatibility." |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1849 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1850 |
^ self containingClass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1851 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1852 |
"Created: 19.6.1997 / 16:26:13 / cg" |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1853 |
! |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
1854 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1855 |
methodArgAndVarNames |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1856 |
"return a collection with the methods argument and variable names. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1857 |
Uses Parser to parse methods source and extract the names. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1858 |
Returns nil if the source is not available, or some other |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1859 |
syntax/parse error occurred. For methods with no args and no vars, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1860 |
an empty collection is returned." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1861 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1862 |
|parser sourceString argNames varNames| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1863 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1864 |
sourceString := self source. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1865 |
sourceString notNil ifTrue:[ |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1866 |
parser := Parser parseMethodArgAndVarSpecificationSilent:sourceString. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1867 |
(parser isNil or:[parser == #Error]) ifTrue:[^ nil]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1868 |
argNames := parser methodArgs. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1869 |
varNames := parser methodVars. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1870 |
argNames isNil ifTrue:[^ varNames]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1871 |
varNames isNil ifTrue:[^ argNames]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1872 |
^ (argNames , varNames) |
159 | 1873 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1874 |
^ nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1875 |
|
159 | 1876 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1877 |
(Method compiledMethodAt:#printOn:) methodArgAndVarNames |
159 | 1878 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1879 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1880 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1881 |
methodArgNames |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1882 |
"return a collection with the methods argument names. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1883 |
Uses Parser to parse methods source and extract the names." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1884 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1885 |
^ self parse:#'parseMethodSpecificationSilent:' return:#methodArgs or:nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1886 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1887 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1888 |
(Method compiledMethodAt:#printOn:) methodArgNames |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1889 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1890 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1891 |
"Modified: 31.10.1995 / 14:36:46 / cg" |
872 | 1892 |
! |
1893 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1894 |
methodComment |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1895 |
"return the methods first comment, nil if there is none. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1896 |
This is a somewhat stupid implementation." |
872 | 1897 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1898 |
|text line nQuote index qIndex qIndex2 comment| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1899 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1900 |
text := self source asCollectionOfLines. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1901 |
(text size < 2) ifTrue:[^nil]. |
872 | 1902 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1903 |
line := (text at:2). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1904 |
nQuote := line occurrencesOf:(Character doubleQuote). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1905 |
(nQuote == 2) ifTrue:[ |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1906 |
qIndex := line indexOf:(Character doubleQuote). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1907 |
qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1908 |
^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1) |
872 | 1909 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1910 |
(nQuote == 1) ifTrue:[ |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1911 |
qIndex := line indexOf:(Character doubleQuote). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1912 |
comment := line copyFrom:(qIndex + 1). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1913 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1914 |
index := 3. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1915 |
line := text at:index. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1916 |
nQuote := line occurrencesOf:(Character doubleQuote). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1917 |
[nQuote ~~ 1] whileTrue:[ |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1918 |
comment := comment , Character cr asString , line withoutSpaces. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1919 |
index := index + 1. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1920 |
line := text at:index. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1921 |
nQuote := line occurrencesOf:(Character doubleQuote) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1922 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1923 |
qIndex := line indexOf:(Character doubleQuote). |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1924 |
^ comment , Character cr asString , (line copyTo:(qIndex - 1)) withoutSpaces |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1925 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1926 |
^ nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1927 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1928 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1929 |
(Method compiledMethodAt:#methodComment) methodComment |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1930 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1931 |
! |
872 | 1932 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1933 |
methodVarNames |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1934 |
"return a collection with the methods local-variable names. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1935 |
Uses Parser to parse methods source and extract the names." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1936 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1937 |
^ self parse:#'parseMethodArgAndVarSpecificationSilent:' return:#methodVars or:nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1938 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1939 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1940 |
(Method compiledMethodAt:#printOn:) methodVarNames |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1941 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1942 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1943 |
"Modified: 31.10.1995 / 14:36:49 / cg" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1944 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1945 |
|
2702 | 1946 |
modfiedInstVars |
1947 |
"return a collection of instVarNames, which are written by |
|
1948 |
the receiver method" |
|
1949 |
||
1950 |
|src parser| |
|
1951 |
||
1952 |
src := self source. |
|
1953 |
src notNil ifTrue:[ |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1954 |
parser := Parser |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1955 |
parseMethod:src |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1956 |
in:self containingClass |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1957 |
ignoreErrors:true |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1958 |
ignoreWarnings:true. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1959 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1960 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1961 |
^ parser modifiedInstVars |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1962 |
]. |
2702 | 1963 |
]. |
1964 |
^ #() "/ actually: unknown |
|
1965 |
||
1966 |
"Created: 19.6.1997 / 17:53:30 / cg" |
|
1967 |
"Modified: 19.6.1997 / 17:54:17 / cg" |
|
1968 |
! |
|
1969 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1970 |
modificationTime |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1971 |
"try to extract the modificationTime as a timeStamp from |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1972 |
the receivers source. If there is no source or no history line, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1973 |
we do not know the modification time, and nil is returned." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1974 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1975 |
|s list histLine| |
877
63ebb325ed20
flush global-access cache (using snapshotID) when saving a methods binary code
Claus Gittinger <cg@exept.de>
parents:
872
diff
changeset
|
1976 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1977 |
HistoryManager isNil ifTrue:[^ nil]. |
1873 | 1978 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1979 |
s := self source. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1980 |
s isNil ifTrue:[^ nil]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1981 |
list := HistoryManager getAllHistoriesFrom:s. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1982 |
list size == 0 ifTrue:[^ nil]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1983 |
histLine := list last. |
1873 | 1984 |
^ AbsoluteTime |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1985 |
fromDate:histLine date |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
1986 |
andTime:histLine time |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1987 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1988 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1989 |
(Method compiledMethodAt:#modificationTime) modificationTime |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1990 |
(Method compiledMethodAt:#isMethod) modificationTime |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1991 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1992 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1993 |
"Modified: 8.9.1995 / 15:08:22 / claus" |
1873 | 1994 |
"Modified: 4.11.1996 / 22:28:17 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1995 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1996 |
|
3845
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
1997 |
name |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
1998 |
"for compatibility with javaMethods" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
1999 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2000 |
^ self selector |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2001 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2002 |
"Created: / 9.11.1998 / 06:15:08 / cg" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2003 |
! |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2004 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2005 |
parse:parseSelector return:accessSelector or:valueIfNoSource |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2006 |
"helper for methodArgNames, methodVarNames etc. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2007 |
Get the source, let parser parse it using parseSelector, |
1873 | 2008 |
return parser-info using accessSelector" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2009 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2010 |
|parser sourceString| |
872 | 2011 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2012 |
sourceString := self source. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2013 |
sourceString notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2014 |
parser := Parser perform:parseSelector with:sourceString. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2015 |
(parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2016 |
^ parser perform:accessSelector |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2017 |
]. |
1873 | 2018 |
^ valueIfNoSource |
2019 |
||
1995 | 2020 |
"Modified: 12.12.1996 / 15:38:59 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2021 |
! |
159 | 2022 |
|
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2023 |
previousVersion |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2024 |
|history| |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2025 |
|
1925 | 2026 |
history := Class methodHistory. |
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2027 |
history isNil ifTrue:[^ nil]. |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2028 |
^ history at:self ifAbsent:nil |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2029 |
|
1925 | 2030 |
"Modified: 7.11.1996 / 19:06:22 / cg" |
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2031 |
! |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2032 |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2033 |
resourceType |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2034 |
"ST-80 compatibility: |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2035 |
return the methods first resource specs key; either nil, |
3243 | 2036 |
or a single symbol containing in Method>>resourceTypes." |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2037 |
|
3387 | 2038 |
|resources| |
2039 |
||
2040 |
(resources := self resources) notNil ifTrue:[ |
|
2041 |
resources keysAndValuesDo:[:key :val| |
|
2042 |
(self class resourceTypes includes:key) ifTrue:[^key] |
|
2043 |
]. |
|
3341 | 2044 |
]. |
3387 | 2045 |
^ nil |
2046 |
||
2047 |
"Modified: / 22.4.1998 / 10:26:31 / cg" |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2048 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2049 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2050 |
resources |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2051 |
"return the methods resource spec; either nil, a single symbol |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2052 |
or a collection of symbols." |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2053 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2054 |
|src parser| |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2055 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2056 |
self hasResource ifFalse:[^ nil]. |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2057 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2058 |
src := self source. |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2059 |
src isNil ifTrue:[ |
4811
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2060 |
^ nil "/ actually: dont know |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2061 |
]. |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2062 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2063 |
(src findString:'resource:') == 0 ifTrue:[ |
4811
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2064 |
^ nil "/ actually: error |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2065 |
]. |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2066 |
parser := Parser |
4811
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2067 |
parseMethod:src |
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2068 |
in:nil |
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2069 |
ignoreErrors:true |
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2070 |
ignoreWarnings:true. |
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2071 |
parser isNil ifTrue:[ |
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2072 |
^ nil "/ actually error |
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2073 |
]. |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2074 |
^ parser primitiveResources. |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2075 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2076 |
"Created: / 26.10.1997 / 16:23:18 / cg" |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2077 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2078 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2079 |
selector |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2080 |
"return the selector under which I am found in my containingClasses |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2081 |
method-table. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2082 |
See comment in who." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2083 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2084 |
"based on who, which has been added for ST-80 compatibility" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2085 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2086 |
|who| |
68 | 2087 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2088 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2089 |
who notNil ifTrue:[^ who methodSelector]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2090 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2091 |
none found - sorry |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2092 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2093 |
^ nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2094 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2095 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2096 |
|m| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2097 |
m := Object compiledMethodAt:#at:. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2098 |
m selector |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2099 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2100 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2101 |
"Modified: 1.11.1996 / 16:25:48 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2102 |
! |
68 | 2103 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2104 |
who |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2105 |
"return the class and selector of where I am defined in; |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2106 |
nil is returned for unbound methods. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2107 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2108 |
ST/X special notice: |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2109 |
returns an instance of MethodWhoInfo, which |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2110 |
responds to #methodClass and #methodSelector query messages. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2111 |
For backward- (& ST-80) compatibility, the returned object also |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2112 |
responds to #at:1 and #at:2 messages. |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2113 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2114 |
Implementation notice: |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2115 |
Since there is no information of the containing class |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2116 |
in the method, we have to do a search here. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2117 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2118 |
Normally, this is not a problem, except when a method is |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2119 |
accepted in the debugger or redefined from within a method |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2120 |
(maybe done indirectly, if #doIt is done recursively) |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2121 |
- the information about which class the original method was |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2122 |
defined in is lost in this case. |
68 | 2123 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2124 |
Problem: |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2125 |
this is heavily called for in the debugger to create |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2126 |
a readable context walkback. For unbound methods, it is |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2127 |
slow, since the search (over all classes) will always fail. |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2128 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2129 |
Q: should we add a backref from the method to the class |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2130 |
and/or add a subclass of Method for unbound ones ? |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2131 |
Q2: if so, what about the bad guy then, who copies methods around to |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2132 |
other classes ?" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2133 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2134 |
|classes cls sel| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2135 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2136 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2137 |
very first, look in the class we found something the last time |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2138 |
this may often give a hit, when asking who repeatingly for |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2139 |
a context chain. (keep last by its name, to not keep classes from |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2140 |
being garbage collected) |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2141 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2142 |
LastWhoClass notNil ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2143 |
cls := Smalltalk at:LastWhoClass ifAbsent:nil. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2144 |
cls notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2145 |
sel := cls selectorAtMethod:self. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2146 |
sel notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2147 |
^ MethodWhoInfo class:cls selector:sel |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2148 |
"/ ^ Array with:cls with:sel |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2149 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2150 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2151 |
cls := cls class. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2152 |
sel := cls selectorAtMethod:self. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2153 |
sel notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2154 |
^ MethodWhoInfo class:cls selector:sel |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2155 |
"/ ^ Array with:cls with:sel |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2156 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2157 |
] |
68 | 2158 |
]. |
227 | 2159 |
|
142 | 2160 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2161 |
first, limit the search to global classes only - |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2162 |
since probability is high, that the receiver is found in there ... |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2163 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2164 |
classes := Smalltalk allClasses. |
142 | 2165 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2166 |
instance methods are usually more common - search those first |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2167 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2168 |
classes do:[:aClass | |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2169 |
|sel| |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2170 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2171 |
sel := aClass selectorAtMethod:self ifAbsent:nil. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2172 |
sel notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2173 |
aClass isMeta ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2174 |
cls := aClass soleInstance. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2175 |
cls notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2176 |
LastWhoClass := cls name |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2177 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2178 |
] ifFalse:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2179 |
LastWhoClass := aClass name. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2180 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2181 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2182 |
^ MethodWhoInfo class:aClass selector:sel |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2183 |
"/ ^ Array with:aClass with:sel |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2184 |
]. |
142 | 2185 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2186 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2187 |
LastWhoClass := nil. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2188 |
classes do:[:aClass | |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2189 |
|sel| |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2190 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2191 |
sel := aClass class selectorAtMethod:self. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2192 |
sel notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2193 |
aClass isMeta ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2194 |
cls := aClass soleInstance. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2195 |
cls notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2196 |
LastWhoClass := cls name |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2197 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2198 |
] ifFalse:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2199 |
LastWhoClass := aClass name. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2200 |
]. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2201 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2202 |
^ MethodWhoInfo class:aClass class selector:sel |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2203 |
"/ ^ Array with:aClass class with:sel |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2204 |
]. |
142 | 2205 |
]. |
2206 |
" |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2207 |
mhmh - must be a method of some anonymous class (i.e. one not |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2208 |
in the Smalltalk dictionary). Search all instances of Behavior |
142 | 2209 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2210 |
Behavior allSubInstancesDo:[:someClass | |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2211 |
|sel| |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2212 |
|
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2213 |
sel := someClass selectorAtMethod:self. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2214 |
sel notNil ifTrue:[ |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2215 |
^ MethodWhoInfo class:someClass selector:sel |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2216 |
"/ ^ Array with:someClass with:sel |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2217 |
] |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2218 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2219 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2220 |
none found - sorry |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2221 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2222 |
^ nil |
444 | 2223 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2224 |
"typical situation: some well-known class" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2225 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2226 |
|m| |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2227 |
m := Object compiledMethodAt:#copy. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2228 |
m who |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2229 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2230 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2231 |
"untypical situation: an anonymous class" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2232 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2233 |
|m cls| |
444 | 2234 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2235 |
Object |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2236 |
subclass:#FunnyClass |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2237 |
instanceVariableNames:'foo' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2238 |
classVariableNames:'' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2239 |
poolDictionaries:'' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2240 |
category:'testing'. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2241 |
cls := Smalltalk at:#FunnyClass. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2242 |
Smalltalk removeClass:cls. |
444 | 2243 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2244 |
cls compile:'testMethod1:arg foo:=arg'. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2245 |
cls compile:'testMethod2 ^ foo'. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2246 |
m := cls compiledMethodAt:#testMethod1:. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2247 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2248 |
m who |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2249 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2250 |
|
2518
303563f538e3
avoid an extra message send in #who
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
2251 |
"Modified: 2.4.1997 / 16:38:34 / cg" |
68 | 2252 |
! |
2253 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2254 |
wrapper |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2255 |
"only for wrapped methods: return the wrapper. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2256 |
Thats the WrapperMethod which contains myself." |
159 | 2257 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2258 |
WrappedMethod allInstancesDo:[:m | |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2259 |
m originalMethod == self ifTrue:[^ m]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2260 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2261 |
^ nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2262 |
! ! |
13 | 2263 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2264 |
!Method methodsFor:'trap methods'! |
13 | 2265 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2266 |
makeInvalid |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2267 |
"make the receiver an invalid method, which raises an invalidCodeObject |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2268 |
signal when executed. This is not for public use - it is required for |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2269 |
the objectFileLoader to invalidate methods whose code is unloaded." |
1 | 2270 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2271 |
|invldMethod| |
159 | 2272 |
|
1873 | 2273 |
invldMethod := self trapMethodForNumArgs:(self numArgs). |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2274 |
self code:invldMethod code. |
1873 | 2275 |
self byteCode:nil. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2276 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2277 |
"Created: 17.9.1995 / 15:00:52 / claus" |
1873 | 2278 |
"Modified: 4.11.1996 / 23:04:34 / cg" |
1 | 2279 |
! |
2280 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2281 |
makeUncompiled |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2282 |
"make the receiver an uncompiled method, which raises an invalidCodeObject |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2283 |
signal when executed. This is not for public use - it is required for |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2284 |
the compiler to invalidate methods which cannot be compiled due to errors |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2285 |
after a class definition change (for example: instvars are no longer there)." |
1 | 2286 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2287 |
|invldMethod| |
872 | 2288 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2289 |
invldMethod := self class compiledMethodAt:#uncompiledCodeObject. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2290 |
self code:invldMethod code. |
1873 | 2291 |
self byteCode:nil. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2292 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2293 |
"Created: 17.9.1995 / 15:01:14 / claus" |
1873 | 2294 |
"Modified: 4.11.1996 / 23:04:46 / cg" |
2295 |
! |
|
2296 |
||
2297 |
makeUnloaded |
|
2298 |
"make the receiver an unloaded method, which raises an invalidCodeObject |
|
2299 |
signal when executed. This is not for public use - it is required for |
|
2300 |
the objectFileLoader to invalidate methods for which a shared library has |
|
2301 |
been removed." |
|
2302 |
||
2303 |
|invldMethod| |
|
2304 |
||
2305 |
invldMethod := self class compiledMethodAt:#unloadedCodeObject. |
|
2306 |
self code:invldMethod code. |
|
2307 |
self byteCode:nil. |
|
2308 |
||
2309 |
"Created: 4.11.1996 / 22:59:21 / cg" |
|
2310 |
"Modified: 4.11.1996 / 23:04:52 / cg" |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2311 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2312 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2313 |
trapMethodForNumArgs:numArgs |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2314 |
|trapSel| |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2315 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2316 |
trapSel := #( |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2317 |
#'invalidCodeObject' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2318 |
#'invalidCodeObjectWith:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2319 |
#'invalidCodeObjectWith:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2320 |
#'invalidCodeObjectWith:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2321 |
#'invalidCodeObjectWith:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2322 |
#'invalidCodeObjectWith:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2323 |
#'invalidCodeObjectWith:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2324 |
#'invalidCodeObjectWith:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2325 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2326 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2327 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2328 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2329 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2330 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2331 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2332 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:' |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2333 |
) at:(numArgs + 1). |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2334 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2335 |
^ Method compiledMethodAt:trapSel. |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2336 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2337 |
"Created: 4.11.1996 / 21:58:58 / cg" |
1873 | 2338 |
"Modified: 4.11.1996 / 23:18:05 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2339 |
! ! |
872 | 2340 |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2341 |
!Method::MethodWhoInfo class methodsFor:'documentation'! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2342 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2343 |
documentation |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2344 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2345 |
In earlier times, Method>>who returned an array filled |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2346 |
with the methods class and selector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2347 |
This was done, since a smalltalk method cannot return multiple |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2348 |
values, but 2 values had to be returned from that method. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2349 |
Thus, the who-interface was used as: |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2350 |
info := <someMethod> who. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2351 |
class := info at:1. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2352 |
sel := info at:2. |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2353 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2354 |
Sure, this is ugly coding style, and the system has been changed to return |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2355 |
an object (an instance of MethodWhoInfo) which responds to the two |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2356 |
messages: #methodClass and #methodSelector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2357 |
This allows to write things much more intuitive: |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2358 |
info := <someMethod> who. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2359 |
class := info methodClass. |
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2360 |
sel := info methodSelector. |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2361 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2362 |
However, to be backward compatible, the returned object still responds to |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2363 |
the #at: message, but only allows inices of 1 and 2 to be used. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2364 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2365 |
The MethodWhoInfo class is private to Method - its not visible to other |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2366 |
classes. |
2242 | 2367 |
|
2368 |
[author:] |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2369 |
Claus Gittinger |
2242 | 2370 |
|
2371 |
[see also:] |
|
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2372 |
Method |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2373 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2374 |
! ! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2375 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2376 |
!Method::MethodWhoInfo class methodsFor:'instance creation'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2377 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2378 |
class:cls selector:sel |
2023 | 2379 |
"return a new MethodWhoInfo object; |
2380 |
this is a private interface for Method" |
|
2381 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2382 |
^ self basicNew class:cls selector:sel |
2023 | 2383 |
|
2384 |
"Modified: 2.1.1997 / 15:27:59 / cg" |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2385 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2386 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2387 |
!Method::MethodWhoInfo methodsFor:'accessing'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2388 |
|
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2389 |
method |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2390 |
^ myClass compiledMethodAt:mySelector |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2391 |
! |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2392 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2393 |
methodClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2394 |
"return the class which contains the method represented by myself" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2395 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2396 |
^ myClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2397 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2398 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2399 |
(Method compiledMethodAt:#who) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2400 |
(Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2401 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2402 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2403 |
"Modified: 2.1.1997 / 14:59:02 / cg" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2404 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2405 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2406 |
methodSelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2407 |
"return the selector under which the the method represented by myself |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2408 |
is found in the class" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2409 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2410 |
^ mySelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2411 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2412 |
"Modified: 2.1.1997 / 14:59:24 / cg" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2413 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2414 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2415 |
!Method::MethodWhoInfo methodsFor:'compatibility'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2416 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2417 |
at:index |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2418 |
"simulate the old behavior (when Method>>who returned an array)" |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2419 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2420 |
index == 1 ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2421 |
^ myClass |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2422 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2423 |
index == 2 ifTrue:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2424 |
^ mySelector |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2425 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2426 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2427 |
"/ sigh - full compatibility ? |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2428 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2429 |
index isInteger ifFalse:[ |
3030
fc5d632d133f
when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents:
2979
diff
changeset
|
2430 |
^ self indexNotInteger |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2431 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2432 |
^ self subscriptBoundsError:index |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2433 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2434 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2435 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2436 |
!Method::MethodWhoInfo methodsFor:'private accessing'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2437 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2438 |
class:cls selector:sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2439 |
myClass := cls. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2440 |
mySelector := sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2441 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2442 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2443 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2444 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
2445 |
!Method class methodsFor:'documentation'! |
872 | 2446 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2447 |
version |
4811
a71c422eadc8
be robust about errors when fetching resources
Claus Gittinger <cg@exept.de>
parents:
4751
diff
changeset
|
2448 |
^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.177 1999-09-24 18:19:38 cg Exp $' |
1 | 2449 |
! ! |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2450 |
Method initialize! |