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