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