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