author | sr |
Wed, 11 Aug 2010 16:11:08 +0200 | |
changeset 13013 | 4f56835cfcaf |
parent 12948 | f238e8b26110 |
child 13100 | d5333b6746d1 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
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 |
" |
|
5385 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
3934 | 14 |
CompiledCode variableSubclass:#Method |
12899
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
15 |
instanceVariableNames:'source sourcePosition category package mclass' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
16 |
classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
17 |
LastWhoClass LastFileLock LastMethodSources LastMethodSourcesLock |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
18 |
CompilationLock' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
19 |
poolDictionaries:'' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
20 |
category:'Kernel-Methods' |
1 | 21 |
! |
22 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
23 |
Object subclass:#MethodWhoInfo |
12899
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
24 |
instanceVariableNames:'myClass mySelector' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
25 |
classVariableNames:'' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
26 |
poolDictionaries:'' |
5c3e8ec6f8bb
added: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12854
diff
changeset
|
27 |
privateIn:Method |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
28 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
29 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
30 |
!Method class methodsFor:'documentation'! |
42 | 31 |
|
88 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
35 |
All Rights Reserved |
88 | 36 |
|
37 |
This software is furnished under a license and may be used |
|
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
! |
|
45 |
||
42 | 46 |
documentation |
47 |
" |
|
68 | 48 |
this class defines protocol for executable methods; |
49 |
both compiled and interpreted methods are represented by this class. |
|
50 |
Compiled methods have a non-nil code field, while interpreted methods have |
|
51 |
a nil code field and non-nil byteCode field. |
|
88 | 52 |
If there are both non-nil code and bytecode fields, the VM will execute |
227 | 53 |
the machine-code of a method. If both are nil when executed, a noByteCode |
54 |
message is sent by the VM to the method where a signal is raised. |
|
1 | 55 |
|
227 | 56 |
The methods sourcecode is represented by source and sourcePosition: |
57 |
- if sourcePosition is a Number, the source-field is the fileName and |
|
58 |
sourcePosition is the character offset of the source-chunk in this source file. |
|
59 |
- If sourcePosition is nil, the source is the string in the source field. |
|
60 |
(an old version used ExternalString instances here, but that lead to |
|
61 |
10000 additional little objects ...) |
|
1 | 62 |
|
68 | 63 |
The flags field defines things like the number of method-locals, |
227 | 64 |
method arguments and stack requirements (for interpreted methods). |
68 | 65 |
Do not depend on any value in the flags field - it may change without |
66 |
notice. |
|
1 | 67 |
|
438 | 68 |
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
|
69 |
identified not by being an instance of Block or Method, but instead by |
438 | 70 |
having the executable flag bit set in the class. The VM can execute anything |
71 |
which is identified as executable (assuming that the first instance variable |
|
72 |
is the machine-code address) - this allows for easy future extension. |
|
73 |
||
1293 | 74 |
[Instance variables:] |
93 | 75 |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
76 |
source <String> the source itself (if sourcePosition isNil) |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
77 |
or the fileName where the source is found |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
78 |
|
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
79 |
sourcePosition <Integer> the position of the methods chunk in the file |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
80 |
|
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
81 |
category <Symbol> the methods category |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
82 |
package <Symbol> the package, in which the methods was defined |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
83 |
mclass <Class> the class in which I am defined |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
84 |
indexed slots literals |
227 | 85 |
|
1293 | 86 |
[Class variables:] |
227 | 87 |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
88 |
PrivateMethodSignal raised on privacy violation (see docu) |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
89 |
|
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
90 |
LastFileReference weak reference to the last sourceFile |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
91 |
LastSourceFileName to speedup source access via NFS |
93 | 92 |
|
68 | 93 |
WARNING: layout known by compiler and runtime system - dont change |
1293 | 94 |
|
95 |
[author:] |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
96 |
Claus Gittinger |
42 | 97 |
" |
176 | 98 |
! |
99 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
100 |
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
|
101 |
" |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
|
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
111 |
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
|
112 |
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
|
113 |
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
|
114 |
which is compiled by the machines native C-compiler. |
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
115 |
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
|
116 |
" |
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 |
! |
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 |
|
12854 | 119 |
privacy |
176 | 120 |
" |
121 |
ST/X includes an EXPERIMENTAL implementation of method privacy. |
|
122 |
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
|
123 |
privacy:#private and privacy:#protected messages. Also, categories may be |
202 | 124 |
filedIn as a whole as private using #privateMethodsFor: or as |
125 |
protected using #protectedMethodsFor: instead of the well known #methodsFor:. |
|
126 |
||
176 | 127 |
The additional #publicMethodsFor: is for documentation purposes, and |
227 | 128 |
is equivalent to #methodsFor: (also to support fileIn of ENVY methods). |
176 | 129 |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
130 |
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
|
131 |
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
|
132 |
class itself or subclasses. |
12854 | 133 |
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
|
134 |
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
|
135 |
(i.e. protected methods are less private than private ones) |
176 | 136 |
|
137 |
When such a situation arises, the VM (runtime system) will raise the |
|
138 |
PrivateMethodSignal exception (if nonNil), which usually brings you into the |
|
139 |
debugger. |
|
140 |
||
227 | 141 |
If PrivateMethodSignal is nil, the VM will not check for this, and |
176 | 142 |
execution is as usual. (you may want to nil-it for production code, |
143 |
and leave it non nil during development). |
|
144 |
||
145 |
NOTICE: there is no (not yet ?) standard defined for method privacy, |
|
12854 | 146 |
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
|
147 |
(from what can be deduced by reading PD code). |
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
148 |
|
176 | 149 |
Also, the usability of privacy is still to be tested. |
415 | 150 |
This interface, the implementation and the rules for when a privacy violation |
151 |
may change (in case of some ANSI standard being defined). |
|
227 | 152 |
Be warned and send me suggestions & critics (constructive ;-) |
5277
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
153 |
|
d457937a69e5
comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents:
5241
diff
changeset
|
154 |
Late note (Feb 2000): |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
155 |
the privacy feature has new been in ST/X for some years and was NOT heavily |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
156 |
used - neither at eXept, nor by customers. |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
157 |
In Smalltalk, it seems to be a very questionable feature, actually limiting |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
158 |
code reusability. |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
159 |
The privacy features are left in the system to demonstrate that it can be |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
160 |
done in Smalltalk (for religious C++ fans ... to avoid useless discussions) |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
161 |
(the check is not expensive, w.r.t. the VM runtime behavior). |
176 | 162 |
" |
42 | 163 |
! ! |
1 | 164 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
165 |
!Method class methodsFor:'initialization'! |
109 | 166 |
|
167 |
initialize |
|
1254 | 168 |
"create signals" |
169 |
||
109 | 170 |
PrivateMethodSignal isNil ifTrue:[ |
7601 | 171 |
"EXPERIMENTAL" |
172 |
PrivateMethodSignal := ExecutionError newSignalMayProceed:true. |
|
173 |
PrivateMethodSignal nameClass:self message:#privateMethodSignal. |
|
174 |
PrivateMethodSignal notifierString:'attempt to execute private/protected method'. |
|
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
175 |
]. |
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
176 |
|
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
177 |
LastFileLock isNil ifTrue:[ |
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
178 |
LastFileLock := RecursionLock new name:'Method-LastFile'. |
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
179 |
LastMethodSourcesLock := RecursionLock new name:'Method-LastMethodSources'. |
12695 | 180 |
|
181 |
"LastFileReference used to be a WeakArray. The problem was, that |
|
182 |
during some operations (generating project definition methods), lots of |
|
183 |
methods and classes are accessed. GC (scavenge) is done heavily, |
|
184 |
while finalization is a low prio process, so that the file limit |
|
185 |
is reached before finalization did close the old streams." |
|
186 |
LastFileReference := Array new:1. |
|
187 |
LastFileReference at:1 put:nil. |
|
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
188 |
]. |
1254 | 189 |
|
5387
f855cf3b2f67
need a recursionLock as compilationLock
Claus Gittinger <cg@exept.de>
parents:
5386
diff
changeset
|
190 |
CompilationLock := RecursionLock new name:'MethodCompilation'. |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
191 |
|
1254 | 192 |
"Modified: 22.4.1996 / 16:34:38 / cg" |
2079
bcf84ab30304
Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents:
2066
diff
changeset
|
193 |
"Modified: 3.1.1997 / 16:58:16 / stefan" |
10375 | 194 |
! |
195 |
||
196 |
lastMethodSourcesLock |
|
197 |
LastMethodSourcesLock isNil ifTrue:[ |
|
198 |
self initialize |
|
199 |
]. |
|
200 |
^ LastMethodSourcesLock |
|
109 | 201 |
! ! |
202 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
203 |
!Method class methodsFor:'Signal constants'! |
159 | 204 |
|
205 |
privateMethodSignal |
|
176 | 206 |
"return the signal raised when a private/protected method is called |
207 |
by some other object (i.e. not a self- or super send)" |
|
208 |
||
159 | 209 |
^ PrivateMethodSignal |
210 |
! ! |
|
211 |
||
11022
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
212 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
213 |
!Method class methodsFor:'queries'! |
3 | 214 |
|
215 |
isBuiltInClass |
|
1264 | 216 |
"return true if this class is known by the run-time-system. |
217 |
Here, true is returned for myself, false for subclasses." |
|
3 | 218 |
|
219 |
^ self == Method |
|
1264 | 220 |
|
221 |
"Modified: 23.4.1996 / 15:59:50 / cg" |
|
44 | 222 |
! |
223 |
||
6089 | 224 |
methodDefinitionTemplateForSelector:aSelector |
225 |
"given a selector, return a prototype definition string" |
|
226 |
||
6091 | 227 |
|nA argNames| |
228 |
||
229 |
(nA := aSelector numArgs) == 1 ifTrue:[ |
|
6090 | 230 |
argNames := #('arg') |
231 |
] ifFalse:[ |
|
6091 | 232 |
argNames := (1 to:nA) collect:[:i | 'arg' , i printString]. |
6090 | 233 |
]. |
12854 | 234 |
^ self |
235 |
methodDefinitionTemplateForSelector:aSelector |
|
6090 | 236 |
andArgumentNames:argNames. |
237 |
||
238 |
" |
|
12854 | 239 |
Method methodDefinitionTemplateForSelector:#foo |
240 |
Method methodDefinitionTemplateForSelector:#+ |
|
241 |
Method methodDefinitionTemplateForSelector:#foo:bar:baz: |
|
6090 | 242 |
" |
243 |
! |
|
244 |
||
245 |
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames |
|
246 |
"given a selector, return a prototype definition string" |
|
247 |
||
6089 | 248 |
aSelector numArgs > 0 ifTrue:[ |
249 |
aSelector isKeyword ifTrue:[ |
|
250 |
^ String streamContents:[:stream | |
|
12854 | 251 |
aSelector keywords with:argNames do:[:eachKeyword :eachArgName| |
9364 | 252 |
stream nextPutAll:eachKeyword; nextPutAll:eachArgName; space. |
253 |
]. |
|
254 |
stream backStep. "remove the last space" |
|
255 |
]. |
|
6089 | 256 |
]. |
6090 | 257 |
^ aSelector , ' ' , (argNames at:1) |
6089 | 258 |
]. |
259 |
^ aSelector |
|
260 |
||
261 |
" |
|
12854 | 262 |
Method methodDefinitionTemplateForSelector:#foo andArgumentNames:#() |
263 |
Method methodDefinitionTemplateForSelector:#+ andArgumentNames:#('aNumber') |
|
264 |
Method methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg') |
|
6089 | 265 |
" |
266 |
! |
|
267 |
||
747 | 268 |
methodPrivacySupported |
269 |
"return true, if the system was compiled to support methodPrivacy. |
|
270 |
You should not depend on that feature being available." |
|
271 |
||
272 |
%{ /* NOCONTEXT */ |
|
273 |
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE) |
|
274 |
RETURN (true); |
|
275 |
#else |
|
276 |
RETURN (false); |
|
277 |
#endif |
|
278 |
%} |
|
3342 | 279 |
! |
280 |
||
281 |
resourceTypes |
|
282 |
"get the types of resources for which a spec definition and corresponding editor exist" |
|
283 |
||
8526 | 284 |
^ #(canvas menu image fileImage help hierarchicalList tabList tableColumns) |
3 | 285 |
! ! |
286 |
||
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
287 |
!Method class methodsFor:'special'! |
957 | 288 |
|
289 |
flushSourceStreamCache |
|
11663
6ef3b25bd306
changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents:
11428
diff
changeset
|
290 |
LastFileLock critical:[ |
6ef3b25bd306
changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents:
11428
diff
changeset
|
291 |
LastSourceFileName := LastMethodSources := nil. |
6ef3b25bd306
changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents:
11428
diff
changeset
|
292 |
LastFileReference at:1 put:0. |
6ef3b25bd306
changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents:
11428
diff
changeset
|
293 |
]. |
957 | 294 |
|
7830 | 295 |
" |
296 |
Method flushSourceStreamCache |
|
297 |
" |
|
298 |
||
957 | 299 |
"Created: 9.2.1996 / 19:05:28 / cg" |
300 |
! ! |
|
301 |
||
7261 | 302 |
!Method methodsFor:'Compatibility-VW'! |
5967 | 303 |
|
11146 | 304 |
classIsMeta |
305 |
"return true, if this method is a class method" |
|
306 |
||
12854 | 307 |
^ self mclass isMeta |
11146 | 308 |
! |
309 |
||
5967 | 310 |
sendsSelector:aSelectorSymbol |
311 |
"return true, if this method contains a message-send |
|
312 |
with aSelectorSymbol as selector." |
|
313 |
||
314 |
^ self sends:aSelectorSymbol |
|
315 |
! ! |
|
316 |
||
9096 | 317 |
|
1 | 318 |
!Method methodsFor:'accessing'! |
319 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
320 |
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
|
321 |
"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
|
322 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
323 |
^ category |
1 | 324 |
! |
325 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
326 |
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
|
327 |
"set the methods category" |
1 | 328 |
|
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
329 |
|newCategory oldCategory cls| |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
330 |
|
3934 | 331 |
aStringOrSymbol notNil ifTrue:[ |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
332 |
newCategory := aStringOrSymbol. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
333 |
newCategory ~= (oldCategory := category) ifTrue:[ |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
334 |
self setCategory:newCategory. |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
335 |
|
10910
d6eb44699802
care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents:
10857
diff
changeset
|
336 |
cls := self mclass. |
d6eb44699802
care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents:
10857
diff
changeset
|
337 |
cls notNil ifTrue:[ |
d6eb44699802
care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents:
10857
diff
changeset
|
338 |
cls addChangeRecordForMethodCategory:self category:newCategory. |
d6eb44699802
care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents:
10857
diff
changeset
|
339 |
self changed:#category with:oldCategory. "/ will vanish |
d6eb44699802
care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents:
10857
diff
changeset
|
340 |
cls changed:#organization with:self selector. "/ will vanish |
12854 | 341 |
Smalltalk changed:#methodCategory with:(Array with:cls with:self with:oldCategory). |
10910
d6eb44699802
care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents:
10857
diff
changeset
|
342 |
] |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
343 |
] |
3934 | 344 |
] |
345 |
||
10729 | 346 |
"Modified: / 25-09-2007 / 16:15:24 / cg" |
1 | 347 |
! |
348 |
||
39 | 349 |
comment |
350 |
"return the methods comment. |
|
68 | 351 |
This is done by searching for and returning the first comment |
12854 | 352 |
from the methods source (excluding any double-quotes). |
68 | 353 |
Returns nil if there is no comment (or source is not available)." |
39 | 354 |
|
12948 | 355 |
|src| |
39 | 356 |
|
159 | 357 |
src := self source. |
358 |
src isNil ifTrue:[^ nil]. |
|
12948 | 359 |
^ self programmingLanguage parserClass methodCommentFromSource:src |
93 | 360 |
|
361 |
" |
|
12948 | 362 |
(Method compiledMethodAt:#comment) comment |
12854 | 363 |
(Object class compiledMethodAt:#infoPrinting:) comment |
93 | 364 |
" |
1236
5c9bc68e3c71
use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents:
1194
diff
changeset
|
365 |
|
12948 | 366 |
"Modified: / 23-02-1998 / 10:26:08 / stefan" |
367 |
"Modified: / 17-07-2010 / 14:23:56 / cg" |
|
39 | 368 |
! |
369 |
||
9702 | 370 |
getPackage |
371 |
"return the package-ID of the method" |
|
372 |
||
373 |
^ package |
|
374 |
! |
|
375 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
376 |
getSource |
3160 | 377 |
"low-level access to the source instance-variable. |
4751 | 378 |
For internal (compiler) use only. |
3160 | 379 |
This is NOT always the methods source string" |
380 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
381 |
^ source |
414 | 382 |
! |
383 |
||
4751 | 384 |
getSourcePosition |
385 |
"low-level access to the sourcePosition instance-variable. |
|
386 |
For internal (compiler) use only. |
|
387 |
This is NOT always the methods sourcePosition" |
|
388 |
||
389 |
^ sourcePosition |
|
390 |
! |
|
391 |
||
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
392 |
localSourceFilename:aFileName position:aNumber |
12854 | 393 |
"set the methods sourcefile/position indicating, that |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
394 |
this is a local file." |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
395 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
396 |
source := aFileName. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
397 |
sourcePosition := aNumber negated |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
398 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
399 |
"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
|
400 |
! |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
401 |
|
5152
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
402 |
makeLocalStringSource |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
403 |
"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
|
404 |
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
|
405 |
by reading the source code file). |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
406 |
This is required, when a methods package is changed, to assure that its |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
407 |
sourceCode is not lost." |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
408 |
|
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
409 |
source notNil ifTrue:[ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
410 |
sourcePosition notNil ifTrue:[ |
12508
471778ff6ccb
comment/format in: #makeLocalStringSource
Claus Gittinger <cg@exept.de>
parents:
12363
diff
changeset
|
411 |
"/ this looks wierd - but (self source) will retrieve the external source |
471778ff6ccb
comment/format in: #makeLocalStringSource
Claus Gittinger <cg@exept.de>
parents:
12363
diff
changeset
|
412 |
"/ (from the file) and store it. So afterwards, we will have the string and |
471778ff6ccb
comment/format in: #makeLocalStringSource
Claus Gittinger <cg@exept.de>
parents:
12363
diff
changeset
|
413 |
"/ sourcePosition will be nil |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
414 |
self source:(self source) |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
415 |
] |
5152
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
416 |
]. |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
417 |
! |
2aacfb3976d4
when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents:
5115
diff
changeset
|
418 |
|
5324 | 419 |
mclass:aClass |
8465
2d2211d74983
Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents:
8462
diff
changeset
|
420 |
"set the method's class" |
12854 | 421 |
|
8465
2d2211d74983
Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents:
8462
diff
changeset
|
422 |
mclass == aClass ifTrue:[ ^ self ]. |
8462 | 423 |
|
12323 | 424 |
"/ (mclass notNil and:[aClass notNil]) ifTrue:[ |
425 |
"/ 'Method [warning]: mclass already set' errorPrintCR. |
|
426 |
"/ ]. |
|
5696 | 427 |
mclass := aClass. |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
428 |
|
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
429 |
"Modified: / 28-11-2006 / 12:12:27 / cg" |
5696 | 430 |
! |
5324 | 431 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
432 |
package |
9702 | 433 |
"return the package-ID 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
|
434 |
|
5385 | 435 |
|cls| |
436 |
||
437 |
package notNil ifTrue:[ ^ package ]. |
|
438 |
(cls := self mclass) isNil ifTrue:[ |
|
12216
692af7a76600
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12193
diff
changeset
|
439 |
^ PackageId noProjectID. |
5385 | 440 |
]. |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
441 |
"/ set it. |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
442 |
package := cls getPackage. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
443 |
package isNil ifTrue:[ |
12216
692af7a76600
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12193
diff
changeset
|
444 |
^ PackageId noProjectID. |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
445 |
]. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
446 |
^ package |
3950 | 447 |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
448 |
"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
|
449 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
450 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
451 |
package:aSymbol |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
452 |
"set the package-symbol" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
453 |
|
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
454 |
|cls oldPackage newPackage| |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
455 |
|
12216
692af7a76600
Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents:
12193
diff
changeset
|
456 |
aSymbol == PackageId noProjectID ifTrue:[ |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
457 |
newPackage := nil |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
458 |
] ifFalse:[ |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
459 |
newPackage := aSymbol |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
460 |
]. |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
461 |
|
9713 | 462 |
package ~~ newPackage ifTrue:[ |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
463 |
oldPackage := package. |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
464 |
"/ this is required, because otherwise I would no longer be able to |
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
465 |
"/ reconstruct my sourcecode (as the connection to the source-file is lost). |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
466 |
self makeLocalStringSource. |
9692
d53de4f90660
allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents:
9661
diff
changeset
|
467 |
package := newPackage. |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
468 |
|
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
469 |
cls := self mclass. |
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
470 |
|
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
471 |
self changed:#package. "/ will vanish |
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
472 |
cls changed:#methodPackage with:self selector. "/ will vanish |
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
473 |
|
12854 | 474 |
Smalltalk changed:#projectOrganization with:(Array with:cls with:self with:oldPackage). |
10196 | 475 |
cls addChangeRecordForMethodPackage:self package:newPackage. |
5724
96c2a5cf4217
category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents:
5721
diff
changeset
|
476 |
] |
10196 | 477 |
|
478 |
"Modified: / 23-11-2006 / 17:01:02 / cg" |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
479 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
480 |
|
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
481 |
setCategory:aStringOrSymbol |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
482 |
"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
|
483 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
484 |
aStringOrSymbol notNil ifTrue:[ |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
485 |
category := aStringOrSymbol asSymbol |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
486 |
] |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
487 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
488 |
"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
|
489 |
! |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
490 |
|
5398 | 491 |
setPackage:aSymbol |
9702 | 492 |
"set the package-symbol (low level - use package:)" |
5398 | 493 |
|
494 |
package := aSymbol |
|
495 |
! |
|
496 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
497 |
source |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
498 |
"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
|
499 |
|
12598 | 500 |
|sourceStream chunk| |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
501 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
502 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
503 |
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
|
504 |
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
|
505 |
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
|
506 |
" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
507 |
sourcePosition isNil ifTrue:[^ source]. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
508 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
509 |
source notNil ifTrue:[ |
10375 | 510 |
self class lastMethodSourcesLock critical:[ |
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
511 |
LastMethodSources notNil ifTrue:[ |
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
512 |
chunk := LastMethodSources at:self ifAbsent:nil. |
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
513 |
]. |
5818 | 514 |
]. |
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
515 |
chunk notNil ifTrue:[ |
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
516 |
^ chunk |
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
517 |
]. |
11778
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
518 |
|
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
519 |
LastFileLock critical:[ |
12854 | 520 |
"have to protect sourceStream from being closed as a side effect |
11778
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
521 |
of some other process fetching some the source from a different source file" |
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
522 |
|
12682 | 523 |
sourceStream := self sourceStreamUsingCache:true. |
12598 | 524 |
sourceStream notNil ifTrue:[ |
11778
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
525 |
[ |
12598 | 526 |
chunk := self sourceChunkFromStream:sourceStream. |
11778
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
527 |
] on:DecodingError do:[:ex| |
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
528 |
"CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data" |
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
529 |
|
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
530 |
('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR. |
12682 | 531 |
sourceStream := self rawSourceStreamUsingCache:true. |
532 |
ex restart. |
|
533 |
]. |
|
534 |
]. |
|
535 |
] timeoutMs:100 ifBlocking:[ |
|
536 |
"take care if LastFileLock is not available - maybe we are |
|
537 |
called by a debugger while someone holds the lock. |
|
538 |
Use uncached source streams" |
|
539 |
sourceStream := self sourceStreamUsingCache:false. |
|
540 |
sourceStream notNil ifTrue:[ |
|
541 |
[ |
|
542 |
chunk := self sourceChunkFromStream:sourceStream. |
|
543 |
sourceStream close. |
|
544 |
] on:DecodingError do:[:ex| |
|
545 |
"CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data" |
|
546 |
('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR. |
|
547 |
sourceStream close. |
|
548 |
sourceStream := self rawSourceStreamUsingCache:false. |
|
11778
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
549 |
ex restart. |
a4d708790f90
avoid that a cached source stream is being closed while used by another process
Stefan Vogel <sv@exept.de>
parents:
11663
diff
changeset
|
550 |
]. |
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
551 |
]. |
7601 | 552 |
]. |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
553 |
]. |
2979 | 554 |
|
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
555 |
"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
|
556 |
chunk notNil ifTrue:[ |
12620 | 557 |
UserPreferences current keepMethodSourceCode ifTrue:[ |
558 |
source := chunk. |
|
559 |
sourcePosition := nil. |
|
560 |
^ source. |
|
561 |
]. |
|
562 |
||
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
563 |
CacheDictionary notNil ifTrue:[ |
10375 | 564 |
self class lastMethodSourcesLock critical:[ |
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
565 |
LastMethodSources isNil ifTrue:[ |
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
566 |
LastMethodSources := CacheDictionary new:50. |
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
567 |
]. |
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
568 |
LastMethodSources at:self put:chunk. |
9119
e633e55e69be
avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents:
9096
diff
changeset
|
569 |
] |
12620 | 570 |
]. |
2979 | 571 |
]. |
572 |
||
10608
82b1346f3e8d
Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents:
10482
diff
changeset
|
573 |
^ chunk |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
574 |
|
10201 | 575 |
"Modified: / 07-01-1997 / 16:20:09 / stefan" |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
576 |
"Modified: / 28-11-2006 / 11:49:25 / cg" |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
577 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
578 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
579 |
source:aString |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
580 |
"set the methods sourcestring" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
581 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
582 |
source := aString. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
583 |
sourcePosition := nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
584 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
585 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
586 |
sourceFilename |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
587 |
"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
|
588 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
589 |
sourcePosition notNil ifTrue:[^ source]. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
590 |
^ nil |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
591 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
592 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
593 |
sourceFilename:aFileName position:aNumber |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
594 |
"set the methods sourcefile/position" |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
595 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
596 |
source := aFileName. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
597 |
sourcePosition := aNumber |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
598 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
599 |
|
2812 | 600 |
sourceLineNumber |
601 |
"return the lineNumber of my source within the returned |
|
602 |
source sourcestring. |
|
603 |
For ST methods, the returned sourceString is always the |
|
604 |
methods pure source; therefore, the lineNumber is always 1." |
|
605 |
||
606 |
^ 1 |
|
607 |
||
608 |
"Created: 30.7.1997 / 15:42:01 / cg" |
|
609 |
! |
|
610 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
611 |
sourcePosition |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
612 |
"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
|
613 |
|
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
614 |
sourcePosition isNil ifTrue:[^ sourcePosition]. |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
615 |
^ sourcePosition abs |
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
616 |
|
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
617 |
"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
|
618 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
619 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
620 |
!Method methodsFor:'accessing-visibility'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
621 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
622 |
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
|
623 |
"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
|
624 |
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
|
625 |
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
|
626 |
it in its message lookup. |
747 | 627 |
(i.e. setting a method to #ignored, and sending that selector, |
12854 | 628 |
leads to either the superclasses implementation to be called, |
747 | 629 |
or a doesNotUnderstand exception to be raised) |
630 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
631 |
Notice: this is a nonstandard feature, not supported |
747 | 632 |
by other smalltalk implementations and not specified in the ANSI spec. |
633 |
||
634 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
635 |
It may change or even vanish (if it shows to be not useful)." |
|
636 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
637 |
^ self privacy == #ignored |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
638 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
639 |
"Modified: / 23.1.1998 / 15:23:02 / stefan" |
176 | 640 |
! |
641 |
||
642 |
isPrivate |
|
643 |
"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
|
644 |
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
|
645 |
from superclasses or the class itself. |
176 | 646 |
If a private method is called by some other class, a runtime |
647 |
error (PrivateMethodSignal) is raised. |
|
648 |
Notice: method privacy is a nonstandard feature, not supported |
|
649 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 650 |
|
176 | 651 |
This is EXPERIMENTAL - and being evaluated for usability. |
652 |
It may change or even vanish (if it shows to be not useful)." |
|
653 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
654 |
^ self privacy == #private |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
655 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
656 |
"Modified: / 23.1.1998 / 15:23:13 / stefan" |
68 | 657 |
! |
658 |
||
176 | 659 |
isProtected |
660 |
"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
|
661 |
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
|
662 |
from superclasses, the class itself or subclasse. |
176 | 663 |
If a protected method is called by some other class, a runtime |
664 |
error (PrivateMethodSignal) is raised. |
|
747 | 665 |
|
176 | 666 |
Notice: method privacy is a nonstandard feature, not supported |
667 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 668 |
|
176 | 669 |
This is EXPERIMENTAL - and being evaluated for usability. |
670 |
It may change or even vanish (if it shows to be not useful)." |
|
671 |
||
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
672 |
^ self privacy == #protected |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
673 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
674 |
"Modified: / 23.1.1998 / 15:23:27 / stefan" |
176 | 675 |
! |
676 |
||
677 |
isPublic |
|
678 |
"return true, if this is a public method - I.e. can be executed via any send. |
|
747 | 679 |
This is the default and how other smalltalk implementations treat all methods. |
680 |
||
360 | 681 |
Notice: method privacy is a nonstandard feature, not supported |
682 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
747 | 683 |
|
360 | 684 |
This is EXPERIMENTAL - and being evaluated for usability. |
685 |
It may change or even vanish (if it shows to be not useful)." |
|
176 | 686 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
687 |
^ self privacy == #public |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
688 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
689 |
"Modified: / 23.1.1998 / 15:23:40 / stefan" |
176 | 690 |
! |
691 |
||
747 | 692 |
isRestricted |
693 |
"return the flag bit stating that this method is restricted. |
|
694 |
Execution of the receiver will only be allowed if the system is not in |
|
12854 | 695 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
747 | 696 |
error (PrivateMethodSignal) is raised. |
697 |
||
698 |
Notice: method restriction is a nonstandard feature, not supported |
|
699 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
700 |
||
701 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
702 |
It may change or even vanish (if it shows to be not useful)." |
|
703 |
||
704 |
%{ /* NOCONTEXT */ |
|
705 |
#ifdef F_RESTRICTED |
|
2868 | 706 |
INT f = __intVal(__INST(flags)); |
747 | 707 |
|
708 |
if (f & F_RESTRICTED) { |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
709 |
RETURN (true); |
747 | 710 |
} |
711 |
#endif |
|
712 |
%}. |
|
713 |
^ false |
|
8526 | 714 |
! ! |
715 |
||
716 |
!Method privateMethodsFor:'accessing-visibility'! |
|
717 |
||
718 |
primSetPrivacy:aSymbol |
|
719 |
"set the methods access rights (privacy) from a symbol; |
|
720 |
Currently, this must be one of #private, #protected, #public or #ignored. |
|
12854 | 721 |
#setPrivacy: simply sets the attribute. When changing methods, that |
8526 | 722 |
have already been called, #privacy: should be used. |
723 |
||
724 |
Notice: method privacy is a nonstandard feature, not supported |
|
725 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
726 |
If at all, use it for debugging purposes, to catch messagesends |
|
727 |
which are not supposed to be sent by others. |
|
728 |
(especially, if working in a team, while integrating other peoples work) |
|
729 |
||
730 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
731 |
It may change or even vanish (if it shows to be not useful)." |
|
732 |
||
733 |
%{ /* NOCONTEXT */ |
|
734 |
||
735 |
#if defined(M_PRIVACY) |
|
736 |
INT f = __intVal(__INST(flags)); |
|
737 |
INT p; |
|
738 |
||
739 |
if (aSymbol == @symbol(public)) |
|
740 |
p = 0; |
|
741 |
else if (aSymbol == @symbol(protected)) |
|
742 |
p = F_PRIVATE; |
|
743 |
else if (aSymbol == @symbol(private)) |
|
744 |
p = F_CLASSPRIVATE; |
|
745 |
else if (aSymbol == @symbol(ignored)) |
|
746 |
p = F_IGNORED; |
|
747 |
else |
|
748 |
RETURN(false); /* illegal symbol */ |
|
12854 | 749 |
|
8526 | 750 |
|
751 |
f = (f & ~M_PRIVACY) | p; |
|
8913 | 752 |
__INST(flags) = __mkSmallInteger(f); |
8526 | 753 |
#endif |
754 |
||
755 |
%}. |
|
756 |
^ true |
|
757 |
||
758 |
"Modified: 27.8.1995 / 22:58:08 / claus" |
|
759 |
! ! |
|
760 |
||
761 |
!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
|
762 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
763 |
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
|
764 |
"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
|
765 |
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
|
766 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
767 |
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
|
768 |
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
|
769 |
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
|
770 |
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
|
771 |
(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
|
772 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
773 |
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
|
774 |
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
|
775 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
776 |
%{ /* NOCONTEXT */ |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
777 |
/* 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
|
778 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
779 |
#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
|
780 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
781 |
INT f = __intVal(__INST(flags)); |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
782 |
switch (f & M_PRIVACY) { |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
783 |
|
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
784 |
# ifdef F_PRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
785 |
case F_PRIVATE: |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
786 |
RETURN (@symbol(protected)); |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
787 |
break; |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
788 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
789 |
# ifdef F_CLASSPRIVATE |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
790 |
case F_CLASSPRIVATE: |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
791 |
RETURN (@symbol(private)); |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
792 |
break; |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
793 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
794 |
# ifdef F_IGNORED |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
795 |
case F_IGNORED: |
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
796 |
RETURN (@symbol(ignored)); |
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
797 |
break; |
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
798 |
# endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
799 |
} |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
800 |
#endif |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
801 |
%}. |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
802 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
803 |
^ #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
|
804 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
805 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
806 |
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
|
807 |
"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
|
808 |
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
|
809 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
810 |
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
|
811 |
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
|
812 |
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
|
813 |
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
|
814 |
(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
|
815 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
816 |
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
|
817 |
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
|
818 |
|
8526 | 819 |
|oldPrivacy| |
820 |
||
821 |
oldPrivacy := self privacy. |
|
822 |
||
823 |
(self setPrivacy:aSymbol flushCaches:true) ifTrue:[ |
|
824 |
|myClass mySelector| |
|
825 |
||
826 |
myClass := self mclass. |
|
827 |
mySelector := self selector. |
|
828 |
||
829 |
self changed:#privacy. "/ will vanish |
|
830 |
myClass notNil ifTrue:[ |
|
831 |
mySelector notNil ifTrue:[ |
|
832 |
myClass changed:#methodPrivacy with:mySelector. "/ will vanish |
|
12854 | 833 |
Smalltalk changed:#privacyOfMethod with:(Array with:myClass with:self with:oldPrivacy). |
10196 | 834 |
myClass addChangeRecordForMethodPrivacy:self. |
8526 | 835 |
] |
836 |
] |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
837 |
] |
10196 | 838 |
|
839 |
"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
|
840 |
! |
747 | 841 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
842 |
restricted:aBoolean |
12854 | 843 |
"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
|
844 |
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
|
845 |
'trap restricted mode' (-->ObjectMemory) otherise a runtime |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
846 |
error (PrivateMethodSignal) is raised. |
747 | 847 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
848 |
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
|
849 |
by other smalltalk implementations and not specified in the ANSI spec. |
747 | 850 |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
851 |
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
|
852 |
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
|
853 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
854 |
%{ /* NOCONTEXT */ |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
855 |
/* 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
|
856 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
857 |
#ifdef F_RESTRICTED |
2868 | 858 |
INT f = __intVal(__INST(flags)); |
859 |
INT old; |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
860 |
|
747 | 861 |
old = f; |
12854 | 862 |
if (aBoolean == true) |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
863 |
f |= F_RESTRICTED; |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
864 |
else |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
865 |
f &= ~F_RESTRICTED; |
8913 | 866 |
__INST(flags) = __mkSmallInteger(f); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
867 |
if (old & F_RESTRICTED) |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
868 |
RETURN(true); |
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
869 |
#endif |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
870 |
%}. |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
871 |
^ false |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
872 |
|
747 | 873 |
" |
874 |
(ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true |
|
875 |
" |
|
532
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
876 |
|
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
877 |
"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
|
878 |
! |
2511c99de912
New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents:
530
diff
changeset
|
879 |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
880 |
setPrivacy:aSymbol |
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
881 |
"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
|
882 |
Currently, this must be one of #private, #protected, #public or #ignored. |
12854 | 883 |
#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
|
884 |
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
|
885 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
886 |
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
|
887 |
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
|
888 |
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
|
889 |
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
|
890 |
(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
|
891 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
892 |
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
|
893 |
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
|
894 |
|
8526 | 895 |
^ self setPrivacy:aSymbol flushCaches:true |
896 |
! |
|
897 |
||
898 |
setPrivacy:aSymbol flushCaches:doFlush |
|
899 |
"set the methods access rights (privacy) from a symbol; |
|
900 |
Currently, this must be one of #private, #protected, #public or #ignored. |
|
12854 | 901 |
#setPrivacy: simply sets the attribute. When changing methods, that |
8526 | 902 |
have already been called, #privacy: should be used. |
903 |
||
904 |
Notice: method privacy is a nonstandard feature, not supported |
|
905 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
906 |
If at all, use it for debugging purposes, to catch messagesends |
|
907 |
which are not supposed to be sent by others. |
|
908 |
(especially, if working in a team, while integrating other peoples work) |
|
909 |
||
910 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
911 |
It may change or even vanish (if it shows to be not useful)." |
|
912 |
||
913 |
|old sel| |
|
914 |
||
915 |
old := self privacy. |
|
916 |
old == aSymbol ifTrue:[^ false]. |
|
917 |
(self primSetPrivacy:aSymbol) ifFalse:[^ false]. |
|
918 |
||
919 |
"/ |
|
920 |
"/ no need to flush, if changing from private to public |
|
921 |
"/ |
|
922 |
doFlush ifTrue:[ |
|
923 |
(aSymbol == #public and:[old ~~ #ignored]) ifFalse:[ |
|
924 |
(sel := self selector) notNil ifTrue:[ |
|
925 |
ObjectMemory flushCachesForSelector:sel |
|
926 |
] ifFalse:[ |
|
927 |
ObjectMemory flushCaches. |
|
928 |
]. |
|
929 |
]. |
|
930 |
]. |
|
3216
e0f3f49118ed
Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents:
3168
diff
changeset
|
931 |
^ true |
1 | 932 |
! ! |
933 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
934 |
!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
|
935 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
936 |
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
|
937 |
"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
|
938 |
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
|
939 |
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
|
940 |
the methodDictionary of any class - just returned. |
2064 | 941 |
If the method contains primitive code, this may return a method |
942 |
without bytecode. |
|
12854 | 943 |
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
|
944 |
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
|
945 |
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
|
946 |
|
9096 | 947 |
|mthd| |
1 | 948 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
949 |
byteCode notNil ifTrue:[ |
6254
feae1d5d5431
Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents:
6234
diff
changeset
|
950 |
" |
feae1d5d5431
Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents:
6234
diff
changeset
|
951 |
is already a bytecoded method |
feae1d5d5431
Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents:
6234
diff
changeset
|
952 |
" |
feae1d5d5431
Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents:
6234
diff
changeset
|
953 |
^ 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
|
954 |
]. |
9096 | 955 |
|
956 |
ParserFlags |
|
957 |
withSTCCompilation:#never |
|
958 |
do:[ |
|
959 |
mthd := self asExecutableMethod. |
|
960 |
]. |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
961 |
^ mthd |
68 | 962 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
963 |
"Created: 24.10.1995 / 14:02:32 / cg" |
2064 | 964 |
"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
|
965 |
! |
306 | 966 |
|
5405 | 967 |
asByteCodeMethodWithSource:newSource |
9096 | 968 |
|mthd| |
969 |
||
12854 | 970 |
ParserFlags |
9096 | 971 |
withSTCCompilation:#never |
972 |
do:[ |
|
973 |
mthd := self asExecutableMethodWithSource:newSource. |
|
974 |
]. |
|
5405 | 975 |
^ mthd |
976 |
||
977 |
"Created: 24.10.1995 / 14:02:32 / cg" |
|
978 |
"Modified: 5.1.1997 / 01:01:53 / cg" |
|
979 |
! |
|
980 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
981 |
asExecutableMethod |
12854 | 982 |
"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
|
983 |
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
|
984 |
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
|
985 |
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
|
986 |
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
|
987 |
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
|
988 |
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
|
989 |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
990 |
|temporaryMethod sourceString| |
306 | 991 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
992 |
byteCode notNil ifTrue:[ |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
993 |
" |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
994 |
is already a bytecoded method |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
995 |
" |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
996 |
^ self |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
997 |
]. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
998 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
999 |
sourceString := self source. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1000 |
sourceString isNil ifTrue:[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1001 |
'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1002 |
^ 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
|
1003 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1004 |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1005 |
temporaryMethod := self asExecutableMethodWithSource:sourceString. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1006 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1007 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1008 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1009 |
^ nil. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1010 |
]. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1011 |
"/ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1012 |
"/ 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
|
1013 |
"/ |
12854 | 1014 |
temporaryMethod sourceFilename:source position:sourcePosition. |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1015 |
^ temporaryMethod |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1016 |
! |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1017 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1018 |
asExecutableMethodWithSource:newSource |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1019 |
|temporaryMethod cls| |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1020 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1021 |
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
|
1022 |
cls isNil ifTrue:[ |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1023 |
'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1024 |
^ nil |
306 | 1025 |
]. |
1 | 1026 |
|
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
1027 |
"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
|
1028 |
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
|
1029 |
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
|
1030 |
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
|
1031 |
(happened when autoloading animation demos) |
176 | 1032 |
" |
4290
5e43473d7a35
moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents:
4015
diff
changeset
|
1033 |
CompilationLock critical:[ |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1034 |
" |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1035 |
dont want this to go into the changes file, |
12854 | 1036 |
dont want output on Transcript and definitely |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1037 |
dont want a lazy method ... |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1038 |
" |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1039 |
Class withoutUpdatingChangesDo:[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1040 |
|silent lazy| |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1041 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1042 |
silent := Smalltalk silentLoading:true. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1043 |
lazy := Compiler compileLazy:false. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1044 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1045 |
[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1046 |
|compiler| |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1047 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1048 |
Class nameSpaceQuerySignal answer:(cls nameSpace) |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1049 |
do:[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1050 |
compiler := cls compilerClass. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1051 |
|
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1052 |
"/ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1053 |
"/ kludge - have to make ST/X's compiler protocol |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1054 |
"/ be compatible to ST-80's |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1055 |
"/ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1056 |
(compiler respondsTo:#compile:forClass:inCategory:notifying:install:) |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1057 |
ifTrue:[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1058 |
temporaryMethod := compiler |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1059 |
compile:newSource |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1060 |
forClass:cls |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1061 |
inCategory:(self category) |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1062 |
notifying:nil |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1063 |
install:false. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1064 |
] ifFalse:[ |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1065 |
temporaryMethod := compiler new |
12854 | 1066 |
compile:newSource |
1067 |
in:cls |
|
1068 |
notifying:nil |
|
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1069 |
ifFail:nil |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1070 |
]. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1071 |
]. |
6254
feae1d5d5431
Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents:
6234
diff
changeset
|
1072 |
] ensure:[ |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1073 |
Compiler compileLazy:lazy. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1074 |
Smalltalk silentLoading:silent. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1075 |
] |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1076 |
]. |
463
447ead9f870c
be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents:
444
diff
changeset
|
1077 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1078 |
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[ |
5700
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1079 |
'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR. |
ee59aff043c4
asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents:
5696
diff
changeset
|
1080 |
^ nil. |
5405 | 1081 |
]. |
1082 |
"/ |
|
1083 |
"/ try to save a bit of memory, by sharing the source (whatever it is) |
|
1084 |
"/ |
|
12854 | 1085 |
temporaryMethod source:newSource. |
5405 | 1086 |
"/ |
1087 |
"/ dont forget the methods class & package ... |
|
1088 |
"/ |
|
1089 |
temporaryMethod setPackage:package. |
|
1090 |
temporaryMethod mclass:mclass. |
|
1091 |
^ temporaryMethod |
|
1 | 1092 |
! ! |
1093 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1094 |
!Method methodsFor:'copying'! |
438 | 1095 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1096 |
copy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1097 |
"redefined to change a source ref into a real string" |
438 | 1098 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1099 |
|aCopy| |
438 | 1100 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1101 |
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
|
1102 |
sourcePosition notNil ifTrue:[ |
5676 | 1103 |
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
|
1104 |
]. |
5676 | 1105 |
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
|
1106 |
^ aCopy |
2176
1a24b0cef25a
when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1107 |
|
5696 | 1108 |
"Modified: 16.1.1997 / 01:27:25 / cg" |
1109 |
! ! |
|
438 | 1110 |
|
1 | 1111 |
!Method methodsFor:'error handling'! |
1112 |
||
328 | 1113 |
invalidCodeObject |
1873 | 1114 |
"{ Pragma: +optSpace }" |
1115 |
||
93 | 1116 |
"this method is triggered by the interpreter when a nil or non method |
1117 |
is about to be executed. |
|
1118 |
In this case, the VM sends this to the bad method (the receiver). |
|
1119 |
||
1120 |
Also, the Compiler creates methods with their code/bytecode set to |
|
1121 |
this method if - after a class change - a method cannot be compiled |
|
1122 |
and is therefore no longer executable (for example, after an instvar |
|
68 | 1123 |
has been removed, and a method still tries to access this instvar) |
44 | 1124 |
|
93 | 1125 |
Thus, we arrive here, when playing around in a classes methodArray, |
12854 | 1126 |
or compiler/runtime system is broken :-(, |
93 | 1127 |
or you ignore the error messages during some recompile." |
1 | 1128 |
|
1873 | 1129 |
%{ |
1130 |
/* |
|
1131 |
* for reasons too far from being explained here, |
|
1132 |
* this MUST be a compiled method |
|
1133 |
*/ |
|
1134 |
%}. |
|
7601 | 1135 |
^ InvalidCodeError |
1136 |
raiseErrorString:'invalid method - not executable'. |
|
1873 | 1137 |
|
1138 |
"Modified: 4.11.1996 / 22:45:06 / cg" |
|
1 | 1139 |
! |
1140 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1141 |
invalidCodeObjectWith:arg |
1873 | 1142 |
"{ Pragma: +optSpace }" |
1143 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1144 |
"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
|
1145 |
uncompilable methods (with 1 arg) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1146 |
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
|
1147 |
|
1873 | 1148 |
%{ |
1149 |
/* |
|
1150 |
* for reasons too far from being explained here, |
|
1151 |
* this MUST be a compiled method |
|
1152 |
*/ |
|
1153 |
%}. |
|
7601 | 1154 |
^ InvalidCodeError |
1155 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1156 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1157 |
"Created: 4.11.1996 / 21:16:16 / cg" |
1873 | 1158 |
"Modified: 4.11.1996 / 22:45:12 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1159 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1160 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1161 |
invalidCodeObjectWith:arg with:arg2 |
1873 | 1162 |
"{ Pragma: +optSpace }" |
1163 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1164 |
"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
|
1165 |
uncompilable methods (with 2 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1166 |
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
|
1167 |
|
1873 | 1168 |
%{ |
1169 |
/* |
|
1170 |
* for reasons too far from being explained here, |
|
1171 |
* this MUST be a compiled method |
|
1172 |
*/ |
|
1173 |
%}. |
|
7601 | 1174 |
^ InvalidCodeError |
1175 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1176 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1177 |
"Created: 4.11.1996 / 21:16:41 / cg" |
1873 | 1178 |
"Modified: 4.11.1996 / 22:45:15 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1179 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1180 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1181 |
invalidCodeObjectWith:arg with:arg2 with:arg3 |
1873 | 1182 |
"{ Pragma: +optSpace }" |
1183 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1184 |
"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
|
1185 |
uncompilable methods (with 3 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1186 |
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
|
1187 |
|
1873 | 1188 |
%{ |
1189 |
/* |
|
1190 |
* for reasons too far from being explained here, |
|
1191 |
* this MUST be a compiled method |
|
1192 |
*/ |
|
1193 |
%}. |
|
7601 | 1194 |
^ InvalidCodeError |
1195 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1196 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1197 |
"Created: 4.11.1996 / 21:16:51 / cg" |
1873 | 1198 |
"Modified: 4.11.1996 / 22:45:18 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1199 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1200 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1201 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 |
1873 | 1202 |
"{ Pragma: +optSpace }" |
1203 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1204 |
"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
|
1205 |
uncompilable methods (with 4 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1206 |
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
|
1207 |
|
1873 | 1208 |
%{ |
1209 |
/* |
|
1210 |
* for reasons too far from being explained here, |
|
1211 |
* this MUST be a compiled method |
|
1212 |
*/ |
|
1213 |
%}. |
|
7601 | 1214 |
^ InvalidCodeError |
1215 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1216 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1217 |
"Created: 4.11.1996 / 21:17:00 / cg" |
1873 | 1218 |
"Modified: 4.11.1996 / 22:45:22 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1219 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1220 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1221 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 |
1873 | 1222 |
"{ Pragma: +optSpace }" |
1223 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1224 |
"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
|
1225 |
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
|
1226 |
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
|
1227 |
|
1873 | 1228 |
%{ |
1229 |
/* |
|
1230 |
* for reasons too far from being explained here, |
|
1231 |
* this MUST be a compiled method |
|
1232 |
*/ |
|
1233 |
%}. |
|
7601 | 1234 |
^ InvalidCodeError |
1235 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1236 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1237 |
"Created: 4.11.1996 / 21:17:09 / cg" |
1873 | 1238 |
"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
|
1239 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1240 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1241 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
1873 | 1242 |
"{ Pragma: +optSpace }" |
1243 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1244 |
"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
|
1245 |
uncompilable methods (with 6 args) will be bound to this method here, |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1246 |
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
|
1247 |
|
1873 | 1248 |
%{ |
1249 |
/* |
|
1250 |
* for reasons too far from being explained here, |
|
1251 |
* this MUST be a compiled method |
|
1252 |
*/ |
|
1253 |
%}. |
|
7601 | 1254 |
^ InvalidCodeError |
1255 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1256 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1257 |
"Created: 4.11.1996 / 21:17:17 / cg" |
1873 | 1258 |
"Modified: 4.11.1996 / 22:45:28 / cg" |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1259 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1260 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1261 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 |
1873 | 1262 |
"{ Pragma: +optSpace }" |
1263 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1264 |
"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
|
1265 |
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
|
1266 |
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
|
1267 |
|
1873 | 1268 |
%{ |
1269 |
/* |
|
1270 |
* for reasons too far from being explained here, |
|
1271 |
* this MUST be a compiled method |
|
1272 |
*/ |
|
1273 |
%}. |
|
7601 | 1274 |
^ InvalidCodeError |
1275 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1276 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1277 |
"Created: 4.11.1996 / 21:17:25 / cg" |
1873 | 1278 |
"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
|
1279 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1280 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1281 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 |
1873 | 1282 |
"{ Pragma: +optSpace }" |
1283 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1284 |
"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
|
1285 |
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
|
1286 |
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
|
1287 |
|
1873 | 1288 |
%{ |
1289 |
/* |
|
1290 |
* for reasons too far from being explained here, |
|
1291 |
* this MUST be a compiled method |
|
1292 |
*/ |
|
1293 |
%}. |
|
7601 | 1294 |
^ InvalidCodeError |
1295 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1296 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1297 |
"Created: 4.11.1996 / 21:17:32 / cg" |
1873 | 1298 |
"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
|
1299 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1300 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1301 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 |
1873 | 1302 |
"{ Pragma: +optSpace }" |
1303 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1304 |
"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
|
1305 |
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
|
1306 |
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
|
1307 |
|
1873 | 1308 |
%{ |
1309 |
/* |
|
1310 |
* for reasons too far from being explained here, |
|
1311 |
* this MUST be a compiled method |
|
1312 |
*/ |
|
1313 |
%}. |
|
7601 | 1314 |
^ InvalidCodeError |
1315 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1316 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1317 |
"Created: 4.11.1996 / 21:17:37 / cg" |
1873 | 1318 |
"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
|
1319 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1320 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1321 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 |
1873 | 1322 |
"{ Pragma: +optSpace }" |
1323 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1324 |
"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
|
1325 |
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
|
1326 |
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
|
1327 |
|
1873 | 1328 |
%{ |
1329 |
/* |
|
1330 |
* for reasons too far from being explained here, |
|
1331 |
* this MUST be a compiled method |
|
1332 |
*/ |
|
1333 |
%}. |
|
7601 | 1334 |
^ InvalidCodeError |
1335 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1336 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1337 |
"Created: 4.11.1996 / 21:17:45 / cg" |
1873 | 1338 |
"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
|
1339 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1340 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1341 |
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 |
1873 | 1342 |
"{ Pragma: +optSpace }" |
1343 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1344 |
"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
|
1345 |
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
|
1346 |
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
|
1347 |
|
1873 | 1348 |
%{ |
1349 |
/* |
|
1350 |
* for reasons too far from being explained here, |
|
1351 |
* this MUST be a compiled method |
|
1352 |
*/ |
|
1353 |
%}. |
|
7601 | 1354 |
^ InvalidCodeError |
1355 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1356 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1357 |
"Created: 4.11.1996 / 21:17:52 / cg" |
1873 | 1358 |
"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
|
1359 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1360 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1361 |
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 | 1362 |
"{ Pragma: +optSpace }" |
1363 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1364 |
"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
|
1365 |
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
|
1366 |
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
|
1367 |
|
1873 | 1368 |
%{ |
1369 |
/* |
|
1370 |
* for reasons too far from being explained here, |
|
1371 |
* this MUST be a compiled method |
|
1372 |
*/ |
|
1373 |
%}. |
|
7601 | 1374 |
^ InvalidCodeError |
1375 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1376 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1377 |
"Created: 4.11.1996 / 20:51:28 / cg" |
1873 | 1378 |
"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
|
1379 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1380 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1381 |
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 | 1382 |
"{ Pragma: +optSpace }" |
1383 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1384 |
"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
|
1385 |
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
|
1386 |
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
|
1387 |
|
1873 | 1388 |
%{ |
1389 |
/* |
|
1390 |
* for reasons too far from being explained here, |
|
1391 |
* this MUST be a compiled method |
|
1392 |
*/ |
|
1393 |
%}. |
|
7601 | 1394 |
^ InvalidCodeError |
1395 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1396 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1397 |
"Created: 4.11.1996 / 21:18:09 / cg" |
1873 | 1398 |
"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
|
1399 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1400 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1401 |
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 | 1402 |
"{ Pragma: +optSpace }" |
1403 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1404 |
"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
|
1405 |
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
|
1406 |
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
|
1407 |
|
1873 | 1408 |
%{ |
1409 |
/* |
|
1410 |
* for reasons too far from being explained here, |
|
1411 |
* this MUST be a compiled method |
|
1412 |
*/ |
|
1413 |
%}. |
|
7601 | 1414 |
^ InvalidCodeError |
1415 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1416 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1417 |
"Created: 4.11.1996 / 21:18:17 / cg" |
1873 | 1418 |
"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
|
1419 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1420 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1421 |
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 | 1422 |
"{ Pragma: +optSpace }" |
1423 |
||
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1424 |
"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
|
1425 |
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
|
1426 |
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
|
1427 |
|
1873 | 1428 |
%{ |
1429 |
/* |
|
1430 |
* for reasons too far from being explained here, |
|
1431 |
* this MUST be a compiled method |
|
1432 |
*/ |
|
1433 |
%}. |
|
7601 | 1434 |
^ InvalidCodeError |
1435 |
raiseErrorString:'invalid method - not executable'. |
|
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1436 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1437 |
"Created: 4.11.1996 / 21:18:22 / cg" |
1873 | 1438 |
"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
|
1439 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
1440 |
|
109 | 1441 |
privateMethodCalled |
1873 | 1442 |
"{ Pragma: +optSpace }" |
1443 |
||
980 | 1444 |
"this error is triggered, if a private or protected method is called. |
1445 |
||
360 | 1446 |
If you continue in the debugger, the method will be called, |
12854 | 1447 |
and further privacy exceptions will NOT be reported at this call location, |
360 | 1448 |
until any new method is compiled, or the privacy of any method changes, |
1449 |
or the caches are flushed. |
|
1450 |
(the reason is that after the continue, the method is enterred into the |
|
1451 |
calling cache, for which method privacy is not checked. |
|
1452 |
Any of the above actions flushes this cache and a privacy check |
|
1453 |
is performed again.) |
|
1454 |
Future versions may not enter private methods into the cache, to fix this |
|
1455 |
(unobvious) behavior. However, then you will get an exception for EVERY |
|
1456 |
call to a private method ... |
|
1457 |
||
1458 |
Notice: method privacy is a nonstandard feature, not supported |
|
1459 |
by other smalltalk implementations and not specified in the ANSI spec. |
|
1460 |
This is EXPERIMENTAL - and being evaluated for usability. |
|
1461 |
It may change or even vanish (if it shows to be not useful)." |
|
68 | 1462 |
|
8518
7dc3f9909640
Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents:
8465
diff
changeset
|
1463 |
^ PrivateMethodSignal raiseRequest |
1873 | 1464 |
|
1465 |
"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
|
1466 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1467 |
|
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 |
uncompiledCodeObject |
1873 | 1469 |
"{ Pragma: +optSpace }" |
1470 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1471 |
"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
|
1472 |
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
|
1473 |
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
|
1474 |
For those methods, the compiler generated a method object consisting |
1873 | 1475 |
of the original source code, but with this methods machine/byte code." |
1476 |
||
1477 |
%{ |
|
1478 |
/* |
|
1479 |
* for reasons too far from being explained here, |
|
1480 |
* this MUST be a compiled method |
|
1481 |
*/ |
|
1482 |
%}. |
|
7601 | 1483 |
^ InvalidCodeError |
1484 |
raiseRequestWith:self |
|
1485 |
errorString:'invalid method - not compiled'. |
|
1873 | 1486 |
|
1487 |
"Modified: 4.11.1996 / 22:58:02 / cg" |
|
1488 |
! |
|
1489 |
||
1490 |
unloadedCodeObject |
|
1491 |
"{ Pragma: +optSpace }" |
|
1492 |
||
1493 |
"this method is invoked by methods which have been binary-unloaded |
|
1494 |
For those the source info consists |
|
1495 |
of the original source code, but with this methods machine/byte code." |
|
1496 |
||
1497 |
%{ |
|
1498 |
/* |
|
1499 |
* for reasons too far from being explained here, |
|
1500 |
* this MUST be a compiled method |
|
1501 |
*/ |
|
1502 |
%}. |
|
7601 | 1503 |
^ InvalidCodeError |
1504 |
raiseRequestWith:self |
|
1505 |
errorString:'invalid method - unloaded'. |
|
1873 | 1506 |
|
1507 |
"Created: 4.11.1996 / 22:57:54 / cg" |
|
1508 |
"Modified: 4.11.1996 / 22:58:28 / cg" |
|
1 | 1509 |
! ! |
1510 |
||
9987 | 1511 |
|
93 | 1512 |
!Method methodsFor:'printing & storing'! |
1 | 1513 |
|
1514 |
printOn:aStream |
|
56 | 1515 |
"put a printed representation of the receiver onto aStream. |
1516 |
Since methods do not store their class/selector, we have to search |
|
1517 |
for it here." |
|
1 | 1518 |
|
227 | 1519 |
|classAndSelector m wrapped| |
1 | 1520 |
|
253 | 1521 |
wrapped := false. |
1522 |
||
6234
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1523 |
self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle). |
159 | 1524 |
aStream nextPut:$(. |
227 | 1525 |
|
176 | 1526 |
classAndSelector := self who. |
227 | 1527 |
classAndSelector isNil ifTrue:[ |
6234
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1528 |
" |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1529 |
not anchored in any class. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1530 |
check if wrapped (to be more informative in inspectors) |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1531 |
" |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1532 |
m := self wrapper. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1533 |
m notNil ifTrue:[ |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1534 |
classAndSelector := m who. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1535 |
wrapped := true. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1536 |
] |
227 | 1537 |
]. |
176 | 1538 |
classAndSelector notNil ifTrue:[ |
6234
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1539 |
(classAndSelector methodClass) name printOn:aStream. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1540 |
aStream nextPutAll:' '. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1541 |
(classAndSelector methodSelector) printOn:aStream. |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1542 |
wrapped ifTrue:[ |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1543 |
aStream nextPutAll:'; wrapped' |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1544 |
]. |
1 | 1545 |
] ifFalse:[ |
6234
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1546 |
" |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1547 |
sorry, a method which is nowhere anchored |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1548 |
" |
d8083875f657
fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents:
6160
diff
changeset
|
1549 |
aStream nextPutAll:'unbound' |
56 | 1550 |
]. |
1551 |
aStream nextPut:$) |
|
176 | 1552 |
|
1553 |
" |
|
253 | 1554 |
(Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr. |
1555 |
(Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr. |
|
10083 | 1556 |
|
1557 |
(Object compiledMethodAt:#at:) whoString printOn:Transcript. Transcript cr. |
|
1558 |
(Object compiledMethodAt:#at:) copy whoString printOn:Transcript. Transcript cr. |
|
176 | 1559 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1560 |
|
10083 | 1561 |
"Modified: / 12-10-2006 / 20:32:22 / 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
|
1562 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1563 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1564 |
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
|
1565 |
"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
|
1566 |
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
|
1567 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1568 |
|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
|
1569 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1570 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1571 |
who notNil ifTrue:[ |
11016 | 1572 |
^ 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
|
1573 |
]. |
6071 | 1574 |
^ '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
|
1575 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1576 |
" |
12854 | 1577 |
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
|
1578 |
(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
|
1579 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1580 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1581 |
"Modified: 1.11.1996 / 16:27:04 / cg" |
1 | 1582 |
! ! |
1583 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1584 |
!Method methodsFor:'private'! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1585 |
|
12695 | 1586 |
cacheSourceStream:aStream |
1587 |
"remember a (raw) source stream for later use" |
|
1588 |
||
1589 |
|lastStream| |
|
1590 |
||
1591 |
(package notNil and:[package ~= PackageId noProjectID]) ifTrue:[ |
|
1592 |
LastFileLock critical:[ |
|
1593 |
lastStream := LastFileReference at:1. |
|
1594 |
(lastStream notNil and:[lastStream ~= 0 and:[lastStream isOpen]]) ifTrue:[ |
|
1595 |
lastStream close. |
|
1596 |
]. |
|
1597 |
LastSourceFileName := package,'/',source. |
|
1598 |
LastFileReference at:1 put:aStream. |
|
1599 |
]. |
|
1600 |
]. |
|
1601 |
! |
|
1602 |
||
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1603 |
localSourceStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1604 |
"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
|
1605 |
searching in standard places." |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1606 |
|
8216 | 1607 |
|dir fileName aStream| |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1608 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1609 |
package notNil ifTrue:[ |
8216 | 1610 |
"/ |
1611 |
"/ old: look in 'source/<filename>' |
|
1612 |
"/ this is still kept in order to find user-private |
|
1613 |
"/ classes in her currentDirectory. |
|
1614 |
"/ |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1615 |
fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1616 |
fileName notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1617 |
aStream := fileName asFilename readStreamOrNil. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1618 |
aStream notNil ifTrue:[^ aStream]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1619 |
]. |
8216 | 1620 |
"/ |
1621 |
"/ new: look in package-dir |
|
1622 |
"/ |
|
1623 |
dir := Smalltalk getPackageDirectoryForPackage:package. |
|
1624 |
dir notNil ifTrue:[ |
|
1625 |
fileName := dir construct:source. |
|
1626 |
aStream := fileName asFilename readStreamOrNil. |
|
1627 |
aStream notNil ifTrue:[^ aStream]. |
|
1628 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1629 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1630 |
fileName := Smalltalk getSourceFileName:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1631 |
fileName notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1632 |
aStream := fileName asFilename readStreamOrNil. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1633 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1634 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1635 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1636 |
|
12682 | 1637 |
rawSourceStreamUsingCache:usingCacheBoolean |
1638 |
"return an open sourceStream (needs positioning). |
|
1639 |
If usingCacheBoolean is true, cache the stream (but take care against concurrent access). |
|
1640 |
You have to close the stream, if usingCacheBoolean is false, ans should not close it |
|
1641 |
if usingCacheBoolean is true." |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1642 |
|
12193 | 1643 |
|aStream fileName who myClass mgr className classNameSymbol dir mod| |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1644 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1645 |
" |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1646 |
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
|
1647 |
abs(sourcePosition) is the offset. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1648 |
Otherwise, source is the real source |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1649 |
" |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1650 |
source isNil ifTrue:[^ nil]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1651 |
sourcePosition isNil ifTrue:[^ source readStream]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1652 |
|
12682 | 1653 |
usingCacheBoolean ifTrue:[ |
1654 |
(package notNil and:[package ~= PackageId noProjectID]) ifTrue:[ |
|
1655 |
"/ keep the last source file open, because open/close |
|
1656 |
"/ operations maybe slow on NFS-mounted file systems. |
|
1657 |
"/ Since the reference to the file is weak, it will be closed |
|
12854 | 1658 |
"/ automatically if the file is not referenced for a while. |
12682 | 1659 |
"/ Neat trick. |
1660 |
||
1661 |
LastFileLock critical:[ |
|
1662 |
aStream := LastFileReference at:1. |
|
1663 |
(aStream isNil or:[aStream == 0 or:[aStream isOpen not]]) ifTrue:[ |
|
11950
fa18df7f0e0f
when caching the last sourceStream, care for the package
Claus Gittinger <cg@exept.de>
parents:
11848
diff
changeset
|
1664 |
aStream := nil. |
12695 | 1665 |
LastFileReference at:1 put:nil. |
12682 | 1666 |
]. |
12695 | 1667 |
(aStream notNil and:[LastSourceFileName ~= (package,'/',source)]) ifTrue:[ |
1668 |
aStream := nil. |
|
1669 |
]. |
|
11950
fa18df7f0e0f
when caching the last sourceStream, care for the package
Claus Gittinger <cg@exept.de>
parents:
11848
diff
changeset
|
1670 |
]. |
12682 | 1671 |
|
1672 |
aStream notNil ifTrue:[ |
|
1673 |
^ aStream |
|
1674 |
]. |
|
11950
fa18df7f0e0f
when caching the last sourceStream, care for the package
Claus Gittinger <cg@exept.de>
parents:
11848
diff
changeset
|
1675 |
]. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1676 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1677 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1678 |
"/ a negative sourcePosition indicates |
12854 | 1679 |
"/ that this is a local file |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1680 |
"/ (not to be requested via the sourceCodeManager) |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1681 |
"/ 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
|
1682 |
"/ 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
|
1683 |
"/ 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
|
1684 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1685 |
sourcePosition < 0 ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1686 |
aStream := source asFilename readStreamOrNil. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1687 |
aStream isNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1688 |
"/ search in some standard places |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1689 |
fileName := Smalltalk getSourceFileName:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1690 |
fileName notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1691 |
aStream := fileName asFilename readStreamOrNil. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1692 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1693 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1694 |
aStream notNil ifTrue:[ |
12695 | 1695 |
usingCacheBoolean ifTrue:[ |
1696 |
self cacheSourceStream:aStream. |
|
1697 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1698 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1699 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1700 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1701 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1702 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1703 |
"/ 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
|
1704 |
"/ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1705 |
(Class tryLocalSourceFirst or:[(mgr := Smalltalk at:#SourceCodeManager) isNil]) ifTrue:[ |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1706 |
aStream := self localSourceStream. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1707 |
aStream notNil ifTrue:[ |
12695 | 1708 |
usingCacheBoolean ifTrue:[ |
1709 |
self cacheSourceStream:aStream. |
|
1710 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1711 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1712 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1713 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1714 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1715 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1716 |
"/ 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
|
1717 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1718 |
who := self who. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1719 |
who notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1720 |
myClass := who methodClass. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1721 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1722 |
(package notNil and:[package ~= myClass package]) ifTrue:[ |
12193 | 1723 |
"/ I am an extension |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1724 |
mgr notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1725 |
"/ try to get the source using my package information ... |
12193 | 1726 |
mod := package asPackageId module. |
1727 |
dir := package asPackageId directory. |
|
1728 |
aStream := mgr streamForExtensionFile:source package:package directory:dir module:mod cache:true. |
|
10857 | 1729 |
aStream notNil ifTrue:[ |
12695 | 1730 |
usingCacheBoolean ifTrue:[ |
1731 |
self cacheSourceStream:aStream. |
|
1732 |
]. |
|
10857 | 1733 |
^ aStream |
1734 |
]. |
|
12193 | 1735 |
]. |
1736 |
"/ consult the local fileSystem |
|
1737 |
aStream := self localSourceStream. |
|
1738 |
aStream notNil ifTrue:[ |
|
12695 | 1739 |
usingCacheBoolean ifTrue:[ |
1740 |
self cacheSourceStream:aStream. |
|
1741 |
]. |
|
12193 | 1742 |
^ aStream |
10857 | 1743 |
] |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1744 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1745 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1746 |
aStream := myClass sourceStreamFor:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1747 |
aStream notNil ifTrue:[ |
12695 | 1748 |
usingCacheBoolean ifTrue:[ |
1749 |
self cacheSourceStream:aStream. |
|
1750 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1751 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1752 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1753 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1754 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1755 |
"/ |
12854 | 1756 |
"/ nope - look in standard places |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1757 |
"/ (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
|
1758 |
"/ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1759 |
(mgr notNil and:[Class tryLocalSourceFirst not]) ifTrue:[ |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1760 |
aStream := self localSourceStream. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1761 |
aStream notNil ifTrue:[ |
12695 | 1762 |
usingCacheBoolean ifTrue:[ |
1763 |
self cacheSourceStream:aStream. |
|
1764 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1765 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1766 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1767 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1768 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1769 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1770 |
"/ final chance: try current directory |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1771 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1772 |
aStream isNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1773 |
aStream := source asFilename readStreamOrNil. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1774 |
aStream notNil ifTrue:[ |
12695 | 1775 |
usingCacheBoolean ifTrue:[ |
1776 |
self cacheSourceStream:aStream. |
|
1777 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1778 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1779 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1780 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1781 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1782 |
(who isNil and:[source notNil]) ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1783 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1784 |
"/ mhmh - seems to be a method which used to be in some |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1785 |
"/ class, but has been overwritten by another or removed. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1786 |
"/ (i.e. it has no containing class anyMore) |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1787 |
"/ try to guess the class from the sourceFileName. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1788 |
"/ and retry. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1789 |
"/ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1790 |
className := Smalltalk classNameForFile:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1791 |
(classNameSymbol := className asSymbolIfInterned) notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1792 |
myClass := Smalltalk at:classNameSymbol ifAbsent:nil. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1793 |
myClass notNil ifTrue:[ |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1794 |
aStream := myClass sourceStreamFor:source. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1795 |
aStream notNil ifTrue:[ |
12695 | 1796 |
usingCacheBoolean ifTrue:[ |
1797 |
self cacheSourceStream:aStream. |
|
1798 |
]. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1799 |
^ aStream |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1800 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1801 |
] |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1802 |
] |
12854 | 1803 |
]. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1804 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1805 |
^ nil |
10201 | 1806 |
|
1807 |
"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
|
1808 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1809 |
|
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1810 |
sourceChunkFromStream:aStream |
10673
05229646ecd7
#source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents:
10608
diff
changeset
|
1811 |
PositionError handle:[:ex | |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1812 |
^ nil |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1813 |
] do:[ |
12546
20612721072e
changed: #sourceChunkFromStream:
Stefan Vogel <sv@exept.de>
parents:
12525
diff
changeset
|
1814 |
aStream position1Based:(sourcePosition ? 1) abs. |
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1815 |
]. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1816 |
^ aStream nextChunk. |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1817 |
! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1818 |
|
12682 | 1819 |
sourceStreamUsingCache:usingCacheBoolean |
1820 |
"return an open sourceStream (needs positioning). |
|
1821 |
If usingCacheBoolean is true, cache the stream (but take care against concurrent access). |
|
1822 |
You have to close the stream, if usingCacheBoolean is false, ans should not close it |
|
1823 |
if usingCacheBoolean is true." |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1824 |
|
12695 | 1825 |
|rawStream| |
1826 |
||
1827 |
rawStream := self rawSourceStreamUsingCache:usingCacheBoolean. |
|
1828 |
rawStream isNil ifTrue:[ |
|
1829 |
^ nil. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1830 |
]. |
12695 | 1831 |
|
1832 |
"/ see if its utf8 encoded... |
|
1833 |
^ EncodedStream decodedStreamFor:rawStream. |
|
8141
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1834 |
! ! |
41b25e5f7532
sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents:
8117
diff
changeset
|
1835 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1836 |
!Method methodsFor:'private-compiler interface'! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1837 |
|
5405 | 1838 |
primitiveNumber |
1839 |
"for stx rel >= 5.x only: |
|
1840 |
return the primitive number." |
|
1841 |
||
1842 |
%{ /* NOCONTEXT */ |
|
1843 |
||
1844 |
#ifdef F_PRIMITIVE |
|
1845 |
INT f = __intVal(__INST(flags)); |
|
6014 | 1846 |
OBJ nr = 0; |
5405 | 1847 |
|
1848 |
if (f & F_PRIMITIVE) { |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1849 |
nr = __INST(code_); |
5405 | 1850 |
} |
1851 |
RETURN (nr); |
|
1852 |
#endif |
|
1853 |
%}. |
|
1854 |
self primitiveFailed |
|
1855 |
! |
|
1856 |
||
1857 |
setPrimitiveNumber:aNumber |
|
1858 |
"for stx rel >= 5.x only: |
|
1859 |
mark the method as having primitive code." |
|
1860 |
||
1861 |
%{ /* NOCONTEXT */ |
|
1862 |
||
1863 |
#ifdef F_PRIMITIVE |
|
1864 |
INT f = __intVal(__INST(flags)); |
|
1865 |
||
1866 |
f |= F_PRIMITIVE; |
|
8913 | 1867 |
__INST(flags) = __mkSmallInteger(f); |
5405 | 1868 |
__INST(code_) = aNumber; |
1869 |
RETURN (self); |
|
1870 |
#endif |
|
1871 |
%}. |
|
1872 |
self primitiveFailed |
|
1873 |
||
1874 |
||
1875 |
||
1876 |
! |
|
1877 |
||
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1878 |
setResourceFlag |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1879 |
"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
|
1880 |
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
|
1881 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1882 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1883 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1884 |
#ifdef F_RESOURCE |
2868 | 1885 |
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
|
1886 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1887 |
f |= F_RESOURCE; |
8913 | 1888 |
__INST(flags) = __mkSmallInteger(f); |
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1889 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1890 |
%} |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1891 |
! ! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
1892 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1893 |
!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
|
1894 |
|
2702 | 1895 |
accessedInstVars |
1896 |
"return a collection of instVarNames, which are accessed by |
|
1897 |
the receiver method" |
|
1898 |
||
1899 |
|src parser| |
|
1900 |
||
1901 |
src := self source. |
|
1902 |
src notNil ifTrue:[ |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1903 |
parser := Parser |
12854 | 1904 |
parseMethod:src |
1905 |
in:self containingClass |
|
1906 |
ignoreErrors:true |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1907 |
ignoreWarnings:true. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1908 |
|
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1909 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1910 |
^ parser usedInstVars |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1911 |
]. |
2702 | 1912 |
]. |
1913 |
^ #() "/ actually: unknown |
|
1914 |
||
1915 |
"Modified: 19.6.1997 / 17:54:09 / cg" |
|
1916 |
! |
|
1917 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1918 |
containingClass |
12854 | 1919 |
"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
|
1920 |
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
|
1921 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1922 |
"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
|
1923 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1924 |
|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
|
1925 |
|
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
1926 |
mclass notNil ifTrue:[ |
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
1927 |
"/ check if this (cached) info is still valid ... |
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
1928 |
(mclass containsMethod:self) ifTrue:[ |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
1929 |
^ mclass |
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
1930 |
]. |
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
1931 |
mclass := nil. |
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
1932 |
]. |
5324 | 1933 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1934 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
1935 |
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
|
1936 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1937 |
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
|
1938 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1939 |
^ 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
|
1940 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1941 |
" |
12854 | 1942 |
(Object compiledMethodAt:#at:) containingClass |
1943 |
||
1944 |
(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
|
1945 |
" |
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 |
|
10482 | 1948 |
externalLibraryFunction |
1949 |
"if this is an externalLibraryFunction call, return the externalLibraryFunction. |
|
1950 |
Returns nil otherwise." |
|
1951 |
||
1952 |
^ self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil |
|
1953 |
! |
|
1954 |
||
12913 | 1955 |
hasAnyResource:aCollectionOfSymbols |
1956 |
"return true if the method has a <resource> definition for any symbol in aCollectionOfSymbols" |
|
1957 |
||
1958 |
^ self hasResource and:[ self resources keys includesAny:aCollectionOfSymbols ] |
|
1959 |
||
1960 |
" |
|
1961 |
Method allInstancesDo:[:m | |
|
1962 |
(m hasAnyResource:#(image canvas)) ifTrue:[self halt] |
|
1963 |
]. |
|
1964 |
" |
|
1965 |
! |
|
1966 |
||
12525 | 1967 |
hasCanvasResource |
1968 |
"return true, if this method is an image-resource method. |
|
1969 |
This is done by looking for a #canvas key in the method's resources." |
|
1970 |
||
1971 |
^ self hasResource:#canvas |
|
1972 |
! |
|
1973 |
||
12521 | 1974 |
hasImageResource |
1975 |
"return true, if this method is an image-resource method. |
|
12525 | 1976 |
This is done by looking for a #image key in the method's resources." |
1977 |
||
1978 |
^ self hasResource:#image |
|
1979 |
! |
|
1980 |
||
1981 |
hasMenuResource |
|
1982 |
"return true, if this method is a menu-resource method. |
|
1983 |
This is done by looking for a #image key in the method's resources." |
|
1984 |
||
1985 |
^ self hasResource:#menu |
|
12521 | 1986 |
! |
1987 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1988 |
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
|
1989 |
"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
|
1990 |
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
|
1991 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1992 |
|src| |
159 | 1993 |
|
2218 | 1994 |
"/ first a trivial reject, if the source does not |
5534 | 1995 |
"/ contain a '% {' sequence |
2218 | 1996 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
1997 |
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
|
1998 |
src notNil ifTrue:[ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
1999 |
(src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[ |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2000 |
"/ cannot contain primitive code. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2001 |
^ false |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2002 |
] |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2003 |
]. |
2218 | 2004 |
|
2005 |
"/ ok; it may or may not ... |
|
2006 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2007 |
^ 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
|
2008 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2009 |
" |
12854 | 2010 |
(Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode |
2011 |
(Object compiledMethodAt:#at:) hasPrimitiveCode |
|
2012 |
(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
|
2013 |
" |
159 | 2014 |
|
2218 | 2015 |
"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
|
2016 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2017 |
|
1093
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2018 |
hasResource |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2019 |
"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
|
2020 |
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
|
2021 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2022 |
%{ /* NOCONTEXT */ |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2023 |
|
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2024 |
#ifdef F_RESOURCE |
1133 | 2025 |
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
|
2026 |
#endif |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2027 |
%}. |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2028 |
^ false |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2029 |
! |
1e742016eea0
category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents:
1087
diff
changeset
|
2030 |
|
11394 | 2031 |
hasResource:aSymbol |
12913 | 2032 |
"return true if the method has a <resource> definition for aSymbol." |
11394 | 2033 |
|
2034 |
^ self hasResource and:[ self resources includesKey:aSymbol ] |
|
2035 |
||
2036 |
" |
|
2037 |
Method allInstancesDo:[:m | |
|
2038 |
(m hasResource:#image) ifTrue:[self halt] |
|
2039 |
]. |
|
2040 |
" |
|
2041 |
! |
|
2042 |
||
2694
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2043 |
homeMethod |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2044 |
"for common protocol with blocks: if the receiver is a method, |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2045 |
return the receiver; otherwise, if its a block, return its home |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2046 |
method." |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2047 |
|
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2048 |
^ self |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2049 |
|
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2050 |
"Created: 19.6.1997 / 16:13:12 / cg" |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2051 |
! |
46ba8cbdc013
added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2558
diff
changeset
|
2052 |
|
10482 | 2053 |
indexOfOLECall |
2054 |
"return true, if the method contains ole call; false if not. |
|
2055 |
Uses Parser to parse methods source and get the information." |
|
2056 |
||
2057 |
|funcOrNil| |
|
2058 |
||
2059 |
funcOrNil := self externalLibraryFunction. |
|
2060 |
(funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil]. |
|
2061 |
^ funcOrNil vtableIndex |
|
2062 |
||
2063 |
" |
|
12854 | 2064 |
(Method compiledMethodAt:#hasPrimitiveCode) isOLECall |
2065 |
(Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall |
|
2066 |
||
2067 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall |
|
2068 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall |
|
2069 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall |
|
2070 |
(Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall |
|
2071 |
||
2072 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall |
|
2073 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction |
|
2074 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall |
|
2075 |
(IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall |
|
10482 | 2076 |
" |
2077 |
! |
|
2078 |
||
11986 | 2079 |
isDocumentationMethod |
11987 | 2080 |
"Return true, if this is a documentation only (only a comment) method |
2081 |
(implies being a metaclass method)" |
|
11986 | 2082 |
|
12275
8ca2aabefa4e
changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents:
12216
diff
changeset
|
2083 |
self mclass isMeta ifFalse:[^ false]. |
12283
54b6f67bcc26
changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents:
12275
diff
changeset
|
2084 |
self isVersionMethod ifTrue:[^ false]. |
12159 | 2085 |
^ self parse:#'parseMethodSilent:' return:#isEmptyMethod or:false. |
11986 | 2086 |
! |
2087 |
||
10482 | 2088 |
isExternalLibraryFunctionCall |
2089 |
"Return true, if this is an externalLibraryFunction call." |
|
2090 |
||
12569
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2091 |
"/ 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
|
2092 |
"/ to be fixed... |
b97efbbc1ac7
comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents:
12546
diff
changeset
|
2093 |
|
10482 | 2094 |
^ self externalLibraryFunction notNil |
2095 |
! |
|
2096 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2097 |
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
|
2098 |
"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
|
2099 |
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
|
2100 |
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
|
2101 |
(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
|
2102 |
|
2558 | 2103 |
|m myCode| |
1873 | 2104 |
|
2105 |
myCode := self code. |
|
2106 |
||
2107 |
m := self trapMethodForNumArgs:(self numArgs). |
|
2108 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2109 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2110 |
(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
|
2111 |
]. |
159 | 2112 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2113 |
m := Method compiledMethodAt:#uncompiledCodeObject. |
1873 | 2114 |
(m notNil and:[self ~~ m]) ifTrue:[ |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2115 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2116 |
(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
|
2117 |
]. |
1873 | 2118 |
|
2119 |
m := Method compiledMethodAt:#unloadedCodeObject. |
|
2120 |
(m notNil and:[self ~~ m]) ifTrue:[ |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2121 |
(myCode notNil and:[myCode = m code]) ifTrue:[^ true]. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2122 |
(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
|
2123 |
]. |
1873 | 2124 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2125 |
^ false |
1194
628abcb5fbb6
moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents:
1190
diff
changeset
|
2126 |
|
1873 | 2127 |
"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
|
2128 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2129 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2130 |
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
|
2131 |
"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
|
2132 |
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
|
2133 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2134 |
^ 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
|
2135 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2136 |
|
10482 | 2137 |
isOLECall |
2138 |
"return true, if the method is an ole call; false if not." |
|
2139 |
||
2140 |
|funcOrNil| |
|
2141 |
||
2142 |
funcOrNil := self externalLibraryFunction. |
|
2143 |
^ funcOrNil notNil and:[funcOrNil isCallTypeOLE] |
|
2144 |
! |
|
2145 |
||
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2146 |
isObsolete |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2147 |
"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
|
2148 |
|
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2149 |
|res| |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2150 |
|
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2151 |
^ (res := self resources) notNil and:[res includesKey:#obsolete] |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2152 |
! |
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2153 |
|
11985 | 2154 |
isVersionMethod |
12017
908685b92c3e
comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents:
12016
diff
changeset
|
2155 |
"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
|
2156 |
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
|
2157 |
method attribute for that..." |
11985 | 2158 |
|
12016 | 2159 |
^ self mclass isMeta |
12165 | 2160 |
and:[(AbstractSourceCodeManager isVersionMethodSelector:self selector)] |
11985 | 2161 |
|
2162 |
" |
|
12854 | 2163 |
(Method class compiledMethodAt:#version) isVersionMethod |
11985 | 2164 |
(Method class compiledMethodAt:#documentation) isVersionMethod |
2165 |
" |
|
2166 |
! |
|
2167 |
||
11848 | 2168 |
isVisualWorksTypedef |
2169 |
"Return true, if this is a type-returning method (a visualWorks typedef)" |
|
2170 |
||
2171 |
^ (self literals size > 0) |
|
2172 |
and:[ (self literalAt:1) isKindOf:CType ] |
|
2173 |
! |
|
2174 |
||
2695
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2175 |
mclass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2176 |
"return the class in which the receiver was compiled. |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2177 |
Same as #containingClass, for ST80 compatibility." |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2178 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2179 |
^ self containingClass |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2180 |
|
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2181 |
"Created: 19.6.1997 / 16:26:13 / cg" |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2182 |
! |
79229a9ab2da
added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2694
diff
changeset
|
2183 |
|
5696 | 2184 |
messages |
2185 |
"return a collection of message-selectors, sent by this method." |
|
2186 |
||
2187 |
^ self messagesSent |
|
2188 |
! |
|
2189 |
||
5584
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2190 |
messagesDo:aBlock |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2191 |
"evaluate aBlock for each message-selector sent by this method. |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2192 |
Uses Parser to parse methods source and extract the names." |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2193 |
|
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2194 |
^ self messagesSent do:aBlock |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2195 |
! |
b175797a8c4d
#messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
5582
diff
changeset
|
2196 |
|
5582 | 2197 |
messagesSent |
2198 |
"return a collection with the message selectors sent to by the receiver. |
|
2199 |
Uses Parser to parse methods source and extract the names. |
|
2200 |
The returned collection includes all used message selectors (i.e. including super-send messages)" |
|
2201 |
||
12854 | 2202 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#() |
5582 | 2203 |
|
2204 |
" |
|
12854 | 2205 |
(Method compiledMethodAt:#printOn:) messagesSent |
2206 |
(Point compiledMethodAt:#x:) messagesSent |
|
5582 | 2207 |
" |
2208 |
! |
|
2209 |
||
2210 |
messagesSentToSelf |
|
2211 |
"return a collection with the message selectors sent to self by the receiver. |
|
2212 |
Uses Parser to parse methods source and extract the names." |
|
2213 |
||
12854 | 2214 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSelf or:#() |
5652 | 2215 |
|
5582 | 2216 |
! |
2217 |
||
2218 |
messagesSentToSuper |
|
2219 |
"return a collection with the message selectors sent to super by the receiver. |
|
2220 |
Uses Parser to parse methods source and extract the names." |
|
2221 |
||
12854 | 2222 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSuper or:#() |
5652 | 2223 |
|
5582 | 2224 |
! |
2225 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2226 |
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
|
2227 |
"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
|
2228 |
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
|
2229 |
Returns nil if the source is not available, or some other |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2230 |
syntax/parse error occurred. For methods with no args and no vars, |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2231 |
an empty collection 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
|
2232 |
|
8427 | 2233 |
|parserClass parser sourceString argNames varNames| |
2234 |
||
2235 |
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
|
2236 |
sourceString := self source. |
8427 | 2237 |
(parserClass notNil and:[sourceString notNil]) ifTrue:[ |
2238 |
parser := parserClass parseMethodArgAndVarSpecificationSilent:sourceString. |
|
8419 | 2239 |
(parser isNil or:[parser == #Error]) ifTrue:[^ nil]. |
2240 |
argNames := parser methodArgs. |
|
2241 |
varNames := parser methodVars. |
|
2242 |
argNames isNil ifTrue:[^ varNames]. |
|
2243 |
varNames isNil ifTrue:[^ argNames]. |
|
2244 |
^ (argNames , varNames) |
|
159 | 2245 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2246 |
^ 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
|
2247 |
|
159 | 2248 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2249 |
(Method compiledMethodAt:#printOn:) methodArgAndVarNames |
159 | 2250 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2251 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2252 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2253 |
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
|
2254 |
"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
|
2255 |
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
|
2256 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2257 |
^ 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
|
2258 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2259 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2260 |
(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
|
2261 |
" |
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 |
|
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 |
"Modified: 31.10.1995 / 14:36:46 / cg" |
872 | 2264 |
! |
2265 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2266 |
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
|
2267 |
"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
|
2268 |
This is a somewhat stupid implementation." |
872 | 2269 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2270 |
|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
|
2271 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2272 |
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
|
2273 |
(text size < 2) ifTrue:[^nil]. |
872 | 2274 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2275 |
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
|
2276 |
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
|
2277 |
(nQuote == 2) ifTrue:[ |
6956
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2278 |
qIndex := line indexOf:(Character doubleQuote). |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2279 |
qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1). |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2280 |
^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1) |
872 | 2281 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2282 |
(nQuote == 1) ifTrue:[ |
6956
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2283 |
qIndex := line indexOf:(Character doubleQuote). |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2284 |
comment := line copyFrom:(qIndex + 1). |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2285 |
(line indexOf:$/ startingAt:qIndex) == (qIndex+1) ifTrue:[ |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2286 |
"/ an EOL comment |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2287 |
^ (comment copyFrom:2) withoutSeparators |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2288 |
]. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2289 |
|
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2290 |
"/ not an EOL comment |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2291 |
index := 3. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2292 |
line := text at:index. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2293 |
nQuote := line occurrencesOf:(Character doubleQuote). |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2294 |
[nQuote ~~ 1] whileTrue:[ |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2295 |
comment := comment , Character cr asString , line withoutSpaces. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2296 |
index := index + 1. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2297 |
line := text at:index. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2298 |
nQuote := line occurrencesOf:(Character doubleQuote) |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2299 |
]. |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2300 |
qIndex := line indexOf:(Character doubleQuote). |
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
2301 |
^ 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
|
2302 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2303 |
^ 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
|
2304 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2305 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2306 |
(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
|
2307 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2308 |
! |
872 | 2309 |
|
9364 | 2310 |
methodDefinitionTemplate |
2311 |
"return the string that defines the method and the arguments" |
|
2312 |
||
12854 | 2313 |
^ Method |
2314 |
methodDefinitionTemplateForSelector:self selector |
|
12324
5ad1797fe12d
comment/format in: #methodDefinitionTemplate
Claus Gittinger <cg@exept.de>
parents:
12323
diff
changeset
|
2315 |
andArgumentNames:self methodArgNames |
9364 | 2316 |
|
2317 |
" |
|
2318 |
(self compiledMethodAt:#printOn:) methodDefinitionTemplate |
|
2319 |
" |
|
2320 |
! |
|
2321 |
||
12900
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2322 |
methodInvocationInfo |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2323 |
^ nil |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2324 |
|
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2325 |
"Created: / 27-04-2010 / 13:36:12 / cg" |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2326 |
! |
4cda19285039
category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
12899
diff
changeset
|
2327 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2328 |
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
|
2329 |
"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
|
2330 |
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
|
2331 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2332 |
^ 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
|
2333 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2334 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2335 |
(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
|
2336 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2337 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2338 |
"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
|
2339 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2340 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2341 |
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
|
2342 |
"try to extract the modificationTime as a timeStamp from |
12854 | 2343 |
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
|
2344 |
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
|
2345 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2346 |
|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
|
2347 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2348 |
HistoryManager isNil ifTrue:[^ nil]. |
1873 | 2349 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2350 |
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
|
2351 |
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
|
2352 |
list := HistoryManager getAllHistoriesFrom:s. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2353 |
list size == 0 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
|
2354 |
histLine := list last. |
12854 | 2355 |
^ Timestamp |
2356 |
fromDate:histLine date |
|
8252
16ed6cd9868d
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
8216
diff
changeset
|
2357 |
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
|
2358 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2359 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2360 |
(Method compiledMethodAt:#modificationTime) modificationTime |
12854 | 2361 |
(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
|
2362 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2363 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2364 |
"Modified: 8.9.1995 / 15:08:22 / claus" |
1873 | 2365 |
"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
|
2366 |
! |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2367 |
|
3845
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2368 |
name |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2369 |
"for compatibility with javaMethods" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2370 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2371 |
^ self selector |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2372 |
|
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2373 |
"Created: / 9.11.1998 / 06:15:08 / cg" |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2374 |
! |
729fda604d59
added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents:
3697
diff
changeset
|
2375 |
|
12854 | 2376 |
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
|
2377 |
"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
|
2378 |
Get the source, let parser parse it using parseSelector, |
1873 | 2379 |
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
|
2380 |
|
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2381 |
^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2382 |
|
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2383 |
" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2384 |
(Method compiledMethodAt:#parse:return:or:) |
12854 | 2385 |
parse:#'parseMethodSilent:' return:#sentMessages or:#() |
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2386 |
" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2387 |
! |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2388 |
|
12854 | 2389 |
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource |
5633
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2390 |
"helper for methodArgNames, methodVarNames etc. |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2391 |
Get the source, let parser parse it using parseSelector, |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2392 |
return parser-info using accessSelector" |
15b028ad5e03
#usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents:
5584
diff
changeset
|
2393 |
|
8427 | 2394 |
|parser parserClass sourceString| |
2395 |
||
2396 |
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
|
2397 |
sourceString := self source. |
8427 | 2398 |
(parserClass notNil and:[sourceString notNil]) ifTrue:[ |
8419 | 2399 |
parseSelector numArgs == 2 ifTrue:[ |
8427 | 2400 |
parser := parserClass perform:parseSelector with:sourceString with:arg2. |
8419 | 2401 |
] ifFalse:[ |
8427 | 2402 |
parser := parserClass perform:parseSelector with:sourceString. |
8419 | 2403 |
]. |
2404 |
(parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource]. |
|
2405 |
^ 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
|
2406 |
]. |
1873 | 2407 |
^ valueIfNoSource |
2408 |
||
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
2409 |
" |
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
2410 |
(Method compiledMethodAt:#parse:return:or:) |
12854 | 2411 |
parse:#'parseMethodSilent:' return:#sentMessages or:#() |
5500
8bc3b30296ae
more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents:
5406
diff
changeset
|
2412 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2413 |
! |
159 | 2414 |
|
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2415 |
parseResources |
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2416 |
"return the methods resource spec; either nil or a collection of symbols." |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2417 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2418 |
|src parser| |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2419 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2420 |
src := self source. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2421 |
src isNil ifTrue:[ |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2422 |
^ nil "/ actually: dont know |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2423 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2424 |
|
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2425 |
(src findString:'resource:') == 0 ifTrue:[ |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2426 |
^ nil "/ actually: error |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2427 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2428 |
"/ no need to parse all - only interested in resource-info |
8427 | 2429 |
self parserClass isNil ifTrue:[ |
12854 | 2430 |
^ nil |
8427 | 2431 |
]. |
8419 | 2432 |
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
|
2433 |
parser isNil ifTrue:[ |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2434 |
^ nil "/ actually error |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2435 |
]. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2436 |
^ parser primitiveResources. |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2437 |
! |
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2438 |
|
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2439 |
previousVersion |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2440 |
"return the receivers previous versions source code" |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2441 |
|
7210 | 2442 |
|sel cls previous| |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2443 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2444 |
sel := self selector. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2445 |
sel isNil ifTrue:[ ^ nil ]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2446 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2447 |
cls := self mclass. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2448 |
cls isNil ifTrue:[ ^ nil ]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2449 |
|
12854 | 2450 |
ChangeSet current reverseDo:[:change | |
2451 |
(change isMethodChange |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2452 |
and:[ (change selector == sel) |
12854 | 2453 |
and:[ change changeClass == cls ]]) |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2454 |
ifTrue:[ |
7210 | 2455 |
previous := change previousVersion. |
2456 |
previous notNil ifTrue:[ |
|
2457 |
^ previous |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2458 |
] |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2459 |
] |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2460 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2461 |
^ nil. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2462 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2463 |
"/ history := Class methodHistory. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2464 |
"/ history isNil ifTrue:[^ nil]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2465 |
"/ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2466 |
"/ entry := history detect:[:entry | |type old new| |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2467 |
"/ type := entry first. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2468 |
"/ type == #methodChange ifTrue:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2469 |
"/ old := entry second. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2470 |
"/ new := entry third. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2471 |
"/ new == self |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2472 |
"/ ] ifFalse:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2473 |
"/ false |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2474 |
"/ ] |
12854 | 2475 |
"/ ] |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2476 |
"/ ifNone:nil. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2477 |
"/ entry isNil ifTrue:[^nil]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2478 |
"/ ^ entry second. |
5339 | 2479 |
"/ ^ history at:self ifAbsent:nil |
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2480 |
|
1925 | 2481 |
"Modified: 7.11.1996 / 19:06:22 / cg" |
1923
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2482 |
! |
97b099fef985
optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents:
1873
diff
changeset
|
2483 |
|
7210 | 2484 |
previousVersionCode |
2485 |
"return the receivers previous versions source code" |
|
2486 |
||
2487 |
|previous| |
|
2488 |
||
2489 |
previous := self previousVersion. |
|
2490 |
previous isNil ifTrue:[ ^ nil ]. |
|
2491 |
||
2492 |
^ previous source |
|
2493 |
! |
|
2494 |
||
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2495 |
previousVersions |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2496 |
"return a collection of the receivers previous versions (sources)" |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2497 |
|
7453 | 2498 |
|sel cls versions lastChange firstSrc last| |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2499 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2500 |
sel := self selector. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2501 |
sel isNil ifTrue:[^ #()]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2502 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2503 |
cls := self mclass. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2504 |
cls isNil ifTrue:[^ #()]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2505 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2506 |
versions := OrderedCollection new. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2507 |
|
12854 | 2508 |
ChangeSet current reverseDo:[:change | |
2509 |
(change isMethodChange |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2510 |
and:[ (change selector == sel) |
12854 | 2511 |
and:[ change changeClass == cls ]]) |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2512 |
ifTrue:[ |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2513 |
versions addFirst:change. |
12854 | 2514 |
lastChange := change. |
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2515 |
] |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2516 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2517 |
|
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2518 |
lastChange notNil ifTrue:[ |
7453 | 2519 |
last := lastChange previousVersion. |
2520 |
last notNil ifTrue:[ |
|
2521 |
firstSrc := last source. |
|
2522 |
(firstSrc size > 0 |
|
2523 |
and:[ firstSrc ~= lastChange source]) ifTrue:[ |
|
12854 | 2524 |
versions addFirst:(MethodChange |
2525 |
className:lastChange className |
|
7453 | 2526 |
selector:lastChange selector |
2527 |
source:firstSrc |
|
2528 |
category:lastChange category). |
|
2529 |
] |
|
6644
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2530 |
] |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2531 |
]. |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2532 |
^ versions |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2533 |
! |
141198d9b865
previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents:
6541
diff
changeset
|
2534 |
|
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2535 |
readsField:instVarIndex |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2536 |
"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
|
2537 |
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
|
2538 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2539 |
|varName readInstVars| |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2540 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2541 |
varName := (self mclass allInstVarNames) at:instVarIndex. |
5636 | 2542 |
readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#readInstVars or:#(). |
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2543 |
^ readInstVars includes:varName. |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2544 |
! |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2545 |
|
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2546 |
resourceType |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2547 |
"ST-80 compatibility: |
12854 | 2548 |
return the methods first resource specs key. |
8526 | 2549 |
Returns either nil, or a single symbol." |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2550 |
|
3387 | 2551 |
|resources| |
2552 |
||
2553 |
(resources := self resources) notNil ifTrue:[ |
|
8526 | 2554 |
resources keysAndValuesDo:[:key :val| |
2555 |
^ key |
|
2556 |
]. |
|
3341 | 2557 |
]. |
3387 | 2558 |
^ nil |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2559 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2560 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2561 |
resources |
5894
ed6193fa6040
Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents:
5818
diff
changeset
|
2562 |
"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
|
2563 |
|
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2564 |
self hasResource ifFalse:[^ nil]. |
5721
5f97733ff519
methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents:
5704
diff
changeset
|
2565 |
^ self parseResources. |
3052
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2566 |
! |
f384e7082ee9
more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents:
3030
diff
changeset
|
2567 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2568 |
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
|
2569 |
"return the selector under which I am found in my containingClasses |
12854 | 2570 |
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
|
2571 |
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
|
2572 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2573 |
"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
|
2574 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2575 |
|who| |
68 | 2576 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2577 |
who := self who. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2578 |
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
|
2579 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2580 |
none found - sorry |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2581 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2582 |
^ nil |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2583 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2584 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2585 |
|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
|
2586 |
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
|
2587 |
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
|
2588 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2589 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2590 |
"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
|
2591 |
! |
68 | 2592 |
|
5534 | 2593 |
sends:aSelectorSymbol |
2594 |
"return true, if this method contains a message-send |
|
2595 |
with aSelectorSymbol as selector." |
|
2596 |
||
2597 |
(self referencesLiteral:aSelectorSymbol) ifTrue:[ |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2598 |
^ self messagesSent includesIdentical:aSelectorSymbol |
5534 | 2599 |
]. |
2600 |
^ false |
|
2601 |
! |
|
2602 |
||
12363 | 2603 |
sends:selectorSymbol1 or:selectorSymbol2 |
2604 |
"return true, if this method contains a message-send |
|
2605 |
to either selectorSymbol1 or selectorSymbol2." |
|
2606 |
||
2607 |
|msgs| |
|
2608 |
||
2609 |
((self referencesLiteral:selectorSymbol1) or:[self referencesLiteral:selectorSymbol2]) ifTrue:[ |
|
2610 |
msgs := self messagesSent. |
|
2611 |
^ (msgs includesIdentical:selectorSymbol1) or:[msgs includesIdentical:selectorSymbol2] |
|
2612 |
]. |
|
2613 |
^ false |
|
2614 |
! |
|
2615 |
||
11022
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2616 |
shouldBeSkippedInDebuggersWalkBack |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2617 |
"return true, if this method thinks, it should be skipped in a walkback. |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2618 |
This is done by looking for a #skipInDebuggersWalkBack flag in the methods resources." |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2619 |
|
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2620 |
|resources| |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2621 |
|
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2622 |
resources := self resources. |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2623 |
^ resources notNil and:[ resources includesKey:#skipInDebuggersWalkBack ]. |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2624 |
! |
8dd9f699915f
+shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents:
11016
diff
changeset
|
2625 |
|
5696 | 2626 |
superMessages |
2627 |
"return a collection of message-selectors, sent to super by this method." |
|
2628 |
||
2629 |
^ self messagesSentToSuper |
|
2630 |
! |
|
2631 |
||
5523 | 2632 |
usedGlobals |
2633 |
"return a collection with the global names referred to by the receiver. |
|
2634 |
Uses Parser to parse methods source and extract them." |
|
2635 |
||
12854 | 2636 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#() |
5523 | 2637 |
|
2638 |
" |
|
12854 | 2639 |
(Method compiledMethodAt:#resources) usedGlobals |
5523 | 2640 |
" |
2641 |
! |
|
2642 |
||
5509 | 2643 |
usedSymbols |
2644 |
"return a collection with the symbols referred to by the receiver. |
|
2645 |
Uses Parser to parse methods source and extract them. |
|
12854 | 2646 |
This collection only includes implicit symbols references |
8895 | 2647 |
(i.e. not messages sent)" |
5509 | 2648 |
|
12854 | 2649 |
^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#() |
5509 | 2650 |
|
2651 |
" |
|
12854 | 2652 |
(Method compiledMethodAt:#usedSymbols) usedSymbols |
2653 |
(Method compiledMethodAt:#usedSymbols) messagesSent |
|
5509 | 2654 |
" |
2655 |
! |
|
2656 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2657 |
who |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2658 |
"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
|
2659 |
nil is returned for unbound methods. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2660 |
|
12854 | 2661 |
ST/X special notice: |
5665 | 2662 |
returns an instance of MethodWhoInfo, which |
2663 |
responds to #methodClass and #methodSelector query messages. |
|
2664 |
For backward- (& ST-80) compatibility, the returned object also |
|
2665 |
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
|
2666 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2667 |
Implementation notice: |
12854 | 2668 |
Since there is no information of the containing class |
5665 | 2669 |
in the method, we have to do a search here. |
2670 |
||
2671 |
Normally, this is not a problem, except when a method is |
|
2672 |
accepted in the debugger or redefined from within a method |
|
2673 |
(maybe done indirectly, if #doIt is done recursively) |
|
12854 | 2674 |
- the information about which class the original method was |
5665 | 2675 |
defined in is lost in this case. |
68 | 2676 |
|
12854 | 2677 |
Problem: |
5665 | 2678 |
this is heavily called for in the debugger to create |
2679 |
a readable context walkback. For unbound methods, it is |
|
2680 |
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
|
2681 |
|
12854 | 2682 |
Q: should we add a backref from the method to the class |
5665 | 2683 |
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
|
2684 |
Q2: if so, what about the bad guy then, who copies methods around to |
5665 | 2685 |
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
|
2686 |
|
6420 | 2687 |
|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
|
2688 |
|
5324 | 2689 |
mclass notNil ifTrue:[ |
5665 | 2690 |
sel := mclass selectorAtMethod:self. |
2691 |
sel notNil ifTrue:[ |
|
2692 |
^ MethodWhoInfo class:mclass selector:sel |
|
2693 |
]. |
|
5704
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
2694 |
"/ flush outdated mclass info |
aeeece3a93ef
flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents:
5700
diff
changeset
|
2695 |
mclass := nil. |
5324 | 2696 |
]. |
2697 |
||
6420 | 2698 |
checkBlock := [:cls | |
2699 |
|sel| |
|
2700 |
||
2701 |
sel := cls selectorAtMethod:self. |
|
2702 |
sel notNil ifTrue:[ |
|
2703 |
LastWhoClass := cls theNonMetaclass name. |
|
2704 |
mclass isNil ifTrue:[ |
|
2705 |
mclass := cls |
|
2706 |
]. |
|
2707 |
^ MethodWhoInfo class:cls selector:sel |
|
2708 |
]. |
|
2709 |
]. |
|
2710 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2711 |
" |
5294
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2712 |
speedup kludge: if my sourceFileName is valid, |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2713 |
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
|
2714 |
" |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2715 |
(fn := self sourceFilename) notNil ifTrue:[ |
10156 | 2716 |
clsName := fn asFilename nameWithoutSuffix. |
5665 | 2717 |
clsName := clsName asSymbolIfInterned. |
2718 |
clsName notNil ifTrue:[ |
|
2719 |
cls := Smalltalk at:clsName ifAbsent:nil. |
|
2720 |
cls notNil ifTrue:[ |
|
6420 | 2721 |
checkBlock value:cls theNonMetaclass. |
2722 |
checkBlock value:cls theMetaclass. |
|
5665 | 2723 |
] |
2724 |
]. |
|
5294
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2725 |
]. |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2726 |
|
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2727 |
" |
f2d689cf7be4
speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents:
5284
diff
changeset
|
2728 |
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
|
2729 |
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
|
2730 |
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
|
2731 |
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
|
2732 |
" |
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 |
LastWhoClass notNil ifTrue:[ |
5665 | 2734 |
cls := Smalltalk at:LastWhoClass ifAbsent:nil. |
2735 |
cls notNil ifTrue:[ |
|
6420 | 2736 |
checkBlock value:cls theNonMetaclass. |
2737 |
checkBlock value:cls theMetaclass. |
|
5665 | 2738 |
] |
68 | 2739 |
]. |
227 | 2740 |
|
142 | 2741 |
" |
12854 | 2742 |
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
|
2743 |
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
|
2744 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2745 |
classes := Smalltalk allClasses. |
142 | 2746 |
" |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2747 |
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
|
2748 |
" |
6420 | 2749 |
classes do:[:cls | |
2750 |
checkBlock value:cls theNonMetaclass. |
|
2751 |
checkBlock value:cls theMetaclass. |
|
142 | 2752 |
]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2753 |
|
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 |
LastWhoClass := nil. |
6397
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
2755 |
"/ " |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
2756 |
"/ 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
|
2757 |
"/ 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
|
2758 |
"/ " |
6420 | 2759 |
"/ Behavior allSubInstancesDo:[:someClassLikeThingy | |
2760 |
"/ (classes includes:someClassLikeThingy) ifFalse:[ |
|
2761 |
"/ checkBlock value:someClassLikeThingy. |
|
6397
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
2762 |
"/ ] |
311358bdeed6
do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents:
6365
diff
changeset
|
2763 |
"/ ]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2764 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2765 |
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
|
2766 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2767 |
^ nil |
444 | 2768 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2769 |
"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
|
2770 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2771 |
|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
|
2772 |
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
|
2773 |
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
|
2774 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2775 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2776 |
"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
|
2777 |
" |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2778 |
|m cls| |
444 | 2779 |
|
12854 | 2780 |
Object |
2781 |
subclass:#FunnyClass |
|
5665 | 2782 |
instanceVariableNames:'foo' |
2783 |
classVariableNames:'' |
|
2784 |
poolDictionaries:'' |
|
2785 |
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
|
2786 |
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
|
2787 |
Smalltalk removeClass:cls. |
444 | 2788 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2789 |
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
|
2790 |
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
|
2791 |
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
|
2792 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2793 |
m 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
|
2794 |
" |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2795 |
|
10156 | 2796 |
"Modified: / 07-11-2006 / 13:58:50 / cg" |
68 | 2797 |
! |
2798 |
||
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2799 |
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
|
2800 |
"only for wrapped methods: return the 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
|
2801 |
Thats the WrapperMethod which contains myself." |
159 | 2802 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2803 |
WrappedMethod allInstancesDo:[:m | |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2804 |
m originalMethod == self ifTrue:[^ m]. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2805 |
]. |
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2806 |
^ nil |
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2807 |
! |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2808 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2809 |
writesField:instVarIndex |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2810 |
"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
|
2811 |
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
|
2812 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2813 |
|varName modifiedInstVars| |
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2814 |
|
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2815 |
varName := (self mclass allInstVarNames) at:instVarIndex. |
5636 | 2816 |
modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). |
5564
0f513f04c50f
#readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents:
5562
diff
changeset
|
2817 |
^ modifiedInstVars includes:varName. |
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2818 |
! ! |
13 | 2819 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2820 |
!Method methodsFor:'trap methods'! |
13 | 2821 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2822 |
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
|
2823 |
"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
|
2824 |
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
|
2825 |
the objectFileLoader to invalidate methods whose code is unloaded." |
1 | 2826 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2827 |
|invldMethod| |
159 | 2828 |
|
1873 | 2829 |
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
|
2830 |
self code:invldMethod code. |
1873 | 2831 |
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
|
2832 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2833 |
"Created: 17.9.1995 / 15:00:52 / claus" |
1873 | 2834 |
"Modified: 4.11.1996 / 23:04:34 / cg" |
1 | 2835 |
! |
2836 |
||
952
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 |
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
|
2838 |
"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
|
2839 |
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
|
2840 |
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
|
2841 |
after a class definition change (for example: instvars are no longer there)." |
1 | 2842 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2843 |
|invldMethod| |
872 | 2844 |
|
952
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 |
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
|
2846 |
self code:invldMethod code. |
1873 | 2847 |
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
|
2848 |
|
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2849 |
"Created: 17.9.1995 / 15:01:14 / claus" |
1873 | 2850 |
"Modified: 4.11.1996 / 23:04:46 / cg" |
2851 |
! |
|
2852 |
||
2853 |
makeUnloaded |
|
2854 |
"make the receiver an unloaded method, which raises an invalidCodeObject |
|
2855 |
signal when executed. This is not for public use - it is required for |
|
2856 |
the objectFileLoader to invalidate methods for which a shared library has |
|
2857 |
been removed." |
|
2858 |
||
2859 |
|invldMethod| |
|
2860 |
||
2861 |
invldMethod := self class compiledMethodAt:#unloadedCodeObject. |
|
2862 |
self code:invldMethod code. |
|
2863 |
self byteCode:nil. |
|
2864 |
||
2865 |
"Created: 4.11.1996 / 22:59:21 / cg" |
|
2866 |
"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
|
2867 |
! |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2868 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2869 |
trapMethodForNumArgs:numArgs |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2870 |
|trapSel| |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2871 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2872 |
trapSel := #( |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2873 |
#'invalidCodeObject' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2874 |
#'invalidCodeObjectWith:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2875 |
#'invalidCodeObjectWith:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2876 |
#'invalidCodeObjectWith:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2877 |
#'invalidCodeObjectWith:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2878 |
#'invalidCodeObjectWith:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2879 |
#'invalidCodeObjectWith:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2880 |
#'invalidCodeObjectWith:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2881 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2882 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2883 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2884 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2885 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2886 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2887 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2888 |
#'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:' |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2889 |
) at:(numArgs + 1). |
1870
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2890 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2891 |
^ Method compiledMethodAt:trapSel. |
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2892 |
|
2623b60c27e1
lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
2893 |
"Created: 4.11.1996 / 21:58:58 / cg" |
1873 | 2894 |
"Modified: 4.11.1996 / 23:18:05 / 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
|
2895 |
! ! |
872 | 2896 |
|
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2897 |
!Method::MethodWhoInfo class methodsFor:'documentation'! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2898 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2899 |
documentation |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2900 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2901 |
In earlier times, Method>>who returned an array filled |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2902 |
with the methods class and selector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2903 |
This was done, since a smalltalk method cannot return multiple |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2904 |
values, but 2 values had to be returned from that method. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2905 |
Thus, the who-interface was used as: |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2906 |
info := <someMethod> who. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2907 |
class := info at:1. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2908 |
sel := info at:2. |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2909 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2910 |
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
|
2911 |
an object (an instance of MethodWhoInfo) which responds to the two |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2912 |
messages: #methodClass and #methodSelector. |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2913 |
This allows to write things much more intuitive: |
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2914 |
info := <someMethod> who. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2915 |
class := info methodClass. |
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2916 |
sel := info methodSelector. |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2917 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2918 |
However, to be backward compatible, the returned object still responds to |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2919 |
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
|
2920 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2921 |
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
|
2922 |
classes. |
2242 | 2923 |
|
2924 |
[author:] |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2925 |
Claus Gittinger |
2242 | 2926 |
|
2927 |
[see also:] |
|
10207
b5ca553d15ad
localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents:
10201
diff
changeset
|
2928 |
Method |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2929 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2930 |
! ! |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2931 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2932 |
!Method::MethodWhoInfo class methodsFor:'instance creation'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2933 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2934 |
class:cls selector:sel |
2023 | 2935 |
"return a new MethodWhoInfo object; |
2936 |
this is a private interface for Method" |
|
2937 |
||
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2938 |
^ self basicNew class:cls selector:sel |
2023 | 2939 |
|
2940 |
"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
|
2941 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2942 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2943 |
!Method::MethodWhoInfo methodsFor:'accessing'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2944 |
|
4669
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2945 |
method |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2946 |
^ myClass compiledMethodAt:mySelector |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2947 |
! |
828addb1c376
source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents:
4595
diff
changeset
|
2948 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2949 |
methodClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2950 |
"return the class which contains the method represented by myself" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2951 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2952 |
^ myClass |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2953 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2954 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2955 |
(Method compiledMethodAt:#who) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2956 |
(Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2957 |
" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2958 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2959 |
"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
|
2960 |
! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2961 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2962 |
methodSelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2963 |
"return the selector under which the the method represented by myself |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2964 |
is found in the class" |
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2965 |
|
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2966 |
^ mySelector |
2022
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2967 |
|
24529e2b7cee
commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents:
1995
diff
changeset
|
2968 |
"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
|
2969 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2970 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2971 |
!Method::MethodWhoInfo methodsFor:'compatibility'! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2972 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2973 |
at:index |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2974 |
"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
|
2975 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2976 |
index == 1 ifTrue:[ |
7219
7c7b9d76af21
subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents:
7210
diff
changeset
|
2977 |
^ myClass |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2978 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2979 |
index == 2 ifTrue:[ |
7219
7c7b9d76af21
subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents:
7210
diff
changeset
|
2980 |
^ mySelector |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2981 |
]. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2982 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2983 |
"/ sigh - full compatibility ? |
7219
7c7b9d76af21
subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents:
7210
diff
changeset
|
2984 |
^ self indexNotIntegerOrOutOfBounds:index |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2985 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2986 |
|
7258 | 2987 |
!Method::MethodWhoInfo methodsFor:'private-accessing'! |
1851
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2988 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2989 |
class:cls selector:sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2990 |
myClass := cls. |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2991 |
mySelector := sel |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2992 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2993 |
|
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2994 |
! ! |
4accc9fafd19
change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents:
1813
diff
changeset
|
2995 |
|
1775
6892b91ddc0b
F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
2996 |
!Method class methodsFor:'documentation'! |
872 | 2997 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2998 |
version |
12948 | 2999 |
^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.351 2010-07-17 12:24:14 cg Exp $' |
12159 | 3000 |
! |
3001 |
||
3002 |
version_CVS |
|
12948 | 3003 |
^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.351 2010-07-17 12:24:14 cg Exp $' |
1 | 3004 |
! ! |
6956
23f0066163ff
oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents:
6725
diff
changeset
|
3005 |
|
952
d600e08a5936
handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3006 |
Method initialize! |