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