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