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