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