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