author | Claus Gittinger <cg@exept.de> |
Thu, 18 Jan 2018 15:27:49 +0100 | |
changeset 22446 | f3eddd51bba2 |
parent 22443 | 0670bf503559 |
child 22527 | bc45db485b0d |
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. |
12216
692af7a76600
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12193
diff
changeset
|
741 |
aSymbol == PackageId noProjectID ifTrue:[ |
19025 | 742 |
Transcript showCR:'warning: unassigning method from any package'. |
743 |
"/ newPackage := nil |
|
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
744 |
]. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
745 |
|
9713 | 746 |
package ~~ newPackage ifTrue:[ |
19025 | 747 |
oldPackage := package. |
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>" |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
776 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
777 |
|
13422 | 778 |
setAnnotations: anObject |
779 |
"set the annotations (low level - use do not use)" |
|
780 |
||
781 |
annotations := anObject |
|
782 |
||
783 |
"Created: / 20-05-2010 / 11:27:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
784 |
! |
|
785 |
||
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
786 |
setCategory:aStringOrSymbol |
22372 | 787 |
"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
|
788 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
789 |
aStringOrSymbol notNil ifTrue:[ |
22372 | 790 |
category := aStringOrSymbol asSymbol |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
791 |
] |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
792 |
|
22372 | 793 |
"Modified: / 13-11-1998 / 23:55:05 / cg" |
794 |
"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
|
795 |
! |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
796 |
|
5398 | 797 |
setPackage:aSymbol |
9702 | 798 |
"set the package-symbol (low level - use package:)" |
5398 | 799 |
|
800 |
package := aSymbol |
|
801 |
! |
|
802 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
803 |
source |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
804 |
"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
|
805 |
|
12598 | 806 |
|sourceStream chunk| |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
807 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
808 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
809 |
if sourcePosition is nonNil, its the fileName and |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
810 |
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
|
811 |
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
|
812 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
813 |
sourcePosition isNil ifTrue:[^ source]. |
13381
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
814 |
source isNil ifTrue:[^ nil]. |
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
815 |
|
20035 | 816 |
LastMethodSources notNil ifTrue:[ |
817 |
self class lastMethodSourcesLock critical:[ |
|
818 |
LastMethodSources notNil ifTrue:[ |
|
819 |
chunk := LastMethodSources at:self ifAbsent:nil. |
|
820 |
]. |
|
821 |
]. |
|
822 |
chunk notNil ifTrue:[ |
|
823 |
^ chunk |
|
824 |
]. |
|
13381
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
825 |
]. |
e16cafbd22bd
comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents:
13189
diff
changeset
|
826 |
|
13463 | 827 |
LastFileLock |
20035 | 828 |
critical:[ |
829 |
"have to protect sourceStream from being closed as a side effect |
|
830 |
of some other process fetching some the source from a different source file" |
|
831 |
||
832 |
sourceStream := self sourceStreamUsingCache:true. |
|
833 |
sourceStream notNil ifTrue:[ |
|
834 |
[ |
|
835 |
chunk := self sourceChunkFromStream:sourceStream. |
|
836 |
] on:DecodingError do:[:ex| |
|
837 |
"CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data" |
|
838 |
||
839 |
Logger info:'DecodingError ignored when reading %1 (%2)' with:self whoString with:ex description. |
|
840 |
sourceStream := self rawSourceStreamUsingCache:true. |
|
841 |
ex restart. |
|
842 |
]. |
|
843 |
]. |
|
844 |
] |
|
845 |
timeoutMs:100 |
|
846 |
ifBlocking:[ |
|
847 |
"take care if LastFileLock is not available - maybe we are |
|
848 |
called by a debugger while someone holds the lock. |
|
849 |
Use uncached source streams" |
|
850 |
sourceStream := self sourceStreamUsingCache:false. |
|
851 |
sourceStream notNil ifTrue:[ |
|
852 |
[ |
|
853 |
chunk := self sourceChunkFromStream:sourceStream. |
|
854 |
sourceStream close. |
|
855 |
] on:DecodingError do:[:ex| |
|
856 |
"CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data" |
|
857 |
Logger info:'DecodingError ignored when reading %1 (%2)' with:self whoString with:ex description. |
|
858 |
sourceStream close. |
|
859 |
sourceStream := self rawSourceStreamUsingCache:false. |
|
860 |
ex restart. |
|
861 |
]. |
|
862 |
]. |
|
863 |
]. |
|
2979 | 864 |
|
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
865 |
"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
|
866 |
chunk notNil ifTrue:[ |
20035 | 867 |
"JV@2013-08-19: Don't consult UserPreferences if the system is initializing. This may |
868 |
lead in funny side-effect as #initializeDefaultPreferences is called which tries to |
|
869 |
initialize some colors. But Color itself is likely not yet initialized, so DNU is |
|
870 |
thrown. |
|
871 |
CG: also care for standalone non-GUI progs, which have no userPreferences class" |
|
872 |
(Smalltalk isInitialized |
|
873 |
and:[UserPreferences notNil |
|
874 |
and:[UserPreferences current keepMethodSourceCode]]) ifTrue:[ |
|
875 |
source := chunk. |
|
876 |
sourcePosition := nil. |
|
877 |
^ source. |
|
878 |
]. |
|
879 |
||
880 |
CacheDictionary notNil ifTrue:[ |
|
881 |
self class lastMethodSourcesLock critical:[ |
|
882 |
LastMethodSources isNil ifTrue:[ |
|
883 |
LastMethodSources := CacheDictionary new:50. |
|
884 |
]. |
|
885 |
LastMethodSources at:self put:chunk. |
|
886 |
] |
|
887 |
]. |
|
2979 | 888 |
]. |
889 |
||
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
890 |
^ chunk |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
891 |
|
10201 | 892 |
"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
|
893 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
894 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
895 |
source:aString |
22372 | 896 |
"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
|
897 |
|
15346 | 898 |
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
|
899 |
source := aString. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
900 |
sourcePosition := nil |
22372 | 901 |
|
902 |
"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
|
903 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
904 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
905 |
sourceFilename |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
906 |
"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
|
907 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
908 |
sourcePosition notNil ifTrue:[^ source]. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
909 |
^ nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
910 |
! |
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 |
sourceFilename:aFileName position:aNumber |
22372 | 913 |
"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
|
914 |
|
15346 | 915 |
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
|
916 |
source := aFileName. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
917 |
sourcePosition := aNumber |
22372 | 918 |
|
919 |
"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
|
920 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
921 |
|
2812 | 922 |
sourceLineNumber |
923 |
"return the lineNumber of my source within the returned |
|
924 |
source sourcestring. |
|
925 |
For ST methods, the returned sourceString is always the |
|
926 |
methods pure source; therefore, the lineNumber is always 1." |
|
927 |
||
928 |
^ 1 |
|
929 |
||
930 |
"Created: 30.7.1997 / 15:42:01 / cg" |
|
931 |
! |
|
932 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
933 |
sourcePosition |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
934 |
"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
|
935 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
936 |
sourcePosition isNil ifTrue:[^ sourcePosition]. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
937 |
^ sourcePosition abs |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
938 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
939 |
"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
|
940 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
941 |
|
14508 | 942 |
!Method methodsFor:'accessing-annotations'! |
943 |
||
944 |
annotateWith: annotation |
|
16221 | 945 |
"add a (hidden) annotation. |
946 |
This is only present in the image, not in the method's source code" |
|
947 |
||
14508 | 948 |
| index | |
949 |
||
950 |
index := self annotationIndexOf: annotation key. |
|
951 |
index isNil ifTrue:[ |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
952 |
annotations := annotations isNil |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
953 |
ifTrue:[Array with: annotation] |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
954 |
ifFalse:[annotations copyWith:annotation] |
14508 | 955 |
] ifFalse:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
956 |
annotations at: index put: annotation |
14508 | 957 |
]. |
958 |
"/ annotation annotatesMethod: self. |
|
959 |
||
960 |
" |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
961 |
(Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious'). |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
962 |
(Object >> #yourself) annotations. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
963 |
(Object >> #yourself) annotationAt: #namespace: |
14508 | 964 |
" |
965 |
||
966 |
"Created: / 19-05-2010 / 16:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
967 |
"Modified: / 20-05-2010 / 11:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
968 |
"Modified (format): / 26-07-2012 / 15:47:51 / cg" |
|
969 |
! |
|
970 |
||
971 |
annotationAt: key |
|
972 |
| index | |
|
973 |
||
974 |
index := self annotationIndexOf: key. |
|
975 |
index isNil ifTrue:[^ nil]. |
|
976 |
^ self annotationAtIndex: index. |
|
977 |
||
978 |
" |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
979 |
(Object >> #yourself) annotationAt: #namespace: |
14508 | 980 |
" |
981 |
||
982 |
"Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
983 |
"Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
984 |
"Modified: / 18-11-2011 / 14:46:21 / cg" |
|
985 |
"Modified (format): / 26-07-2012 / 15:47:54 / cg" |
|
986 |
! |
|
987 |
||
988 |
annotations |
|
18411 | 989 |
"return (a copy) of the annotations array" |
990 |
||
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
|
991 |
| retval | |
14508 | 992 |
|
16261 | 993 |
annotations isNil ifTrue:[^ #()]. |
18411 | 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 := 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
|
996 |
1 to: annotations size do: [:i| |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
997 |
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
|
998 |
]. |
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. |
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 |
|
14508 | 1001 |
"Modified: / 18-11-2011 / 14:46:56 / cg" |
1002 |
"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
|
1003 |
"Modified: / 05-03-2014 / 15:18:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14508 | 1004 |
! |
1005 |
||
1006 |
annotations: anObject |
|
1007 |
"set the annotations" |
|
1008 |
||
1009 |
self setAnnotations: anObject. |
|
1010 |
"/ "iterate over annotations just to invoke |
|
19868 | 1011 |
"/ annotationAtIndex: which lazily initializes annotations |
1012 |
"/ and sends #annotatesMethod:" |
|
14508 | 1013 |
"/ self annotationsDo:[:annotation|] |
1014 |
||
1015 |
"Created: / 02-07-2010 / 22:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1016 |
! |
|
1017 |
||
1018 |
annotationsAt: key |
|
1019 |
||
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1020 |
^OrderedCollection |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1021 |
streamContents:[:annotStream| |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1022 |
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
|
1023 |
] |
14508 | 1024 |
|
1025 |
"Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1026 |
"Modified (format): / 26-07-2012 / 15:46:56 / cg" |
|
1027 |
! |
|
1028 |
||
1029 |
annotationsAt: key do: block |
|
1030 |
self annotationsDo: [:annot| |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1031 |
annot key == key ifTrue:[block value: annot] |
14508 | 1032 |
] |
1033 |
||
1034 |
"Created: / 16-07-2010 / 11:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1035 |
"Modified (format): / 26-07-2012 / 15:48:37 / cg" |
|
1036 |
! |
|
1037 |
||
1038 |
annotationsAt: key1 orAt: key2 |
|
1039 |
||
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1040 |
^OrderedCollection |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1041 |
streamContents:[:annotStream| |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1042 |
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
|
1043 |
] |
14508 | 1044 |
|
1045 |
"Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1046 |
"Modified (format): / 26-07-2012 / 15:49:11 / cg" |
|
1047 |
! |
|
1048 |
||
1049 |
annotationsAt: key1 orAt: key2 do: block |
|
1050 |
self annotationsDo:[:annot | |
|
19585 | 1051 |
|key| |
1052 |
key := annot key. |
|
1053 |
(key == key1 or:[key == key2]) ifTrue:[ |
|
1054 |
block value: annot |
|
1055 |
] |
|
14508 | 1056 |
] |
1057 |
||
1058 |
"Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1059 |
"Modified (format): / 26-07-2012 / 15:49:30 / cg" |
|
1060 |
! |
|
1061 |
||
1062 |
annotationsDo: aBlock |
|
1063 |
annotations isNil ifTrue:[^nil]. |
|
1064 |
1 to: annotations size do: [:i| |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1065 |
aBlock value: (self annotationAtIndex: i) |
14508 | 1066 |
]. |
1067 |
||
1068 |
"Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1069 |
"Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1070 |
"Modified (format): / 18-11-2011 / 14:47:06 / cg" |
|
1071 |
! ! |
|
1072 |
||
22446 | 1073 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1074 |
!Method methodsFor:'accessing-visibility'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1075 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1076 |
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
|
1077 |
"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
|
1078 |
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
|
1079 |
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
|
1080 |
it in its message lookup. |
747 | 1081 |
(i.e. setting a method to #ignored, and sending that selector, |
12854 | 1082 |
leads to either the superclasses implementation to be called, |
747 | 1083 |
or a doesNotUnderstand exception to be raised) |
1084 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1085 |
Notice: this is a nonstandard feature, not supported |
747 | 1086 |
by other smalltalk implementations and not specified in the ANSI spec. |
1087 |
||
1088 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1089 |
It may change or even vanish (if it shows to be not useful)." |
|
1090 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1091 |
^ self privacy == #ignored |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1092 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1093 |
"Modified: / 23.1.1998 / 15:23:02 / stefan" |
176 | 1094 |
! |
1095 |
||
1096 |
isPrivate |
|
1097 |
"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
|
1098 |
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
|
1099 |
from superclasses or the class itself. |
176 | 1100 |
If a private method is called by some other class, a runtime |
1101 |
error (PrivateMethodSignal) is raised. |
|
1102 |
Notice: method privacy is a nonstandard feature, not supported |
|
1103 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 1104 |
|
176 | 1105 |
This is EXPERIMENTAL - and being evaluated for usability. |
1106 |
It may change or even vanish (if it shows to be not useful)." |
|
1107 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1108 |
^ self privacy == #private |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1109 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1110 |
"Modified: / 23.1.1998 / 15:23:13 / stefan" |
68 | 1111 |
! |
1112 |
||
176 | 1113 |
isProtected |
1114 |
"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
|
1115 |
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
|
1116 |
from superclasses, the class itself or subclasse. |
176 | 1117 |
If a protected method is called by some other class, a runtime |
1118 |
error (PrivateMethodSignal) is raised. |
|
747 | 1119 |
|
176 | 1120 |
Notice: method privacy is a nonstandard feature, not supported |
1121 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 1122 |
|
176 | 1123 |
This is EXPERIMENTAL - and being evaluated for usability. |
1124 |
It may change or even vanish (if it shows to be not useful)." |
|
1125 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1126 |
^ self privacy == #protected |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1127 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1128 |
"Modified: / 23.1.1998 / 15:23:27 / stefan" |
176 | 1129 |
! |
1130 |
||
1131 |
isPublic |
|
1132 |
"return true, if this is a public method - I.e. can be executed via any send. |
|
747 | 1133 |
This is the default and how other smalltalk implementations treat all methods. |
1134 |
||
360 | 1135 |
Notice: method privacy is a nonstandard feature, not supported |
1136 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 1137 |
|
360 | 1138 |
This is EXPERIMENTAL - and being evaluated for usability. |
1139 |
It may change or even vanish (if it shows to be not useful)." |
|
176 | 1140 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1141 |
^ self privacy == #public |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1142 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1143 |
"Modified: / 23.1.1998 / 15:23:40 / stefan" |
176 | 1144 |
! |
1145 |
||
747 | 1146 |
isRestricted |
1147 |
"return the flag bit stating that this method is restricted. |
|
1148 |
Execution of the receiver will only be allowed if the system is not in |
|
12854 | 1149 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
747 | 1150 |
error (PrivateMethodSignal) is raised. |
1151 |
||
1152 |
Notice: method restriction is a nonstandard feature, not supported |
|
1153 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1154 |
||
1155 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1156 |
It may change or even vanish (if it shows to be not useful)." |
|
1157 |
||
1158 |
%{ /* NOCONTEXT */ |
|
1159 |
#ifdef F_RESTRICTED |
|
2868 | 1160 |
INT f = __intVal(__INST(flags)); |
747 | 1161 |
|
1162 |
if (f & F_RESTRICTED) { |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1163 |
RETURN (true); |
747 | 1164 |
} |
1165 |
#endif |
|
1166 |
%}. |
|
1167 |
^ false |
|
8526 | 1168 |
! ! |
1169 |
||
1170 |
!Method privateMethodsFor:'accessing-visibility'! |
|
1171 |
||
1172 |
primSetPrivacy:aSymbol |
|
1173 |
"set the methods access rights (privacy) from a symbol; |
|
1174 |
Currently, this must be one of #private, #protected, #public or #ignored. |
|
12854 | 1175 |
#setPrivacy: simply sets the attribute. When changing methods, that |
8526 | 1176 |
have already been called, #privacy: should be used. |
1177 |
||
1178 |
Notice: method privacy is a nonstandard feature, not supported |
|
1179 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1180 |
If at all, use it for debugging purposes, to catch messagesends |
|
1181 |
which are not supposed to be sent by others. |
|
1182 |
(especially, if working in a team, while integrating other peoples work) |
|
1183 |
||
1184 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1185 |
It may change or even vanish (if it shows to be not useful)." |
|
1186 |
||
1187 |
%{ /* NOCONTEXT */ |
|
1188 |
||
1189 |
#if defined(M_PRIVACY) |
|
1190 |
INT f = __intVal(__INST(flags)); |
|
1191 |
INT p; |
|
1192 |
||
1193 |
if (aSymbol == @symbol(public)) |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1194 |
p = 0; |
8526 | 1195 |
else if (aSymbol == @symbol(protected)) |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1196 |
p = F_PRIVATE; |
8526 | 1197 |
else if (aSymbol == @symbol(private)) |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1198 |
p = F_CLASSPRIVATE; |
8526 | 1199 |
else if (aSymbol == @symbol(ignored)) |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1200 |
p = F_IGNORED; |
8526 | 1201 |
else |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1202 |
RETURN(false); /* illegal symbol */ |
12854 | 1203 |
|
8526 | 1204 |
|
1205 |
f = (f & ~M_PRIVACY) | p; |
|
8913 | 1206 |
__INST(flags) = __mkSmallInteger(f); |
8526 | 1207 |
#endif |
1208 |
||
1209 |
%}. |
|
1210 |
^ true |
|
1211 |
||
1212 |
"Modified: 27.8.1995 / 22:58:08 / claus" |
|
1213 |
! ! |
|
1214 |
||
1215 |
!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
|
1216 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1217 |
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
|
1218 |
"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
|
1219 |
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
|
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 |
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
|
1222 |
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
|
1223 |
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
|
1224 |
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
|
1225 |
(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
|
1226 |
|
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 |
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
|
1228 |
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
|
1229 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1230 |
%{ /* NOCONTEXT */ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1231 |
/* 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
|
1232 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1233 |
#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
|
1234 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1235 |
INT f = __intVal(__INST(flags)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1236 |
switch (f & M_PRIVACY) { |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1237 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1238 |
# ifdef F_PRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1239 |
case F_PRIVATE: |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1240 |
RETURN (@symbol(protected)); |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1241 |
break; |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1242 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1243 |
# ifdef F_CLASSPRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1244 |
case F_CLASSPRIVATE: |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1245 |
RETURN (@symbol(private)); |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1246 |
break; |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1247 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1248 |
# ifdef F_IGNORED |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1249 |
case F_IGNORED: |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1250 |
RETURN (@symbol(ignored)); |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1251 |
break; |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1252 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1253 |
} |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1254 |
#endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1255 |
%}. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1256 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1257 |
^ #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
|
1258 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1259 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1260 |
privacy:aSymbol |
22372 | 1261 |
"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
|
1262 |
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
|
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 |
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
|
1265 |
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
|
1266 |
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
|
1267 |
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
|
1268 |
(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
|
1269 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1270 |
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
|
1271 |
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
|
1272 |
|
8526 | 1273 |
|oldPrivacy| |
1274 |
||
1275 |
oldPrivacy := self privacy. |
|
1276 |
||
1277 |
(self setPrivacy:aSymbol flushCaches:true) ifTrue:[ |
|
22372 | 1278 |
|myClass mySelector| |
1279 |
||
1280 |
myClass := self mclass. |
|
1281 |
mySelector := self selector. |
|
1282 |
||
1283 |
self changed:#privacy. "/ will vanish |
|
1284 |
myClass notNil ifTrue:[ |
|
1285 |
mySelector notNil ifTrue:[ |
|
1286 |
myClass changed:#methodPrivacy with:mySelector. "/ will vanish |
|
1287 |
Smalltalk changed:#privacyOfMethod with:(Array with:myClass with:self with:oldPrivacy). |
|
1288 |
myClass addChangeRecordForMethodPrivacy:self. |
|
1289 |
] |
|
1290 |
] |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1291 |
] |
10196 | 1292 |
|
1293 |
"Modified: / 23-11-2006 / 17:03:20 / cg" |
|
22372 | 1294 |
"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
|
1295 |
! |
747 | 1296 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1297 |
restricted:aBoolean |
12854 | 1298 |
"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
|
1299 |
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
|
1300 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1301 |
error (PrivateMethodSignal) is raised. |
747 | 1302 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1303 |
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
|
1304 |
by other smalltalk implementations and not specified in the ANSI spec. |
747 | 1305 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1306 |
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
|
1307 |
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
|
1308 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1309 |
%{ /* NOCONTEXT */ |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1310 |
/* 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
|
1311 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1312 |
#ifdef F_RESTRICTED |
2868 | 1313 |
INT f = __intVal(__INST(flags)); |
1314 |
INT old; |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1315 |
|
747 | 1316 |
old = f; |
12854 | 1317 |
if (aBoolean == true) |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1318 |
f |= F_RESTRICTED; |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1319 |
else |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1320 |
f &= ~F_RESTRICTED; |
8913 | 1321 |
__INST(flags) = __mkSmallInteger(f); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1322 |
if (old & F_RESTRICTED) |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1323 |
RETURN(true); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1324 |
#endif |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1325 |
%}. |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1326 |
^ false |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1327 |
|
747 | 1328 |
" |
1329 |
(ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true |
|
1330 |
" |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1331 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1332 |
"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
|
1333 |
! |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
1334 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1335 |
setPrivacy:aSymbol |
22372 | 1336 |
"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
|
1337 |
Currently, this must be one of #private, #protected, #public or #ignored. |
22372 | 1338 |
#setPrivacy: simply sets the attribute. |
1339 |
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
|
1340 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1341 |
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
|
1342 |
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
|
1343 |
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
|
1344 |
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
|
1345 |
(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
|
1346 |
|
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 |
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
|
1348 |
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
|
1349 |
|
8526 | 1350 |
^ self setPrivacy:aSymbol flushCaches:true |
22372 | 1351 |
|
1352 |
"Modified (comment): / 21-11-2017 / 13:05:54 / cg" |
|
8526 | 1353 |
! |
1354 |
||
1355 |
setPrivacy:aSymbol flushCaches:doFlush |
|
17526 | 1356 |
"set the method's access rights (privacy) from a symbol; |
8526 | 1357 |
Currently, this must be one of #private, #protected, #public or #ignored. |
12854 | 1358 |
#setPrivacy: simply sets the attribute. When changing methods, that |
8526 | 1359 |
have already been called, #privacy: should be used. |
1360 |
||
1361 |
Notice: method privacy is a nonstandard feature, not supported |
|
17526 | 1362 |
by other Smalltalk implementations and not specified in the ANSI spec. |
1363 |
If at all, use it for debugging purposes, to catch message sends |
|
8526 | 1364 |
which are not supposed to be sent by others. |
1365 |
(especially, if working in a team, while integrating other peoples work) |
|
1366 |
||
1367 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1368 |
It may change or even vanish (if it shows to be not useful)." |
|
1369 |
||
1370 |
|old sel| |
|
1371 |
||
1372 |
old := self privacy. |
|
1373 |
old == aSymbol ifTrue:[^ false]. |
|
1374 |
(self primSetPrivacy:aSymbol) ifFalse:[^ false]. |
|
1375 |
||
1376 |
"/ |
|
1377 |
"/ no need to flush, if changing from private to public |
|
1378 |
"/ |
|
1379 |
doFlush ifTrue:[ |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1380 |
(aSymbol == #public and:[old ~~ #ignored]) ifFalse:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1381 |
(sel := self selector) notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1382 |
ObjectMemory flushCachesForSelector:sel numArgs:self argumentCount |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1383 |
] ifFalse:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1384 |
ObjectMemory flushCaches. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1385 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1386 |
]. |
8526 | 1387 |
]. |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
1388 |
^ true |
1 | 1389 |
! ! |
1390 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1391 |
!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
|
1392 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1393 |
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
|
1394 |
"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
|
1395 |
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
|
1396 |
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
|
1397 |
the methodDictionary of any class - just returned. |
2064 | 1398 |
If the method contains primitive code, this may return a method |
1399 |
without bytecode. |
|
12854 | 1400 |
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
|
1401 |
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
|
1402 |
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
|
1403 |
|
9096 | 1404 |
|mthd| |
1 | 1405 |
|
952
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 |
byteCode notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1407 |
" |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1408 |
is already a bytecoded method |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1409 |
" |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1410 |
^ 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
|
1411 |
]. |
9096 | 1412 |
|
1413 |
ParserFlags |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1414 |
withSTCCompilation:#never |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1415 |
do:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1416 |
mthd := self asExecutableMethod. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1417 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1418 |
^ mthd |
68 | 1419 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1420 |
"Created: 24.10.1995 / 14:02:32 / cg" |
2064 | 1421 |
"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
|
1422 |
! |
306 | 1423 |
|
5405 | 1424 |
asByteCodeMethodWithSource:newSource |
9096 | 1425 |
|mthd| |
1426 |
||
12854 | 1427 |
ParserFlags |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1428 |
withSTCCompilation:#never |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1429 |
do:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1430 |
mthd := self asExecutableMethodWithSource:newSource. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1431 |
]. |
5405 | 1432 |
^ mthd |
1433 |
||
1434 |
"Created: 24.10.1995 / 14:02:32 / cg" |
|
1435 |
"Modified: 5.1.1997 / 01:01:53 / cg" |
|
1436 |
! |
|
1437 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1438 |
asExecutableMethod |
12854 | 1439 |
"if the receiver has neither bytecodes nor machinecode, create & return a |
19449 | 1440 |
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
|
1441 |
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
|
1442 |
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
|
1443 |
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
|
1444 |
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
|
1445 |
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
|
1446 |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1447 |
|temporaryMethod sourceString| |
306 | 1448 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1449 |
byteCode notNil ifTrue:[ |
19449 | 1450 |
" |
1451 |
is already a bytecoded method |
|
1452 |
" |
|
1453 |
^ self |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1454 |
]. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1455 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1456 |
sourceString := self source. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1457 |
sourceString isNil ifTrue:[ |
19449 | 1458 |
'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR. |
1459 |
^ 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
|
1460 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1461 |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1462 |
temporaryMethod := self asExecutableMethodWithSource:sourceString. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1463 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1464 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
19449 | 1465 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
1466 |
^ nil. |
|
5700
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 |
"/ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1469 |
"/ 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
|
1470 |
"/ |
12854 | 1471 |
temporaryMethod sourceFilename:source position:sourcePosition. |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1472 |
^ temporaryMethod |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1473 |
! |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1474 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1475 |
asExecutableMethodWithSource:newSource |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1476 |
|temporaryMethod cls| |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1477 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1478 |
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
|
1479 |
cls isNil ifTrue:[ |
20804 | 1480 |
'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR. |
1481 |
^ nil |
|
306 | 1482 |
]. |
1 | 1483 |
|
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
1484 |
"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
|
1485 |
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
|
1486 |
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
|
1487 |
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
|
1488 |
(happened when autoloading animation demos) |
176 | 1489 |
" |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
1490 |
CompilationLock critical:[ |
20804 | 1491 |
" |
1492 |
don't want this to go into the changes file, |
|
1493 |
don't want output on Transcript and definitely |
|
1494 |
don't want a lazy method ... |
|
1495 |
" |
|
1496 |
Class withoutUpdatingChangesDo:[ |
|
1497 |
|silent lazy| |
|
1498 |
||
1499 |
silent := Smalltalk silentLoading:true. |
|
1500 |
lazy := Compiler compileLazy:false. |
|
1501 |
||
1502 |
[ |
|
1503 |
|compiler| |
|
1504 |
||
1505 |
Class nameSpaceQuerySignal answer:(cls nameSpace) |
|
1506 |
do:[ |
|
1507 |
compiler := cls compilerClass. |
|
1508 |
||
1509 |
"/ |
|
1510 |
"/ kludge - have to make ST/X's compiler protocol |
|
1511 |
"/ be compatible to ST-80's |
|
1512 |
"/ |
|
1513 |
(compiler respondsTo:#compile:forClass:inCategory:notifying:install:) |
|
1514 |
ifTrue:[ |
|
1515 |
temporaryMethod := compiler |
|
1516 |
compile:newSource |
|
1517 |
forClass:cls |
|
1518 |
inCategory:(self category) |
|
1519 |
notifying:nil |
|
1520 |
install:false. |
|
1521 |
] ifFalse:[ |
|
1522 |
temporaryMethod := compiler new |
|
1523 |
compile:newSource |
|
1524 |
in:cls |
|
1525 |
notifying:nil |
|
1526 |
ifFail:nil |
|
1527 |
]. |
|
1528 |
]. |
|
1529 |
] ensure:[ |
|
1530 |
Compiler compileLazy:lazy. |
|
1531 |
Smalltalk silentLoading:silent. |
|
1532 |
] |
|
1533 |
]. |
|
463
447ead9f870c
be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents:
444
diff
changeset
|
1534 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1535 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
20804 | 1536 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
1537 |
^ nil. |
|
5405 | 1538 |
]. |
1539 |
"/ |
|
1540 |
"/ try to save a bit of memory, by sharing the source (whatever it is) |
|
1541 |
"/ |
|
12854 | 1542 |
temporaryMethod source:newSource. |
5405 | 1543 |
"/ |
22372 | 1544 |
"/ don't forget the method's class & package ... |
5405 | 1545 |
"/ |
1546 |
temporaryMethod setPackage:package. |
|
17250 | 1547 |
temporaryMethod mclass:(self getMclass). |
5405 | 1548 |
^ temporaryMethod |
22372 | 1549 |
|
1550 |
"Modified (comment): / 21-11-2017 / 13:03:45 / cg" |
|
1 | 1551 |
! ! |
1552 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1553 |
!Method methodsFor:'copying'! |
438 | 1554 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1555 |
copy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1556 |
"redefined to change a source ref into a real string" |
438 | 1557 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1558 |
|aCopy| |
438 | 1559 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1560 |
aCopy := super copy. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1561 |
sourcePosition notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1562 |
aCopy source:(self source) |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1563 |
]. |
5676 | 1564 |
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
|
1565 |
^ aCopy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1566 |
|
5696 | 1567 |
"Modified: 16.1.1997 / 01:27:25 / cg" |
1568 |
! ! |
|
438 | 1569 |
|
1 | 1570 |
!Method methodsFor:'error handling'! |
1571 |
||
328 | 1572 |
invalidCodeObject |
1873 | 1573 |
"{ Pragma: +optSpace }" |
1574 |
||
93 | 1575 |
"this method is triggered by the interpreter when a nil or non method |
1576 |
is about to be executed. |
|
1577 |
In this case, the VM sends this to the bad method (the receiver). |
|
1578 |
||
1579 |
Also, the Compiler creates methods with their code/bytecode set to |
|
1580 |
this method if - after a class change - a method cannot be compiled |
|
1581 |
and is therefore no longer executable (for example, after an instvar |
|
68 | 1582 |
has been removed, and a method still tries to access this instvar) |
44 | 1583 |
|
93 | 1584 |
Thus, we arrive here, when playing around in a classes methodArray, |
12854 | 1585 |
or compiler/runtime system is broken :-(, |
93 | 1586 |
or you ignore the error messages during some recompile." |
1 | 1587 |
|
1873 | 1588 |
%{ |
1589 |
/* |
|
1590 |
* for reasons too far from being explained here, |
|
1591 |
* this MUST be a compiled method |
|
1592 |
*/ |
|
1593 |
%}. |
|
7601 | 1594 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1595 |
raiseErrorString:'invalid method - not executable'. |
1873 | 1596 |
|
1597 |
"Modified: 4.11.1996 / 22:45:06 / cg" |
|
1 | 1598 |
! |
1599 |
||
13693 | 1600 |
invalidCodeObjectWith:arg |
1601 |
"{ Pragma: +optSpace }" |
|
1602 |
||
1603 |
"When recompiling classes after a definition-change, all |
|
1604 |
uncompilable methods (with 2 args) will be bound to this method here, |
|
1605 |
so that evaluating such an uncompilable method will trigger an error." |
|
1606 |
||
1607 |
%{ |
|
1608 |
/* |
|
1609 |
* for reasons too far from being explained here, |
|
1610 |
* this MUST be a compiled method |
|
1611 |
*/ |
|
1612 |
%}. |
|
1613 |
^ InvalidCodeError |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1614 |
raiseErrorString:'invalid method - not executable'. |
13693 | 1615 |
|
1616 |
"Created: / 14-09-2011 / 11:23:49 / sr" |
|
1617 |
! |
|
1618 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1619 |
invalidCodeObjectWith:arg with:arg2 |
1873 | 1620 |
"{ Pragma: +optSpace }" |
1621 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1622 |
"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
|
1623 |
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
|
1624 |
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
|
1625 |
|
1873 | 1626 |
%{ |
1627 |
/* |
|
1628 |
* for reasons too far from being explained here, |
|
1629 |
* this MUST be a compiled method |
|
1630 |
*/ |
|
1631 |
%}. |
|
7601 | 1632 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1633 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1634 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1635 |
"Created: 4.11.1996 / 21:16:41 / cg" |
1873 | 1636 |
"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
|
1637 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1638 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1639 |
invalidCodeObjectWith:arg with:arg2 with:arg3 |
1873 | 1640 |
"{ Pragma: +optSpace }" |
1641 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1642 |
"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
|
1643 |
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
|
1644 |
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
|
1645 |
|
1873 | 1646 |
%{ |
1647 |
/* |
|
1648 |
* for reasons too far from being explained here, |
|
1649 |
* this MUST be a compiled method |
|
1650 |
*/ |
|
1651 |
%}. |
|
7601 | 1652 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1653 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1654 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1655 |
"Created: 4.11.1996 / 21:16:51 / cg" |
1873 | 1656 |
"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
|
1657 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1658 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1659 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 |
1873 | 1660 |
"{ Pragma: +optSpace }" |
1661 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1662 |
"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
|
1663 |
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
|
1664 |
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
|
1665 |
|
1873 | 1666 |
%{ |
1667 |
/* |
|
1668 |
* for reasons too far from being explained here, |
|
1669 |
* this MUST be a compiled method |
|
1670 |
*/ |
|
1671 |
%}. |
|
7601 | 1672 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1673 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1674 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1675 |
"Created: 4.11.1996 / 21:17:00 / cg" |
1873 | 1676 |
"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
|
1677 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1678 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1679 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 |
1873 | 1680 |
"{ Pragma: +optSpace }" |
1681 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1682 |
"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
|
1683 |
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
|
1684 |
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
|
1685 |
|
1873 | 1686 |
%{ |
1687 |
/* |
|
1688 |
* for reasons too far from being explained here, |
|
1689 |
* this MUST be a compiled method |
|
1690 |
*/ |
|
1691 |
%}. |
|
7601 | 1692 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1693 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1694 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1695 |
"Created: 4.11.1996 / 21:17:09 / cg" |
1873 | 1696 |
"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
|
1697 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1698 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1699 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
1873 | 1700 |
"{ Pragma: +optSpace }" |
1701 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1702 |
"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
|
1703 |
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
|
1704 |
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
|
1705 |
|
1873 | 1706 |
%{ |
1707 |
/* |
|
1708 |
* for reasons too far from being explained here, |
|
1709 |
* this MUST be a compiled method |
|
1710 |
*/ |
|
1711 |
%}. |
|
7601 | 1712 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1713 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1714 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1715 |
"Created: 4.11.1996 / 21:17:17 / cg" |
1873 | 1716 |
"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
|
1717 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1718 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1719 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 |
1873 | 1720 |
"{ Pragma: +optSpace }" |
1721 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1722 |
"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
|
1723 |
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
|
1724 |
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
|
1725 |
|
1873 | 1726 |
%{ |
1727 |
/* |
|
1728 |
* for reasons too far from being explained here, |
|
1729 |
* this MUST be a compiled method |
|
1730 |
*/ |
|
1731 |
%}. |
|
7601 | 1732 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1733 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1734 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1735 |
"Created: 4.11.1996 / 21:17:25 / cg" |
1873 | 1736 |
"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
|
1737 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1738 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1739 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 |
1873 | 1740 |
"{ Pragma: +optSpace }" |
1741 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1742 |
"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
|
1743 |
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
|
1744 |
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
|
1745 |
|
1873 | 1746 |
%{ |
1747 |
/* |
|
1748 |
* for reasons too far from being explained here, |
|
1749 |
* this MUST be a compiled method |
|
1750 |
*/ |
|
1751 |
%}. |
|
7601 | 1752 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1753 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1754 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1755 |
"Created: 4.11.1996 / 21:17:32 / cg" |
1873 | 1756 |
"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
|
1757 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1758 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1759 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 |
1873 | 1760 |
"{ Pragma: +optSpace }" |
1761 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1762 |
"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
|
1763 |
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
|
1764 |
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
|
1765 |
|
1873 | 1766 |
%{ |
1767 |
/* |
|
1768 |
* for reasons too far from being explained here, |
|
1769 |
* this MUST be a compiled method |
|
1770 |
*/ |
|
1771 |
%}. |
|
7601 | 1772 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1773 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1774 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1775 |
"Created: 4.11.1996 / 21:17:37 / cg" |
1873 | 1776 |
"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
|
1777 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1778 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1779 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 |
1873 | 1780 |
"{ Pragma: +optSpace }" |
1781 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1782 |
"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
|
1783 |
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
|
1784 |
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
|
1785 |
|
1873 | 1786 |
%{ |
1787 |
/* |
|
1788 |
* for reasons too far from being explained here, |
|
1789 |
* this MUST be a compiled method |
|
1790 |
*/ |
|
1791 |
%}. |
|
7601 | 1792 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1793 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1794 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1795 |
"Created: 4.11.1996 / 21:17:45 / cg" |
1873 | 1796 |
"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
|
1797 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1798 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1799 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 |
1873 | 1800 |
"{ Pragma: +optSpace }" |
1801 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1802 |
"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
|
1803 |
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
|
1804 |
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
|
1805 |
|
1873 | 1806 |
%{ |
1807 |
/* |
|
1808 |
* for reasons too far from being explained here, |
|
1809 |
* this MUST be a compiled method |
|
1810 |
*/ |
|
1811 |
%}. |
|
7601 | 1812 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1813 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1814 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1815 |
"Created: 4.11.1996 / 21:17:52 / cg" |
1873 | 1816 |
"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
|
1817 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1818 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1819 |
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 | 1820 |
"{ Pragma: +optSpace }" |
1821 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1822 |
"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
|
1823 |
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
|
1824 |
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
|
1825 |
|
1873 | 1826 |
%{ |
1827 |
/* |
|
1828 |
* for reasons too far from being explained here, |
|
1829 |
* this MUST be a compiled method |
|
1830 |
*/ |
|
1831 |
%}. |
|
7601 | 1832 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1833 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1834 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1835 |
"Created: 4.11.1996 / 20:51:28 / cg" |
1873 | 1836 |
"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
|
1837 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1838 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1839 |
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 | 1840 |
"{ Pragma: +optSpace }" |
1841 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1842 |
"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
|
1843 |
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
|
1844 |
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
|
1845 |
|
1873 | 1846 |
%{ |
1847 |
/* |
|
1848 |
* for reasons too far from being explained here, |
|
1849 |
* this MUST be a compiled method |
|
1850 |
*/ |
|
1851 |
%}. |
|
7601 | 1852 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1853 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1854 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1855 |
"Created: 4.11.1996 / 21:18:09 / cg" |
1873 | 1856 |
"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
|
1857 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1858 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1859 |
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 | 1860 |
"{ Pragma: +optSpace }" |
1861 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1862 |
"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
|
1863 |
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
|
1864 |
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
|
1865 |
|
1873 | 1866 |
%{ |
1867 |
/* |
|
1868 |
* for reasons too far from being explained here, |
|
1869 |
* this MUST be a compiled method |
|
1870 |
*/ |
|
1871 |
%}. |
|
7601 | 1872 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1873 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1874 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1875 |
"Created: 4.11.1996 / 21:18:17 / cg" |
1873 | 1876 |
"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
|
1877 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1878 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1879 |
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 | 1880 |
"{ Pragma: +optSpace }" |
1881 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1882 |
"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
|
1883 |
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
|
1884 |
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
|
1885 |
|
1873 | 1886 |
%{ |
1887 |
/* |
|
1888 |
* for reasons too far from being explained here, |
|
1889 |
* this MUST be a compiled method |
|
1890 |
*/ |
|
1891 |
%}. |
|
7601 | 1892 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1893 |
raiseErrorString:'invalid method - not executable'. |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1894 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1895 |
"Created: 4.11.1996 / 21:18:22 / cg" |
1873 | 1896 |
"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
|
1897 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1898 |
|
109 | 1899 |
privateMethodCalled |
1873 | 1900 |
"{ Pragma: +optSpace }" |
1901 |
||
980 | 1902 |
"this error is triggered, if a private or protected method is called. |
1903 |
||
360 | 1904 |
If you continue in the debugger, the method will be called, |
12854 | 1905 |
and further privacy exceptions will NOT be reported at this call location, |
360 | 1906 |
until any new method is compiled, or the privacy of any method changes, |
1907 |
or the caches are flushed. |
|
20209 | 1908 |
(the reason is that after the continue, the method is entered into the |
360 | 1909 |
calling cache, for which method privacy is not checked. |
1910 |
Any of the above actions flushes this cache and a privacy check |
|
1911 |
is performed again.) |
|
1912 |
Future versions may not enter private methods into the cache, to fix this |
|
1913 |
(unobvious) behavior. However, then you will get an exception for EVERY |
|
1914 |
call to a private method ... |
|
1915 |
||
1916 |
Notice: method privacy is a nonstandard feature, not supported |
|
1917 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1918 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1919 |
It may change or even vanish (if it shows to be not useful)." |
|
68 | 1920 |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
1921 |
^ PrivateMethodSignal raiseRequest |
1873 | 1922 |
|
1923 |
"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
|
1924 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1925 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1926 |
uncompiledCodeObject |
1873 | 1927 |
"{ Pragma: +optSpace }" |
1928 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1929 |
"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
|
1930 |
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
|
1931 |
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
|
1932 |
For those methods, the compiler generated a method object consisting |
1873 | 1933 |
of the original source code, but with this methods machine/byte code." |
1934 |
||
1935 |
%{ |
|
1936 |
/* |
|
1937 |
* for reasons too far from being explained here, |
|
1938 |
* this MUST be a compiled method |
|
1939 |
*/ |
|
1940 |
%}. |
|
7601 | 1941 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1942 |
raiseRequestWith:self |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1943 |
errorString:'invalid method - not compiled'. |
1873 | 1944 |
|
1945 |
"Modified: 4.11.1996 / 22:58:02 / cg" |
|
1946 |
! |
|
1947 |
||
1948 |
unloadedCodeObject |
|
1949 |
"{ Pragma: +optSpace }" |
|
1950 |
||
1951 |
"this method is invoked by methods which have been binary-unloaded |
|
1952 |
For those the source info consists |
|
1953 |
of the original source code, but with this methods machine/byte code." |
|
1954 |
||
1955 |
%{ |
|
1956 |
/* |
|
1957 |
* for reasons too far from being explained here, |
|
1958 |
* this MUST be a compiled method |
|
1959 |
*/ |
|
1960 |
%}. |
|
7601 | 1961 |
^ InvalidCodeError |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1962 |
raiseRequestWith:self |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
1963 |
errorString:'invalid method - unloaded'. |
1873 | 1964 |
|
1965 |
"Created: 4.11.1996 / 22:57:54 / cg" |
|
1966 |
"Modified: 4.11.1996 / 22:58:28 / cg" |
|
1 | 1967 |
! ! |
1968 |
||
9987 | 1969 |
|
93 | 1970 |
!Method methodsFor:'printing & storing'! |
1 | 1971 |
|
1972 |
printOn:aStream |
|
56 | 1973 |
"put a printed representation of the receiver onto aStream. |
1974 |
Since methods do not store their class/selector, we have to search |
|
1975 |
for it here." |
|
1 | 1976 |
|
227 | 1977 |
|classAndSelector m wrapped| |
1 | 1978 |
|
253 | 1979 |
wrapped := false. |
1980 |
||
6234
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1981 |
self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle). |
159 | 1982 |
aStream nextPut:$(. |
227 | 1983 |
|
176 | 1984 |
classAndSelector := self who. |
227 | 1985 |
classAndSelector isNil ifTrue:[ |
19847 | 1986 |
" |
1987 |
not anchored in any class. |
|
1988 |
check if wrapped (to be more informative in inspectors) |
|
1989 |
" |
|
1990 |
m := self wrapper. |
|
1991 |
m notNil ifTrue:[ |
|
1992 |
classAndSelector := m who. |
|
1993 |
wrapped := true. |
|
1994 |
] |
|
227 | 1995 |
]. |
176 | 1996 |
classAndSelector notNil ifTrue:[ |
19847 | 1997 |
(classAndSelector methodClass) name printOn:aStream. |
1998 |
"/ print out in a form that can directly be evaluated (>> is a selector in Behavior) |
|
21156 | 1999 |
"/ in order to not break existing code which parses those strings, |
21937 | 2000 |
"/ do not replace '>>' by ' » ' |
19847 | 2001 |
aStream nextPutAll:' >> '. |
2002 |
(classAndSelector methodSelector) printOn:aStream. |
|
1 | 2003 |
] ifFalse:[ |
19847 | 2004 |
" |
2005 |
sorry, a method which is nowhere anchored |
|
2006 |
" |
|
2007 |
aStream nextPutAll:'unbound' |
|
56 | 2008 |
]. |
13101 | 2009 |
aStream nextPut:$). |
2010 |
||
2011 |
wrapped ifTrue:[ |
|
19847 | 2012 |
aStream nextPutAll:'; wrapped' |
13101 | 2013 |
]. |
176 | 2014 |
|
2015 |
" |
|
253 | 2016 |
(Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr. |
2017 |
(Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr. |
|
10083 | 2018 |
|
2019 |
(Object compiledMethodAt:#at:) whoString printOn:Transcript. Transcript cr. |
|
2020 |
(Object compiledMethodAt:#at:) copy whoString printOn:Transcript. Transcript cr. |
|
176 | 2021 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2022 |
|
13101 | 2023 |
"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
|
2024 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2025 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2026 |
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
|
2027 |
"return a string as className>>selector, if this is not an unbound |
20208 | 2028 |
method. |
19782 | 2029 |
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
|
2030 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2031 |
|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
|
2032 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2033 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2034 |
who notNil ifTrue:[ |
19782 | 2035 |
"/ in order to not break existing code which parses those strings, |
21937 | 2036 |
"/ do not replace '>>' by ' » ' |
19782 | 2037 |
^ 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
|
2038 |
]. |
6071 | 2039 |
^ '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
|
2040 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2041 |
" |
12854 | 2042 |
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
|
2043 |
(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
|
2044 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2045 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2046 |
"Modified: 1.11.1996 / 16:27:04 / cg" |
21156 | 2047 |
! |
2048 |
||
2049 |
whoStringWith:sep |
|
2050 |
"return a string like className>>selector, |
|
2051 |
if this is not an unbound method. |
|
2052 |
Otherwise return 'unbound'. Used with debugging." |
|
2053 |
||
2054 |
|who| |
|
2055 |
||
2056 |
who := self who. |
|
2057 |
who notNil ifTrue:[ |
|
2058 |
^ who methodClass name , sep , (who methodSelector storeString) |
|
2059 |
]. |
|
2060 |
^ 'unboundMethod' |
|
2061 |
||
2062 |
" |
|
2063 |
Method new whoStringWith:' >> ' |
|
2064 |
(Method compiledMethodAt:#whoString) whoStringWith:' >> ' |
|
21937 | 2065 |
(Method compiledMethodAt:#whoString) whoStringWith:' » ' |
21157 | 2066 |
(Method compiledMethodAt:#whoString) whoStringWith:' -> ' |
21156 | 2067 |
" |
1 | 2068 |
! ! |
2069 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2070 |
!Method methodsFor:'private'! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2071 |
|
13422 | 2072 |
annotationAtIndex: index |
14253 | 2073 |
"return the annotation at given index. |
18411 | 2074 |
any raw annotation array (as generated by the compiler) |
2075 |
is lazily initialized from the 2-element format to real annotation instances here. |
|
2076 |
This is done to avoid the need for knowledge about annotation instances in the stc compiler." |
|
13422 | 2077 |
|
13662
7d7ae1e5f589
changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents:
13660
diff
changeset
|
2078 |
| annotationOrArray annotation args | |
13683
1b6be902030b
comment/format in: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents:
13679
diff
changeset
|
2079 |
|
13817 | 2080 |
annotations isNil ifTrue:[^nil]. |
18411 | 2081 |
|
13662
7d7ae1e5f589
changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents:
13660
diff
changeset
|
2082 |
annotationOrArray := annotation := annotations at: index. |
7d7ae1e5f589
changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents:
13660
diff
changeset
|
2083 |
annotationOrArray isArray ifTrue:[ |
20547 | 2084 |
args := annotationOrArray size == 2 |
2085 |
ifTrue:[annotationOrArray second] |
|
2086 |
ifFalse:[#()]. |
|
2087 |
args isArray ifFalse:[args := Array with: args]. |
|
21373 | 2088 |
annotation := Annotation method:self key: annotationOrArray first arguments: args. |
2089 |
||
2090 |
"/ unknown annotations are not written back, |
|
2091 |
"/ to give later loaded annotation classes a chance to create |
|
2092 |
"/ a proper instance (otherwise, it would be and remain an unknown annotation) |
|
20547 | 2093 |
annotation isUnknown ifFalse:[ |
2094 |
annotations isImmutable ifTrue:[ |
|
2095 |
annotations := annotations asMutableCollection |
|
2096 |
]. |
|
2097 |
annotations at: index put: annotation. |
|
13422 | 2098 |
"/ annotation annotatesMethod: self |
20547 | 2099 |
]. |
21372 | 2100 |
]. |
13422 | 2101 |
^annotation |
2102 |
||
2103 |
"Created: / 02-07-2010 / 22:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2104 |
"Modified: / 11-07-2010 / 19:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
21373 | 2105 |
"Modified (format): / 07-02-2017 / 20:17:30 / cg" |
13422 | 2106 |
! |
2107 |
||
2108 |
annotationIndexOf: key |
|
14253 | 2109 |
"Returns the index of annotation with given key |
13422 | 2110 |
or nil if there is no such annotation" |
2111 |
||
13817 | 2112 |
annotations isNil ifTrue:[^nil]. |
2113 |
||
2114 |
annotations keysAndValuesDo: [:index :annotationOrArray| |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2115 |
annotationOrArray isArray |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2116 |
ifTrue: [annotationOrArray first == key ifTrue:[^index]] |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2117 |
ifFalse:[annotationOrArray key == key ifTrue:[^index]] |
13817 | 2118 |
]. |
13422 | 2119 |
^nil. |
2120 |
||
2121 |
"Created: / 19-05-2010 / 16:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2122 |
"Modified: / 11-07-2010 / 19:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14253 | 2123 |
"Modified (comment): / 26-07-2012 / 15:48:14 / cg" |
13422 | 2124 |
! |
2125 |
||
12695 | 2126 |
cacheSourceStream:aStream |
2127 |
"remember a (raw) source stream for later use" |
|
2128 |
||
2129 |
|lastStream| |
|
2130 |
||
2131 |
(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
|
2132 |
LastFileLock critical:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2133 |
lastStream := LastFileReference at:1. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2134 |
(lastStream notNil |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2135 |
and:[lastStream class ~~ SmallInteger |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2136 |
and:[lastStream isOpen]]) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2137 |
lastStream close. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2138 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2139 |
LastSourceFileName := package,'/',source. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2140 |
LastFileReference at:1 put:aStream. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2141 |
]. |
12695 | 2142 |
]. |
2143 |
! |
|
2144 |
||
13422 | 2145 |
getAnnotations |
2146 |
^annotations |
|
2147 |
||
2148 |
"Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2149 |
"Modified: / 11-07-2010 / 19:30:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14253 | 2150 |
"Modified (format): / 26-07-2012 / 15:49:38 / cg" |
13422 | 2151 |
! |
2152 |
||
2153 |
getLookupObject |
|
2154 |
||
2155 |
^lookupObject |
|
2156 |
||
2157 |
"Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2158 |
! |
|
2159 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2160 |
localSourceStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2161 |
"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
|
2162 |
searching in standard places." |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2163 |
|
8216 | 2164 |
|dir fileName aStream| |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2165 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2166 |
package notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2167 |
"/ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2168 |
"/ old: look in 'source/<filename>' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2169 |
"/ this is still kept in order to find user-private |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2170 |
"/ classes in her currentDirectory. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2171 |
"/ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2172 |
fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2173 |
fileName notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2174 |
aStream := fileName asFilename readStreamOrNil. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2175 |
aStream notNil ifTrue:[^ aStream]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2176 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2177 |
"/ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2178 |
"/ new: look in package-dir |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2179 |
"/ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2180 |
dir := Smalltalk getPackageDirectoryForPackage:package. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2181 |
dir notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2182 |
fileName := dir construct:source. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2183 |
aStream := fileName asFilename readStreamOrNil. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2184 |
aStream notNil ifTrue:[^ aStream]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2185 |
]. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2186 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2187 |
fileName := Smalltalk getSourceFileName:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2188 |
fileName notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2189 |
aStream := fileName asFilename readStreamOrNil. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2190 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2191 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2192 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2193 |
|
12682 | 2194 |
rawSourceStreamUsingCache:usingCacheBoolean |
2195 |
"return an open sourceStream (needs positioning). |
|
2196 |
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
|
2197 |
You have to close the stream, if usingCacheBoolean is false, and should not close it |
12682 | 2198 |
if usingCacheBoolean is true." |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2199 |
|
15952 | 2200 |
|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
|
2201 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2202 |
" |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2203 |
if sourcePosition is nonNil, its the fileName and |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2204 |
abs(sourcePosition) is the offset. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2205 |
Otherwise, source is the real source |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2206 |
" |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2207 |
source isNil ifTrue:[^ nil]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2208 |
sourcePosition isNil ifTrue:[^ source readStream]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2209 |
|
12682 | 2210 |
usingCacheBoolean ifTrue:[ |
20035 | 2211 |
(package notNil and:[package ~= PackageId noProjectID]) ifTrue:[ |
2212 |
"/ keep the last source file open, because open/close |
|
2213 |
"/ operations maybe slow on NFS-mounted file systems. |
|
2214 |
"/ Since the reference to the file is weak, it will be closed |
|
2215 |
"/ automatically if the file is not referenced for a while. |
|
2216 |
"/ Neat trick. |
|
2217 |
||
2218 |
LastFileLock critical:[ |
|
2219 |
aStream := LastFileReference at:1. |
|
2220 |
(aStream isNil |
|
2221 |
or:[aStream class == SmallInteger |
|
2222 |
or:[aStream isOpen not]]) ifTrue:[ |
|
2223 |
aStream := nil. |
|
2224 |
LastFileReference at:1 put:nil. |
|
2225 |
]. |
|
2226 |
(aStream notNil |
|
2227 |
and:[LastSourceFileName ~= (package,'/',source)]) ifTrue:[ |
|
2228 |
aStream := nil. |
|
2229 |
]. |
|
2230 |
]. |
|
2231 |
||
2232 |
aStream notNil ifTrue:[ |
|
2233 |
^ aStream |
|
2234 |
]. |
|
2235 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2236 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2237 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2238 |
"/ a negative sourcePosition indicates |
12854 | 2239 |
"/ that this is a local file |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2240 |
"/ (not to be requested via the sourceCodeManager) |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2241 |
"/ 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
|
2242 |
"/ 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
|
2243 |
"/ 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
|
2244 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2245 |
sourcePosition < 0 ifTrue:[ |
20035 | 2246 |
aStream := source asFilename readStreamOrNil. |
2247 |
aStream isNil ifTrue:[ |
|
2248 |
"/ search in some standard places |
|
2249 |
fileName := Smalltalk getSourceFileName:source. |
|
2250 |
fileName notNil ifTrue:[ |
|
2251 |
aStream := fileName asFilename readStreamOrNil. |
|
2252 |
]. |
|
2253 |
]. |
|
2254 |
aStream notNil ifTrue:[ |
|
2255 |
usingCacheBoolean ifTrue:[ |
|
2256 |
self cacheSourceStream:aStream. |
|
2257 |
]. |
|
2258 |
^ aStream |
|
2259 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2260 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2261 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2262 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2263 |
"/ 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
|
2264 |
"/ |
17254 | 2265 |
(mclass notNil and:[package == mclass package]) ifTrue:[ |
20035 | 2266 |
mgr := mclass sourceCodeManagerFromBinaryRevision |
15952 | 2267 |
] ifFalse:[ |
20035 | 2268 |
"I'm an extension and we don't have binary revision info (!!) |
2269 |
for extensions, try to guess here" |
|
2270 |
pkgDef := ProjectDefinition definitionClassForPackage: package. |
|
2271 |
pkgDef notNil ifTrue:[ |
|
2272 |
mgr := pkgDef sourceCodeManagerFromBinaryRevision |
|
2273 |
] ifFalse:[ |
|
2274 |
"OK, trust the configuration" |
|
2275 |
mgr := AbstractSourceCodeManager managerForPackage: package |
|
2276 |
] |
|
15952 | 2277 |
]. |
2278 |
||
2279 |
(Class tryLocalSourceFirst or:[mgr isNil]) ifTrue:[ |
|
20035 | 2280 |
aStream := self localSourceStream. |
2281 |
aStream notNil ifTrue:[ |
|
2282 |
usingCacheBoolean ifTrue:[ |
|
2283 |
self cacheSourceStream:aStream. |
|
2284 |
]. |
|
2285 |
^ aStream |
|
2286 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2287 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2288 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2289 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2290 |
"/ 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
|
2291 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2292 |
who := self who. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2293 |
who notNil ifTrue:[ |
20035 | 2294 |
myClass := who methodClass. |
2295 |
||
2296 |
(package notNil and:[package ~= myClass package and:[package ~= #'__NoProject__']]) ifTrue:[ |
|
2297 |
"/ I am an extension |
|
2298 |
mgr notNil ifTrue:[ |
|
2299 |
"/ try to get the source using my package information ... |
|
2300 |
mod := package asPackageId module. |
|
2301 |
dir := package asPackageId directory. |
|
2302 |
aStream := mgr streamForExtensionFile:source package:package directory:dir module:mod cache:true. |
|
2303 |
aStream notNil ifTrue:[ |
|
2304 |
usingCacheBoolean ifTrue:[ |
|
2305 |
self cacheSourceStream:aStream. |
|
2306 |
]. |
|
2307 |
^ aStream |
|
2308 |
]. |
|
2309 |
]. |
|
2310 |
"/ consult the local fileSystem |
|
2311 |
aStream := self localSourceStream. |
|
2312 |
aStream notNil ifTrue:[ |
|
2313 |
usingCacheBoolean ifTrue:[ |
|
2314 |
self cacheSourceStream:aStream. |
|
2315 |
]. |
|
2316 |
^ aStream |
|
2317 |
] |
|
2318 |
]. |
|
2319 |
||
2320 |
aStream := myClass sourceStreamFor:source. |
|
2321 |
aStream notNil ifTrue:[ |
|
2322 |
usingCacheBoolean ifTrue:[ |
|
2323 |
self cacheSourceStream:aStream. |
|
2324 |
]. |
|
2325 |
^ aStream |
|
2326 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2327 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2328 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2329 |
"/ |
12854 | 2330 |
"/ nope - look in standard places |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2331 |
"/ (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
|
2332 |
"/ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2333 |
(mgr notNil and:[Class tryLocalSourceFirst not]) ifTrue:[ |
20035 | 2334 |
aStream := self localSourceStream. |
2335 |
aStream notNil ifTrue:[ |
|
2336 |
usingCacheBoolean ifTrue:[ |
|
2337 |
self cacheSourceStream:aStream. |
|
2338 |
]. |
|
2339 |
^ aStream |
|
2340 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2341 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2342 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2343 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2344 |
"/ final chance: try current directory |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2345 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2346 |
aStream isNil ifTrue:[ |
20035 | 2347 |
aStream := source asFilename readStreamOrNil. |
2348 |
aStream notNil ifTrue:[ |
|
2349 |
usingCacheBoolean ifTrue:[ |
|
2350 |
self cacheSourceStream:aStream. |
|
2351 |
]. |
|
2352 |
^ aStream |
|
2353 |
]. |
|
8141
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 |
(who isNil and:[source notNil]) ifTrue:[ |
20035 | 2357 |
"/ |
2358 |
"/ mhmh - seems to be a method which used to be in some |
|
2359 |
"/ class, but has been overwritten by another or removed. |
|
2360 |
"/ (i.e. it has no containing class anyMore) |
|
2361 |
"/ try to guess the class from the sourceFileName. |
|
2362 |
"/ and retry. |
|
2363 |
"/ |
|
2364 |
className := Smalltalk classNameForFile:source. |
|
2365 |
(classNameSymbol := className asSymbolIfInterned) notNil ifTrue:[ |
|
2366 |
myClass := Smalltalk at:classNameSymbol ifAbsent:nil. |
|
2367 |
myClass notNil ifTrue:[ |
|
2368 |
aStream := myClass sourceStreamFor:source. |
|
2369 |
aStream notNil ifTrue:[ |
|
2370 |
usingCacheBoolean ifTrue:[ |
|
2371 |
self cacheSourceStream:aStream. |
|
2372 |
]. |
|
2373 |
^ aStream |
|
2374 |
]. |
|
2375 |
] |
|
2376 |
] |
|
12854 | 2377 |
]. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2378 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2379 |
^ nil |
10201 | 2380 |
|
2381 |
"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
|
2382 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2383 |
|
13422 | 2384 |
setLookupObject: lookup |
2385 |
"set the lookupObject (low level - use lookupObject:)" |
|
2386 |
||
14536 | 2387 |
lookupObject ~~ lookup ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2388 |
lookupObject := lookup. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2389 |
ObjectMemory flushCaches. |
14536 | 2390 |
]. |
13422 | 2391 |
|
2392 |
"Created: / 11-07-2010 / 19:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2393 |
! |
|
2394 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2395 |
sourceChunkFromStream:aStream |
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
2396 |
PositionError handle:[:ex | |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2397 |
^ nil |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2398 |
] do:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2399 |
aStream position:(sourcePosition ? 1) abs - 1. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2400 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2401 |
^ aStream nextChunk. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2402 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2403 |
|
12682 | 2404 |
sourceStreamUsingCache:usingCacheBoolean |
2405 |
"return an open sourceStream (needs positioning). |
|
2406 |
If usingCacheBoolean is true, cache the stream (but take care against concurrent access). |
|
14090
bb45ad9b6aab
changed: #sourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents:
14047
diff
changeset
|
2407 |
You have to close the stream, if usingCacheBoolean is false, and should not close it |
12682 | 2408 |
if usingCacheBoolean is true." |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2409 |
|
12695 | 2410 |
|rawStream| |
2411 |
||
2412 |
rawStream := self rawSourceStreamUsingCache:usingCacheBoolean. |
|
2413 |
rawStream isNil ifTrue:[ |
|
21431 | 2414 |
^ nil. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2415 |
]. |
14090
bb45ad9b6aab
changed: #sourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents:
14047
diff
changeset
|
2416 |
rawStream position:0. |
12695 | 2417 |
|
21431 | 2418 |
"/ see if it's utf8 encoded... |
12695 | 2419 |
^ EncodedStream decodedStreamFor:rawStream. |
21431 | 2420 |
|
2421 |
"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
|
2422 |
! ! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
2423 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2424 |
!Method methodsFor:'private-compiler interface'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2425 |
|
5405 | 2426 |
primitiveNumber |
2427 |
"for stx rel >= 5.x only: |
|
2428 |
return the primitive number." |
|
2429 |
||
2430 |
%{ /* NOCONTEXT */ |
|
2431 |
||
2432 |
#ifdef F_PRIMITIVE |
|
2433 |
INT f = __intVal(__INST(flags)); |
|
6014 | 2434 |
OBJ nr = 0; |
5405 | 2435 |
|
2436 |
if (f & F_PRIMITIVE) { |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2437 |
nr = __INST(code_); |
5405 | 2438 |
} |
2439 |
RETURN (nr); |
|
2440 |
#endif |
|
2441 |
%}. |
|
2442 |
self primitiveFailed |
|
2443 |
! |
|
2444 |
||
2445 |
setPrimitiveNumber:aNumber |
|
2446 |
"for stx rel >= 5.x only: |
|
2447 |
mark the method as having primitive code." |
|
2448 |
||
2449 |
%{ /* NOCONTEXT */ |
|
2450 |
||
2451 |
#ifdef F_PRIMITIVE |
|
2452 |
INT f = __intVal(__INST(flags)); |
|
2453 |
||
2454 |
f |= F_PRIMITIVE; |
|
8913 | 2455 |
__INST(flags) = __mkSmallInteger(f); |
5405 | 2456 |
__INST(code_) = aNumber; |
2457 |
RETURN (self); |
|
2458 |
#endif |
|
2459 |
%}. |
|
2460 |
self primitiveFailed |
|
2461 |
||
2462 |
||
2463 |
||
2464 |
! |
|
2465 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2466 |
setResourceFlag |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2467 |
"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
|
2468 |
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
|
2469 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2470 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2471 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2472 |
#ifdef F_RESOURCE |
2868 | 2473 |
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
|
2474 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2475 |
f |= F_RESOURCE; |
8913 | 2476 |
__INST(flags) = __mkSmallInteger(f); |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2477 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2478 |
%} |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2479 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2480 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2481 |
!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
|
2482 |
|
2702 | 2483 |
accessedInstVars |
2484 |
"return a collection of instVarNames, which are accessed by |
|
2485 |
the receiver method" |
|
2486 |
||
2487 |
|src parser| |
|
2488 |
||
2489 |
src := self source. |
|
2490 |
src notNil ifTrue:[ |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2491 |
parser := Parser |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2492 |
parseMethod:src |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2493 |
in:self containingClass |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2494 |
ignoreErrors:true |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2495 |
ignoreWarnings:true. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2496 |
|
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2497 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2498 |
^ parser usedInstVars |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2499 |
]. |
2702 | 2500 |
]. |
2501 |
^ #() "/ actually: unknown |
|
2502 |
||
2503 |
"Modified: 19.6.1997 / 17:54:09 / cg" |
|
2504 |
! |
|
2505 |
||
14237 | 2506 |
accessesField:instVarIndex |
2507 |
"return true, if the instvar at instVarIndex is accessed by the receiver. |
|
2508 |
Uses parser (for now); could look at bytecode as well here..." |
|
2509 |
||
2510 |
|instVarName| |
|
2511 |
||
2512 |
instVarName := (self mclass allInstVarNames) at:instVarIndex. |
|
2513 |
^ self accessesInstVar:instVarName |
|
2514 |
||
2515 |
"Created: / 23-07-2012 / 11:13:54 / cg" |
|
2516 |
! |
|
2517 |
||
2518 |
accessesInstVar:instVarName |
|
2519 |
"return true, if the named instvar is accessed by the receiver. |
|
2520 |
Uses parser (for now); could look at bytecode as well here..." |
|
2521 |
||
2522 |
|usedInstVars| |
|
2523 |
||
2524 |
(self source includesString:instVarName) ifFalse:[^ false]. "/ that's much faster than parsing... |
|
2525 |
usedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#usedInstVars or:#(). |
|
2526 |
^ usedInstVars includes:instVarName. |
|
2527 |
||
2528 |
"Created: / 23-07-2012 / 11:15:02 / cg" |
|
2529 |
! |
|
2530 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2531 |
containingClass |
12854 | 2532 |
"return the class I am defined in. |
17278 | 2533 |
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
|
2534 |
due to an accept in a browser or debugger. |
17278 | 2535 |
However, the mclass slot still contains a reference to the once valid class and can be fetched |
2536 |
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
|
2537 |
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
|
2538 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2539 |
"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
|
2540 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2541 |
|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
|
2542 |
|
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
2543 |
mclass notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2544 |
"/ 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
|
2545 |
(mclass containsMethod:self) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2546 |
^ mclass |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2547 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2548 |
^ nil. |
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
2549 |
]. |
5324 | 2550 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2551 |
who := self who. |
17254 | 2552 |
who notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2553 |
mclass := who methodClass. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2554 |
^ mclass |
17254 | 2555 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2556 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2557 |
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
|
2558 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2559 |
^ 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
|
2560 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2561 |
" |
12854 | 2562 |
(Object compiledMethodAt:#at:) containingClass |
2563 |
||
2564 |
(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
|
2565 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2566 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2567 |
|
10482 | 2568 |
externalLibraryFunction |
2569 |
"if this is an externalLibraryFunction call, return the externalLibraryFunction. |
|
2570 |
Returns nil otherwise." |
|
2571 |
||
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2572 |
|newMethod function| |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2573 |
|
13463 | 2574 |
(self |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2575 |
literalsDetect:[:lit | |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2576 |
#( |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2577 |
#'invoke' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2578 |
#'invokeWith:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2579 |
#'invokeWith:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2580 |
#'invokeWith:with:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2581 |
#'invokeWith:with:with:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2582 |
#'invokeWithArguments:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2583 |
#'invokeCPPVirtualOn:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2584 |
#'invokeCPPVirtualOn:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2585 |
#'invokeCPPVirtualOn:with:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2586 |
#'invokeCPPVirtualOn:with:with:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2587 |
#'invokeCPPVirtualOn:with:with:with:with:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2588 |
#'invokeCPPVirtualOn:withArguments:' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2589 |
) includes:lit |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2590 |
] |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2591 |
ifNone:nil) notNil |
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2592 |
ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2593 |
"/ sigh - for stc-compiled code, this does not work: |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2594 |
function := self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2595 |
function isNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2596 |
"/ parse it and ask the parser |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2597 |
newMethod := Compiler compile:self source forClass:self mclass install:false. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2598 |
function := newMethod literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2599 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2600 |
^ function |
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2601 |
]. |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2602 |
^ nil |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2603 |
|
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2604 |
" |
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2605 |
(IDispatchPointer compiledMethodAt:#'invokeGetTypeInfo:_:_:') |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2606 |
externalLibraryFunction |
13189
96fe3d9e3f3a
changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents:
13156
diff
changeset
|
2607 |
" |
10482 | 2608 |
! |
2609 |
||
13422 | 2610 |
hasAnnotation |
14253 | 2611 |
"Return true iff the method has any annotation" |
13422 | 2612 |
|
2613 |
^annotations notNil |
|
2614 |
||
2615 |
"Created: / 11-07-2010 / 19:27:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14253 | 2616 |
"Modified (comment): / 26-07-2012 / 15:49:59 / cg" |
13422 | 2617 |
! |
2618 |
||
2619 |
hasAnnotation: key |
|
14253 | 2620 |
"Return true iff the method is annotated with the given key" |
13422 | 2621 |
|
17463 | 2622 |
annotations isNil ifTrue:[^ false]. |
2623 |
^ (self annotationIndexOf: key) notNil |
|
13422 | 2624 |
|
2625 |
"Created: / 11-07-2010 / 19:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14253 | 2626 |
"Modified (comment): / 26-07-2012 / 15:49:54 / cg" |
13422 | 2627 |
! |
2628 |
||
12913 | 2629 |
hasAnyResource:aCollectionOfSymbols |
2630 |
"return true if the method has a <resource> definition for any symbol in aCollectionOfSymbols" |
|
2631 |
||
2632 |
^ self hasResource and:[ self resources keys includesAny:aCollectionOfSymbols ] |
|
2633 |
||
2634 |
" |
|
2635 |
Method allInstancesDo:[:m | |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2636 |
(m hasAnyResource:#(image canvas)) ifTrue:[self halt] |
12913 | 2637 |
]. |
2638 |
" |
|
2639 |
! |
|
2640 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2641 |
hasPrimitiveCode |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2642 |
"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
|
2643 |
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
|
2644 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2645 |
|src| |
159 | 2646 |
|
2218 | 2647 |
"/ first a trivial reject, if the source does not |
5534 | 2648 |
"/ contain a '% {' sequence |
2218 | 2649 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2650 |
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
|
2651 |
src notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2652 |
(src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2653 |
"/ cannot contain primitive code. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2654 |
^ false |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2655 |
] |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2656 |
]. |
2218 | 2657 |
|
2658 |
"/ ok; it may or may not ... |
|
2659 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2660 |
^ 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
|
2661 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2662 |
" |
12854 | 2663 |
(Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode |
2664 |
(Object compiledMethodAt:#at:) hasPrimitiveCode |
|
2665 |
(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
|
2666 |
" |
159 | 2667 |
|
2218 | 2668 |
"Modified: 22.1.1997 / 00:03:45 / cg" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2669 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2670 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2671 |
hasResource |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2672 |
"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
|
2673 |
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
|
2674 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2675 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2676 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2677 |
#ifdef F_RESOURCE |
1133 | 2678 |
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
|
2679 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2680 |
%}. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2681 |
^ false |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2682 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2683 |
|
10482 | 2684 |
indexOfOLECall |
14357
08d5b662477a
comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents:
14274
diff
changeset
|
2685 |
"return the vtable inedx, if the method contains an ole call; nil if not. |
10482 | 2686 |
Uses Parser to parse methods source and get the information." |
2687 |
||
2688 |
|funcOrNil| |
|
2689 |
||
2690 |
funcOrNil := self externalLibraryFunction. |
|
2691 |
(funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil]. |
|
2692 |
^ funcOrNil vtableIndex |
|
2693 |
||
2694 |
" |
|
12854 | 2695 |
(Method compiledMethodAt:#hasPrimitiveCode) isOLECall |
2696 |
(Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall |
|
2697 |
||
2698 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall |
|
2699 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall |
|
2700 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall |
|
2701 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall |
|
2702 |
||
2703 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall |
|
2704 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction |
|
2705 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall |
|
2706 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall |
|
10482 | 2707 |
" |
14357
08d5b662477a
comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents:
14274
diff
changeset
|
2708 |
|
08d5b662477a
comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents:
14274
diff
changeset
|
2709 |
"Modified (comment): / 25-09-2012 / 12:01:32 / cg" |
10482 | 2710 |
! |
2711 |
||
11986 | 2712 |
isDocumentationMethod |
11987 | 2713 |
"Return true, if this is a documentation only (only a comment) method |
2714 |
(implies being a metaclass method)" |
|
11986 | 2715 |
|
12275
8ca2aabefa4e
changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents:
12216
diff
changeset
|
2716 |
self mclass isMeta ifFalse:[^ false]. |
12283
54b6f67bcc26
changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents:
12275
diff
changeset
|
2717 |
self isVersionMethod ifTrue:[^ false]. |
12159 | 2718 |
^ self parse:#'parseMethodSilent:' return:#isEmptyMethod or:false. |
11986 | 2719 |
! |
2720 |
||
13639 | 2721 |
isExtension |
2722 |
"return true, if this method is an extension (i.e. package ~= classes' package)" |
|
2723 |
||
2724 |
^ package ~= self mclass package |
|
2725 |
||
2726 |
"Created: / 07-09-2011 / 09:29:13 / cg" |
|
2727 |
! |
|
2728 |
||
10482 | 2729 |
isExternalLibraryFunctionCall |
2730 |
"Return true, if this is an externalLibraryFunction call." |
|
2731 |
||
12569
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2732 |
"/ 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
|
2733 |
"/ to be fixed... |
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2734 |
|
10482 | 2735 |
^ self externalLibraryFunction notNil |
2736 |
! |
|
2737 |
||
20683 | 2738 |
isForCompatibility |
2739 |
"returns true, if this method only used for compatibility |
|
2740 |
and should use only when porting foreign code but not otherwise" |
|
2741 |
||
21450 | 2742 |
^ (self package == #'stx:libcompat') or:[self isTaggedAs:#compatibility] |
2743 |
||
2744 |
"Modified: / 15-02-2017 / 17:16:10 / cg" |
|
20683 | 2745 |
! |
2746 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2747 |
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
|
2748 |
"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
|
2749 |
a (re)-compilation error. Since invalidation is by patching the |
17452 | 2750 |
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
|
2751 |
(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
|
2752 |
|
2558 | 2753 |
|m myCode| |
1873 | 2754 |
|
2755 |
myCode := self code. |
|
2756 |
||
18438 | 2757 |
m := self trapMethodForNumArgs:(self argumentCount). |
1873 | 2758 |
(m notNil and:[self ~~ m]) ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2759 |
(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
|
2760 |
(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
|
2761 |
]. |
159 | 2762 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2763 |
m := Method compiledMethodAt:#uncompiledCodeObject. |
1873 | 2764 |
(m notNil and:[self ~~ m]) ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2765 |
(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
|
2766 |
(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
|
2767 |
]. |
1873 | 2768 |
|
2769 |
m := Method compiledMethodAt:#unloadedCodeObject. |
|
2770 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2771 |
(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
|
2772 |
(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
|
2773 |
]. |
1873 | 2774 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2775 |
^ false |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
2776 |
|
1873 | 2777 |
"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
|
2778 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2779 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2780 |
isMethod |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2781 |
"return true, if the receiver is some kind of method; |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2782 |
true returned here - the method is redefined from Object." |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2783 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2784 |
^ true |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2785 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2786 |
|
14274
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2787 |
isMethodWithBreakpoints |
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2788 |
"only redefined in MethodWithBreakpoints" |
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2789 |
|
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2790 |
^ false |
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2791 |
|
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2792 |
"Created: / 01-08-2012 / 17:26:43 / cg" |
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2793 |
! |
cee19bad32a0
added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents:
14266
diff
changeset
|
2794 |
|
10482 | 2795 |
isOLECall |
2796 |
"return true, if the method is an ole call; false if not." |
|
2797 |
||
2798 |
|funcOrNil| |
|
2799 |
||
2800 |
funcOrNil := self externalLibraryFunction. |
|
2801 |
^ funcOrNil notNil and:[funcOrNil isCallTypeOLE] |
|
2802 |
! |
|
2803 |
||
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2804 |
isObsolete |
22443 | 2805 |
"returns true, if this method is obsolete and should not be used any longer. |
2806 |
Obsolete methods are marked by a: |
|
2807 |
<resource: #obsolete> |
|
2808 |
attribute. |
|
2809 |
" |
|
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2810 |
|
21450 | 2811 |
^ self isTaggedAs:#obsolete |
2812 |
||
22443 | 2813 |
" |
2814 |
SystemBrowser browseMethods:(Method allInstances select:#isObsolete) |
|
2815 |
" |
|
2816 |
||
21450 | 2817 |
"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
|
2818 |
! |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2819 |
|
15079 | 2820 |
isShadowingExtension |
2821 |
"return true, if this method is an extension (i.e. package ~= classes' package) |
|
2822 |
which shadows an existing method from another package (i.e. a package conflict)" |
|
2823 |
||
16877
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
2824 |
^ self shadowedMethod notNil. |
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
2825 |
|
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
2826 |
"Modified: / 03-10-2014 / 15:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
15079 | 2827 |
! |
2828 |
||
22019 | 2829 |
isSubclassResponsibility |
2830 |
^ self |
|
2831 |
sendsAnySelector:#( |
|
2832 |
#subclassResponsibility #subclassResponsibility: |
|
2833 |
#implementedBySubclass "/ ST/V code uses this |
|
2834 |
). |
|
2835 |
||
2836 |
"Created: / 16-07-2017 / 11:25:54 / cg" |
|
2837 |
! |
|
2838 |
||
13422 | 2839 |
isSynthetic |
21336 | 2840 |
"a synthetic method does not really exist - it is only shown in a browser's list" |
13638 | 2841 |
|
2842 |
^ false |
|
2843 |
||
2844 |
"Modified (format): / 07-09-2011 / 09:00:56 / cg" |
|
21336 | 2845 |
"Modified (comment): / 01-02-2017 / 16:58:39 / stefan" |
13422 | 2846 |
! |
2847 |
||
21450 | 2848 |
isTaggedAs:tag |
2849 |
"returns true, if this method has a <resource: tag> annotation" |
|
2850 |
||
2851 |
|res| |
|
2852 |
||
2853 |
^ (res := self resources) notNil and:[res includesKey:tag] |
|
2854 |
||
2855 |
"Created: / 15-02-2017 / 17:15:15 / cg" |
|
2856 |
! |
|
2857 |
||
11985 | 2858 |
isVersionMethod |
12017
908685b92c3e
comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents:
12016
diff
changeset
|
2859 |
"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
|
2860 |
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
|
2861 |
method attribute for that..." |
11985 | 2862 |
|
12016 | 2863 |
^ self mclass isMeta |
12165 | 2864 |
and:[(AbstractSourceCodeManager isVersionMethodSelector:self selector)] |
11985 | 2865 |
|
2866 |
" |
|
12854 | 2867 |
(Method class compiledMethodAt:#version) isVersionMethod |
11985 | 2868 |
(Method class compiledMethodAt:#documentation) isVersionMethod |
2869 |
" |
|
2870 |
! |
|
2871 |
||
11848 | 2872 |
isVisualWorksTypedef |
2873 |
"Return true, if this is a type-returning method (a visualWorks typedef)" |
|
2874 |
||
2875 |
^ (self literals size > 0) |
|
2876 |
and:[ (self literalAt:1) isKindOf:CType ] |
|
2877 |
! |
|
2878 |
||
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2879 |
mclass |
17278 | 2880 |
"return the class in which the receiver is currently contained in. |
2881 |
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
|
2882 |
due to an accept in a browser or debugger. |
17278 | 2883 |
However, the mclass slot still contains a reference to the once valid class and can be fetched |
2884 |
via getMclass. |
|
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2885 |
Same as #containingClass, for ST80 compatibility." |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2886 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2887 |
^ self containingClass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2888 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2889 |
"Created: 19.6.1997 / 16:26:13 / cg" |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2890 |
! |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2891 |
|
5696 | 2892 |
messages |
2893 |
"return a collection of message-selectors, sent by this method." |
|
2894 |
||
2895 |
^ self messagesSent |
|
2896 |
! |
|
2897 |
||
5584
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2898 |
messagesDo:aBlock |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2899 |
"evaluate aBlock for each message-selector sent by this method. |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2900 |
Uses Parser to parse methods source and extract the names." |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2901 |
|
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2902 |
^ self messagesSent do:aBlock |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2903 |
! |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2904 |
|
14402 | 2905 |
messagesPossiblySent |
2906 |
"return a collection with the message selectors possibly sent to by the receiver. |
|
2907 |
Uses Parser to parse methods source and extract the names. |
|
2908 |
The returned collection includes perform-like and possibly performed messages" |
|
2909 |
||
2910 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesPossiblySent or:#() |
|
2911 |
||
2912 |
" |
|
2913 |
(Method compiledMethodAt:#printOn:) messagesSent |
|
2914 |
(Point compiledMethodAt:#x:) messagesSent |
|
17173 | 2915 |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2916 |
(WindowEvent class compiledMethodAt:#focusInView:) messagesSent |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2917 |
(WindowEvent class compiledMethodAt:#focusInView:) messagesPossiblySent |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2918 |
|
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2919 |
(Method compiledMethodAt:#messagesPossiblySent) messagesSent |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2920 |
(Method compiledMethodAt:#messagesPossiblySent) messagesPossiblySent |
14402 | 2921 |
" |
2922 |
! |
|
2923 |
||
5582 | 2924 |
messagesSent |
2925 |
"return a collection with the message selectors sent to by the receiver. |
|
2926 |
Uses Parser to parse methods source and extract the names. |
|
2927 |
The returned collection includes all used message selectors (i.e. including super-send messages)" |
|
2928 |
||
12854 | 2929 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#() |
5582 | 2930 |
|
2931 |
" |
|
12854 | 2932 |
(Method compiledMethodAt:#printOn:) messagesSent |
2933 |
(Point compiledMethodAt:#x:) messagesSent |
|
5582 | 2934 |
" |
2935 |
! |
|
2936 |
||
2937 |
messagesSentToSelf |
|
2938 |
"return a collection with the message selectors sent to self by the receiver. |
|
2939 |
Uses Parser to parse methods source and extract the names." |
|
2940 |
||
12854 | 2941 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSelf or:#() |
5652 | 2942 |
|
5582 | 2943 |
! |
2944 |
||
2945 |
messagesSentToSuper |
|
2946 |
"return a collection with the message selectors sent to super by the receiver. |
|
2947 |
Uses Parser to parse methods source and extract the names." |
|
2948 |
||
12854 | 2949 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSuper or:#() |
5652 | 2950 |
|
5582 | 2951 |
! |
2952 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2953 |
methodArgAndVarNames |
22372 | 2954 |
"return a collection with the method's argument and variable names. |
2955 |
Uses Parser to parse the method's source and extract the names. |
|
15787 | 2956 |
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
|
2957 |
syntax/parse error occurred. |
15787 | 2958 |
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
|
2959 |
|
8427 | 2960 |
|parserClass parser sourceString argNames varNames| |
2961 |
||
2962 |
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
|
2963 |
sourceString := self source. |
8427 | 2964 |
(parserClass notNil and:[sourceString notNil]) ifTrue:[ |
22372 | 2965 |
parser := parserClass parseMethodArgAndVarSpecificationSilent:sourceString. |
2966 |
(parser isNil or:[parser == #Error]) ifTrue:[^ #()]. |
|
2967 |
argNames := parser methodArgs. |
|
2968 |
varNames := parser methodVars. |
|
2969 |
argNames isNil ifTrue:[^ varNames ? #()]. |
|
2970 |
varNames isNil ifTrue:[^ argNames ? #()]. |
|
2971 |
^ (argNames , varNames) |
|
159 | 2972 |
]. |
15787 | 2973 |
^ #() |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2974 |
|
159 | 2975 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2976 |
(Method compiledMethodAt:#printOn:) methodArgAndVarNames |
159 | 2977 |
" |
22372 | 2978 |
|
2979 |
"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
|
2980 |
! |
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 |
|
15649 | 2982 |
methodArgAndVarNamesInContext: context |
15727 | 2983 |
"return a collection with the method's argument and variable names. |
15649 | 2984 |
Uses Parser to parse methods source and extract the names. |
2985 |
Returns nil if the source is not available, or some other |
|
2986 |
syntax/parse error occurred. For methods with no args and no vars, |
|
2987 |
an empty collection is returned." |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2988 |
|
15649 | 2989 |
^self methodArgAndVarNames |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
2990 |
|
15649 | 2991 |
"Created: / 18-12-2012 / 18:17:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2992 |
! |
|
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 |
methodArgNames |
22372 | 2995 |
"return a collection with the method's argument names. |
2996 |
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
|
2997 |
|
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 |
^ self parse:#'parseMethodSpecificationSilent:' return:#methodArgs or:nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2999 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3000 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3001 |
(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
|
3002 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3003 |
|
22372 | 3004 |
"Modified: / 31-10-1995 / 14:36:46 / cg" |
3005 |
"Modified (comment): / 21-11-2017 / 13:04:44 / cg" |
|
872 | 3006 |
! |
3007 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3008 |
methodComment |
22372 | 3009 |
"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
|
3010 |
This is a somewhat stupid implementation." |
872 | 3011 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3012 |
|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
|
3013 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3014 |
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
|
3015 |
(text size < 2) ifTrue:[^nil]. |
872 | 3016 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3017 |
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
|
3018 |
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
|
3019 |
(nQuote == 2) ifTrue:[ |
22372 | 3020 |
qIndex := line indexOf:(Character doubleQuote). |
3021 |
qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1). |
|
3022 |
^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1) |
|
872 | 3023 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3024 |
(nQuote == 1) ifTrue:[ |
22372 | 3025 |
qIndex := line indexOf:(Character doubleQuote). |
3026 |
comment := line copyFrom:(qIndex + 1). |
|
3027 |
(line indexOf:$/ startingAt:qIndex) == (qIndex+1) ifTrue:[ |
|
3028 |
"/ an EOL comment |
|
3029 |
^ (comment copyFrom:2) withoutSeparators |
|
3030 |
]. |
|
3031 |
||
3032 |
"/ not an EOL comment |
|
3033 |
index := 3. |
|
3034 |
line := text at:index. |
|
3035 |
nQuote := line occurrencesOf:(Character doubleQuote). |
|
3036 |
[nQuote ~~ 1] whileTrue:[ |
|
3037 |
comment := comment , Character cr asString , line withoutSpaces. |
|
3038 |
index := index + 1. |
|
3039 |
line := text at:index. |
|
3040 |
nQuote := line occurrencesOf:(Character doubleQuote) |
|
3041 |
]. |
|
3042 |
qIndex := line indexOf:(Character doubleQuote). |
|
3043 |
^ 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
|
3044 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3045 |
^ 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
|
3046 |
|
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 |
" |
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 |
(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
|
3049 |
" |
22372 | 3050 |
|
3051 |
"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
|
3052 |
! |
872 | 3053 |
|
9364 | 3054 |
methodDefinitionTemplate |
3055 |
"return the string that defines the method and the arguments" |
|
3056 |
||
16261 | 3057 |
^ self class |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3058 |
methodDefinitionTemplateForSelector:self selector |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3059 |
andArgumentNames:self methodArgNames |
9364 | 3060 |
|
3061 |
" |
|
3062 |
(self compiledMethodAt:#printOn:) methodDefinitionTemplate |
|
3063 |
" |
|
3064 |
! |
|
3065 |
||
12900
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
3066 |
methodInvocationInfo |
13567
fe6564553977
comment: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
13463
diff
changeset
|
3067 |
"redefined by InstrumentedMethod, to return the collected info" |
fe6564553977
comment: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
13463
diff
changeset
|
3068 |
|
12900
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
3069 |
^ nil |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
3070 |
|
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
3071 |
"Created: / 27-04-2010 / 13:36:12 / cg" |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
3072 |
! |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
3073 |
|
952
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 |
methodVarNames |
22372 | 3075 |
"return a collection with the method's local-variable names. |
3076 |
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
|
3077 |
|
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 |
^ 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
|
3079 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3080 |
" |
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 |
(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
|
3082 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3083 |
|
22372 | 3084 |
"Modified: / 31-10-1995 / 14:36:49 / cg" |
3085 |
"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
|
3086 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3087 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3088 |
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
|
3089 |
"try to extract the modificationTime as a timeStamp from |
19449 | 3090 |
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
|
3091 |
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
|
3092 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3093 |
|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
|
3094 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3095 |
HistoryManager isNil ifTrue:[^ nil]. |
1873 | 3096 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3097 |
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
|
3098 |
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
|
3099 |
list := HistoryManager getAllHistoriesFrom:s. |
16261 | 3100 |
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
|
3101 |
histLine := list last. |
12854 | 3102 |
^ Timestamp |
19449 | 3103 |
fromDate:histLine date |
3104 |
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
|
3105 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3106 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3107 |
(Method compiledMethodAt:#modificationTime) modificationTime |
12854 | 3108 |
(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
|
3109 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3110 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3111 |
"Modified: 8.9.1995 / 15:08:22 / claus" |
1873 | 3112 |
"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
|
3113 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3114 |
|
15424 | 3115 |
modifiedInstVars |
3116 |
"returns a collection of instance variables which are modified by this method. |
|
3117 |
Uses parser (for now); could look at bytecode as well here..." |
|
3118 |
||
3119 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). |
|
3120 |
! |
|
3121 |
||
3845
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3122 |
name |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3123 |
"for compatibility with javaMethods" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3124 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3125 |
^ self selector |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3126 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3127 |
"Created: / 9.11.1998 / 06:15:08 / cg" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3128 |
! |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
3129 |
|
20208 | 3130 |
overwrites:aMethod |
20035 | 3131 |
|mth| |
3132 |
||
3133 |
mth := self. |
|
3134 |
[ mth := mth overwrittenMethod. mth notNil ] whileTrue:[ |
|
3135 |
mth == aMethod ifTrue:[ |
|
3136 |
^ true |
|
3137 |
]. |
|
3138 |
]. |
|
3139 |
^ false |
|
13422 | 3140 |
|
15952 | 3141 |
"Created: / 05-07-2012 / 10:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13422 | 3142 |
! |
3143 |
||
12854 | 3144 |
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
|
3145 |
"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
|
3146 |
Get the source, let parser parse it using parseSelector, |
1873 | 3147 |
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
|
3148 |
|
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3149 |
^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3150 |
|
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3151 |
" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3152 |
(Method compiledMethodAt:#parse:return:or:) |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3153 |
parse:#'parseMethodSilent:' return:#sentMessages or:#() |
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3154 |
" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3155 |
! |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3156 |
|
12854 | 3157 |
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource |
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3158 |
"helper for methodArgNames, methodVarNames etc. |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3159 |
Get the source, let parser parse it using parseSelector, |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3160 |
return parser-info using accessSelector" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
3161 |
|
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3162 |
|parser parserClass sourceString cachedInfo| |
8427 | 3163 |
|
3164 |
parserClass := self parserClass. |
|
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3165 |
|
14039
30251b45156a
added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents:
13847
diff
changeset
|
3166 |
"/ 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
|
3167 |
"/ 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
|
3168 |
"/ of them. If the same is parsed soon after, we do not have to parse again. |
21581 | 3169 |
parseSelector == #'parseMethodSilent:in:' ifTrue:[ |
3170 |
LastParseTreeCache notNil ifTrue:[ |
|
3171 |
"/ to flush: LastParseTreeCache removeAll. |
|
3172 |
cachedInfo := LastParseTreeCache at:self ifAbsent:nil. |
|
3173 |
cachedInfo notNil ifTrue:[ |
|
3174 |
cachedInfo method == self ifTrue:[ |
|
3175 |
cachedInfo parser class == parserClass ifTrue:[ |
|
3176 |
"/ Transcript show:'hit '; showCR:self. |
|
3177 |
^ cachedInfo parser perform:accessSelector |
|
3178 |
] |
|
3179 |
]. |
|
3180 |
LastParseTreeCache removeKey:self |
|
3181 |
] |
|
3182 |
]. |
|
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3183 |
]. |
21581 | 3184 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3185 |
sourceString := self source. |
8427 | 3186 |
(parserClass notNil and:[sourceString notNil]) ifTrue:[ |
19716 | 3187 |
parseSelector argumentCount == 2 ifTrue:[ |
3188 |
parser := parserClass perform:parseSelector with:sourceString with:arg2. |
|
3189 |
] ifFalse:[ |
|
3190 |
parser := parserClass perform:parseSelector with:sourceString. |
|
3191 |
]. |
|
3192 |
(parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource]. |
|
21581 | 3193 |
|
3194 |
parseSelector == #'parseMethodSilent:in:' ifTrue:[ |
|
3195 |
"do not cache the parser, if it was parsing for code - a lot of information is missing then" |
|
3196 |
(self mclass notNil and:[parser wasParsedForCode not]) ifTrue:[ |
|
3197 |
LastParseTreeCache isNil ifTrue:[ |
|
3198 |
LastParseTreeCache := CacheDictionary new:500. |
|
3199 |
]. |
|
3200 |
LastParseTreeCache at:self put:(ParserCacheEntry new method:self parser:parser). |
|
19716 | 3201 |
]. |
21581 | 3202 |
^ parser perform:accessSelector |
19716 | 3203 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3204 |
]. |
1873 | 3205 |
^ valueIfNoSource |
3206 |
||
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
3207 |
" |
15579 | 3208 |
LastParseTreeCache removeAll. |
3209 |
||
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
3210 |
(Method compiledMethodAt:#parse:return:or:) |
19716 | 3211 |
parse:#'parseMethodSilent:' return:#sentMessages or:#() |
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
3212 |
" |
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3213 |
|
21581 | 3214 |
"Modified: / 26-02-2017 / 12:05: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
|
3215 |
! |
159 | 3216 |
|
13422 | 3217 |
parseAnnotations |
17361 | 3218 |
"return the method's annotations." |
13422 | 3219 |
|
3220 |
|src parser| |
|
3221 |
||
3222 |
src := self source. |
|
3223 |
src isNil ifTrue:[ |
|
20804 | 3224 |
^ nil "/ actually: don't know |
13422 | 3225 |
]. |
3226 |
||
3227 |
self parserClass isNil ifTrue:[ |
|
20804 | 3228 |
^ nil |
13422 | 3229 |
]. |
3230 |
parser := self parserClass parseMethod: src. |
|
3231 |
(parser isNil or: [parser == #Error]) ifTrue:[ |
|
20804 | 3232 |
^ nil "/ actually error |
13422 | 3233 |
]. |
3234 |
^ annotations := parser annotations. |
|
3235 |
||
3236 |
"Created: / 10-07-2010 / 21:16:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3237 |
! |
|
3238 |
||
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3239 |
parseResources |
16218 | 3240 |
"return the method's resource spec; either nil or a collection of symbols. |
3241 |
Resources are a special kind of annotation, of the form: |
|
20804 | 3242 |
<resource: #symbol...> |
16218 | 3243 |
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
|
3244 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3245 |
|src parser| |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3246 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3247 |
src := self source. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3248 |
src isNil ifTrue:[ |
20804 | 3249 |
^ 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
|
3250 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3251 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3252 |
(src findString:'resource:') == 0 ifTrue:[ |
20804 | 3253 |
^ nil "/ actually: error |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3254 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3255 |
"/ no need to parse all - only interested in resource-info |
8427 | 3256 |
self parserClass isNil ifTrue:[ |
20804 | 3257 |
^ nil |
8427 | 3258 |
]. |
8419 | 3259 |
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
|
3260 |
parser isNil ifTrue:[ |
20804 | 3261 |
^ nil "/ actually error |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3262 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3263 |
^ parser primitiveResources. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3264 |
! |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
3265 |
|
14402 | 3266 |
possiblySends:aSelectorSymbol |
3267 |
"return true, if this method contains an indirect message-send |
|
3268 |
(such as perform) with aSelectorSymbol as selector." |
|
3269 |
||
3270 |
(self referencesLiteral:aSelectorSymbol) ifTrue:[ |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3271 |
^ self messagesPossiblySent includesIdentical:aSelectorSymbol |
14402 | 3272 |
]. |
3273 |
^ false |
|
3274 |
! |
|
3275 |
||
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
3276 |
previousVersion |
19449 | 3277 |
"return the receiver's previous version's source code" |
14251 | 3278 |
|
3279 |
|previous| |
|
3280 |
||
3281 |
previous := self previousVersions:2. |
|
3282 |
previous isEmptyOrNil ifTrue:[^ nil]. |
|
3283 |
^ previous first. |
|
3284 |
||
3285 |
"/ |sel cls previous| |
|
3286 |
"/ |
|
3287 |
"/ sel := self selector. |
|
3288 |
"/ sel isNil ifTrue:[ ^ nil ]. |
|
3289 |
"/ |
|
3290 |
"/ cls := self mclass. |
|
3291 |
"/ cls isNil ifTrue:[ ^ nil ]. |
|
3292 |
"/ |
|
3293 |
"/ ChangeSet current reverseDo:[:change | |
|
3294 |
"/ (change isMethodChange |
|
3295 |
"/ and:[ (change selector == sel) |
|
3296 |
"/ and:[ change changeClass == cls ]]) |
|
3297 |
"/ ifTrue:[ |
|
3298 |
"/ previous := change previousVersion. |
|
3299 |
"/ previous notNil ifTrue:[ |
|
3300 |
"/ ^ previous |
|
3301 |
"/ ] |
|
3302 |
"/ ] |
|
3303 |
"/ ]. |
|
3304 |
"/ ^ nil. |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3305 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3306 |
"/ history := Class methodHistory. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3307 |
"/ history isNil ifTrue:[^ nil]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3308 |
"/ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3309 |
"/ entry := history detect:[:entry | |type old new| |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3310 |
"/ type := entry first. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3311 |
"/ type == #methodChange ifTrue:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3312 |
"/ old := entry second. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3313 |
"/ new := entry third. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3314 |
"/ new == self |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3315 |
"/ ] ifFalse:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3316 |
"/ false |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3317 |
"/ ] |
12854 | 3318 |
"/ ] |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3319 |
"/ ifNone:nil. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3320 |
"/ entry isNil ifTrue:[^nil]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3321 |
"/ ^ entry second. |
5339 | 3322 |
"/ ^ history at:self ifAbsent:nil |
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
3323 |
|
14251 | 3324 |
"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
|
3325 |
! |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
3326 |
|
7210 | 3327 |
previousVersionCode |
19449 | 3328 |
"return the receiver's previous version's source code" |
7210 | 3329 |
|
3330 |
|previous| |
|
3331 |
||
3332 |
previous := self previousVersion. |
|
3333 |
previous isNil ifTrue:[ ^ nil ]. |
|
3334 |
||
3335 |
^ previous source |
|
3336 |
! |
|
3337 |
||
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3338 |
previousVersions |
14251 | 3339 |
"return a collection of the receiver's previous versions (sources)" |
3340 |
||
3341 |
^ self previousVersions:nil |
|
3342 |
||
3343 |
"Modified (comment): / 26-07-2012 / 12:04:15 / cg" |
|
3344 |
! |
|
3345 |
||
3346 |
previousVersions:count |
|
3347 |
"return a collection of the receiver's count previous versions (sources). |
|
3348 |
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
|
3349 |
|
7453 | 3350 |
|sel cls versions lastChange firstSrc last| |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3351 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3352 |
sel := self selector. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3353 |
sel isNil ifTrue:[^ #()]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3354 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3355 |
cls := self mclass. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3356 |
cls isNil ifTrue:[^ #()]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3357 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3358 |
versions := OrderedCollection new. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3359 |
|
12854 | 3360 |
ChangeSet current reverseDo:[:change | |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3361 |
(change isMethodChange |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3362 |
and:[ (change selector == sel) |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3363 |
and:[ change changeClass == cls ]]) |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3364 |
ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3365 |
versions addFirst:change. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3366 |
lastChange := change. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3367 |
(count notNil and:[versions size == count]) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3368 |
^ versions |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3369 |
] |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3370 |
] |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3371 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3372 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3373 |
lastChange notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3374 |
last := lastChange previousVersion. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3375 |
last notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3376 |
firstSrc := last source. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3377 |
(firstSrc notEmptyOrNil |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3378 |
and:[ firstSrc ~= lastChange source]) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3379 |
versions addFirst:(MethodDefinitionChange |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3380 |
className:lastChange className |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3381 |
selector:lastChange selector |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3382 |
source:firstSrc |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3383 |
category:lastChange category). |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3384 |
] |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3385 |
] |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3386 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3387 |
^ versions |
14251 | 3388 |
|
3389 |
" |
|
3390 |
(Method compiledMethodAt:#previousVersions:) previousVersions:nil |
|
3391 |
" |
|
3392 |
||
3393 |
"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
|
3394 |
! |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
3395 |
|
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3396 |
readsField:instVarIndex |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3397 |
"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
|
3398 |
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
|
3399 |
|
14237 | 3400 |
|instVarName| |
3401 |
||
3402 |
instVarName := (self mclass allInstVarNames) at:instVarIndex. |
|
3403 |
^ self readsInstVar:instVarName |
|
3404 |
||
3405 |
"Modified: / 23-07-2012 / 11:16:08 / cg" |
|
3406 |
! |
|
3407 |
||
3408 |
readsInstVar:instVarName |
|
3409 |
"return true, if the named instvar is read by the receiver. |
|
3410 |
Uses parser (for now); could look at bytecode as well here..." |
|
3411 |
||
3412 |
|readInstVars| |
|
3413 |
||
3414 |
(self source includesString:instVarName) ifFalse:[^ false]. "/ that's much faster than parsing... |
|
5636 | 3415 |
readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#readInstVars or:#(). |
14237 | 3416 |
^ readInstVars includes:instVarName. |
3417 |
||
3418 |
"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
|
3419 |
! |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3420 |
|
14253 | 3421 |
refersToLiteral: anObject |
3422 |
"redefined to search in annotations" |
|
3423 |
||
3424 |
(super refersToLiteral: anObject) ifTrue:[^ true]. |
|
3425 |
||
15387 | 3426 |
self annotationsDo:[:annot | |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3427 |
(annot refersToLiteral: anObject) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3428 |
"/ self halt. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3429 |
^ true |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3430 |
]. |
14253 | 3431 |
]. |
3432 |
^ false |
|
3433 |
||
3434 |
"Created: / 26-07-2012 / 15:51:14 / cg" |
|
3435 |
! |
|
3436 |
||
3437 |
refersToLiteralMatching: aMatchString |
|
3438 |
(super refersToLiteralMatching: aMatchString) ifTrue:[^ true]. |
|
3439 |
||
15387 | 3440 |
self annotationsDo:[:annot | |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3441 |
(annot refersToLiteralMatching: aMatchString) ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3442 |
"/ self halt. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3443 |
^ true |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3444 |
]. |
14253 | 3445 |
]. |
3446 |
^ false |
|
3447 |
||
3448 |
"Created: / 26-07-2012 / 15:51:36 / cg" |
|
3449 |
! |
|
3450 |
||
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3451 |
resourceType |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3452 |
"ST-80 compatibility: |
22372 | 3453 |
return the method's first resource specs key. |
8526 | 3454 |
Returns either nil, or a single symbol." |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3455 |
|
3387 | 3456 |
|resources| |
3457 |
||
3458 |
(resources := self resources) notNil ifTrue:[ |
|
22372 | 3459 |
resources keysAndValuesDo:[:key :val| |
3460 |
^ key |
|
3461 |
]. |
|
3341 | 3462 |
]. |
3387 | 3463 |
^ nil |
22372 | 3464 |
|
3465 |
"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
|
3466 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3467 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3468 |
resources |
22446 | 3469 |
"return the method's resource spec (i.e. resource-annotation); |
3470 |
either nil or a collection of symbols." |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3471 |
|
13422 | 3472 |
| resources | |
13817 | 3473 |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3474 |
self hasResource ifFalse:[^ nil]. |
13817 | 3475 |
annotations isNil ifTrue:[^ self parseResources]. |
13422 | 3476 |
|
3477 |
resources := IdentityDictionary new. |
|
18753 | 3478 |
self annotationsAt: #resource: orAt: #resource:values: do:[:annot| |
3479 |
resources at: annot type put: annot value ? true |
|
13817 | 3480 |
]. |
3481 |
^ resources |
|
13422 | 3482 |
|
3483 |
"Modified: / 16-07-2010 / 11:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13817 | 3484 |
"Modified: / 18-11-2011 / 14:48:41 / cg" |
22372 | 3485 |
"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
|
3486 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
3487 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3488 |
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
|
3489 |
"return the selector under which I am found in my containingClasses |
12854 | 3490 |
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
|
3491 |
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
|
3492 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3493 |
"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
|
3494 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3495 |
|who| |
68 | 3496 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3497 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3498 |
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
|
3499 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3500 |
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
|
3501 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3502 |
^ 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
|
3503 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3504 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3505 |
|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
|
3506 |
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
|
3507 |
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
|
3508 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3509 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3510 |
"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
|
3511 |
! |
68 | 3512 |
|
12363 | 3513 |
sends:selectorSymbol1 or:selectorSymbol2 |
21341 | 3514 |
<resource: #obsolete> |
12363 | 3515 |
"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
|
3516 |
to either selectorSymbol1 or selectorSymbol2. |
82bcca38e855
comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents:
13567
diff
changeset
|
3517 |
This is a hack, because calling sends: twice parses twice (should cache parse trees)" |
12363 | 3518 |
|
21341 | 3519 |
^ self sendsAnySelector:{ selectorSymbol1 . selectorSymbol2 } |
3520 |
||
3521 |
"Modified: / 05-02-2017 / 01:28:03 / cg" |
|
12363 | 3522 |
! |
3523 |
||
21341 | 3524 |
sendsAnySelector:aCollectionOfSelectorSymbols |
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3525 |
"return true, if this method contains a message-send |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3526 |
to any of aCollectionOfSelectorSymbols." |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3527 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3528 |
|msgs| |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3529 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3530 |
(aCollectionOfSelectorSymbols contains:[:sym | self referencesLiteral:sym]) ifTrue:[ |
21341 | 3531 |
"/ cg: was temporarily disabled to speed up some searches. |
3532 |
"/ I think, we have to change the caller's to call referencesLiteral: instead, |
|
3533 |
"/ if there is any speed problem there. Not here. |
|
3534 |
"/ ^ true. |
|
3535 |
||
3536 |
msgs := self messagesSent. |
|
3537 |
^ aCollectionOfSelectorSymbols contains:[:sym | msgs includesIdentical:sym] |
|
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3538 |
]. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3539 |
^ false |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3540 |
|
21341 | 3541 |
"Modified: / 05-02-2017 / 01:22:03 / cg" |
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3542 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3543 |
|
19739 | 3544 |
sendsMessageForWhich:aCheckBlock |
3545 |
"return true, if this method contains a message-send |
|
3546 |
for which aCheckBlock returns true, when given the selector." |
|
3547 |
||
3548 |
self literalsDo:[:each | |
|
3549 |
each isSymbol ifTrue:[ |
|
3550 |
"/ first check if the selector matches |
|
3551 |
(aCheckBlock value:each) ifTrue:[ |
|
3552 |
"/ then, if this is really a message send |
|
3553 |
(self messagesSent includes:each) ifTrue:[^ true]. |
|
3554 |
] |
|
3555 |
] |
|
20208 | 3556 |
]. |
19739 | 3557 |
^ false |
3558 |
||
3559 |
" |
|
20208 | 3560 |
(self compiledMethodAt:#sendsAnyForWhich:) |
19739 | 3561 |
sendsAnyForWhich:[:sel | sel startsWith:'message'] |
20208 | 3562 |
(self compiledMethodAt:#sendsAnyForWhich:) |
19739 | 3563 |
sendsAnyForWhich:[:sel | sel startsWith:'foo'] |
3564 |
" |
|
3565 |
! |
|
3566 |
||
21341 | 3567 |
sendsSelector:aSelectorSymbol |
3568 |
"return true, if this method contains a message-send |
|
3569 |
with aSelectorSymbol as selector." |
|
3570 |
||
3571 |
(self referencesLiteral:aSelectorSymbol) ifTrue:[ |
|
3572 |
"/ cg: was temporarily disabled to speed up some searches. |
|
3573 |
"/ I think, we have to change the callers to call referencesLiteral: instead, |
|
3574 |
"/ if there is any speed problem there. Not here. |
|
3575 |
"/ ^ true. |
|
3576 |
"/ the self messagesSent does a parse-tree analysis |
|
3577 |
^ self messagesSent includesIdentical:aSelectorSymbol |
|
3578 |
]. |
|
3579 |
^ false |
|
3580 |
||
3581 |
"Modified: / 05-02-2017 / 01:21:09 / cg" |
|
3582 |
! |
|
3583 |
||
16877
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3584 |
shadowedMethod |
17562 | 3585 |
"Return the shadowed method if this method is an extension (i.e. package ~= classes' package) |
3586 |
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
|
3587 |
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
|
3588 |
|
17562 | 3589 |
| 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
|
3590 |
|
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3591 |
myClass := self mclass. |
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3592 |
myClass isNil ifTrue:[^ nil]. |
17562 | 3593 |
nonMetaClass := myClass theNonMetaclass. |
3594 |
||
3595 |
(package ~= nonMetaClass package |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3596 |
and:[ package ~= PackageId noProjectID |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3597 |
and:[ (myProjectDefinition := nonMetaClass projectDefinitionClass) notNil ]]) |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3598 |
ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3599 |
originalMethod := myProjectDefinition savedOverwrittenMethodForClass:myClass selector:self selector. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3600 |
|
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3601 |
"/ 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
|
3602 |
"/ (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
|
3603 |
"/ "/ self halt. ^ nil |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3604 |
"/ ]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3605 |
^ originalMethod |
17562 | 3606 |
]. |
16877
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3607 |
^ nil |
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3608 |
|
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3609 |
"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
|
3610 |
! |
d4a452edacb5
Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16847
diff
changeset
|
3611 |
|
11022
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3612 |
shouldBeSkippedInDebuggersWalkBack |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3613 |
"return true, if this method thinks, it should be skipped in a walkback. |
17463 | 3614 |
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
|
3615 |
|
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3616 |
|resources| |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3617 |
|
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3618 |
resources := self resources. |
20208 | 3619 |
^ resources notNil |
19699 | 3620 |
and:[ resources includesKey:#skipInDebuggersWalkBack ]. |
11022
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3621 |
! |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
3622 |
|
5696 | 3623 |
superMessages |
3624 |
"return a collection of message-selectors, sent to super by this method." |
|
3625 |
||
3626 |
^ self messagesSentToSuper |
|
3627 |
! |
|
3628 |
||
5523 | 3629 |
usedGlobals |
3630 |
"return a collection with the global names referred to by the receiver. |
|
3631 |
Uses Parser to parse methods source and extract them." |
|
3632 |
||
12854 | 3633 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#() |
5523 | 3634 |
|
3635 |
" |
|
12854 | 3636 |
(Method compiledMethodAt:#resources) usedGlobals |
5523 | 3637 |
" |
3638 |
! |
|
3639 |
||
5509 | 3640 |
usedSymbols |
3641 |
"return a collection with the symbols referred to by the receiver. |
|
3642 |
Uses Parser to parse methods source and extract them. |
|
12854 | 3643 |
This collection only includes implicit symbols references |
8895 | 3644 |
(i.e. not messages sent)" |
5509 | 3645 |
|
12854 | 3646 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#() |
5509 | 3647 |
|
3648 |
" |
|
12854 | 3649 |
(Method compiledMethodAt:#usedSymbols) usedSymbols |
3650 |
(Method compiledMethodAt:#usedSymbols) messagesSent |
|
5509 | 3651 |
" |
3652 |
! |
|
3653 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3654 |
who |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3655 |
"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
|
3656 |
nil is returned for unbound methods. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3657 |
|
12854 | 3658 |
ST/X special notice: |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3659 |
returns an instance of MethodWhoInfo, which |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3660 |
responds to #methodClass and #methodSelector query messages. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3661 |
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
|
3662 |
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
|
3663 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3664 |
Implementation notice: |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3665 |
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
|
3666 |
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
|
3667 |
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
|
3668 |
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
|
3669 |
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
|
3670 |
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
|
3671 |
|
17250 | 3672 |
|cls sel fn clsName checkBlock| |
3673 |
||
5324 | 3674 |
mclass notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3675 |
"/ 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
|
3676 |
sel := mclass selectorAtMethod:self. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3677 |
sel notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3678 |
^ MethodWhoInfo class:mclass selector:sel |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3679 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3680 |
^ nil. |
5324 | 3681 |
]. |
3682 |
||
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3683 |
checkBlock := |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3684 |
[:cls | |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3685 |
|sel| |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3686 |
|
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3687 |
sel := cls selectorAtMethod:self. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3688 |
sel notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3689 |
LastWhoClass := cls theNonMetaclass name. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3690 |
mclass := cls. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3691 |
^ MethodWhoInfo class:cls selector:sel |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3692 |
]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3693 |
]. |
17250 | 3694 |
|
3695 |
" |
|
3696 |
first, look in the class we found something the last time |
|
3697 |
this may often give a hit, when asking who repeatingly for |
|
3698 |
a context chain. (keep last by its name, to not keep classes from |
|
3699 |
being garbage collected) |
|
3700 |
" |
|
3701 |
LastWhoClass notNil ifTrue:[ |
|
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3702 |
cls := Smalltalk at:LastWhoClass ifAbsent:nil. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3703 |
cls notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3704 |
checkBlock value:cls theNonMetaclass. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3705 |
checkBlock value:cls theMetaclass. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3706 |
] |
6420 | 3707 |
]. |
3708 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3709 |
" |
5294
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3710 |
speedup kludge: if my sourceFileName is valid, |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3711 |
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
|
3712 |
" |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3713 |
(fn := self sourceFilename) notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3714 |
clsName := fn asFilename nameWithoutSuffix. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3715 |
clsName := clsName asSymbolIfInterned. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3716 |
clsName notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3717 |
cls := Smalltalk at:clsName ifAbsent:nil. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3718 |
cls notNil ifTrue:[ |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3719 |
checkBlock value:cls theNonMetaclass. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3720 |
checkBlock value:cls theMetaclass. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3721 |
] |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3722 |
]. |
5294
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3723 |
]. |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3724 |
|
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
3725 |
" |
17250 | 3726 |
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
|
3727 |
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
|
3728 |
" |
17250 | 3729 |
Smalltalk allClassesDo:[:cls | |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3730 |
checkBlock value:cls theNonMetaclass. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3731 |
checkBlock value:cls theMetaclass. |
142 | 3732 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3733 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3734 |
LastWhoClass := nil. |
6397
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3735 |
"/ " |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3736 |
"/ 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
|
3737 |
"/ 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
|
3738 |
"/ " |
6420 | 3739 |
"/ Behavior allSubInstancesDo:[:someClassLikeThingy | |
3740 |
"/ (classes includes:someClassLikeThingy) ifFalse:[ |
|
3741 |
"/ checkBlock value:someClassLikeThingy. |
|
6397
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3742 |
"/ ] |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
3743 |
"/ ]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3744 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3745 |
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
|
3746 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3747 |
^ nil |
444 | 3748 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3749 |
"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
|
3750 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3751 |
|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
|
3752 |
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
|
3753 |
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
|
3754 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3755 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3756 |
"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
|
3757 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3758 |
|m cls| |
444 | 3759 |
|
12854 | 3760 |
Object |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3761 |
subclass:#FunnyClass |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3762 |
instanceVariableNames:'foo' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3763 |
classVariableNames:'' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3764 |
poolDictionaries:'' |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3765 |
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
|
3766 |
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
|
3767 |
Smalltalk removeClass:cls. |
444 | 3768 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3769 |
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
|
3770 |
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
|
3771 |
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
|
3772 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3773 |
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
|
3774 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3775 |
|
10156 | 3776 |
"Modified: / 07-11-2006 / 13:58:50 / cg" |
68 | 3777 |
! |
3778 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3779 |
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
|
3780 |
"only for wrapped methods: return the wrapper. |
14419
eef0be88cb60
comment/format in: #wrapper
Claus Gittinger <cg@exept.de>
parents:
14402
diff
changeset
|
3781 |
That's the WrapperMethod which contains myself." |
159 | 3782 |
|
13847 | 3783 |
WrappedMethod notNil ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3784 |
WrappedMethod allInstancesDo:[:m | |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3785 |
m originalMethod == self ifTrue:[^ m]. |
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3786 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3787 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3788 |
^ nil |
13847 | 3789 |
|
3790 |
"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
|
3791 |
! |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3792 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3793 |
writesField:instVarIndex |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
3794 |
"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
|
3795 |
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
|
3796 |
|
14237 | 3797 |
|instVarName| |
3798 |
||
3799 |
instVarName := (self mclass allInstVarNames) at:instVarIndex. |
|
3800 |
^ self writesInstVar:instVarName |
|
3801 |
||
3802 |
"Modified: / 23-07-2012 / 11:16:51 / cg" |
|
3803 |
! |
|
3804 |
||
3805 |
writesInstVar:instVarName |
|
3806 |
"return true, if the named instvar is written (modified) by the receiver. |
|
3807 |
Uses parser (for now); could look at bytecode as well here..." |
|
3808 |
||
3809 |
|modifiedInstVars| |
|
3810 |
||
3811 |
(self source includesString:instVarName) ifFalse:[^ false]. "/ that's much faster than parsing... |
|
5636 | 3812 |
modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). |
14237 | 3813 |
^ modifiedInstVars includes:instVarName. |
3814 |
||
3815 |
"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
|
3816 |
! ! |
13 | 3817 |
|
22446 | 3818 |
|
14863 | 3819 |
!Method methodsFor:'source management'! |
3820 |
||
3821 |
revisionInfo |
|
17402 | 3822 |
"cg: is this correct for extensions? (shouldn't this be the revisionInfo from the extensions container?)" |
14863 | 3823 |
|
3824 |
^self containingClass theNonMetaclass revisionInfo |
|
3825 |
||
3826 |
"Created: / 28-08-2010 / 22:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3827 |
"Modified: / 12-09-2010 / 16:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3828 |
! ! |
|
3829 |
||
952
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 |
!Method methodsFor:'trap methods'! |
13 | 3831 |
|
952
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 |
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
|
3833 |
"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
|
3834 |
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
|
3835 |
the objectFileLoader to invalidate methods whose code is unloaded." |
1 | 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 |
|invldMethod| |
159 | 3838 |
|
18438 | 3839 |
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
|
3840 |
self code:invldMethod code. |
1873 | 3841 |
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
|
3842 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3843 |
"Created: 17.9.1995 / 15:00:52 / claus" |
1873 | 3844 |
"Modified: 4.11.1996 / 23:04:34 / cg" |
1 | 3845 |
! |
3846 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3847 |
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
|
3848 |
"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
|
3849 |
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
|
3850 |
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
|
3851 |
after a class definition change (for example: instvars are no longer there)." |
1 | 3852 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3853 |
|invldMethod| |
872 | 3854 |
|
21692 | 3855 |
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
|
3856 |
self code:invldMethod code. |
1873 | 3857 |
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
|
3858 |
|
21692 | 3859 |
"Created: / 17-09-1995 / 15:01:14 / claus" |
3860 |
"Modified: / 10-04-2017 / 22:50:21 / cg" |
|
1873 | 3861 |
! |
3862 |
||
3863 |
makeUnloaded |
|
3864 |
"make the receiver an unloaded method, which raises an invalidCodeObject |
|
3865 |
signal when executed. This is not for public use - it is required for |
|
3866 |
the objectFileLoader to invalidate methods for which a shared library has |
|
3867 |
been removed." |
|
3868 |
||
3869 |
|invldMethod| |
|
3870 |
||
3871 |
invldMethod := self class compiledMethodAt:#unloadedCodeObject. |
|
3872 |
self code:invldMethod code. |
|
3873 |
self byteCode:nil. |
|
3874 |
||
3875 |
"Created: 4.11.1996 / 22:59:21 / cg" |
|
3876 |
"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
|
3877 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3878 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
3879 |
trapMethodForNumArgs:numArgs |
13657
206c6696707b
added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents:
13651
diff
changeset
|
3880 |
^ self class trapMethodForNumArgs:numArgs |
206c6696707b
added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents:
13651
diff
changeset
|
3881 |
|
206c6696707b
added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents:
13651
diff
changeset
|
3882 |
"Created: / 04-11-1996 / 21:58:58 / cg" |
206c6696707b
added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents:
13651
diff
changeset
|
3883 |
"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
|
3884 |
! ! |
872 | 3885 |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3886 |
!Method::MethodWhoInfo class methodsFor:'documentation'! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3887 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3888 |
documentation |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3889 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3890 |
In earlier times, Method>>who returned an array filled |
22372 | 3891 |
with the method's class and selector. |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3892 |
This was done, since a smalltalk method cannot return multiple |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3893 |
values, but 2 values had to be returned from that method. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3894 |
Thus, the who-interface was used as: |
22372 | 3895 |
info := <someMethod> who. |
3896 |
class := info at:1. |
|
3897 |
sel := info at:2. |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3898 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3899 |
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
|
3900 |
an object (an instance of MethodWhoInfo) which responds to the two |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3901 |
messages: #methodClass and #methodSelector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3902 |
This allows to write things much more intuitive: |
22372 | 3903 |
info := <someMethod> who. |
3904 |
class := info methodClass. |
|
3905 |
sel := info methodSelector. |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3906 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3907 |
However, to be backward compatible, the returned object still responds to |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3908 |
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
|
3909 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3910 |
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
|
3911 |
classes. |
2242 | 3912 |
|
3913 |
[author:] |
|
22372 | 3914 |
Claus Gittinger |
2242 | 3915 |
|
3916 |
[see also:] |
|
22372 | 3917 |
Method |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3918 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3919 |
! ! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3920 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3921 |
!Method::MethodWhoInfo class methodsFor:'instance creation'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3922 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3923 |
class:cls selector:sel |
2023 | 3924 |
"return a new MethodWhoInfo object; |
3925 |
this is a private interface for Method" |
|
3926 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3927 |
^ self basicNew class:cls selector:sel |
2023 | 3928 |
|
3929 |
"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
|
3930 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3931 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3932 |
!Method::MethodWhoInfo methodsFor:'accessing'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3933 |
|
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3934 |
method |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3935 |
^ myClass compiledMethodAt:mySelector |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3936 |
! |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
3937 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3938 |
methodClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3939 |
"return the class which contains the method represented by myself" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3940 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3941 |
^ myClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3942 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3943 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3944 |
(Method compiledMethodAt:#who) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3945 |
(Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3946 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3947 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3948 |
"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
|
3949 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3950 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3951 |
methodSelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3952 |
"return the selector under which the the method represented by myself |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3953 |
is found in the class" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3954 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3955 |
^ mySelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3956 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
3957 |
"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
|
3958 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3959 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3960 |
!Method::MethodWhoInfo methodsFor:'compatibility'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3961 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3962 |
at:index |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3963 |
"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
|
3964 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3965 |
index == 1 ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3966 |
^ myClass |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3967 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3968 |
index == 2 ifTrue:[ |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
3969 |
^ mySelector |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3970 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3971 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3972 |
"/ sigh - full compatibility ? |
7219
7c7b9d76af21
subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents:
7210
diff
changeset
|
3973 |
^ self indexNotIntegerOrOutOfBounds:index |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3974 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3975 |
|
7258 | 3976 |
!Method::MethodWhoInfo methodsFor:'private-accessing'! |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3977 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3978 |
class:cls selector:sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3979 |
myClass := cls. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3980 |
mySelector := sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3981 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3982 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3983 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
3984 |
|
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3985 |
!Method::ParseTreeCacheEntry methodsFor:'accessing'! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3986 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3987 |
method |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3988 |
^ method |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3989 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3990 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3991 |
method:something |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3992 |
method := something. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3993 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3994 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3995 |
parser |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3996 |
^ parser |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3997 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3998 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
3999 |
parser:something |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4000 |
parser := something. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4001 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4002 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4003 |
parserClass |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4004 |
^ parserClass |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4005 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4006 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4007 |
parserClass:something |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4008 |
parserClass := something. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4009 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4010 |
|
13660 | 4011 |
parserClass:parserClassArg method:methodArg |
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4012 |
parserClass := parserClassArg. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4013 |
method := methodArg. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4014 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4015 |
|
13660 | 4016 |
parserClass:parserClassArg method:methodArg parser:parserArg |
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4017 |
parserClass := parserClassArg. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4018 |
method := methodArg. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4019 |
parser := parserArg. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4020 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4021 |
"Created: / 08-08-2011 / 19:05:02 / cg" |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4022 |
! ! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4023 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4024 |
!Method::ParserCacheEntry methodsFor:'accessing'! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4025 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4026 |
method |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4027 |
^ method |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4028 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4029 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4030 |
method:something |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4031 |
method := something. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4032 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4033 |
|
19716 | 4034 |
method:methodArg parser:parserArg |
4035 |
method := methodArg. |
|
4036 |
parser := parserArg. |
|
4037 |
||
4038 |
"Created: / 08-08-2011 / 19:05:02 / cg" |
|
4039 |
! |
|
4040 |
||
13570
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4041 |
parser |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4042 |
^ parser |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4043 |
! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4044 |
|
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4045 |
parser:something |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4046 |
parser := something. |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4047 |
! ! |
382db10e848d
changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents:
13569
diff
changeset
|
4048 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
4049 |
!Method class methodsFor:'documentation'! |
872 | 4050 |
|
13569
82bcca38e855
comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents:
13567
diff
changeset
|
4051 |
version |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
4052 |
^ '$Header$' |
13569
82bcca38e855
comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents:
13567
diff
changeset
|
4053 |
! |
82bcca38e855
comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents:
13567
diff
changeset
|
4054 |
|
13422 | 4055 |
version_CVS |
18620
b4e9f25d6ce6
preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents:
18462
diff
changeset
|
4056 |
^ '$Header$' |
12159 | 4057 |
! |
4058 |
||
13422 | 4059 |
version_SVN |
15245 | 4060 |
^ '$ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
1 | 4061 |
! ! |
6956
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
4062 |
|
14863 | 4063 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
4064 |
Method initialize! |