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