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