author | Claus Gittinger <cg@exept.de> |
Wed, 03 Aug 2011 12:42:00 +0200 | |
changeset 13544 | 4c9779fe1181 |
parent 13463 | 7c98583d98c8 |
child 13567 | fe6564553977 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
13463 | 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 |
" |
|
5385 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
3934 | 14 |
CompiledCode variableSubclass:#Method |
13422 | 15 |
instanceVariableNames:'source sourcePosition category package mclass lookupObject |
16 |
annotations' |
|
12899
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
17 |
classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
18 |
LastWhoClass LastFileLock LastMethodSources LastMethodSourcesLock |
13422 | 19 |
CompilationLock Overrides' |
12899
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
20 |
poolDictionaries:'' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
21 |
category:'Kernel-Methods' |
1 | 22 |
! |
23 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
24 |
Object subclass:#MethodWhoInfo |
12899
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
25 |
instanceVariableNames:'myClass mySelector' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
26 |
classVariableNames:'' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
27 |
poolDictionaries:'' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
28 |
privateIn:Method |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
29 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
30 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
31 |
!Method class methodsFor:'documentation'! |
42 | 32 |
|
88 | 33 |
copyright |
34 |
" |
|
35 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
13463 | 36 |
All Rights Reserved |
88 | 37 |
|
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
45 |
! |
|
46 |
||
42 | 47 |
documentation |
48 |
" |
|
68 | 49 |
this class defines protocol for executable methods; |
50 |
both compiled and interpreted methods are represented by this class. |
|
51 |
Compiled methods have a non-nil code field, while interpreted methods have |
|
52 |
a nil code field and non-nil byteCode field. |
|
88 | 53 |
If there are both non-nil code and bytecode fields, the VM will execute |
227 | 54 |
the machine-code of a method. If both are nil when executed, a noByteCode |
55 |
message is sent by the VM to the method where a signal is raised. |
|
1 | 56 |
|
227 | 57 |
The methods sourcecode is represented by source and sourcePosition: |
58 |
- if sourcePosition is a Number, the source-field is the fileName and |
|
59 |
sourcePosition is the character offset of the source-chunk in this source file. |
|
60 |
- If sourcePosition is nil, the source is the string in the source field. |
|
61 |
(an old version used ExternalString instances here, but that lead to |
|
62 |
10000 additional little objects ...) |
|
1 | 63 |
|
68 | 64 |
The flags field defines things like the number of method-locals, |
227 | 65 |
method arguments and stack requirements (for interpreted methods). |
68 | 66 |
Do not depend on any value in the flags field - it may change without |
67 |
notice. |
|
1 | 68 |
|
438 | 69 |
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
|
70 |
identified not by being an instance of Block or Method, but instead by |
438 | 71 |
having the executable flag bit set in the class. The VM can execute anything |
72 |
which is identified as executable (assuming that the first instance variable |
|
73 |
is the machine-code address) - this allows for easy future extension. |
|
74 |
||
1293 | 75 |
[Instance variables:] |
93 | 76 |
|
13463 | 77 |
source <String> the source itself (if sourcePosition isNil) |
78 |
or the fileName where the source is found |
|
79 |
||
80 |
sourcePosition <Integer> the position of the methods chunk in the file |
|
81 |
||
82 |
category <Symbol> the methods category |
|
83 |
package <Symbol> the package, in which the methods was defined |
|
84 |
mclass <Class> the class in which I am defined |
|
85 |
indexed slots literals |
|
227 | 86 |
|
1293 | 87 |
[Class variables:] |
227 | 88 |
|
13463 | 89 |
PrivateMethodSignal raised on privacy violation (see docu) |
90 |
||
91 |
LastFileReference weak reference to the last sourceFile |
|
92 |
LastSourceFileName to speedup source access via NFS |
|
93 | 93 |
|
68 | 94 |
WARNING: layout known by compiler and runtime system - dont change |
1293 | 95 |
|
96 |
[author:] |
|
13463 | 97 |
Claus Gittinger |
42 | 98 |
" |
176 | 99 |
! |
100 |
||
952
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 |
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
|
102 |
" |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
|
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
112 |
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
|
113 |
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
|
114 |
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
|
115 |
which is compiled by the machines native C-compiler. |
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
116 |
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
|
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 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
119 |
|
12854 | 120 |
privacy |
176 | 121 |
" |
122 |
ST/X includes an EXPERIMENTAL implementation of method privacy. |
|
123 |
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
|
124 |
privacy:#private and privacy:#protected messages. Also, categories may be |
202 | 125 |
filedIn as a whole as private using #privateMethodsFor: or as |
126 |
protected using #protectedMethodsFor: instead of the well known #methodsFor:. |
|
127 |
||
176 | 128 |
The additional #publicMethodsFor: is for documentation purposes, and |
227 | 129 |
is equivalent to #methodsFor: (also to support fileIn of ENVY methods). |
176 | 130 |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
131 |
Protected methods may be executed only when called via a self-send |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
132 |
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
|
133 |
class itself or subclasses. |
12854 | 134 |
Private methods may not be called from subclasses-methods, |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
135 |
i.e. they may only be called via self sends from within the current class. |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
136 |
(i.e. protected methods are less private than private ones) |
176 | 137 |
|
138 |
When such a situation arises, the VM (runtime system) will raise the |
|
139 |
PrivateMethodSignal exception (if nonNil), which usually brings you into the |
|
140 |
debugger. |
|
141 |
||
227 | 142 |
If PrivateMethodSignal is nil, the VM will not check for this, and |
176 | 143 |
execution is as usual. (you may want to nil-it for production code, |
144 |
and leave it non nil during development). |
|
145 |
||
146 |
NOTICE: there is no (not yet ?) standard defined for method privacy, |
|
12854 | 147 |
however, the definition protocol was designed to be somewhat ENVY compatible |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
148 |
(from what can be deduced by reading PD code). |
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
149 |
|
176 | 150 |
Also, the usability of privacy is still to be tested. |
415 | 151 |
This interface, the implementation and the rules for when a privacy violation |
152 |
may change (in case of some ANSI standard being defined). |
|
227 | 153 |
Be warned and send me suggestions & critics (constructive ;-) |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
154 |
|
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
155 |
Late note (Feb 2000): |
13463 | 156 |
the privacy feature has new been in ST/X for some years and was NOT heavily |
157 |
used - neither at eXept, nor by customers. |
|
158 |
In Smalltalk, it seems to be a very questionable feature, actually limiting |
|
159 |
code reusability. |
|
160 |
The privacy features are left in the system to demonstrate that it can be |
|
161 |
done in Smalltalk (for religious C++ fans ... to avoid useless discussions) |
|
162 |
(the check is not expensive, w.r.t. the VM runtime behavior). |
|
176 | 163 |
" |
42 | 164 |
! ! |
1 | 165 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
166 |
!Method class methodsFor:'initialization'! |
109 | 167 |
|
168 |
initialize |
|
1254 | 169 |
"create signals" |
170 |
||
109 | 171 |
PrivateMethodSignal isNil ifTrue:[ |
13463 | 172 |
"EXPERIMENTAL" |
173 |
PrivateMethodSignal := ExecutionError newSignalMayProceed:true. |
|
174 |
PrivateMethodSignal nameClass:self message:#privateMethodSignal. |
|
175 |
PrivateMethodSignal notifierString:'attempt to execute private/protected method'. |
|
2079
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 |
|
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
178 |
LastFileLock isNil ifTrue:[ |
13463 | 179 |
LastFileLock := RecursionLock new name:'Method-LastFile'. |
180 |
LastMethodSourcesLock := RecursionLock new name:'Method-LastMethodSources'. |
|
181 |
||
182 |
"LastFileReference used to be a WeakArray. The problem was, that |
|
183 |
during some operations (generating project definition methods), lots of |
|
184 |
methods and classes are accessed. GC (scavenge) is done heavily, |
|
185 |
while finalization is a low prio process, so that the file limit |
|
186 |
is reached before finalization did close the old streams." |
|
187 |
LastFileReference := Array new:1. |
|
188 |
LastFileReference at:1 put:nil. |
|
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
189 |
]. |
1254 | 190 |
|
5387
f855cf3b2f67
need a recursionLock as compilationLock
Claus Gittinger <cg@exept.de>
parents:
5386
diff
changeset
|
191 |
CompilationLock := RecursionLock new name:'MethodCompilation'. |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
192 |
|
1254 | 193 |
"Modified: 22.4.1996 / 16:34:38 / cg" |
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
194 |
"Modified: 3.1.1997 / 16:58:16 / stefan" |
10375 | 195 |
! |
196 |
||
197 |
lastMethodSourcesLock |
|
198 |
LastMethodSourcesLock isNil ifTrue:[ |
|
13463 | 199 |
self initialize |
10375 | 200 |
]. |
201 |
^ LastMethodSourcesLock |
|
109 | 202 |
! ! |
203 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
204 |
!Method class methodsFor:'Signal constants'! |
159 | 205 |
|
206 |
privateMethodSignal |
|
176 | 207 |
"return the signal raised when a private/protected method is called |
208 |
by some other object (i.e. not a self- or super send)" |
|
209 |
||
159 | 210 |
^ PrivateMethodSignal |
211 |
! ! |
|
212 |
||
11022
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
213 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
214 |
!Method class methodsFor:'queries'! |
3 | 215 |
|
216 |
isBuiltInClass |
|
1264 | 217 |
"return true if this class is known by the run-time-system. |
218 |
Here, true is returned for myself, false for subclasses." |
|
3 | 219 |
|
220 |
^ self == Method |
|
1264 | 221 |
|
222 |
"Modified: 23.4.1996 / 15:59:50 / cg" |
|
44 | 223 |
! |
224 |
||
6089 | 225 |
methodDefinitionTemplateForSelector:aSelector |
226 |
"given a selector, return a prototype definition string" |
|
227 |
||
6091 | 228 |
|nA argNames| |
229 |
||
230 |
(nA := aSelector numArgs) == 1 ifTrue:[ |
|
13463 | 231 |
argNames := #('arg') |
6090 | 232 |
] ifFalse:[ |
13463 | 233 |
argNames := (1 to:nA) collect:[:i | 'arg' , i printString]. |
6090 | 234 |
]. |
12854 | 235 |
^ self |
13463 | 236 |
methodDefinitionTemplateForSelector:aSelector |
237 |
andArgumentNames:argNames. |
|
6090 | 238 |
|
239 |
" |
|
12854 | 240 |
Method methodDefinitionTemplateForSelector:#foo |
241 |
Method methodDefinitionTemplateForSelector:#+ |
|
242 |
Method methodDefinitionTemplateForSelector:#foo:bar:baz: |
|
6090 | 243 |
" |
244 |
! |
|
245 |
||
246 |
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames |
|
247 |
"given a selector, return a prototype definition string" |
|
248 |
||
6089 | 249 |
aSelector numArgs > 0 ifTrue:[ |
13463 | 250 |
aSelector isKeyword ifTrue:[ |
251 |
^ String streamContents:[:stream | |
|
252 |
aSelector keywords with:argNames do:[:eachKeyword :eachArgName| |
|
253 |
stream nextPutAll:eachKeyword; nextPutAll:eachArgName; space. |
|
254 |
]. |
|
255 |
stream backStep. "remove the last space" |
|
256 |
]. |
|
257 |
]. |
|
258 |
^ aSelector , ' ' , (argNames at:1) |
|
6089 | 259 |
]. |
260 |
^ aSelector |
|
261 |
||
262 |
" |
|
12854 | 263 |
Method methodDefinitionTemplateForSelector:#foo andArgumentNames:#() |
264 |
Method methodDefinitionTemplateForSelector:#+ andArgumentNames:#('aNumber') |
|
265 |
Method methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg') |
|
6089 | 266 |
" |
267 |
! |
|
268 |
||
747 | 269 |
methodPrivacySupported |
270 |
"return true, if the system was compiled to support methodPrivacy. |
|
271 |
You should not depend on that feature being available." |
|
272 |
||
273 |
%{ /* NOCONTEXT */ |
|
274 |
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE) |
|
275 |
RETURN (true); |
|
276 |
#else |
|
277 |
RETURN (false); |
|
278 |
#endif |
|
279 |
%} |
|
3342 | 280 |
! |
281 |
||
282 |
resourceTypes |
|
283 |
"get the types of resources for which a spec definition and corresponding editor exist" |
|
284 |
||
8526 | 285 |
^ #(canvas menu image fileImage help hierarchicalList tabList tableColumns) |
3 | 286 |
! ! |
287 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
288 |
!Method class methodsFor:'special'! |
957 | 289 |
|
290 |
flushSourceStreamCache |
|
11663
6ef3b25bd306
changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents:
11428
diff
changeset
|
291 |
LastFileLock critical:[ |
13463 | 292 |
LastSourceFileName := LastMethodSources := nil. |
293 |
LastFileReference at:1 put:0. |
|
11663
6ef3b25bd306
changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents:
11428
diff
changeset
|
294 |
]. |
957 | 295 |
|
7830 | 296 |
" |
297 |
Method flushSourceStreamCache |
|
298 |
" |
|
299 |
||
957 | 300 |
"Created: 9.2.1996 / 19:05:28 / cg" |
301 |
! ! |
|
302 |
||
13422 | 303 |
|
7261 | 304 |
!Method methodsFor:'Compatibility-VW'! |
5967 | 305 |
|
11146 | 306 |
classIsMeta |
307 |
"return true, if this method is a class method" |
|
308 |
||
12854 | 309 |
^ self mclass isMeta |
11146 | 310 |
! |
311 |
||
5967 | 312 |
sendsSelector:aSelectorSymbol |
313 |
"return true, if this method contains a message-send |
|
314 |
with aSelectorSymbol as selector." |
|
315 |
||
316 |
^ self sends:aSelectorSymbol |
|
317 |
! ! |
|
318 |
||
9096 | 319 |
|
1 | 320 |
!Method methodsFor:'accessing'! |
321 |
||
13422 | 322 |
annotateWith: annotation |
323 |
||
324 |
| index | |
|
325 |
index := self annotationIndexOf: annotation key. |
|
13463 | 326 |
index |
327 |
ifNil: |
|
328 |
[annotations := annotations |
|
329 |
ifNil:[Array with: annotation] |
|
330 |
ifNotNil:[annotations copyWith:annotation]] |
|
331 |
ifNotNil: |
|
332 |
[annotations at: index put: annotation]. |
|
13422 | 333 |
"/ annotation annotatesMethod: self. |
334 |
||
335 |
" |
|
13463 | 336 |
(Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious'). |
337 |
(Object >> #yourself) annotations. |
|
338 |
(Object >> #yourself) annotationAt: #namespace: |
|
13422 | 339 |
" |
340 |
||
341 |
"Created: / 19-05-2010 / 16:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
342 |
"Modified: / 20-05-2010 / 11:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
343 |
! |
|
344 |
||
345 |
annotationAt: key |
|
346 |
||
347 |
| index | |
|
348 |
||
349 |
index := self annotationIndexOf: key. |
|
13463 | 350 |
index ifNil:[^nil]. |
13422 | 351 |
^self annotationAtIndex: index. |
352 |
||
353 |
" |
|
13463 | 354 |
(Object >> #yourself) annotationAt: #namespace: |
13422 | 355 |
" |
356 |
||
357 |
"Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
358 |
"Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 |
! |
|
360 |
||
361 |
annotations |
|
362 |
"Returns annotations" |
|
363 |
||
364 |
annotations ifNil:[^#()]. |
|
13463 | 365 |
"iterate over annotation array to |
13422 | 366 |
trigger lazy-loading" |
367 |
self annotationsDo:[:ignored]. |
|
368 |
^ annotations |
|
369 |
||
370 |
"Modified: / 11-07-2010 / 19:25:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
371 |
! |
|
372 |
||
373 |
annotations: anObject |
|
374 |
"set the annotations" |
|
375 |
||
376 |
self setAnnotations: anObject. |
|
377 |
"/ "iterate over annotations just to invoke |
|
378 |
"/ annotationAtIndex: which lazyliyinitialize annotations |
|
379 |
"/ and send #annotatesMethod:" |
|
380 |
"/ self annotationsDo:[:annotation|] |
|
381 |
||
382 |
"Created: / 02-07-2010 / 22:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
383 |
! |
|
384 |
||
385 |
annotationsAt: key |
|
386 |
||
387 |
^OrderedCollection streamContents: |
|
13463 | 388 |
[:annotStream| |
389 |
self annotationsAt: key do: |
|
390 |
[:annot|annotStream nextPut: annot]] |
|
13422 | 391 |
|
392 |
"Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
393 |
! |
|
394 |
||
395 |
annotationsAt: key do: block |
|
396 |
||
397 |
| annots | |
|
398 |
annots := OrderedCollection new: 1. |
|
399 |
self annotationsDo: |
|
13463 | 400 |
[:annot| |
401 |
annot key == key ifTrue: |
|
402 |
[block value: annot]] |
|
13422 | 403 |
|
404 |
"Created: / 16-07-2010 / 11:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
405 |
! |
|
406 |
||
407 |
annotationsAt: key1 orAt: key2 |
|
408 |
||
409 |
^OrderedCollection streamContents: |
|
13463 | 410 |
[:annotStream| |
411 |
self annotationsAt: key1 orAt: key2 do: |
|
412 |
[:annot|annotStream nextPut: annot]] |
|
13422 | 413 |
|
414 |
"Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
415 |
! |
|
416 |
||
417 |
annotationsAt: key1 orAt: key2 do: block |
|
418 |
||
419 |
| annots | |
|
420 |
annots := OrderedCollection new: 1. |
|
421 |
self annotationsDo: |
|
13463 | 422 |
[:annot| |
423 |
(annot key == key1 or:[annot key == key2]) ifTrue: |
|
424 |
[block value: annot]] |
|
13422 | 425 |
|
426 |
"Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
427 |
! |
|
428 |
||
429 |
annotationsDo: aBlock |
|
430 |
||
431 |
annotations ifNil:[^nil]. |
|
432 |
1 to: annotations size do: |
|
13463 | 433 |
[:i|aBlock value: (self annotationAtIndex: i)]. |
13422 | 434 |
|
435 |
"Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
436 |
"Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
437 |
! |
|
438 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
439 |
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
|
440 |
"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
|
441 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
442 |
^ category |
1 | 443 |
! |
444 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
445 |
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
|
446 |
"set the methods category" |
1 | 447 |
|
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
448 |
|newCategory oldCategory cls| |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
449 |
|
3934 | 450 |
aStringOrSymbol notNil ifTrue:[ |
13463 | 451 |
newCategory := aStringOrSymbol. |
452 |
newCategory ~= (oldCategory := category) ifTrue:[ |
|
453 |
self setCategory:newCategory. |
|
454 |
||
455 |
cls := self mclass. |
|
456 |
cls notNil ifTrue:[ |
|
457 |
cls addChangeRecordForMethodCategory:self category:newCategory. |
|
458 |
self changed:#category with:oldCategory. "/ will vanish |
|
459 |
cls changed:#organization with:self selector. "/ will vanish |
|
460 |
Smalltalk changed:#methodCategory with:(Array with:cls with:self with:oldCategory). |
|
461 |
] |
|
462 |
] |
|
3934 | 463 |
] |
464 |
||
10729 | 465 |
"Modified: / 25-09-2007 / 16:15:24 / cg" |
1 | 466 |
! |
467 |
||
39 | 468 |
comment |
469 |
"return the methods comment. |
|
68 | 470 |
This is done by searching for and returning the first comment |
12854 | 471 |
from the methods source (excluding any double-quotes). |
68 | 472 |
Returns nil if there is no comment (or source is not available)." |
39 | 473 |
|
12948 | 474 |
|src| |
39 | 475 |
|
159 | 476 |
src := self source. |
477 |
src isNil ifTrue:[^ nil]. |
|
12948 | 478 |
^ self programmingLanguage parserClass methodCommentFromSource:src |
93 | 479 |
|
480 |
" |
|
13463 | 481 |
(Method compiledMethodAt:#comment) comment |
12854 | 482 |
(Object class compiledMethodAt:#infoPrinting:) comment |
93 | 483 |
" |
1236
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
484 |
|
12948 | 485 |
"Modified: / 23-02-1998 / 10:26:08 / stefan" |
486 |
"Modified: / 17-07-2010 / 14:23:56 / cg" |
|
39 | 487 |
! |
488 |
||
9702 | 489 |
getPackage |
490 |
"return the package-ID of the method" |
|
491 |
||
492 |
^ package |
|
493 |
! |
|
494 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
495 |
getSource |
3160 | 496 |
"low-level access to the source instance-variable. |
4751 | 497 |
For internal (compiler) use only. |
3160 | 498 |
This is NOT always the methods source string" |
499 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
500 |
^ source |
414 | 501 |
! |
502 |
||
4751 | 503 |
getSourcePosition |
504 |
"low-level access to the sourcePosition instance-variable. |
|
505 |
For internal (compiler) use only. |
|
506 |
This is NOT always the methods sourcePosition" |
|
507 |
||
508 |
^ sourcePosition |
|
509 |
! |
|
510 |
||
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
511 |
localSourceFilename:aFileName position:aNumber |
12854 | 512 |
"set the methods sourcefile/position indicating, that |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
513 |
this is a local file." |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
514 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
515 |
source := aFileName. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
516 |
sourcePosition := aNumber negated |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
517 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
518 |
"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
|
519 |
! |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
520 |
|
13422 | 521 |
lookupObject |
522 |
||
523 |
^lookupObject ifNil:[Lookup builtin]. |
|
524 |
||
525 |
"Created: / 28-04-2010 / 18:36:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
526 |
! |
|
527 |
||
528 |
lookupObject: anObject |
|
529 |
||
530 |
self setLookupObject: anObject. |
|
531 |
||
532 |
"Created: / 28-04-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
533 |
"Modified: / 11-07-2010 / 19:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
534 |
! |
|
535 |
||
5152
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
536 |
makeLocalStringSource |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
537 |
"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
|
538 |
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
|
539 |
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
|
540 |
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
|
541 |
sourceCode is not lost." |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
542 |
|
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
543 |
source notNil ifTrue:[ |
13463 | 544 |
sourcePosition notNil ifTrue:[ |
545 |
"/ this looks wierd - but (self source) will retrieve the external source |
|
546 |
"/ (from the file) and store it. So afterwards, we will have the string and |
|
547 |
"/ sourcePosition will be nil |
|
548 |
self source:(self source) |
|
549 |
] |
|
5152
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
550 |
]. |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
551 |
! |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
552 |
|
5324 | 553 |
mclass:aClass |
8465
2d2211d74983
Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents:
8462
diff
changeset
|
554 |
"set the method's class" |
12854 | 555 |
|
8465
2d2211d74983
Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents:
8462
diff
changeset
|
556 |
mclass == aClass ifTrue:[ ^ self ]. |
8462 | 557 |
|
12323 | 558 |
"/ (mclass notNil and:[aClass notNil]) ifTrue:[ |
559 |
"/ 'Method [warning]: mclass already set' errorPrintCR. |
|
560 |
"/ ]. |
|
5696 | 561 |
mclass := aClass. |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
562 |
|
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
563 |
"Modified: / 28-11-2006 / 12:12:27 / cg" |
5696 | 564 |
! |
5324 | 565 |
|
13422 | 566 |
nameSpace |
567 |
||
568 |
"Returns my namespace or nil. If no explicit method namespace |
|
569 |
is set, my programmming language is used as default namespace |
|
570 |
(for compatibility reasons, for smalltalk methods nil is returned, |
|
571 |
which means that the method is not namespaced). |
|
572 |
" |
|
573 |
||
13463 | 574 |
| nsA lang | |
13422 | 575 |
nsA := self annotationAt: #namespace:. |
576 |
nsA ifNotNil:[^nsA nameSpace]. |
|
577 |
||
578 |
^(lang := self programmingLanguage) isSmalltalk |
|
13463 | 579 |
ifTrue:[nil] |
580 |
ifFalse:[lang]. |
|
13422 | 581 |
|
582 |
" |
|
13463 | 583 |
(Method >> #nameSpace) nameSpace |
584 |
(Object >> #yourself) nameSpace |
|
585 |
||
13422 | 586 |
" |
587 |
||
588 |
"Created: / 26-04-2010 / 16:30:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
589 |
"Modified: / 20-05-2010 / 09:38:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
590 |
! |
|
591 |
||
592 |
nameSpace: aNameSpace |
|
593 |
||
594 |
self annotateWith: (Annotation namespace: aNameSpace name) |
|
595 |
||
596 |
"Created: / 20-05-2010 / 10:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
597 |
"Modified: / 20-05-2010 / 11:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
598 |
! |
|
599 |
||
600 |
nameSpaceName |
|
601 |
||
602 |
| ns | |
|
603 |
^(ns := self nameSpace) |
|
13463 | 604 |
ifNotNil:[ns name] |
605 |
ifNil:[''] |
|
13422 | 606 |
! |
607 |
||
13100 | 608 |
originalMethodIfWrapped |
609 |
"return the method the receiver is wrapping - none here" |
|
610 |
||
611 |
^ self |
|
612 |
||
613 |
"Created: / 22-10-2010 / 11:46:07 / cg" |
|
614 |
! |
|
615 |
||
13422 | 616 |
overriddenMethod |
617 |
||
618 |
"Answers overridden method or nil." |
|
619 |
||
620 |
Overrides ifNil:[^nil]. |
|
621 |
^(Overrides includesKey: self) |
|
13463 | 622 |
ifTrue:[Overrides at: self] |
13422 | 623 |
|
624 |
"Created: / 17-06-2009 / 19:09:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
625 |
! |
|
626 |
||
627 |
overriddenMethod: aMethod |
|
628 |
||
629 |
"Set overridden method to aMethod" |
|
630 |
||
631 |
Overrides ifNil:[Overrides := WeakIdentityDictionary new:10]. |
|
632 |
aMethod ifNotNil:[aMethod makeLocalStringSource]. |
|
633 |
Overrides at: self put: aMethod |
|
634 |
||
635 |
"Created: / 17-06-2009 / 19:09:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
636 |
"Modified: / 22-08-2009 / 10:47:42 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
637 |
! |
|
638 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
639 |
package |
9702 | 640 |
"return the package-ID of the method (nil is translated to noProject here)" |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
641 |
|
5385 | 642 |
|cls| |
643 |
||
644 |
package notNil ifTrue:[ ^ package ]. |
|
645 |
(cls := self mclass) isNil ifTrue:[ |
|
13463 | 646 |
^ PackageId noProjectID. |
5385 | 647 |
]. |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
648 |
"/ set it. |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
649 |
package := cls getPackage. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
650 |
package isNil ifTrue:[ |
13463 | 651 |
^ PackageId noProjectID. |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
652 |
]. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
653 |
^ package |
3950 | 654 |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
655 |
"Modified: / 28-11-2006 / 12:12:43 / cg" |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
656 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
657 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
658 |
package:aSymbol |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
659 |
"set the package-symbol" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
660 |
|
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
661 |
|cls oldPackage newPackage| |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
662 |
|
12216
692af7a76600
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12193
diff
changeset
|
663 |
aSymbol == PackageId noProjectID ifTrue:[ |
13463 | 664 |
newPackage := nil |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
665 |
] ifFalse:[ |
13463 | 666 |
newPackage := aSymbol |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
667 |
]. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
668 |
|
9713 | 669 |
package ~~ newPackage ifTrue:[ |
13463 | 670 |
oldPackage := package. |
671 |
"/ this is required, because otherwise I would no longer be able to |
|
672 |
"/ reconstruct my sourcecode (as the connection to the source-file is lost). |
|
673 |
self makeLocalStringSource. |
|
674 |
package := newPackage. |
|
675 |
||
676 |
cls := self mclass. |
|
677 |
||
678 |
self changed:#package. "/ will vanish |
|
679 |
cls changed:#methodPackage with:self selector. "/ will vanish |
|
680 |
||
681 |
Smalltalk changed:#projectOrganization with:(Array with:cls with:self with:oldPackage). |
|
682 |
cls addChangeRecordForMethodPackage:self package:newPackage. |
|
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
683 |
] |
10196 | 684 |
|
685 |
"Modified: / 23-11-2006 / 17:01:02 / cg" |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
686 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
687 |
|
13422 | 688 |
setAnnotations: anObject |
689 |
"set the annotations (low level - use do not use)" |
|
690 |
||
691 |
annotations := anObject |
|
692 |
||
693 |
"Created: / 20-05-2010 / 11:27:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
694 |
! |
|
695 |
||
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
696 |
setCategory:aStringOrSymbol |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
697 |
"set the methods category (without change notification)" |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
698 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
699 |
aStringOrSymbol notNil ifTrue:[ |
13463 | 700 |
category := aStringOrSymbol asSymbol |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
701 |
] |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
702 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
703 |
"Modified: / 13.11.1998 / 23:55:05 / cg" |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
704 |
! |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
705 |
|
5398 | 706 |
setPackage:aSymbol |
9702 | 707 |
"set the package-symbol (low level - use package:)" |
5398 | 708 |
|
709 |
package := aSymbol |
|
710 |
! |
|
711 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
712 |
source |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
713 |
"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
|
714 |
|
12598 | 715 |
|sourceStream chunk| |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
716 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
717 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
718 |
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
|
719 |
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
|
720 |
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
|
721 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
722 |
sourcePosition isNil ifTrue:[^ source]. |
13381
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
723 |
source isNil ifTrue:[^ nil]. |
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
724 |
|
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
725 |
self class lastMethodSourcesLock critical:[ |
13463 | 726 |
LastMethodSources notNil ifTrue:[ |
727 |
chunk := LastMethodSources at:self ifAbsent:nil. |
|
728 |
]. |
|
13381
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
729 |
]. |
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
730 |
chunk notNil ifTrue:[ |
13463 | 731 |
^ chunk |
13381
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
732 |
]. |
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
733 |
|
13463 | 734 |
LastFileLock |
735 |
critical:[ |
|
736 |
"have to protect sourceStream from being closed as a side effect |
|
737 |
of some other process fetching some the source from a different source file" |
|
738 |
||
739 |
sourceStream := self sourceStreamUsingCache:true. |
|
740 |
sourceStream notNil ifTrue:[ |
|
741 |
[ |
|
742 |
chunk := self sourceChunkFromStream:sourceStream. |
|
743 |
] on:DecodingError do:[:ex| |
|
744 |
"CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data" |
|
745 |
||
746 |
('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR. |
|
747 |
sourceStream := self rawSourceStreamUsingCache:true. |
|
748 |
ex restart. |
|
749 |
]. |
|
750 |
]. |
|
751 |
] |
|
752 |
timeoutMs:100 |
|
753 |
ifBlocking:[ |
|
754 |
"take care if LastFileLock is not available - maybe we are |
|
755 |
called by a debugger while someone holds the lock. |
|
756 |
Use uncached source streams" |
|
757 |
sourceStream := self sourceStreamUsingCache:false. |
|
758 |
sourceStream notNil ifTrue:[ |
|
759 |
[ |
|
760 |
chunk := self sourceChunkFromStream:sourceStream. |
|
761 |
sourceStream close. |
|
762 |
] on:DecodingError do:[:ex| |
|
763 |
"CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data" |
|
764 |
('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR. |
|
765 |
sourceStream close. |
|
766 |
sourceStream := self rawSourceStreamUsingCache:false. |
|
767 |
ex restart. |
|
768 |
]. |
|
769 |
]. |
|
770 |
]. |
|
2979 | 771 |
|
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
772 |
"Cache the source of recently used methods" |
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
773 |
chunk notNil ifTrue:[ |
13463 | 774 |
UserPreferences current keepMethodSourceCode ifTrue:[ |
775 |
source := chunk. |
|
776 |
sourcePosition := nil. |
|
777 |
^ source. |
|
778 |
]. |
|
779 |
||
780 |
CacheDictionary notNil ifTrue:[ |
|
781 |
self class lastMethodSourcesLock critical:[ |
|
782 |
LastMethodSources isNil ifTrue:[ |
|
783 |
LastMethodSources := CacheDictionary new:50. |
|
784 |
]. |
|
785 |
LastMethodSources at:self put:chunk. |
|
786 |
] |
|
787 |
]. |
|
2979 | 788 |
]. |
789 |
||
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
790 |
^ chunk |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
791 |
|
10201 | 792 |
"Modified: / 07-01-1997 / 16:20:09 / stefan" |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
793 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
794 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
795 |
source:aString |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
796 |
"set the methods sourcestring" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
797 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
798 |
source := aString. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
799 |
sourcePosition := nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
800 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
801 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
802 |
sourceFilename |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
803 |
"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
|
804 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
805 |
sourcePosition notNil ifTrue:[^ source]. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
806 |
^ nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
807 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
808 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
809 |
sourceFilename:aFileName position:aNumber |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
810 |
"set the methods sourcefile/position" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
811 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
812 |
source := aFileName. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
813 |
sourcePosition := aNumber |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
814 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
815 |
|
2812 | 816 |
sourceLineNumber |
817 |
"return the lineNumber of my source within the returned |
|
818 |
source sourcestring. |
|
819 |
For ST methods, the returned sourceString is always the |
|
820 |
methods pure source; therefore, the lineNumber is always 1." |
|
821 |
||
822 |
^ 1 |
|
823 |
||
824 |
"Created: 30.7.1997 / 15:42:01 / cg" |
|
825 |
! |
|
826 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
827 |
sourcePosition |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
828 |
"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
|
829 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
830 |
sourcePosition isNil ifTrue:[^ sourcePosition]. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
831 |
^ sourcePosition abs |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
832 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
833 |
"Modified: 16.1.1997 / 01:28:25 / cg" |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
834 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
835 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
836 |
!Method methodsFor:'accessing-visibility'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
837 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
838 |
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
|
839 |
"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
|
840 |
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
|
841 |
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
|
842 |
it in its message lookup. |
747 | 843 |
(i.e. setting a method to #ignored, and sending that selector, |
12854 | 844 |
leads to either the superclasses implementation to be called, |
747 | 845 |
or a doesNotUnderstand exception to be raised) |
846 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
847 |
Notice: this is a nonstandard feature, not supported |
747 | 848 |
by other smalltalk implementations and not specified in the ANSI spec. |
849 |
||
850 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
851 |
It may change or even vanish (if it shows to be not useful)." |
|
852 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
853 |
^ self privacy == #ignored |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
854 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
855 |
"Modified: / 23.1.1998 / 15:23:02 / stefan" |
176 | 856 |
! |
857 |
||
858 |
isPrivate |
|
859 |
"return true, if this is a private method. |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
860 |
Execution of private methods is only allowed via self sends |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
861 |
from superclasses or the class itself. |
176 | 862 |
If a private method is called by some other class, a runtime |
863 |
error (PrivateMethodSignal) is raised. |
|
864 |
Notice: method privacy is a nonstandard feature, not supported |
|
865 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 866 |
|
176 | 867 |
This is EXPERIMENTAL - and being evaluated for usability. |
868 |
It may change or even vanish (if it shows to be not useful)." |
|
869 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
870 |
^ self privacy == #private |
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 |
"Modified: / 23.1.1998 / 15:23:13 / stefan" |
68 | 873 |
! |
874 |
||
176 | 875 |
isProtected |
876 |
"return true, if this is a protected method. |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
877 |
Execution of protected methods is only allowed via self/super sends |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
878 |
from superclasses, the class itself or subclasse. |
176 | 879 |
If a protected method is called by some other class, a runtime |
880 |
error (PrivateMethodSignal) is raised. |
|
747 | 881 |
|
176 | 882 |
Notice: method privacy is a nonstandard feature, not supported |
883 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 884 |
|
176 | 885 |
This is EXPERIMENTAL - and being evaluated for usability. |
886 |
It may change or even vanish (if it shows to be not useful)." |
|
887 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
888 |
^ self privacy == #protected |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
889 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
890 |
"Modified: / 23.1.1998 / 15:23:27 / stefan" |
176 | 891 |
! |
892 |
||
893 |
isPublic |
|
894 |
"return true, if this is a public method - I.e. can be executed via any send. |
|
747 | 895 |
This is the default and how other smalltalk implementations treat all methods. |
896 |
||
360 | 897 |
Notice: method privacy is a nonstandard feature, not supported |
898 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 899 |
|
360 | 900 |
This is EXPERIMENTAL - and being evaluated for usability. |
901 |
It may change or even vanish (if it shows to be not useful)." |
|
176 | 902 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
903 |
^ self privacy == #public |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
904 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
905 |
"Modified: / 23.1.1998 / 15:23:40 / stefan" |
176 | 906 |
! |
907 |
||
747 | 908 |
isRestricted |
909 |
"return the flag bit stating that this method is restricted. |
|
910 |
Execution of the receiver will only be allowed if the system is not in |
|
12854 | 911 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
747 | 912 |
error (PrivateMethodSignal) is raised. |
913 |
||
914 |
Notice: method restriction is a nonstandard feature, not supported |
|
915 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
916 |
||
917 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
918 |
It may change or even vanish (if it shows to be not useful)." |
|
919 |
||
920 |
%{ /* NOCONTEXT */ |
|
921 |
#ifdef F_RESTRICTED |
|
2868 | 922 |
INT f = __intVal(__INST(flags)); |
747 | 923 |
|
924 |
if (f & F_RESTRICTED) { |
|
13463 | 925 |
RETURN (true); |
747 | 926 |
} |
927 |
#endif |
|
928 |
%}. |
|
929 |
^ false |
|
8526 | 930 |
! ! |
931 |
||
932 |
!Method privateMethodsFor:'accessing-visibility'! |
|
933 |
||
934 |
primSetPrivacy:aSymbol |
|
935 |
"set the methods access rights (privacy) from a symbol; |
|
936 |
Currently, this must be one of #private, #protected, #public or #ignored. |
|
12854 | 937 |
#setPrivacy: simply sets the attribute. When changing methods, that |
8526 | 938 |
have already been called, #privacy: should be used. |
939 |
||
940 |
Notice: method privacy is a nonstandard feature, not supported |
|
941 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
942 |
If at all, use it for debugging purposes, to catch messagesends |
|
943 |
which are not supposed to be sent by others. |
|
944 |
(especially, if working in a team, while integrating other peoples work) |
|
945 |
||
946 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
947 |
It may change or even vanish (if it shows to be not useful)." |
|
948 |
||
949 |
%{ /* NOCONTEXT */ |
|
950 |
||
951 |
#if defined(M_PRIVACY) |
|
952 |
INT f = __intVal(__INST(flags)); |
|
953 |
INT p; |
|
954 |
||
955 |
if (aSymbol == @symbol(public)) |
|
13463 | 956 |
p = 0; |
8526 | 957 |
else if (aSymbol == @symbol(protected)) |
13463 | 958 |
p = F_PRIVATE; |
8526 | 959 |
else if (aSymbol == @symbol(private)) |
13463 | 960 |
p = F_CLASSPRIVATE; |
8526 | 961 |
else if (aSymbol == @symbol(ignored)) |
13463 | 962 |
p = F_IGNORED; |
8526 | 963 |
else |
13463 | 964 |
RETURN(false); /* illegal symbol */ |
12854 | 965 |
|
8526 | 966 |
|
967 |
f = (f & ~M_PRIVACY) | p; |
|
8913 | 968 |
__INST(flags) = __mkSmallInteger(f); |
8526 | 969 |
#endif |
970 |
||
971 |
%}. |
|
972 |
^ true |
|
973 |
||
974 |
"Modified: 27.8.1995 / 22:58:08 / claus" |
|
975 |
! ! |
|
976 |
||
977 |
!Method methodsFor:'accessing-visibility'! |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
978 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
979 |
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
|
980 |
"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
|
981 |
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
|
982 |
|
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 |
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
|
984 |
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
|
985 |
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
|
986 |
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
|
987 |
(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
|
988 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
989 |
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
|
990 |
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
|
991 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
992 |
%{ /* NOCONTEXT */ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
993 |
/* 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
|
994 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
995 |
#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
|
996 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
997 |
INT f = __intVal(__INST(flags)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
998 |
switch (f & M_PRIVACY) { |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
999 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1000 |
# ifdef F_PRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1001 |
case F_PRIVATE: |
13463 | 1002 |
RETURN (@symbol(protected)); |
1003 |
break; |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1004 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1005 |
# ifdef F_CLASSPRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1006 |
case F_CLASSPRIVATE: |
13463 | 1007 |
RETURN (@symbol(private)); |
1008 |
break; |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1009 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1010 |
# ifdef F_IGNORED |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1011 |
case F_IGNORED: |
13463 | 1012 |
RETURN (@symbol(ignored)); |
1013 |
break; |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1014 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1015 |
} |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1016 |
#endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1017 |
%}. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1018 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1019 |
^ #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
|
1020 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1021 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1022 |
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
|
1023 |
"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
|
1024 |
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
|
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 |
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
|
1027 |
by other smalltalk implementations and not specified in the ANSI spec. |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
1028 |
If at all, use it for debugging purposes, to catch message sends |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1029 |
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
|
1030 |
(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
|
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 |
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
|
1033 |
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
|
1034 |
|
8526 | 1035 |
|oldPrivacy| |
1036 |
||
1037 |
oldPrivacy := self privacy. |
|
1038 |
||
1039 |
(self setPrivacy:aSymbol flushCaches:true) ifTrue:[ |
|
13463 | 1040 |
|myClass mySelector| |
1041 |
||
1042 |
myClass := self mclass. |
|
1043 |
mySelector := self selector. |
|
1044 |
||
1045 |
self changed:#privacy. "/ will vanish |
|
1046 |
myClass notNil ifTrue:[ |
|
1047 |
mySelector notNil ifTrue:[ |
|
1048 |
myClass changed:#methodPrivacy with:mySelector. "/ will vanish |
|
1049 |
Smalltalk changed:#privacyOfMethod with:(Array with:myClass with:self with:oldPrivacy). |
|
1050 |
myClass addChangeRecordForMethodPrivacy:self. |
|
1051 |
] |
|
1052 |
] |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1053 |
] |
10196 | 1054 |
|
1055 |
"Modified: / 23-11-2006 / 17:03:20 / 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
|
1056 |
! |
747 | 1057 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1058 |
restricted:aBoolean |
12854 | 1059 |
"set or clear the flag bit stating that this method is restricted. |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1060 |
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
|
1061 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1062 |
error (PrivateMethodSignal) is raised. |
747 | 1063 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1064 |
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
|
1065 |
by other smalltalk implementations and not specified in the ANSI spec. |
747 | 1066 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1067 |
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
|
1068 |
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
|
1069 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1070 |
%{ /* NOCONTEXT */ |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1071 |
/* 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
|
1072 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1073 |
#ifdef F_RESTRICTED |
2868 | 1074 |
INT f = __intVal(__INST(flags)); |
1075 |
INT old; |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1076 |
|
747 | 1077 |
old = f; |
12854 | 1078 |
if (aBoolean == true) |
13463 | 1079 |
f |= F_RESTRICTED; |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1080 |
else |
13463 | 1081 |
f &= ~F_RESTRICTED; |
8913 | 1082 |
__INST(flags) = __mkSmallInteger(f); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1083 |
if (old & F_RESTRICTED) |
13463 | 1084 |
RETURN(true); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1085 |
#endif |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1086 |
%}. |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1087 |
^ false |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1088 |
|
747 | 1089 |
" |
1090 |
(ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true |
|
1091 |
" |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1092 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1093 |
"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
|
1094 |
! |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1095 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1096 |
setPrivacy:aSymbol |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1097 |
"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
|
1098 |
Currently, this must be one of #private, #protected, #public or #ignored. |
12854 | 1099 |
#setPrivacy: simply sets the attribute. When changing methods, that |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1100 |
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
|
1101 |
|
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 |
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
|
1103 |
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
|
1104 |
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
|
1105 |
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
|
1106 |
(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
|
1107 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1108 |
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
|
1109 |
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
|
1110 |
|
8526 | 1111 |
^ self setPrivacy:aSymbol flushCaches:true |
1112 |
! |
|
1113 |
||
1114 |
setPrivacy:aSymbol flushCaches:doFlush |
|
1115 |
"set the methods access rights (privacy) from a symbol; |
|
1116 |
Currently, this must be one of #private, #protected, #public or #ignored. |
|
12854 | 1117 |
#setPrivacy: simply sets the attribute. When changing methods, that |
8526 | 1118 |
have already been called, #privacy: should be used. |
1119 |
||
1120 |
Notice: method privacy is a nonstandard feature, not supported |
|
1121 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1122 |
If at all, use it for debugging purposes, to catch messagesends |
|
1123 |
which are not supposed to be sent by others. |
|
1124 |
(especially, if working in a team, while integrating other peoples work) |
|
1125 |
||
1126 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1127 |
It may change or even vanish (if it shows to be not useful)." |
|
1128 |
||
1129 |
|old sel| |
|
1130 |
||
1131 |
old := self privacy. |
|
1132 |
old == aSymbol ifTrue:[^ false]. |
|
1133 |
(self primSetPrivacy:aSymbol) ifFalse:[^ false]. |
|
1134 |
||
1135 |
"/ |
|
1136 |
"/ no need to flush, if changing from private to public |
|
1137 |
"/ |
|
1138 |
doFlush ifTrue:[ |
|
13463 | 1139 |
(aSymbol == #public and:[old ~~ #ignored]) ifFalse:[ |
1140 |
(sel := self selector) notNil ifTrue:[ |
|
1141 |
ObjectMemory flushCachesForSelector:sel |
|
1142 |
] ifFalse:[ |
|
1143 |
ObjectMemory flushCaches. |
|
1144 |
]. |
|
1145 |
]. |
|
8526 | 1146 |
]. |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1147 |
^ true |
1 | 1148 |
! ! |
1149 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1150 |
!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
|
1151 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1152 |
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
|
1153 |
"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
|
1154 |
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
|
1155 |
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
|
1156 |
the methodDictionary of any class - just returned. |
2064 | 1157 |
If the method contains primitive code, this may return a method |
1158 |
without bytecode. |
|
12854 | 1159 |
Can be used to obtain a bytecode version of a machine-code method, |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1160 |
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
|
1161 |
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
|
1162 |
|
9096 | 1163 |
|mthd| |
1 | 1164 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1165 |
byteCode notNil ifTrue:[ |
13463 | 1166 |
" |
1167 |
is already a bytecoded method |
|
1168 |
" |
|
1169 |
^ 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
|
1170 |
]. |
9096 | 1171 |
|
1172 |
ParserFlags |
|
13463 | 1173 |
withSTCCompilation:#never |
1174 |
do:[ |
|
1175 |
mthd := self asExecutableMethod. |
|
1176 |
]. |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1177 |
^ mthd |
68 | 1178 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1179 |
"Created: 24.10.1995 / 14:02:32 / cg" |
2064 | 1180 |
"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
|
1181 |
! |
306 | 1182 |
|
5405 | 1183 |
asByteCodeMethodWithSource:newSource |
9096 | 1184 |
|mthd| |
1185 |
||
12854 | 1186 |
ParserFlags |
13463 | 1187 |
withSTCCompilation:#never |
1188 |
do:[ |
|
1189 |
mthd := self asExecutableMethodWithSource:newSource. |
|
1190 |
]. |
|
5405 | 1191 |
^ mthd |
1192 |
||
1193 |
"Created: 24.10.1995 / 14:02:32 / cg" |
|
1194 |
"Modified: 5.1.1997 / 01:01:53 / cg" |
|
1195 |
! |
|
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 |
asExecutableMethod |
12854 | 1198 |
"if the receiver has neither bytecodes nor machinecode, create & return a |
952
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 |
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
|
1200 |
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
|
1201 |
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
|
1202 |
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
|
1203 |
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
|
1204 |
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
|
1205 |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1206 |
|temporaryMethod sourceString| |
306 | 1207 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1208 |
byteCode notNil ifTrue:[ |
13463 | 1209 |
" |
1210 |
is already a bytecoded method |
|
1211 |
" |
|
1212 |
^ self |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1213 |
]. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1214 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1215 |
sourceString := self source. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1216 |
sourceString isNil ifTrue:[ |
13463 | 1217 |
'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR. |
1218 |
^ 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
|
1219 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1220 |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1221 |
temporaryMethod := self asExecutableMethodWithSource:sourceString. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1222 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1223 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
13463 | 1224 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
1225 |
^ nil. |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1226 |
]. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1227 |
"/ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1228 |
"/ try to save a bit of memory, by sharing the source (whatever it is) |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1229 |
"/ |
12854 | 1230 |
temporaryMethod sourceFilename:source position:sourcePosition. |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1231 |
^ temporaryMethod |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1232 |
! |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1233 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1234 |
asExecutableMethodWithSource:newSource |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1235 |
|temporaryMethod cls| |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1236 |
|
952
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 |
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
|
1238 |
cls isNil ifTrue:[ |
13463 | 1239 |
'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR. |
1240 |
^ nil |
|
306 | 1241 |
]. |
1 | 1242 |
|
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
1243 |
"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
|
1244 |
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
|
1245 |
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
|
1246 |
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
|
1247 |
(happened when autoloading animation demos) |
176 | 1248 |
" |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
1249 |
CompilationLock critical:[ |
13463 | 1250 |
" |
1251 |
dont want this to go into the changes file, |
|
1252 |
dont want output on Transcript and definitely |
|
1253 |
dont want a lazy method ... |
|
1254 |
" |
|
1255 |
Class withoutUpdatingChangesDo:[ |
|
1256 |
|silent lazy| |
|
1257 |
||
1258 |
silent := Smalltalk silentLoading:true. |
|
1259 |
lazy := Compiler compileLazy:false. |
|
1260 |
||
1261 |
[ |
|
1262 |
|compiler| |
|
1263 |
||
1264 |
Class nameSpaceQuerySignal answer:(cls nameSpace) |
|
1265 |
do:[ |
|
1266 |
compiler := cls compilerClass. |
|
1267 |
||
1268 |
"/ |
|
1269 |
"/ kludge - have to make ST/X's compiler protocol |
|
1270 |
"/ be compatible to ST-80's |
|
1271 |
"/ |
|
1272 |
(compiler respondsTo:#compile:forClass:inCategory:notifying:install:) |
|
1273 |
ifTrue:[ |
|
1274 |
temporaryMethod := compiler |
|
1275 |
compile:newSource |
|
1276 |
forClass:cls |
|
1277 |
inCategory:(self category) |
|
1278 |
notifying:nil |
|
1279 |
install:false. |
|
1280 |
] ifFalse:[ |
|
1281 |
temporaryMethod := compiler new |
|
1282 |
compile:newSource |
|
1283 |
in:cls |
|
1284 |
notifying:nil |
|
1285 |
ifFail:nil |
|
1286 |
]. |
|
1287 |
]. |
|
1288 |
] ensure:[ |
|
1289 |
Compiler compileLazy:lazy. |
|
1290 |
Smalltalk silentLoading:silent. |
|
1291 |
] |
|
1292 |
]. |
|
463
447ead9f870c
be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents:
444
diff
changeset
|
1293 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1294 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
13463 | 1295 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
1296 |
^ nil. |
|
5405 | 1297 |
]. |
1298 |
"/ |
|
1299 |
"/ try to save a bit of memory, by sharing the source (whatever it is) |
|
1300 |
"/ |
|
12854 | 1301 |
temporaryMethod source:newSource. |
5405 | 1302 |
"/ |
1303 |
"/ dont forget the methods class & package ... |
|
1304 |
"/ |
|
1305 |
temporaryMethod setPackage:package. |
|
1306 |
temporaryMethod mclass:mclass. |
|
1307 |
^ temporaryMethod |
|
1 | 1308 |
! ! |
1309 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1310 |
!Method methodsFor:'copying'! |
438 | 1311 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1312 |
copy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1313 |
"redefined to change a source ref into a real string" |
438 | 1314 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1315 |
|aCopy| |
438 | 1316 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1317 |
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
|
1318 |
sourcePosition notNil ifTrue:[ |
13463 | 1319 |
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
|
1320 |
]. |
5676 | 1321 |
aCopy mclass: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
|
1322 |
^ aCopy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1323 |
|
5696 | 1324 |
"Modified: 16.1.1997 / 01:27:25 / cg" |
1325 |
! ! |
|
438 | 1326 |
|
1 | 1327 |
!Method methodsFor:'error handling'! |
1328 |
||
328 | 1329 |
invalidCodeObject |
1873 | 1330 |
"{ Pragma: +optSpace }" |
1331 |
||
93 | 1332 |
"this method is triggered by the interpreter when a nil or non method |
1333 |
is about to be executed. |
|
1334 |
In this case, the VM sends this to the bad method (the receiver). |
|
1335 |
||
1336 |
Also, the Compiler creates methods with their code/bytecode set to |
|
1337 |
this method if - after a class change - a method cannot be compiled |
|
1338 |
and is therefore no longer executable (for example, after an instvar |
|
68 | 1339 |
has been removed, and a method still tries to access this instvar) |
44 | 1340 |
|
93 | 1341 |
Thus, we arrive here, when playing around in a classes methodArray, |
12854 | 1342 |
or compiler/runtime system is broken :-(, |
93 | 1343 |
or you ignore the error messages during some recompile." |
1 | 1344 |
|
1873 | 1345 |
%{ |
1346 |
/* |
|
1347 |
* for reasons too far from being explained here, |
|
1348 |
* this MUST be a compiled method |
|
1349 |
*/ |
|
1350 |
%}. |
|
7601 | 1351 |
^ InvalidCodeError |
13463 | 1352 |
raiseErrorString:'invalid method - not executable'. |
1873 | 1353 |
|
1354 |
"Modified: 4.11.1996 / 22:45:06 / cg" |
|
1 | 1355 |
! |
1356 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1357 |
invalidCodeObjectWith:arg |
1873 | 1358 |
"{ Pragma: +optSpace }" |
1359 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1360 |
"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
|
1361 |
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
|
1362 |
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
|
1363 |
|
1873 | 1364 |
%{ |
1365 |
/* |
|
1366 |
* for reasons too far from being explained here, |
|
1367 |
* this MUST be a compiled method |
|
1368 |
*/ |
|
1369 |
%}. |
|
7601 | 1370 |
^ InvalidCodeError |
13463 | 1371 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1372 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1373 |
"Created: 4.11.1996 / 21:16:16 / cg" |
1873 | 1374 |
"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
|
1375 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1376 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1377 |
invalidCodeObjectWith:arg with:arg2 |
1873 | 1378 |
"{ Pragma: +optSpace }" |
1379 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1380 |
"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
|
1381 |
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
|
1382 |
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
|
1383 |
|
1873 | 1384 |
%{ |
1385 |
/* |
|
1386 |
* for reasons too far from being explained here, |
|
1387 |
* this MUST be a compiled method |
|
1388 |
*/ |
|
1389 |
%}. |
|
7601 | 1390 |
^ InvalidCodeError |
13463 | 1391 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1392 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1393 |
"Created: 4.11.1996 / 21:16:41 / cg" |
1873 | 1394 |
"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
|
1395 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1396 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1397 |
invalidCodeObjectWith:arg with:arg2 with:arg3 |
1873 | 1398 |
"{ Pragma: +optSpace }" |
1399 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1400 |
"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
|
1401 |
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
|
1402 |
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
|
1403 |
|
1873 | 1404 |
%{ |
1405 |
/* |
|
1406 |
* for reasons too far from being explained here, |
|
1407 |
* this MUST be a compiled method |
|
1408 |
*/ |
|
1409 |
%}. |
|
7601 | 1410 |
^ InvalidCodeError |
13463 | 1411 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1412 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1413 |
"Created: 4.11.1996 / 21:16:51 / cg" |
1873 | 1414 |
"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
|
1415 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1416 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1417 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 |
1873 | 1418 |
"{ Pragma: +optSpace }" |
1419 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1420 |
"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
|
1421 |
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
|
1422 |
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
|
1423 |
|
1873 | 1424 |
%{ |
1425 |
/* |
|
1426 |
* for reasons too far from being explained here, |
|
1427 |
* this MUST be a compiled method |
|
1428 |
*/ |
|
1429 |
%}. |
|
7601 | 1430 |
^ InvalidCodeError |
13463 | 1431 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1432 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1433 |
"Created: 4.11.1996 / 21:17:00 / cg" |
1873 | 1434 |
"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
|
1435 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1436 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1437 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 |
1873 | 1438 |
"{ Pragma: +optSpace }" |
1439 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1440 |
"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
|
1441 |
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
|
1442 |
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
|
1443 |
|
1873 | 1444 |
%{ |
1445 |
/* |
|
1446 |
* for reasons too far from being explained here, |
|
1447 |
* this MUST be a compiled method |
|
1448 |
*/ |
|
1449 |
%}. |
|
7601 | 1450 |
^ InvalidCodeError |
13463 | 1451 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1452 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1453 |
"Created: 4.11.1996 / 21:17:09 / cg" |
1873 | 1454 |
"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
|
1455 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1456 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1457 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
1873 | 1458 |
"{ Pragma: +optSpace }" |
1459 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1460 |
"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
|
1461 |
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
|
1462 |
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
|
1463 |
|
1873 | 1464 |
%{ |
1465 |
/* |
|
1466 |
* for reasons too far from being explained here, |
|
1467 |
* this MUST be a compiled method |
|
1468 |
*/ |
|
1469 |
%}. |
|
7601 | 1470 |
^ InvalidCodeError |
13463 | 1471 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1472 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1473 |
"Created: 4.11.1996 / 21:17:17 / cg" |
1873 | 1474 |
"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
|
1475 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1476 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1477 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 |
1873 | 1478 |
"{ Pragma: +optSpace }" |
1479 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1480 |
"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
|
1481 |
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
|
1482 |
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
|
1483 |
|
1873 | 1484 |
%{ |
1485 |
/* |
|
1486 |
* for reasons too far from being explained here, |
|
1487 |
* this MUST be a compiled method |
|
1488 |
*/ |
|
1489 |
%}. |
|
7601 | 1490 |
^ InvalidCodeError |
13463 | 1491 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1492 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1493 |
"Created: 4.11.1996 / 21:17:25 / cg" |
1873 | 1494 |
"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
|
1495 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1496 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1497 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 |
1873 | 1498 |
"{ Pragma: +optSpace }" |
1499 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1500 |
"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
|
1501 |
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
|
1502 |
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
|
1503 |
|
1873 | 1504 |
%{ |
1505 |
/* |
|
1506 |
* for reasons too far from being explained here, |
|
1507 |
* this MUST be a compiled method |
|
1508 |
*/ |
|
1509 |
%}. |
|
7601 | 1510 |
^ InvalidCodeError |
13463 | 1511 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1512 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1513 |
"Created: 4.11.1996 / 21:17:32 / cg" |
1873 | 1514 |
"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
|
1515 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1516 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1517 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 |
1873 | 1518 |
"{ Pragma: +optSpace }" |
1519 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1520 |
"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
|
1521 |
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
|
1522 |
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
|
1523 |
|
1873 | 1524 |
%{ |
1525 |
/* |
|
1526 |
* for reasons too far from being explained here, |
|
1527 |
* this MUST be a compiled method |
|
1528 |
*/ |
|
1529 |
%}. |
|
7601 | 1530 |
^ InvalidCodeError |
13463 | 1531 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1532 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1533 |
"Created: 4.11.1996 / 21:17:37 / cg" |
1873 | 1534 |
"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
|
1535 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1536 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1537 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 |
1873 | 1538 |
"{ Pragma: +optSpace }" |
1539 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1540 |
"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
|
1541 |
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
|
1542 |
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
|
1543 |
|
1873 | 1544 |
%{ |
1545 |
/* |
|
1546 |
* for reasons too far from being explained here, |
|
1547 |
* this MUST be a compiled method |
|
1548 |
*/ |
|
1549 |
%}. |
|
7601 | 1550 |
^ InvalidCodeError |
13463 | 1551 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1552 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1553 |
"Created: 4.11.1996 / 21:17:45 / cg" |
1873 | 1554 |
"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
|
1555 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1556 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1557 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 |
1873 | 1558 |
"{ Pragma: +optSpace }" |
1559 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1560 |
"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
|
1561 |
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
|
1562 |
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
|
1563 |
|
1873 | 1564 |
%{ |
1565 |
/* |
|
1566 |
* for reasons too far from being explained here, |
|
1567 |
* this MUST be a compiled method |
|
1568 |
*/ |
|
1569 |
%}. |
|
7601 | 1570 |
^ InvalidCodeError |
13463 | 1571 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1572 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1573 |
"Created: 4.11.1996 / 21:17:52 / cg" |
1873 | 1574 |
"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
|
1575 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1576 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1577 |
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 | 1578 |
"{ Pragma: +optSpace }" |
1579 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1580 |
"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
|
1581 |
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
|
1582 |
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
|
1583 |
|
1873 | 1584 |
%{ |
1585 |
/* |
|
1586 |
* for reasons too far from being explained here, |
|
1587 |
* this MUST be a compiled method |
|
1588 |
*/ |
|
1589 |
%}. |
|
7601 | 1590 |
^ InvalidCodeError |
13463 | 1591 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1592 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1593 |
"Created: 4.11.1996 / 20:51:28 / cg" |
1873 | 1594 |
"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
|
1595 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1596 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1597 |
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 | 1598 |
"{ Pragma: +optSpace }" |
1599 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1600 |
"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
|
1601 |
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
|
1602 |
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
|
1603 |
|
1873 | 1604 |
%{ |
1605 |
/* |
|
1606 |
* for reasons too far from being explained here, |
|
1607 |
* this MUST be a compiled method |
|
1608 |
*/ |
|
1609 |
%}. |
|
7601 | 1610 |
^ InvalidCodeError |
13463 | 1611 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1612 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1613 |
"Created: 4.11.1996 / 21:18:09 / cg" |
1873 | 1614 |
"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
|
1615 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1616 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1617 |
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 | 1618 |
"{ Pragma: +optSpace }" |
1619 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1620 |
"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
|
1621 |
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
|
1622 |
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
|
1623 |
|
1873 | 1624 |
%{ |
1625 |
/* |
|
1626 |
* for reasons too far from being explained here, |
|
1627 |
* this MUST be a compiled method |
|
1628 |
*/ |
|
1629 |
%}. |
|
7601 | 1630 |
^ InvalidCodeError |
13463 | 1631 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1632 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1633 |
"Created: 4.11.1996 / 21:18:17 / cg" |
1873 | 1634 |
"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
|
1635 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1636 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1637 |
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 | 1638 |
"{ Pragma: +optSpace }" |
1639 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1640 |
"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
|
1641 |
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
|
1642 |
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
|
1643 |
|
1873 | 1644 |
%{ |
1645 |
/* |
|
1646 |
* for reasons too far from being explained here, |
|
1647 |
* this MUST be a compiled method |
|
1648 |
*/ |
|
1649 |
%}. |
|
7601 | 1650 |
^ InvalidCodeError |
13463 | 1651 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1652 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1653 |
"Created: 4.11.1996 / 21:18:22 / cg" |
1873 | 1654 |
"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
|
1655 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1656 |
|
109 | 1657 |
privateMethodCalled |
1873 | 1658 |
"{ Pragma: +optSpace }" |
1659 |
||
980 | 1660 |
"this error is triggered, if a private or protected method is called. |
1661 |
||
360 | 1662 |
If you continue in the debugger, the method will be called, |
12854 | 1663 |
and further privacy exceptions will NOT be reported at this call location, |
360 | 1664 |
until any new method is compiled, or the privacy of any method changes, |
1665 |
or the caches are flushed. |
|
1666 |
(the reason is that after the continue, the method is enterred into the |
|
1667 |
calling cache, for which method privacy is not checked. |
|
1668 |
Any of the above actions flushes this cache and a privacy check |
|
1669 |
is performed again.) |
|
1670 |
Future versions may not enter private methods into the cache, to fix this |
|
1671 |
(unobvious) behavior. However, then you will get an exception for EVERY |
|
1672 |
call to a private method ... |
|
1673 |
||
1674 |
Notice: method privacy is a nonstandard feature, not supported |
|
1675 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1676 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1677 |
It may change or even vanish (if it shows to be not useful)." |
|
68 | 1678 |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
1679 |
^ PrivateMethodSignal raiseRequest |
1873 | 1680 |
|
1681 |
"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
|
1682 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1683 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1684 |
uncompiledCodeObject |
1873 | 1685 |
"{ Pragma: +optSpace }" |
1686 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1687 |
"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
|
1688 |
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
|
1689 |
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
|
1690 |
For those methods, the compiler generated a method object consisting |
1873 | 1691 |
of the original source code, but with this methods machine/byte code." |
1692 |
||
1693 |
%{ |
|
1694 |
/* |
|
1695 |
* for reasons too far from being explained here, |
|
1696 |
* this MUST be a compiled method |
|
1697 |
*/ |
|
1698 |
%}. |
|
7601 | 1699 |
^ InvalidCodeError |
13463 | 1700 |
raiseRequestWith:self |
1701 |
errorString:'invalid method - not compiled'. |
|
1873 | 1702 |
|
1703 |
"Modified: 4.11.1996 / 22:58:02 / cg" |
|
1704 |
! |
|
1705 |
||
1706 |
unloadedCodeObject |
|
1707 |
"{ Pragma: +optSpace }" |
|
1708 |
||
1709 |
"this method is invoked by methods which have been binary-unloaded |
|
1710 |
For those the source info consists |
|
1711 |
of the original source code, but with this methods machine/byte code." |
|
1712 |
||
1713 |
%{ |
|
1714 |
/* |
|
1715 |
* for reasons too far from being explained here, |
|
1716 |
* this MUST be a compiled method |
|
1717 |
*/ |
|
1718 |
%}. |
|
7601 | 1719 |
^ InvalidCodeError |
13463 | 1720 |
raiseRequestWith:self |
1721 |
errorString:'invalid method - unloaded'. |
|
1873 | 1722 |
|
1723 |
"Created: 4.11.1996 / 22:57:54 / cg" |
|
1724 |
"Modified: 4.11.1996 / 22:58:28 / cg" |
|
1 | 1725 |
! ! |
1726 |
||
9987 | 1727 |
|
93 | 1728 |
!Method methodsFor:'printing & storing'! |
1 | 1729 |
|
1730 |
printOn:aStream |
|
56 | 1731 |
"put a printed representation of the receiver onto aStream. |
1732 |
Since methods do not store their class/selector, we have to search |
|
1733 |
for it here." |
|
1 | 1734 |
|
227 | 1735 |
|classAndSelector m wrapped| |
1 | 1736 |
|
253 | 1737 |
wrapped := false. |
1738 |
||
6234
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1739 |
self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle). |
159 | 1740 |
aStream nextPut:$(. |
227 | 1741 |
|
176 | 1742 |
classAndSelector := self who. |
227 | 1743 |
classAndSelector isNil ifTrue:[ |
13463 | 1744 |
" |
1745 |
not anchored in any class. |
|
1746 |
check if wrapped (to be more informative in inspectors) |
|
1747 |
" |
|
1748 |
m := self wrapper. |
|
1749 |
m notNil ifTrue:[ |
|
1750 |
classAndSelector := m who. |
|
1751 |
wrapped := true. |
|
1752 |
] |
|
227 | 1753 |
]. |
176 | 1754 |
classAndSelector notNil ifTrue:[ |
13463 | 1755 |
(classAndSelector methodClass) name printOn:aStream. |
1756 |
aStream nextPutAll:' '. |
|
1757 |
(classAndSelector methodSelector) printOn:aStream. |
|
1 | 1758 |
] ifFalse:[ |
13463 | 1759 |
" |
1760 |
sorry, a method which is nowhere anchored |
|
1761 |
" |
|
1762 |
aStream nextPutAll:'unbound' |
|
56 | 1763 |
]. |
13101 | 1764 |
aStream nextPut:$). |
1765 |
||
1766 |
wrapped ifTrue:[ |
|
13463 | 1767 |
aStream nextPutAll:'; wrapped' |
13101 | 1768 |
]. |
176 | 1769 |
|
1770 |
" |
|
253 | 1771 |
(Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr. |
1772 |
(Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr. |
|
10083 | 1773 |
|
1774 |
(Object compiledMethodAt:#at:) whoString printOn:Transcript. Transcript cr. |
|
1775 |
(Object compiledMethodAt:#at:) copy whoString printOn:Transcript. Transcript cr. |
|
176 | 1776 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1777 |
|
13101 | 1778 |
"Modified: / 22-10-2010 / 12:07:25 / 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
|
1779 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1780 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1781 |
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
|
1782 |
"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
|
1783 |
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
|
1784 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1785 |
|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
|
1786 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1787 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1788 |
who notNil ifTrue:[ |
13463 | 1789 |
^ who methodClass name , ' >> ' , (who methodSelector storeString) |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1790 |
]. |
6071 | 1791 |
^ 'unboundMethod' |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1792 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1793 |
" |
12854 | 1794 |
Method new whoString |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1795 |
(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
|
1796 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1797 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1798 |
"Modified: 1.11.1996 / 16:27:04 / cg" |
1 | 1799 |
! ! |
1800 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1801 |
!Method methodsFor:'private'! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1802 |
|
13422 | 1803 |
annotationAtIndex: index |
1804 |
||
1805 |
"return annotation at given index. |
|
1806 |
any raw annotation array is lazily |
|
1807 |
initialized" |
|
1808 |
||
1809 |
| annotation args | |
|
1810 |
annotations ifNil:[^nil]. |
|
1811 |
annotation := annotations at: index. |
|
13463 | 1812 |
annotation isArray ifTrue:[ |
1813 |
args := annotation size == 2 |
|
1814 |
ifTrue:[annotation second] |
|
1815 |
ifFalse:[#()]. |
|
1816 |
args isArray ifFalse:[args := Array with: args]. |
|
1817 |
annotation := Annotation |
|
1818 |
key: annotation first |
|
1819 |
arguments: args. |
|
1820 |
annotation isUnknown ifFalse:[ |
|
1821 |
annotations at: index put: annotation. |
|
13422 | 1822 |
"/ annotation annotatesMethod: self |
13463 | 1823 |
]. |
13422 | 1824 |
]. |
1825 |
^annotation |
|
1826 |
||
1827 |
"Created: / 02-07-2010 / 22:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1828 |
"Modified: / 11-07-2010 / 19:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1829 |
! |
|
1830 |
||
1831 |
annotationIndexOf: key |
|
1832 |
||
1833 |
"Returns index of annotation with given key |
|
1834 |
or nil if there is no such annotation" |
|
1835 |
||
1836 |
annotations ifNil:[^nil]. |
|
13463 | 1837 |
|
13422 | 1838 |
annotations keysAndValuesDo: |
13463 | 1839 |
[:index :annotationOrArray| |
1840 |
annotationOrArray isArray |
|
1841 |
ifTrue: [annotationOrArray first == key ifTrue:[^index]] |
|
1842 |
ifFalse:[annotationOrArray key == key ifTrue:[^index]]]. |
|
13422 | 1843 |
^nil. |
1844 |
||
1845 |
"Created: / 19-05-2010 / 16:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1846 |
"Modified: / 11-07-2010 / 19:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1847 |
! |
|
1848 |
||
12695 | 1849 |
cacheSourceStream:aStream |
1850 |
"remember a (raw) source stream for later use" |
|
1851 |
||
1852 |
|lastStream| |
|
1853 |
||
1854 |
(package notNil and:[package ~= PackageId noProjectID]) ifTrue:[ |
|
13463 | 1855 |
LastFileLock critical:[ |
1856 |
lastStream := LastFileReference at:1. |
|
1857 |
(lastStream notNil and:[lastStream ~= 0 and:[lastStream isOpen]]) ifTrue:[ |
|
1858 |
lastStream close. |
|
1859 |
]. |
|
1860 |
LastSourceFileName := package,'/',source. |
|
1861 |
LastFileReference at:1 put:aStream. |
|
1862 |
]. |
|
12695 | 1863 |
]. |
1864 |
! |
|
1865 |
||
13422 | 1866 |
getAnnotations |
1867 |
||
1868 |
^annotations |
|
1869 |
||
1870 |
"Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1871 |
"Modified: / 11-07-2010 / 19:30:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1872 |
! |
|
1873 |
||
1874 |
getLookupObject |
|
1875 |
||
1876 |
^lookupObject |
|
1877 |
||
1878 |
"Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1879 |
! |
|
1880 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1881 |
localSourceStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1882 |
"try to open a stream from a local source file, |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1883 |
searching in standard places." |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1884 |
|
8216 | 1885 |
|dir fileName aStream| |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1886 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1887 |
package notNil ifTrue:[ |
13463 | 1888 |
"/ |
1889 |
"/ old: look in 'source/<filename>' |
|
1890 |
"/ this is still kept in order to find user-private |
|
1891 |
"/ classes in her currentDirectory. |
|
1892 |
"/ |
|
1893 |
fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source. |
|
1894 |
fileName notNil ifTrue:[ |
|
1895 |
aStream := fileName asFilename readStreamOrNil. |
|
1896 |
aStream notNil ifTrue:[^ aStream]. |
|
1897 |
]. |
|
1898 |
"/ |
|
1899 |
"/ new: look in package-dir |
|
1900 |
"/ |
|
1901 |
dir := Smalltalk getPackageDirectoryForPackage:package. |
|
1902 |
dir notNil ifTrue:[ |
|
1903 |
fileName := dir construct:source. |
|
1904 |
aStream := fileName asFilename readStreamOrNil. |
|
1905 |
aStream notNil ifTrue:[^ aStream]. |
|
1906 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1907 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1908 |
fileName := Smalltalk getSourceFileName:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1909 |
fileName notNil ifTrue:[ |
13463 | 1910 |
aStream := fileName asFilename readStreamOrNil. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1911 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1912 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1913 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1914 |
|
12682 | 1915 |
rawSourceStreamUsingCache:usingCacheBoolean |
1916 |
"return an open sourceStream (needs positioning). |
|
1917 |
If usingCacheBoolean is true, cache the stream (but take care against concurrent access). |
|
13390
3bee59036719
comment/format in: #rawSourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents:
13381
diff
changeset
|
1918 |
You have to close the stream, if usingCacheBoolean is false, and should not close it |
12682 | 1919 |
if usingCacheBoolean is true." |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1920 |
|
12193 | 1921 |
|aStream fileName who myClass mgr className classNameSymbol dir mod| |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1922 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1923 |
" |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1924 |
if sourcePosition is nonNil, its the fileName and |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1925 |
abs(sourcePosition) is the offset. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1926 |
Otherwise, source is the real source |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1927 |
" |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1928 |
source isNil ifTrue:[^ nil]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1929 |
sourcePosition isNil ifTrue:[^ source readStream]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1930 |
|
12682 | 1931 |
usingCacheBoolean ifTrue:[ |
13463 | 1932 |
(package notNil and:[package ~= PackageId noProjectID]) ifTrue:[ |
1933 |
"/ keep the last source file open, because open/close |
|
1934 |
"/ operations maybe slow on NFS-mounted file systems. |
|
1935 |
"/ Since the reference to the file is weak, it will be closed |
|
1936 |
"/ automatically if the file is not referenced for a while. |
|
1937 |
"/ Neat trick. |
|
1938 |
||
1939 |
LastFileLock critical:[ |
|
1940 |
aStream := LastFileReference at:1. |
|
1941 |
(aStream isNil or:[aStream == 0 or:[aStream isOpen not]]) ifTrue:[ |
|
1942 |
aStream := nil. |
|
1943 |
LastFileReference at:1 put:nil. |
|
1944 |
]. |
|
1945 |
(aStream notNil and:[LastSourceFileName ~= (package,'/',source)]) ifTrue:[ |
|
1946 |
aStream := nil. |
|
1947 |
]. |
|
1948 |
]. |
|
1949 |
||
1950 |
aStream notNil ifTrue:[ |
|
1951 |
^ aStream |
|
1952 |
]. |
|
1953 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1954 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1955 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1956 |
"/ a negative sourcePosition indicates |
12854 | 1957 |
"/ that this is a local file |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1958 |
"/ (not to be requested via the sourceCodeManager) |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1959 |
"/ This kludge was added, to allow sourceCode to be |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1960 |
"/ saved to a local source file (i.e. 'st.src') |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1961 |
"/ and having a clue for which file is meant later. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1962 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1963 |
sourcePosition < 0 ifTrue:[ |
13463 | 1964 |
aStream := source asFilename readStreamOrNil. |
1965 |
aStream isNil ifTrue:[ |
|
1966 |
"/ search in some standard places |
|
1967 |
fileName := Smalltalk getSourceFileName:source. |
|
1968 |
fileName notNil ifTrue:[ |
|
1969 |
aStream := fileName asFilename readStreamOrNil. |
|
1970 |
]. |
|
1971 |
]. |
|
1972 |
aStream notNil ifTrue:[ |
|
1973 |
usingCacheBoolean ifTrue:[ |
|
1974 |
self cacheSourceStream:aStream. |
|
1975 |
]. |
|
1976 |
^ aStream |
|
1977 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1978 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1979 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1980 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1981 |
"/ if there is no SourceManager, look in local standard places first |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1982 |
"/ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1983 |
(Class tryLocalSourceFirst or:[(mgr := Smalltalk at:#SourceCodeManager) isNil]) ifTrue:[ |
13463 | 1984 |
aStream := self localSourceStream. |
1985 |
aStream notNil ifTrue:[ |
|
1986 |
usingCacheBoolean ifTrue:[ |
|
1987 |
self cacheSourceStream:aStream. |
|
1988 |
]. |
|
1989 |
^ aStream |
|
1990 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1991 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1992 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1993 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1994 |
"/ nope - ask my class for the source (this also invokes the SCMgr) |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1995 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1996 |
who := self who. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1997 |
who notNil ifTrue:[ |
13463 | 1998 |
myClass := who methodClass. |
1999 |
||
2000 |
(package notNil and:[package ~= myClass package]) ifTrue:[ |
|
2001 |
"/ I am an extension |
|
2002 |
mgr notNil ifTrue:[ |
|
2003 |
"/ try to get the source using my package information ... |
|
2004 |
mod := package asPackageId module. |
|
2005 |
dir := package asPackageId directory. |
|
2006 |
aStream := mgr streamForExtensionFile:source package:package directory:dir module:mod cache:true. |
|
2007 |
aStream notNil ifTrue:[ |
|
2008 |
usingCacheBoolean ifTrue:[ |
|
2009 |
self cacheSourceStream:aStream. |
|
2010 |
]. |
|
2011 |
^ aStream |
|
2012 |
]. |
|
2013 |
]. |
|
2014 |
"/ consult the local fileSystem |
|
2015 |
aStream := self localSourceStream. |
|
2016 |
aStream notNil ifTrue:[ |
|
2017 |
usingCacheBoolean ifTrue:[ |
|
2018 |
self cacheSourceStream:aStream. |
|
2019 |
]. |
|
2020 |
^ aStream |
|
2021 |
] |
|
2022 |
]. |
|
2023 |
||
2024 |
aStream := myClass sourceStreamFor:source. |
|
2025 |
aStream notNil ifTrue:[ |
|
2026 |
usingCacheBoolean ifTrue:[ |
|
2027 |
self cacheSourceStream:aStream. |
|
2028 |
]. |
|
2029 |
^ aStream |
|
2030 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2031 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2032 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2033 |
"/ |
12854 | 2034 |
"/ nope - look in standard places |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2035 |
"/ (if there is a source-code manager - otherwise, we already did that) |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2036 |
"/ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2037 |
(mgr notNil and:[Class tryLocalSourceFirst not]) ifTrue:[ |
13463 | 2038 |
aStream := self localSourceStream. |
2039 |
aStream notNil ifTrue:[ |
|
2040 |
usingCacheBoolean ifTrue:[ |
|
2041 |
self cacheSourceStream:aStream. |
|
2042 |
]. |
|
2043 |
^ aStream |
|
2044 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2045 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2046 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2047 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2048 |
"/ final chance: try current directory |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2049 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2050 |
aStream isNil ifTrue:[ |
13463 | 2051 |
aStream := source asFilename readStreamOrNil. |
2052 |
aStream notNil ifTrue:[ |
|
2053 |
usingCacheBoolean ifTrue:[ |
|
2054 |
self cacheSourceStream:aStream. |
|
2055 |
]. |
|
2056 |
^ aStream |
|
2057 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2058 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2059 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2060 |
(who isNil and:[source notNil]) ifTrue:[ |
13463 | 2061 |
"/ |
2062 |
"/ mhmh - seems to be a method which used to be in some |
|
2063 |
"/ class, but has been overwritten by another or removed. |
|
2064 |
"/ (i.e. it has no containing class anyMore) |
|
2065 |
"/ try to guess the class from the sourceFileName. |
|
2066 |
"/ and retry. |
|
2067 |
"/ |
|
2068 |
className := Smalltalk classNameForFile:source. |
|
2069 |
(classNameSymbol := className asSymbolIfInterned) notNil ifTrue:[ |
|
2070 |
myClass := Smalltalk at:classNameSymbol ifAbsent:nil. |
|
2071 |
myClass notNil ifTrue:[ |
|
2072 |
aStream := myClass sourceStreamFor:source. |
|
2073 |
aStream notNil ifTrue:[ |
|
2074 |
usingCacheBoolean ifTrue:[ |
|
2075 |
self cacheSourceStream:aStream. |
|
2076 |
]. |
|
2077 |
^ aStream |
|
2078 |
]. |
|
2079 |
] |
|
2080 |
] |
|
12854 | 2081 |
]. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2082 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2083 |
^ nil |
10201 | 2084 |
|
2085 |
"Modified: / 26-11-2006 / 22:33:38 / cg" |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2086 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2087 |
|
13422 | 2088 |
setLookupObject: lookup |
2089 |
"set the lookupObject (low level - use lookupObject:)" |
|
2090 |
||
2091 |
lookupObject := lookup. |
|
2092 |
ObjectMemory flushCaches. |
|
2093 |
||
2094 |
"Created: / 11-07-2010 / 19:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2095 |
! |
|
2096 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2097 |
sourceChunkFromStream:aStream |
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
2098 |
PositionError handle:[:ex | |
13463 | 2099 |
^ nil |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2100 |
] do:[ |
13463 | 2101 |
aStream position1Based:(sourcePosition ? 1) abs. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2102 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2103 |
^ aStream nextChunk. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2104 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2105 |
|
12682 | 2106 |
sourceStreamUsingCache:usingCacheBoolean |
2107 |
"return an open sourceStream (needs positioning). |
|
2108 |
If usingCacheBoolean is true, cache the stream (but take care against concurrent access). |
|
2109 |
You have to close the stream, if usingCacheBoolean is false, ans should not close it |
|
2110 |
if usingCacheBoolean is true." |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2111 |
|
12695 | 2112 |
|rawStream| |
2113 |
||
2114 |
rawStream := self rawSourceStreamUsingCache:usingCacheBoolean. |
|
2115 |
rawStream isNil ifTrue:[ |
|
13463 | 2116 |
^ nil. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2117 |
]. |
12695 | 2118 |
|
2119 |
"/ see if its utf8 encoded... |
|
2120 |
^ EncodedStream decodedStreamFor:rawStream. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2121 |
! ! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2122 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2123 |
!Method methodsFor:'private-compiler interface'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2124 |
|
5405 | 2125 |
primitiveNumber |
2126 |
"for stx rel >= 5.x only: |
|
2127 |
return the primitive number." |
|
2128 |
||
2129 |
%{ /* NOCONTEXT */ |
|
2130 |
||
2131 |
#ifdef F_PRIMITIVE |
|
2132 |
INT f = __intVal(__INST(flags)); |
|
6014 | 2133 |
OBJ nr = 0; |
5405 | 2134 |
|
2135 |
if (f & F_PRIMITIVE) { |
|
13463 | 2136 |
nr = __INST(code_); |
5405 | 2137 |
} |
2138 |
RETURN (nr); |
|
2139 |
#endif |
|
2140 |
%}. |
|
2141 |
self primitiveFailed |
|
2142 |
! |
|
2143 |
||
2144 |
setPrimitiveNumber:aNumber |
|
2145 |
"for stx rel >= 5.x only: |
|
2146 |
mark the method as having primitive code." |
|
2147 |
||
2148 |
%{ /* NOCONTEXT */ |
|
2149 |
||
2150 |
#ifdef F_PRIMITIVE |
|
2151 |
INT f = __intVal(__INST(flags)); |
|
2152 |
||
2153 |
f |= F_PRIMITIVE; |
|
8913 | 2154 |
__INST(flags) = __mkSmallInteger(f); |
5405 | 2155 |
__INST(code_) = aNumber; |
2156 |
RETURN (self); |
|
2157 |
#endif |
|
2158 |
%}. |
|
2159 |
self primitiveFailed |
|
2160 |
||
2161 |
||
2162 |
||
2163 |
! |
|
2164 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2165 |
setResourceFlag |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2166 |
"mark the method as having a <resource> definition in its |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
2167 |
source. This flag can be used to find resource-flagged methods quicker." |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2168 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2169 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2170 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2171 |
#ifdef F_RESOURCE |
2868 | 2172 |
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
|
2173 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2174 |
f |= F_RESOURCE; |
8913 | 2175 |
__INST(flags) = __mkSmallInteger(f); |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2176 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2177 |
%} |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2178 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2179 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2180 |
!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
|
2181 |
|
2702 | 2182 |
accessedInstVars |
2183 |
"return a collection of instVarNames, which are accessed by |
|
2184 |
the receiver method" |
|
2185 |
||
2186 |
|src parser| |
|
2187 |
||
2188 |
src := self source. |
|
2189 |
src notNil ifTrue:[ |
|
13463 | 2190 |
parser := Parser |
2191 |
parseMethod:src |
|
2192 |
in:self containingClass |
|
2193 |
ignoreErrors:true |
|
2194 |
ignoreWarnings:true. |
|
2195 |
||
2196 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
2197 |
^ parser usedInstVars |
|
2198 |
]. |
|
2702 | 2199 |
]. |
2200 |
^ #() "/ actually: unknown |
|
2201 |
||
2202 |
"Modified: 19.6.1997 / 17:54:09 / cg" |
|
2203 |
! |
|
2204 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2205 |
containingClass |
12854 | 2206 |
"return the class I am defined in. |
952
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 |
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
|
2208 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2209 |
"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
|
2210 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2211 |
|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
|
2212 |
|
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
2213 |
mclass notNil ifTrue:[ |
13463 | 2214 |
"/ check if this (cached) info is still valid ... |
2215 |
(mclass containsMethod:self) ifTrue:[ |
|
2216 |
^ mclass |
|
2217 |
]. |
|
2218 |
mclass := nil. |
|
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
2219 |
]. |
5324 | 2220 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2221 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2222 |
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
|
2223 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2224 |
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
|
2225 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2226 |
^ 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
|
2227 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2228 |
" |
12854 | 2229 |
(Object compiledMethodAt:#at:) containingClass |
2230 |
||
2231 |
(Object class compiledMethodAt:#version) 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
|
2232 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2233 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2234 |
|
10482 | 2235 |
externalLibraryFunction |
2236 |
"if this is an externalLibraryFunction call, return the externalLibraryFunction. |
|
2237 |
Returns nil otherwise." |
|
2238 |
||
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2239 |
|newMethod function| |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2240 |
|
13463 | 2241 |
(self |
2242 |
literalsDetect:[:lit | |
|
2243 |
#( |
|
2244 |
#'invoke' |
|
2245 |
#'invokeWith:' |
|
2246 |
#'invokeWith:with:' |
|
2247 |
#'invokeWith:with:with:' |
|
2248 |
#'invokeWith:with:with:with:' |
|
2249 |
#'invokeWithArguments:' |
|
2250 |
#'invokeCPPVirtualOn:' |
|
2251 |
#'invokeCPPVirtualOn:with:' |
|
2252 |
#'invokeCPPVirtualOn:with:with:' |
|
2253 |
#'invokeCPPVirtualOn:with:with:with:' |
|
2254 |
#'invokeCPPVirtualOn:with:with:with:with:' |
|
2255 |
#'invokeCPPVirtualOn:withArguments:' |
|
2256 |
) includes:lit |
|
2257 |
] |
|
2258 |
ifNone:nil) notNil |
|
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2259 |
ifTrue:[ |
13463 | 2260 |
"/ sigh - for stc-compiled code, this does not work: |
2261 |
function := self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil. |
|
2262 |
function isNil ifTrue:[ |
|
2263 |
"/ parse it and ask the parser |
|
2264 |
newMethod := Compiler compile:self source forClass:self mclass install:false. |
|
2265 |
function := newMethod literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil. |
|
2266 |
]. |
|
2267 |
^ function |
|
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2268 |
]. |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2269 |
^ nil |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2270 |
|
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2271 |
" |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2272 |
(IDispatchPointer compiledMethodAt:#'invokeGetTypeInfo:_:_:') |
13463 | 2273 |
externalLibraryFunction |
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2274 |
" |
10482 | 2275 |
! |
2276 |
||
13422 | 2277 |
hasAnnotation |
2278 |
||
2279 |
"Return true iff method has any annotation" |
|
2280 |
||
2281 |
^annotations notNil |
|
2282 |
||
2283 |
"Created: / 11-07-2010 / 19:27:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2284 |
! |
|
2285 |
||
2286 |
hasAnnotation: key |
|
2287 |
||
2288 |
"Return true iff method is annotated with |
|
2289 |
given key" |
|
2290 |
||
2291 |
^(self annotationIndexOf: key) notNil |
|
2292 |
||
2293 |
"Created: / 11-07-2010 / 19:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2294 |
! |
|
2295 |
||
12913 | 2296 |
hasAnyResource:aCollectionOfSymbols |
2297 |
"return true if the method has a <resource> definition for any symbol in aCollectionOfSymbols" |
|
2298 |
||
2299 |
^ self hasResource and:[ self resources keys includesAny:aCollectionOfSymbols ] |
|
2300 |
||
2301 |
" |
|
2302 |
Method allInstancesDo:[:m | |
|
13463 | 2303 |
(m hasAnyResource:#(image canvas)) ifTrue:[self halt] |
12913 | 2304 |
]. |
2305 |
" |
|
2306 |
! |
|
2307 |
||
12525 | 2308 |
hasCanvasResource |
2309 |
"return true, if this method is an image-resource method. |
|
2310 |
This is done by looking for a #canvas key in the method's resources." |
|
2311 |
||
2312 |
^ self hasResource:#canvas |
|
2313 |
! |
|
2314 |
||
12521 | 2315 |
hasImageResource |
2316 |
"return true, if this method is an image-resource method. |
|
12525 | 2317 |
This is done by looking for a #image key in the method's resources." |
2318 |
||
2319 |
^ self hasResource:#image |
|
2320 |
! |
|
2321 |
||
2322 |
hasMenuResource |
|
2323 |
"return true, if this method is a menu-resource method. |
|
2324 |
This is done by looking for a #image key in the method's resources." |
|
2325 |
||
2326 |
^ self hasResource:#menu |
|
12521 | 2327 |
! |
2328 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2329 |
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
|
2330 |
"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
|
2331 |
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
|
2332 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2333 |
|src| |
159 | 2334 |
|
2218 | 2335 |
"/ first a trivial reject, if the source does not |
5534 | 2336 |
"/ contain a '% {' sequence |
2218 | 2337 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2338 |
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
|
2339 |
src notNil ifTrue:[ |
13463 | 2340 |
(src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[ |
2341 |
"/ cannot contain primitive code. |
|
2342 |
^ false |
|
2343 |
] |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2344 |
]. |
2218 | 2345 |
|
2346 |
"/ ok; it may or may not ... |
|
2347 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2348 |
^ 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
|
2349 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2350 |
" |
12854 | 2351 |
(Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode |
2352 |
(Object compiledMethodAt:#at:) hasPrimitiveCode |
|
2353 |
(Object compiledMethodAt:#basicAt:) hasPrimitiveCode |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2354 |
" |
159 | 2355 |
|
2218 | 2356 |
"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
|
2357 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2358 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2359 |
hasResource |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2360 |
"return true if the method had a <resource> definition in its |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
2361 |
source. This flag can be used to find resource-flagged methods quicker." |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2362 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2363 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2364 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2365 |
#ifdef F_RESOURCE |
1133 | 2366 |
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
|
2367 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2368 |
%}. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2369 |
^ false |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2370 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2371 |
|
11394 | 2372 |
hasResource:aSymbol |
12913 | 2373 |
"return true if the method has a <resource> definition for aSymbol." |
11394 | 2374 |
|
13156
6c38ec930b4d
comment/format in: #resources
Claus Gittinger <cg@exept.de>
parents:
13101
diff
changeset
|
2375 |
^ self hasResource and:[ (self resources ? #()) includesKey:aSymbol ] |
11394 | 2376 |
|
2377 |
" |
|
2378 |
Method allInstancesDo:[:m | |
|
13463 | 2379 |
(m hasResource:#image) ifTrue:[self halt] |
11394 | 2380 |
]. |
2381 |
" |
|
13156
6c38ec930b4d
comment/format in: #resources
Claus Gittinger <cg@exept.de>
parents:
13101
diff
changeset
|
2382 |
|
6c38ec930b4d
comment/format in: #resources
Claus Gittinger <cg@exept.de>
parents:
13101
diff
changeset
|
2383 |
"Modified: / 01-12-2010 / 13:59:58 / cg" |
11394 | 2384 |
! |
2385 |
||
2694
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2386 |
homeMethod |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2387 |
"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
|
2388 |
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
|
2389 |
method." |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2390 |
|
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2391 |
^ self |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2392 |
|
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2393 |
"Created: 19.6.1997 / 16:13:12 / cg" |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2394 |
! |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2395 |
|
10482 | 2396 |
indexOfOLECall |
2397 |
"return true, if the method contains ole call; false if not. |
|
2398 |
Uses Parser to parse methods source and get the information." |
|
2399 |
||
2400 |
|funcOrNil| |
|
2401 |
||
2402 |
funcOrNil := self externalLibraryFunction. |
|
2403 |
(funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil]. |
|
2404 |
^ funcOrNil vtableIndex |
|
2405 |
||
2406 |
" |
|
12854 | 2407 |
(Method compiledMethodAt:#hasPrimitiveCode) isOLECall |
2408 |
(Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall |
|
2409 |
||
2410 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall |
|
2411 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall |
|
2412 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall |
|
2413 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall |
|
2414 |
||
2415 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall |
|
2416 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction |
|
2417 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall |
|
2418 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall |
|
10482 | 2419 |
" |
2420 |
! |
|
2421 |
||
11986 | 2422 |
isDocumentationMethod |
11987 | 2423 |
"Return true, if this is a documentation only (only a comment) method |
2424 |
(implies being a metaclass method)" |
|
11986 | 2425 |
|
12275
8ca2aabefa4e
changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents:
12216
diff
changeset
|
2426 |
self mclass isMeta ifFalse:[^ false]. |
12283
54b6f67bcc26
changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents:
12275
diff
changeset
|
2427 |
self isVersionMethod ifTrue:[^ false]. |
12159 | 2428 |
^ self parse:#'parseMethodSilent:' return:#isEmptyMethod or:false. |
11986 | 2429 |
! |
2430 |
||
10482 | 2431 |
isExternalLibraryFunctionCall |
2432 |
"Return true, if this is an externalLibraryFunction call." |
|
2433 |
||
12569
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2434 |
"/ sigh - for now, stc-compiled code does not have it in the literal array |
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2435 |
"/ to be fixed... |
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2436 |
|
10482 | 2437 |
^ self externalLibraryFunction notNil |
2438 |
! |
|
2439 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2440 |
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
|
2441 |
"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
|
2442 |
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
|
2443 |
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
|
2444 |
(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
|
2445 |
|
2558 | 2446 |
|m myCode| |
1873 | 2447 |
|
2448 |
myCode := self code. |
|
2449 |
||
2450 |
m := self trapMethodForNumArgs:(self numArgs). |
|
2451 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
13463 | 2452 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
2453 |
(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
|
2454 |
]. |
159 | 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 |
m := Method compiledMethodAt:#uncompiledCodeObject. |
1873 | 2457 |
(m notNil and:[self ~~ m]) ifTrue:[ |
13463 | 2458 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
2459 |
(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
|
2460 |
]. |
1873 | 2461 |
|
2462 |
m := Method compiledMethodAt:#unloadedCodeObject. |
|
2463 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
13463 | 2464 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
2465 |
(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
|
2466 |
]. |
1873 | 2467 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2468 |
^ false |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
2469 |
|
1873 | 2470 |
"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
|
2471 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2472 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2473 |
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
|
2474 |
"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
|
2475 |
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
|
2476 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2477 |
^ 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
|
2478 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2479 |
|
10482 | 2480 |
isOLECall |
2481 |
"return true, if the method is an ole call; false if not." |
|
2482 |
||
2483 |
|funcOrNil| |
|
2484 |
||
2485 |
funcOrNil := self externalLibraryFunction. |
|
2486 |
^ funcOrNil notNil and:[funcOrNil isCallTypeOLE] |
|
2487 |
! |
|
2488 |
||
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2489 |
isObsolete |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2490 |
"returns true, if this method is obsolete and should not be used any longer" |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2491 |
|
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2492 |
|res| |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2493 |
|
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2494 |
^ (res := self resources) notNil and:[res includesKey:#obsolete] |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2495 |
! |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2496 |
|
13422 | 2497 |
isSynthetic |
2498 |
||
2499 |
^false |
|
2500 |
! |
|
2501 |
||
11985 | 2502 |
isVersionMethod |
12017
908685b92c3e
comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents:
12016
diff
changeset
|
2503 |
"Return true, if this is a CVS, SVN or other version method. |
908685b92c3e
comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents:
12016
diff
changeset
|
2504 |
Stupid: need to know all of them here; better add a pragma or |
908685b92c3e
comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents:
12016
diff
changeset
|
2505 |
method attribute for that..." |
11985 | 2506 |
|
12016 | 2507 |
^ self mclass isMeta |
12165 | 2508 |
and:[(AbstractSourceCodeManager isVersionMethodSelector:self selector)] |
11985 | 2509 |
|
2510 |
" |
|
12854 | 2511 |
(Method class compiledMethodAt:#version) isVersionMethod |
11985 | 2512 |
(Method class compiledMethodAt:#documentation) isVersionMethod |
2513 |
" |
|
2514 |
! |
|
2515 |
||
11848 | 2516 |
isVisualWorksTypedef |
2517 |
"Return true, if this is a type-returning method (a visualWorks typedef)" |
|
2518 |
||
2519 |
^ (self literals size > 0) |
|
2520 |
and:[ (self literalAt:1) isKindOf:CType ] |
|
2521 |
! |
|
2522 |
||
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2523 |
mclass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2524 |
"return the class in which the receiver was compiled. |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2525 |
Same as #containingClass, for ST80 compatibility." |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2526 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2527 |
^ self containingClass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2528 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2529 |
"Created: 19.6.1997 / 16:26:13 / cg" |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2530 |
! |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2531 |
|
5696 | 2532 |
messages |
2533 |
"return a collection of message-selectors, sent by this method." |
|
2534 |
||
2535 |
^ self messagesSent |
|
2536 |
! |
|
2537 |
||
5584
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2538 |
messagesDo:aBlock |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2539 |
"evaluate aBlock for each message-selector sent by this method. |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2540 |
Uses Parser to parse methods source and extract the names." |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2541 |
|
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2542 |
^ self messagesSent do:aBlock |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2543 |
! |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2544 |
|
5582 | 2545 |
messagesSent |
2546 |
"return a collection with the message selectors sent to by the receiver. |
|
2547 |
Uses Parser to parse methods source and extract the names. |
|
2548 |
The returned collection includes all used message selectors (i.e. including super-send messages)" |
|
2549 |
||
12854 | 2550 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#() |
5582 | 2551 |
|
2552 |
" |
|
12854 | 2553 |
(Method compiledMethodAt:#printOn:) messagesSent |
2554 |
(Point compiledMethodAt:#x:) messagesSent |
|
5582 | 2555 |
" |
2556 |
! |
|
2557 |
||
2558 |
messagesSentToSelf |
|
2559 |
"return a collection with the message selectors sent to self by the receiver. |
|
2560 |
Uses Parser to parse methods source and extract the names." |
|
2561 |
||
12854 | 2562 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSelf or:#() |
5652 | 2563 |
|
5582 | 2564 |
! |
2565 |
||
2566 |
messagesSentToSuper |
|
2567 |
"return a collection with the message selectors sent to super by the receiver. |
|
2568 |
Uses Parser to parse methods source and extract the names." |
|
2569 |
||
12854 | 2570 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSuper or:#() |
5652 | 2571 |
|
5582 | 2572 |
! |
2573 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2574 |
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
|
2575 |
"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
|
2576 |
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
|
2577 |
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
|
2578 |
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
|
2579 |
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
|
2580 |
|
8427 | 2581 |
|parserClass parser sourceString argNames varNames| |
2582 |
||
2583 |
parserClass := self parserClass. |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2584 |
sourceString := self source. |
8427 | 2585 |
(parserClass notNil and:[sourceString notNil]) ifTrue:[ |
13463 | 2586 |
parser := parserClass parseMethodArgAndVarSpecificationSilent:sourceString. |
2587 |
(parser isNil or:[parser == #Error]) ifTrue:[^ nil]. |
|
2588 |
argNames := parser methodArgs. |
|
2589 |
varNames := parser methodVars. |
|
2590 |
argNames isNil ifTrue:[^ varNames]. |
|
2591 |
varNames isNil ifTrue:[^ argNames]. |
|
2592 |
^ (argNames , varNames) |
|
159 | 2593 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2594 |
^ 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
|
2595 |
|
159 | 2596 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2597 |
(Method compiledMethodAt:#printOn:) methodArgAndVarNames |
159 | 2598 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2599 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2600 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2601 |
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
|
2602 |
"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
|
2603 |
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
|
2604 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2605 |
^ 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
|
2606 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2607 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2608 |
(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
|
2609 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2610 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2611 |
"Modified: 31.10.1995 / 14:36:46 / cg" |
872 | 2612 |
! |
2613 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2614 |
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
|
2615 |
"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
|
2616 |
This is a somewhat stupid implementation." |
872 | 2617 |
|
952
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 |
|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
|
2619 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2620 |
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
|
2621 |
(text size < 2) ifTrue:[^nil]. |
872 | 2622 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2623 |
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
|
2624 |
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
|
2625 |
(nQuote == 2) ifTrue:[ |
13463 | 2626 |
qIndex := line indexOf:(Character doubleQuote). |
2627 |
qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1). |
|
2628 |
^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1) |
|
872 | 2629 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2630 |
(nQuote == 1) ifTrue:[ |
13463 | 2631 |
qIndex := line indexOf:(Character doubleQuote). |
2632 |
comment := line copyFrom:(qIndex + 1). |
|
2633 |
(line indexOf:$/ startingAt:qIndex) == (qIndex+1) ifTrue:[ |
|
2634 |
"/ an EOL comment |
|
2635 |
^ (comment copyFrom:2) withoutSeparators |
|
2636 |
]. |
|
2637 |
||
2638 |
"/ not an EOL comment |
|
2639 |
index := 3. |
|
2640 |
line := text at:index. |
|
2641 |
nQuote := line occurrencesOf:(Character doubleQuote). |
|
2642 |
[nQuote ~~ 1] whileTrue:[ |
|
2643 |
comment := comment , Character cr asString , line withoutSpaces. |
|
2644 |
index := index + 1. |
|
2645 |
line := text at:index. |
|
2646 |
nQuote := line occurrencesOf:(Character doubleQuote) |
|
2647 |
]. |
|
2648 |
qIndex := line indexOf:(Character doubleQuote). |
|
2649 |
^ comment , Character cr asString , (line copyTo:(qIndex - 1)) withoutSpaces |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2650 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2651 |
^ 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
|
2652 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2653 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2654 |
(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
|
2655 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2656 |
! |
872 | 2657 |
|
9364 | 2658 |
methodDefinitionTemplate |
2659 |
"return the string that defines the method and the arguments" |
|
2660 |
||
12854 | 2661 |
^ Method |
13463 | 2662 |
methodDefinitionTemplateForSelector:self selector |
2663 |
andArgumentNames:self methodArgNames |
|
9364 | 2664 |
|
2665 |
" |
|
2666 |
(self compiledMethodAt:#printOn:) methodDefinitionTemplate |
|
2667 |
" |
|
2668 |
! |
|
2669 |
||
12900
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2670 |
methodInvocationInfo |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2671 |
^ nil |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2672 |
|
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2673 |
"Created: / 27-04-2010 / 13:36:12 / cg" |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2674 |
! |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2675 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2676 |
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
|
2677 |
"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
|
2678 |
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
|
2679 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2680 |
^ 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
|
2681 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2682 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2683 |
(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
|
2684 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2685 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2686 |
"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
|
2687 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2688 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2689 |
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
|
2690 |
"try to extract the modificationTime as a timeStamp from |
12854 | 2691 |
the receivers source. If there is no source or no history line, |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2692 |
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
|
2693 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2694 |
|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
|
2695 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2696 |
HistoryManager isNil ifTrue:[^ nil]. |
1873 | 2697 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2698 |
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
|
2699 |
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
|
2700 |
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
|
2701 |
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
|
2702 |
histLine := list last. |
12854 | 2703 |
^ Timestamp |
13463 | 2704 |
fromDate:histLine date |
2705 |
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
|
2706 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2707 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2708 |
(Method compiledMethodAt:#modificationTime) modificationTime |
12854 | 2709 |
(Method compiledMethodAt:#isMethod) modificationTime |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2710 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2711 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2712 |
"Modified: 8.9.1995 / 15:08:22 / claus" |
1873 | 2713 |
"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
|
2714 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2715 |
|
3845
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2716 |
name |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2717 |
"for compatibility with javaMethods" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2718 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2719 |
^ self selector |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2720 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2721 |
"Created: / 9.11.1998 / 06:15:08 / cg" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2722 |
! |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2723 |
|
13422 | 2724 |
overrides: aMethod |
2725 |
||
2726 |
| mth | |
|
2727 |
mth := self overriddenMethod. |
|
2728 |
[ mth notNil ] whileTrue: |
|
13463 | 2729 |
[mth == aMethod ifTrue:[^true]. |
2730 |
mth := mth overriddenMethod]. |
|
13422 | 2731 |
^false |
2732 |
||
2733 |
"Modified: / 18-06-2009 / 12:15:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
2734 |
! |
|
2735 |
||
12854 | 2736 |
parse:parseSelector return:accessSelector or:valueIfNoSource |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2737 |
"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
|
2738 |
Get the source, let parser parse it using parseSelector, |
1873 | 2739 |
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
|
2740 |
|
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2741 |
^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2742 |
|
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2743 |
" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2744 |
(Method compiledMethodAt:#parse:return:or:) |
13463 | 2745 |
parse:#'parseMethodSilent:' return:#sentMessages or:#() |
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2746 |
" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2747 |
! |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2748 |
|
12854 | 2749 |
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource |
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2750 |
"helper for methodArgNames, methodVarNames etc. |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2751 |
Get the source, let parser parse it using parseSelector, |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2752 |
return parser-info using accessSelector" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2753 |
|
8427 | 2754 |
|parser parserClass sourceString| |
2755 |
||
2756 |
parserClass := self parserClass. |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2757 |
sourceString := self source. |
8427 | 2758 |
(parserClass notNil and:[sourceString notNil]) ifTrue:[ |
13463 | 2759 |
parseSelector numArgs == 2 ifTrue:[ |
2760 |
parser := parserClass perform:parseSelector with:sourceString with:arg2. |
|
2761 |
] ifFalse:[ |
|
2762 |
parser := parserClass perform:parseSelector with:sourceString. |
|
2763 |
]. |
|
2764 |
(parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource]. |
|
2765 |
^ 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
|
2766 |
]. |
1873 | 2767 |
^ valueIfNoSource |
2768 |
||
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
2769 |
" |
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
2770 |
(Method compiledMethodAt:#parse:return:or:) |
13463 | 2771 |
parse:#'parseMethodSilent:' return:#sentMessages or:#() |
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
2772 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2773 |
! |
159 | 2774 |
|
13422 | 2775 |
parseAnnotations |
2776 |
||
2777 |
"return the methods annotations." |
|
2778 |
||
2779 |
|src parser| |
|
2780 |
||
2781 |
src := self source. |
|
2782 |
src isNil ifTrue:[ |
|
13463 | 2783 |
^ nil "/ actually: dont know |
13422 | 2784 |
]. |
2785 |
||
2786 |
self parserClass isNil ifTrue:[ |
|
13463 | 2787 |
^ nil |
13422 | 2788 |
]. |
2789 |
parser := self parserClass parseMethod: src. |
|
2790 |
(parser isNil or: [parser == #Error]) ifTrue:[ |
|
13463 | 2791 |
^ nil "/ actually error |
13422 | 2792 |
]. |
2793 |
^ annotations := parser annotations. |
|
2794 |
||
2795 |
"Created: / 10-07-2010 / 21:16:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2796 |
! |
|
2797 |
||
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2798 |
parseResources |
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2799 |
"return the methods resource spec; either nil or a collection of symbols." |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2800 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2801 |
|src parser| |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2802 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2803 |
src := self source. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2804 |
src isNil ifTrue:[ |
13463 | 2805 |
^ nil "/ actually: dont know |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2806 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2807 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2808 |
(src findString:'resource:') == 0 ifTrue:[ |
13463 | 2809 |
^ nil "/ actually: error |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2810 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2811 |
"/ no need to parse all - only interested in resource-info |
8427 | 2812 |
self parserClass isNil ifTrue:[ |
13463 | 2813 |
^ nil |
8427 | 2814 |
]. |
8419 | 2815 |
parser := self parserClass parseMethodArgAndVarSpecificationSilent:src in:nil. |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2816 |
parser isNil ifTrue:[ |
13463 | 2817 |
^ nil "/ actually error |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2818 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2819 |
^ parser primitiveResources. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2820 |
! |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2821 |
|
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2822 |
previousVersion |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2823 |
"return the receivers previous versions source code" |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2824 |
|
7210 | 2825 |
|sel cls previous| |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2826 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2827 |
sel := self selector. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2828 |
sel isNil ifTrue:[ ^ nil ]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2829 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2830 |
cls := self mclass. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2831 |
cls isNil ifTrue:[ ^ nil ]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2832 |
|
12854 | 2833 |
ChangeSet current reverseDo:[:change | |
13463 | 2834 |
(change isMethodChange |
2835 |
and:[ (change selector == sel) |
|
2836 |
and:[ change changeClass == cls ]]) |
|
2837 |
ifTrue:[ |
|
2838 |
previous := change previousVersion. |
|
2839 |
previous notNil ifTrue:[ |
|
2840 |
^ previous |
|
2841 |
] |
|
2842 |
] |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2843 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2844 |
^ nil. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2845 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2846 |
"/ history := Class methodHistory. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2847 |
"/ history isNil ifTrue:[^ nil]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2848 |
"/ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2849 |
"/ entry := history detect:[:entry | |type old new| |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2850 |
"/ type := entry first. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2851 |
"/ type == #methodChange ifTrue:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2852 |
"/ old := entry second. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2853 |
"/ new := entry third. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2854 |
"/ new == self |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2855 |
"/ ] ifFalse:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2856 |
"/ false |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2857 |
"/ ] |
12854 | 2858 |
"/ ] |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2859 |
"/ ifNone:nil. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2860 |
"/ entry isNil ifTrue:[^nil]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2861 |
"/ ^ entry second. |
5339 | 2862 |
"/ ^ history at:self ifAbsent:nil |
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2863 |
|
1925 | 2864 |
"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
|
2865 |
! |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2866 |
|
7210 | 2867 |
previousVersionCode |
2868 |
"return the receivers previous versions source code" |
|
2869 |
||
2870 |
|previous| |
|
2871 |
||
2872 |
previous := self previousVersion. |
|
2873 |
previous isNil ifTrue:[ ^ nil ]. |
|
2874 |
||
2875 |
^ previous source |
|
2876 |
! |
|
2877 |
||
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2878 |
previousVersions |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2879 |
"return a collection of the receivers previous versions (sources)" |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2880 |
|
7453 | 2881 |
|sel cls versions lastChange firstSrc last| |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2882 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2883 |
sel := self selector. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2884 |
sel isNil ifTrue:[^ #()]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2885 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2886 |
cls := self mclass. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2887 |
cls isNil ifTrue:[^ #()]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2888 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2889 |
versions := OrderedCollection new. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2890 |
|
12854 | 2891 |
ChangeSet current reverseDo:[:change | |
13463 | 2892 |
(change isMethodChange |
2893 |
and:[ (change selector == sel) |
|
2894 |
and:[ change changeClass == cls ]]) |
|
2895 |
ifTrue:[ |
|
2896 |
versions addFirst:change. |
|
2897 |
lastChange := change. |
|
2898 |
] |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2899 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2900 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2901 |
lastChange notNil ifTrue:[ |
13463 | 2902 |
last := lastChange previousVersion. |
2903 |
last notNil ifTrue:[ |
|
2904 |
firstSrc := last source. |
|
2905 |
(firstSrc size > 0 |
|
2906 |
and:[ firstSrc ~= lastChange source]) ifTrue:[ |
|
2907 |
versions addFirst:(MethodChange |
|
2908 |
className:lastChange className |
|
2909 |
selector:lastChange selector |
|
2910 |
source:firstSrc |
|
2911 |
category:lastChange category). |
|
2912 |
] |
|
2913 |
] |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2914 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2915 |
^ versions |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2916 |
! |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2917 |
|
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2918 |
readsField:instVarIndex |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2919 |
"return true, if the instvar at instVarIndex is read by the receiver. |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2920 |
Uses parser (for now); could look at bytecode as well here..." |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2921 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2922 |
|varName readInstVars| |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2923 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2924 |
varName := (self mclass allInstVarNames) at:instVarIndex. |
5636 | 2925 |
readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#readInstVars or:#(). |
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2926 |
^ readInstVars includes:varName. |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2927 |
! |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2928 |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2929 |
resourceType |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2930 |
"ST-80 compatibility: |
12854 | 2931 |
return the methods first resource specs key. |
8526 | 2932 |
Returns either nil, or a single symbol." |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2933 |
|
3387 | 2934 |
|resources| |
2935 |
||
2936 |
(resources := self resources) notNil ifTrue:[ |
|
13463 | 2937 |
resources keysAndValuesDo:[:key :val| |
2938 |
^ key |
|
2939 |
]. |
|
3341 | 2940 |
]. |
3387 | 2941 |
^ nil |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2942 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2943 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2944 |
resources |
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2945 |
"return the methods resource spec; either nil or a collection of symbols." |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2946 |
|
13422 | 2947 |
| resources | |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2948 |
self hasResource ifFalse:[^ nil]. |
13422 | 2949 |
annotations ifNil:[^ self parseResources]. |
2950 |
||
2951 |
resources := IdentityDictionary new. |
|
2952 |
self annotationsAt: #resource: orAt: #resource:value: do: |
|
13463 | 2953 |
[:annot| |
2954 |
resources at: annot type put: annot value ? true]. |
|
13422 | 2955 |
^resources |
2956 |
||
2957 |
"Modified: / 16-07-2010 / 11:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2958 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2959 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2960 |
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
|
2961 |
"return the selector under which I am found in my containingClasses |
12854 | 2962 |
method-table. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2963 |
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
|
2964 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2965 |
"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
|
2966 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2967 |
|who| |
68 | 2968 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2969 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2970 |
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
|
2971 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2972 |
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
|
2973 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2974 |
^ 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
|
2975 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2976 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2977 |
|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
|
2978 |
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
|
2979 |
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
|
2980 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2981 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2982 |
"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
|
2983 |
! |
68 | 2984 |
|
5534 | 2985 |
sends:aSelectorSymbol |
2986 |
"return true, if this method contains a message-send |
|
2987 |
with aSelectorSymbol as selector." |
|
2988 |
||
2989 |
(self referencesLiteral:aSelectorSymbol) ifTrue:[ |
|
13463 | 2990 |
^ self messagesSent includesIdentical:aSelectorSymbol |
5534 | 2991 |
]. |
2992 |
^ false |
|
2993 |
! |
|
2994 |
||
12363 | 2995 |
sends:selectorSymbol1 or:selectorSymbol2 |
2996 |
"return true, if this method contains a message-send |
|
2997 |
to either selectorSymbol1 or selectorSymbol2." |
|
2998 |
||
2999 |
|msgs| |
|
3000 |
||
3001 |
((self referencesLiteral:selectorSymbol1) or:[self referencesLiteral:selectorSymbol2]) ifTrue:[ |
|
13463 | 3002 |
msgs := self messagesSent. |
3003 |
^ (msgs includesIdentical:selectorSymbol1) or:[msgs includesIdentical:selectorSymbol2] |
|
12363 | 3004 |
]. |
3005 |
^ false |
|
3006 |
! |
|
3007 |
||
11022
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3008 |
shouldBeSkippedInDebuggersWalkBack |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3009 |
"return true, if this method thinks, it should be skipped in a walkback. |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3010 |
This is done by looking for a #skipInDebuggersWalkBack flag in the methods resources." |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3011 |
|
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3012 |
|resources| |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3013 |
|
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3014 |
resources := self resources. |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3015 |
^ resources notNil and:[ resources includesKey:#skipInDebuggersWalkBack ]. |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3016 |
! |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3017 |
|
5696 | 3018 |
superMessages |
3019 |
"return a collection of message-selectors, sent to super by this method." |
|
3020 |
||
3021 |
^ self messagesSentToSuper |
|
3022 |
! |
|
3023 |
||
5523 | 3024 |
usedGlobals |
3025 |
"return a collection with the global names referred to by the receiver. |
|
3026 |
Uses Parser to parse methods source and extract them." |
|
3027 |
||
12854 | 3028 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#() |
5523 | 3029 |
|
3030 |
" |
|
12854 | 3031 |
(Method compiledMethodAt:#resources) usedGlobals |
5523 | 3032 |
" |
3033 |
! |
|
3034 |
||
5509 | 3035 |
usedSymbols |
3036 |
"return a collection with the symbols referred to by the receiver. |
|
3037 |
Uses Parser to parse methods source and extract them. |
|
12854 | 3038 |
This collection only includes implicit symbols references |
8895 | 3039 |
(i.e. not messages sent)" |
5509 | 3040 |
|
12854 | 3041 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#() |
5509 | 3042 |
|
3043 |
" |
|
12854 | 3044 |
(Method compiledMethodAt:#usedSymbols) usedSymbols |
3045 |
(Method compiledMethodAt:#usedSymbols) messagesSent |
|
5509 | 3046 |
" |
3047 |
! |
|
3048 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3049 |
who |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3050 |
"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
|
3051 |
nil is returned for unbound methods. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3052 |
|
12854 | 3053 |
ST/X special notice: |
13463 | 3054 |
returns an instance of MethodWhoInfo, which |
3055 |
responds to #methodClass and #methodSelector query messages. |
|
3056 |
For backward- (& ST-80) compatibility, the returned object also |
|
3057 |
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
|
3058 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3059 |
Implementation notice: |
13463 | 3060 |
Since there is no information of the containing class |
3061 |
in the method, we have to do a search here. |
|
3062 |
||
3063 |
Normally, this is not a problem, except when a method is |
|
3064 |
accepted in the debugger or redefined from within a method |
|
3065 |
(maybe done indirectly, if #doIt is done recursively) |
|
3066 |
- the information about which class the original method was |
|
3067 |
defined in is lost in this case. |
|
68 | 3068 |
|
12854 | 3069 |
Problem: |
13463 | 3070 |
this is heavily called for in the debugger to create |
3071 |
a readable context walkback. For unbound methods, it is |
|
3072 |
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
|
3073 |
|
12854 | 3074 |
Q: should we add a backref from the method to the class |
13463 | 3075 |
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
|
3076 |
Q2: if so, what about the bad guy then, who copies methods around to |
13463 | 3077 |
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
|
3078 |
|
6420 | 3079 |
|classes cls sel fn clsName checkBlock| |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3080 |
|
5324 | 3081 |
mclass notNil ifTrue:[ |
13463 | 3082 |
sel := mclass selectorAtMethod:self. |
3083 |
sel notNil ifTrue:[ |
|
3084 |
^ MethodWhoInfo class:mclass selector:sel |
|
3085 |
]. |
|
3086 |
"/ flush outdated mclass info |
|
3087 |
mclass := nil. |
|
5324 | 3088 |
]. |
3089 |
||
6420 | 3090 |
checkBlock := [:cls | |
13463 | 3091 |
|sel| |
3092 |
||
3093 |
sel := cls selectorAtMethod:self. |
|
3094 |
sel notNil ifTrue:[ |
|
3095 |
LastWhoClass := cls theNonMetaclass name. |
|
3096 |
mclass isNil ifTrue:[ |
|
3097 |
mclass := cls |
|
3098 |
]. |
|
3099 |
^ MethodWhoInfo class:cls selector:sel |
|
3100 |
]. |
|
6420 | 3101 |
]. |
3102 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3103 |
" |
5294
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3104 |
speedup kludge: if my sourceFileName is valid, |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3105 |
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
|
3106 |
" |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3107 |
(fn := self sourceFilename) notNil ifTrue:[ |
13463 | 3108 |
clsName := fn asFilename nameWithoutSuffix. |
3109 |
clsName := clsName asSymbolIfInterned. |
|
3110 |
clsName notNil ifTrue:[ |
|
3111 |
cls := Smalltalk at:clsName ifAbsent:nil. |
|
3112 |
cls notNil ifTrue:[ |
|
3113 |
checkBlock value:cls theNonMetaclass. |
|
3114 |
checkBlock value:cls theMetaclass. |
|
3115 |
] |
|
3116 |
]. |
|
5294
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3117 |
]. |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3118 |
|
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3119 |
" |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3120 |
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
|
3121 |
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
|
3122 |
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
|
3123 |
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
|
3124 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3125 |
LastWhoClass notNil ifTrue:[ |
13463 | 3126 |
cls := Smalltalk at:LastWhoClass ifAbsent:nil. |
3127 |
cls notNil ifTrue:[ |
|
3128 |
checkBlock value:cls theNonMetaclass. |
|
3129 |
checkBlock value:cls theMetaclass. |
|
3130 |
] |
|
68 | 3131 |
]. |
227 | 3132 |
|
142 | 3133 |
" |
12854 | 3134 |
first, limit the search to global classes only - |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3135 |
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
|
3136 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3137 |
classes := Smalltalk allClasses. |
142 | 3138 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3139 |
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
|
3140 |
" |
6420 | 3141 |
classes do:[:cls | |
13463 | 3142 |
checkBlock value:cls theNonMetaclass. |
3143 |
checkBlock value:cls theMetaclass. |
|
142 | 3144 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3145 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3146 |
LastWhoClass := nil. |
6397
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3147 |
"/ " |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3148 |
"/ mhmh - must be a method of some anonymous class (i.e. one not |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3149 |
"/ in the Smalltalk dictionary). Search all instances of Behavior |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3150 |
"/ " |
6420 | 3151 |
"/ Behavior allSubInstancesDo:[:someClassLikeThingy | |
3152 |
"/ (classes includes:someClassLikeThingy) ifFalse:[ |
|
3153 |
"/ checkBlock value:someClassLikeThingy. |
|
6397
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3154 |
"/ ] |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3155 |
"/ ]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3156 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3157 |
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
|
3158 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3159 |
^ nil |
444 | 3160 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3161 |
"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
|
3162 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3163 |
|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
|
3164 |
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
|
3165 |
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
|
3166 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3167 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3168 |
"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
|
3169 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3170 |
|m cls| |
444 | 3171 |
|
12854 | 3172 |
Object |
13463 | 3173 |
subclass:#FunnyClass |
3174 |
instanceVariableNames:'foo' |
|
3175 |
classVariableNames:'' |
|
3176 |
poolDictionaries:'' |
|
3177 |
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
|
3178 |
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
|
3179 |
Smalltalk removeClass:cls. |
444 | 3180 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3181 |
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
|
3182 |
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
|
3183 |
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
|
3184 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3185 |
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
|
3186 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3187 |
|
10156 | 3188 |
"Modified: / 07-11-2006 / 13:58:50 / cg" |
68 | 3189 |
! |
3190 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3191 |
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
|
3192 |
"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
|
3193 |
Thats the WrapperMethod which contains myself." |
159 | 3194 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3195 |
WrappedMethod allInstancesDo:[:m | |
13463 | 3196 |
m originalMethod == self ifTrue:[^ m]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3197 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3198 |
^ nil |
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3199 |
! |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3200 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3201 |
writesField:instVarIndex |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3202 |
"return true, if the instvar at instVarIndex is written (modified) by the receiver. |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3203 |
Uses parser (for now); could look at bytecode as well here..." |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3204 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3205 |
|varName modifiedInstVars| |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3206 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3207 |
varName := (self mclass allInstVarNames) at:instVarIndex. |
5636 | 3208 |
modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). |
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3209 |
^ modifiedInstVars includes:varName. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3210 |
! ! |
13 | 3211 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3212 |
!Method methodsFor:'trap methods'! |
13 | 3213 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3214 |
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
|
3215 |
"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
|
3216 |
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
|
3217 |
the objectFileLoader to invalidate methods whose code is unloaded." |
1 | 3218 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3219 |
|invldMethod| |
159 | 3220 |
|
1873 | 3221 |
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
|
3222 |
self code:invldMethod code. |
1873 | 3223 |
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
|
3224 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3225 |
"Created: 17.9.1995 / 15:00:52 / claus" |
1873 | 3226 |
"Modified: 4.11.1996 / 23:04:34 / cg" |
1 | 3227 |
! |
3228 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3229 |
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
|
3230 |
"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
|
3231 |
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
|
3232 |
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
|
3233 |
after a class definition change (for example: instvars are no longer there)." |
1 | 3234 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3235 |
|invldMethod| |
872 | 3236 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3237 |
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
|
3238 |
self code:invldMethod code. |
1873 | 3239 |
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
|
3240 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3241 |
"Created: 17.9.1995 / 15:01:14 / claus" |
1873 | 3242 |
"Modified: 4.11.1996 / 23:04:46 / cg" |
3243 |
! |
|
3244 |
||
3245 |
makeUnloaded |
|
3246 |
"make the receiver an unloaded method, which raises an invalidCodeObject |
|
3247 |
signal when executed. This is not for public use - it is required for |
|
3248 |
the objectFileLoader to invalidate methods for which a shared library has |
|
3249 |
been removed." |
|
3250 |
||
3251 |
|invldMethod| |
|
3252 |
||
3253 |
invldMethod := self class compiledMethodAt:#unloadedCodeObject. |
|
3254 |
self code:invldMethod code. |
|
3255 |
self byteCode:nil. |
|
3256 |
||
3257 |
"Created: 4.11.1996 / 22:59:21 / cg" |
|
3258 |
"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
|
3259 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3260 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3261 |
trapMethodForNumArgs:numArgs |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3262 |
|trapSel| |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3263 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3264 |
trapSel := #( |
13463 | 3265 |
#'invalidCodeObject' |
3266 |
#'invalidCodeObjectWith:' |
|
3267 |
#'invalidCodeObjectWith:with:' |
|
3268 |
#'invalidCodeObjectWith:with:with:' |
|
3269 |
#'invalidCodeObjectWith:with:with:with:' |
|
3270 |
#'invalidCodeObjectWith:with:with:with:with:' |
|
3271 |
#'invalidCodeObjectWith:with:with:with:with:with:' |
|
3272 |
#'invalidCodeObjectWith:with:with:with:with:with:with:' |
|
3273 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:' |
|
3274 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:' |
|
3275 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:' |
|
3276 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:' |
|
3277 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:' |
|
3278 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:' |
|
3279 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:' |
|
3280 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:' |
|
3281 |
) at:(numArgs + 1). |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3282 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3283 |
^ Method compiledMethodAt:trapSel. |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3284 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3285 |
"Created: 4.11.1996 / 21:58:58 / cg" |
1873 | 3286 |
"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
|
3287 |
! ! |
872 | 3288 |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3289 |
!Method::MethodWhoInfo class methodsFor:'documentation'! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3290 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3291 |
documentation |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3292 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3293 |
In earlier times, Method>>who returned an array filled |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3294 |
with the methods class and selector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3295 |
This was done, since a smalltalk method cannot return multiple |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3296 |
values, but 2 values had to be returned from that method. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3297 |
Thus, the who-interface was used as: |
13463 | 3298 |
info := <someMethod> who. |
3299 |
class := info at:1. |
|
3300 |
sel := info at:2. |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3301 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3302 |
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
|
3303 |
an object (an instance of MethodWhoInfo) which responds to the two |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3304 |
messages: #methodClass and #methodSelector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3305 |
This allows to write things much more intuitive: |
13463 | 3306 |
info := <someMethod> who. |
3307 |
class := info methodClass. |
|
3308 |
sel := info methodSelector. |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3309 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3310 |
However, to be backward compatible, the returned object still responds to |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3311 |
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
|
3312 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3313 |
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
|
3314 |
classes. |
2242 | 3315 |
|
3316 |
[author:] |
|
13463 | 3317 |
Claus Gittinger |
2242 | 3318 |
|
3319 |
[see also:] |
|
13463 | 3320 |
Method |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3321 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3322 |
! ! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3323 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3324 |
!Method::MethodWhoInfo class methodsFor:'instance creation'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3325 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3326 |
class:cls selector:sel |
2023 | 3327 |
"return a new MethodWhoInfo object; |
3328 |
this is a private interface for Method" |
|
3329 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3330 |
^ self basicNew class:cls selector:sel |
2023 | 3331 |
|
3332 |
"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
|
3333 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3334 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3335 |
!Method::MethodWhoInfo methodsFor:'accessing'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3336 |
|
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3337 |
method |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3338 |
^ myClass compiledMethodAt:mySelector |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3339 |
! |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3340 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3341 |
methodClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3342 |
"return the class which contains the method represented by myself" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3343 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3344 |
^ myClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3345 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3346 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3347 |
(Method compiledMethodAt:#who) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3348 |
(Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3349 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3350 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3351 |
"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
|
3352 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3353 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3354 |
methodSelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3355 |
"return the selector under which the the method represented by myself |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3356 |
is found in the class" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3357 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3358 |
^ mySelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3359 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3360 |
"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
|
3361 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3362 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3363 |
!Method::MethodWhoInfo methodsFor:'compatibility'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3364 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3365 |
at:index |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3366 |
"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
|
3367 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3368 |
index == 1 ifTrue:[ |
13463 | 3369 |
^ myClass |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3370 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3371 |
index == 2 ifTrue:[ |
13463 | 3372 |
^ mySelector |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3373 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3374 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3375 |
"/ sigh - full compatibility ? |
7219
7c7b9d76af21
subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents:
7210
diff
changeset
|
3376 |
^ self indexNotIntegerOrOutOfBounds:index |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3377 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3378 |
|
7258 | 3379 |
!Method::MethodWhoInfo methodsFor:'private-accessing'! |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3380 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3381 |
class:cls selector:sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3382 |
myClass := cls. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3383 |
mySelector := sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3384 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3385 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3386 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3387 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
3388 |
!Method class methodsFor:'documentation'! |
872 | 3389 |
|
13422 | 3390 |
version_CVS |
13463 | 3391 |
^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.359 2011-06-29 19:18:20 cg Exp $' |
12159 | 3392 |
! |
3393 |
||
13422 | 3394 |
version_SVN |
13463 | 3395 |
^ '§ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 §' |
1 | 3396 |
! ! |
6956
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
3397 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3398 |
Method initialize! |