author | Claus Gittinger <cg@exept.de> |
Sun, 16 Jul 2017 13:14:07 +0200 | |
changeset 22021 | fe6f188d987e |
parent 21381 | 26838cd5e876 |
child 22022 | 1049173dbe23 |
permissions | -rw-r--r-- |
13403 | 1 |
" |
13479 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
13403 | 3 |
All Rights Reserved |
4 |
||
13479 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
13403 | 25 |
" |
26 |
"{ Package: 'stx:libbasic' }" |
|
27 |
||
17300 | 28 |
"{ NameSpace: Smalltalk }" |
29 |
||
13403 | 30 |
Object subclass:#Annotation |
14501 | 31 |
instanceVariableNames:'key arguments' |
13403 | 32 |
classVariableNames:'' |
33 |
poolDictionaries:'' |
|
34 |
category:'Kernel-Extensions' |
|
35 |
! |
|
36 |
||
37 |
Annotation subclass:#NameSpace |
|
14501 | 38 |
instanceVariableNames:'' |
13403 | 39 |
classVariableNames:'' |
40 |
poolDictionaries:'' |
|
41 |
privateIn:Annotation |
|
42 |
! |
|
43 |
||
44 |
Annotation subclass:#Resource |
|
14501 | 45 |
instanceVariableNames:'' |
13403 | 46 |
classVariableNames:'' |
47 |
poolDictionaries:'' |
|
48 |
privateIn:Annotation |
|
49 |
! |
|
50 |
||
51 |
Annotation subclass:#Unknown |
|
14501 | 52 |
instanceVariableNames:'method' |
13403 | 53 |
classVariableNames:'' |
54 |
poolDictionaries:'' |
|
55 |
privateIn:Annotation |
|
56 |
! |
|
57 |
||
58 |
!Annotation class methodsFor:'documentation'! |
|
59 |
||
60 |
copyright |
|
61 |
" |
|
13479 | 62 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
13403 | 63 |
All Rights Reserved |
64 |
||
13479 | 65 |
Permission is hereby granted, free of charge, to any person |
66 |
obtaining a copy of this software and associated documentation |
|
67 |
files (the 'Software'), to deal in the Software without |
|
68 |
restriction, including without limitation the rights to use, |
|
69 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
70 |
copies of the Software, and to permit persons to whom the |
|
71 |
Software is furnished to do so, subject to the following |
|
72 |
conditions: |
|
73 |
||
74 |
The above copyright notice and this permission notice shall be |
|
75 |
included in all copies or substantial portions of the Software. |
|
76 |
||
77 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
78 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
79 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
80 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
81 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
82 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
83 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
84 |
OTHER DEALINGS IN THE SOFTWARE. |
|
13403 | 85 |
" |
14430 | 86 |
! |
87 |
||
88 |
documentation |
|
89 |
" |
|
90 |
I represent an occurrence of a pragma in a compiled method. |
|
22021 | 91 |
|
14430 | 92 |
A pragma is a literal message pattern that occurs between angle brackets at the start of a method after any temporaries. |
93 |
A common example is the primitive pragma: |
|
94 |
<primitive: 123 errorCode: 'errorCode'> |
|
14447
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
95 |
but you can add your own and use them as metadata attached to a method. |
22021 | 96 |
|
14447
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
97 |
Because pragmas are messages one can browse senders and implementors and perform them. |
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
98 |
One can query a method for its pragmas by sending it the pragmas message, which answers an Array of instances of me, |
14430 | 99 |
one for each pragma in the method. |
100 |
I can provide information about the defining class, method, its selector, |
|
101 |
as well as the information about the pragma keyword and its arguments. See the two 'accessing' protocols for details. |
|
102 |
'accessing-method' provides information about the method the pragma is found in, |
|
103 |
while 'accessing-pragma' is about the pragma itself. |
|
104 |
Instances are retrieved using one of the pragma search methods of the 'finding' protocol on the class side. |
|
22021 | 105 |
|
14430 | 106 |
To browse all methods with pragmas in the system evaluate |
22021 | 107 |
SystemBrowser default browseAllSelect: [:m| m pragmas notEmpty] |
108 |
or: |
|
109 |
Smalltalk browseAllSelect: [:m| m pragmas notEmpty] |
|
110 |
||
111 |
(in Squeak/Pharo): to browse all nonprimitive methods with pragmas evaluate |
|
112 |
SystemBrowser default browseAllSelect: [:m| m primitive isZero and: [m pragmas notEmpty]] |
|
113 |
" |
|
114 |
! |
|
115 |
||
116 |
knownPragmas |
|
117 |
" |
|
118 |
context flagging: |
|
119 |
<context: #return> |
|
120 |
tells the compiler that this context will be returned through |
|
121 |
via 'thisContext sender ... sender return' from a lower context. |
|
122 |
The compiler's will create a returnable context |
|
123 |
(i.e. to prevent context optimizations) |
|
124 |
||
125 |
exception handling: |
|
126 |
<exception: #handle> |
|
127 |
marks contexts as exception handlers. |
|
128 |
||
129 |
<exception: #unwind> |
|
130 |
marks contexts which contain unwind actions |
|
131 |
||
132 |
<exception: #raise> |
|
133 |
marks contexts which raise an exception |
|
134 |
||
135 |
misc: |
|
136 |
<resource: #skipInDebuggersWalkBack> |
|
137 |
will not be shown in the debugger |
|
138 |
||
139 |
<resource: #style (...)> |
|
140 |
affected by style sheet |
|
141 |
||
142 |
<modifier: #super> |
|
143 |
must be called if redefined i.e. redefiners MUST do a super-send |
|
144 |
||
145 |
<inspector2Tab> |
|
146 |
<postLoad> |
|
147 |
<swizzle: selector> |
|
14430 | 148 |
" |
13403 | 149 |
! ! |
150 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
151 |
!Annotation class methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
152 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
153 |
initialize |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
154 |
"Invoked at system start or when the class is dynamically loaded." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
155 |
|
13670 | 156 |
Smalltalk at:#Pragma put:self. |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
157 |
|
13670 | 158 |
"Modified: / 09-09-2011 / 07:16:26 / cg" |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
159 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
160 |
|
13403 | 161 |
!Annotation class methodsFor:'instance creation'! |
162 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
163 |
for: aMethod selector: aSelector arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
164 |
^self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
165 |
setMethod: aMethod; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
166 |
setKeyword: aSelector; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
167 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
168 |
yourself |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
169 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
170 |
|
13403 | 171 |
key: key arguments: arguments |
172 |
||
21381 | 173 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
174 |
"/ (self respondsTo: key) |
|
175 |
(self class includesSelector:key) ifTrue: [ |
|
176 |
^ self |
|
177 |
perform: key |
|
178 |
withArguments: arguments |
|
179 |
] ifFalse:[ |
|
180 |
^ Annotation::Unknown new |
|
13403 | 181 |
key: key |
21381 | 182 |
arguments: arguments |
183 |
] |
|
13403 | 184 |
|
185 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
186 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
21381 | 187 |
"Modified: / 07-02-2017 / 20:27:49 / cg" |
13403 | 188 |
! |
189 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
190 |
method:method key:key arguments:arguments |
13663
5e08299c39f1
changed: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13625
diff
changeset
|
191 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
14500 | 192 |
"/ (self respondsTo: key) |
21381 | 193 |
(self class includesSelector:key) ifTrue: [ |
194 |
^ self perform: key withArguments: arguments |
|
195 |
] ifFalse: [ |
|
196 |
^ Annotation::Unknown new method: method key: key arguments: arguments |
|
197 |
] |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
198 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
199 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
200 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
201 |
"Created: / 05-09-2011 / 04:39:17 / cg" |
21381 | 202 |
"Modified: / 07-02-2017 / 20:15:55 / cg" |
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
203 |
! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
204 |
|
14262 | 205 |
nameSpace: aString |
206 |
||
207 |
^Annotation::NameSpace new nameSpaceName: aString |
|
208 |
||
209 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
210 |
"Created: / 26-07-2012 / 23:05:28 / cg" |
|
211 |
! |
|
212 |
||
13403 | 213 |
namespace: aString |
14262 | 214 |
<resource: #obsolete> |
13403 | 215 |
|
14501 | 216 |
^ self nameSpace:aString |
13403 | 217 |
|
218 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
219 |
! |
|
220 |
||
221 |
resource: type |
|
222 |
||
14501 | 223 |
^Annotation::Resource new type: type value:nil |
13403 | 224 |
|
225 |
"Created: / 16-07-2010 / 11:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
226 |
! |
|
227 |
||
18751 | 228 |
resource:type values:value |
229 |
^ Annotation::Resource new type:type value:value |
|
13403 | 230 |
|
231 |
"Created: / 16-07-2010 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
232 |
! ! |
|
233 |
||
16134 | 234 |
!Annotation class methodsFor:'finding'! |
14500 | 235 |
|
17645 | 236 |
allInMethod: aMethod |
237 |
"VisualWorks compatibility. |
|
238 |
Answer a collection of all pragmas found in the given method" |
|
239 |
||
240 |
^ aMethod annotations |
|
241 |
! |
|
242 |
||
16134 | 243 |
allNamed:aSymbol |
244 |
"Answer a collection of all pragmas found in all methods of all classes whose keyword is aSymbol." |
|
245 |
||
19820 | 246 |
^ Array |
247 |
streamContents: [ :stream | |
|
248 |
Smalltalk allClassesDo:[:eachClass | |
|
249 |
self withPragmasIn: eachClass do: [ :pragma | |
|
250 |
pragma keyword = aSymbol ifTrue: [ |
|
251 |
stream nextPut: pragma |
|
252 |
] |
|
253 |
] |
|
254 |
] |
|
255 |
]. |
|
16134 | 256 |
|
257 |
" |
|
258 |
Annotation allNamed:'worldMenu' |
|
259 |
" |
|
260 |
! |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
261 |
|
19820 | 262 |
allNamed:aSymbol from:aSubClass to:aSuperClass |
263 |
"Answer a collection of all pragmas found in methods of all classes |
|
264 |
between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol." |
|
265 |
||
266 |
^ Array |
|
267 |
streamContents:[:stream | |
|
268 |
aSubClass withAllSuperclassesDo:[:class | |
|
269 |
self withPragmasIn:class do:[:pragma | |
|
270 |
pragma keyword = aSymbol ifTrue: [ |
|
271 |
stream nextPut: pragma |
|
272 |
] |
|
273 |
]. |
|
274 |
aSuperClass = class ifTrue: [ |
|
275 |
^ stream contents |
|
276 |
] |
|
277 |
] |
|
278 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
279 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
280 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
281 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
282 |
"Answer a collection of all pragmas found in methods of all classes between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol, sorted according to argument anInteger." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
283 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
284 |
^ self allNamed: aSymbol from: aSubClass to: aSuperClass sortedUsing: [ :a :b | (a argumentAt: anInteger) < (b argumentAt: anInteger) ]. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
285 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
286 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
287 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
288 |
"Answer a collection of all pragmas found in methods of all classes between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol, sorted according to aSortBlock." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
289 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
290 |
^ (self allNamed: aSymbol from: aSubClass to: aSuperClass) sort: aSortBlock. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
291 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
292 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
293 |
allNamed: aSymbol in: aClass |
19820 | 294 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol." |
295 |
||
296 |
^ Array |
|
297 |
streamContents: [ :stream | |
|
298 |
self withPragmasIn: aClass do: [ :pragma | |
|
299 |
pragma keyword = aSymbol ifTrue: [ |
|
300 |
stream nextPut: pragma |
|
301 |
] |
|
302 |
] |
|
303 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
304 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
305 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
306 |
allNamed: aSymbol in: aClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
307 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol, sorted according to argument anInteger." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
308 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
309 |
^ self allNamed: aSymbol in: aClass sortedUsing: [ :a :b | (a argumentAt: anInteger) < (b argumentAt: anInteger) ]. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
310 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
311 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
312 |
allNamed: aSymbol in: aClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
313 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol, sorted according to aSortBlock." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
314 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
315 |
^ (self allNamed: aSymbol in: aClass) sort: aSortBlock. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
316 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
317 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
318 |
!Annotation class methodsFor:'private'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
319 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
320 |
keyword: aSymbol arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
321 |
^ self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
322 |
setKeyword: aSymbol; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
323 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
324 |
yourself. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
325 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
326 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
327 |
withPragmasIn: aClass do: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
328 |
aClass selectorsAndMethodsDo: [ :selector :method | method annotationsDo: aBlock ]. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
329 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
330 |
"Modified: / 20-08-2011 / 21:31:49 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
331 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
332 |
|
13403 | 333 |
!Annotation methodsFor:'accessing'! |
334 |
||
14501 | 335 |
arguments |
336 |
^ arguments |
|
337 |
! |
|
338 |
||
13403 | 339 |
first |
340 |
||
341 |
^self key |
|
342 |
||
343 |
"Created: / 10-07-2010 / 21:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
344 |
! |
|
345 |
||
346 |
key |
|
14501 | 347 |
^ key |
13403 | 348 |
! ! |
349 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
350 |
!Annotation methodsFor:'accessing-method'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
351 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
352 |
method |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
353 |
"Answer the compiled-method containing the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
354 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
355 |
self halt:'inimplemented' |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
356 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
357 |
"Modified: / 21-08-2011 / 12:44:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
358 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
359 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
360 |
methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
361 |
"Answer the class of the method containing the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
362 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
363 |
^ self method methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
364 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
365 |
"Modified: / 21-08-2011 / 12:44:47 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
366 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
367 |
|
17694 | 368 |
methodSelector |
369 |
"Answer the selector of the method containing the pragma. |
|
370 |
Added to not confuse this with the selector (i.e. key) of the pragma's message pattern." |
|
371 |
||
372 |
^ self method selector |
|
373 |
||
374 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
|
375 |
! |
|
376 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
377 |
selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
378 |
"Answer the selector of the method containing the pragma. |
17694 | 379 |
Do not confuse this with the selector (i.e. key) of the pragma's message pattern. |
380 |
(use methodSelector, to make this clear)" |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
381 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
382 |
^ self method selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
383 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
384 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
385 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
386 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
387 |
!Annotation methodsFor:'accessing-pragma'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
388 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
389 |
argumentAt: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
390 |
"Answer one of the arguments of the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
391 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
392 |
^ self arguments at: anInteger. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
393 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
394 |
|
18432 | 395 |
argumentCount |
396 |
"Answer the number of arguments in the pragma." |
|
397 |
||
398 |
^ self arguments size. |
|
399 |
! |
|
400 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
401 |
message |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
402 |
"Answer the message of the receiving pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
403 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
404 |
^ Message selector: self keyword arguments: self arguments. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
405 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
406 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
407 |
numArgs |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
408 |
"Answer the number of arguments in the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
409 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
410 |
^ self arguments size. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
411 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
412 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
413 |
!Annotation methodsFor:'comparing'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
414 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
415 |
analogousCodeTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
416 |
^self class == anObject class |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
417 |
and: [self keyword == anObject keyword |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
418 |
and: [self arguments = anObject arguments]] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
419 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
420 |
"Modified: / 21-08-2011 / 12:45:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
421 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
422 |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
423 |
!Annotation methodsFor:'compatibility - squeak'! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
424 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
425 |
keyword |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
426 |
^ self key |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
427 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
428 |
"Created: / 05-09-2011 / 04:34:26 / cg" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
429 |
! ! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
430 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
431 |
!Annotation methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
432 |
|
17300 | 433 |
key:keyArg |
434 |
key := keyArg. |
|
435 |
! |
|
436 |
||
14501 | 437 |
key:keyArg arguments:argumentsArg |
438 |
key := keyArg. |
|
439 |
arguments := argumentsArg. |
|
440 |
! |
|
441 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
442 |
setArguments: anArray |
14501 | 443 |
arguments := anArray |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
444 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
445 |
"Modified: / 21-08-2011 / 12:45:51 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
446 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
447 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
448 |
setKeyword: aSymbol |
14501 | 449 |
key := aSymbol |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
450 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
451 |
"Modified: / 21-08-2011 / 12:46:06 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
452 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
453 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
454 |
setMethod: aCompiledMethod |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
455 |
self subclassResponsibility |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
456 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
457 |
"Modified: / 21-08-2011 / 12:46:16 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
458 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
459 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
460 |
!Annotation methodsFor:'printing'! |
13403 | 461 |
|
462 |
printOn:aStream |
|
20217 | 463 |
"append a printed representation of the receiver to the argument, aStream" |
13403 | 464 |
|
465 |
self storeOn:aStream. |
|
466 |
||
467 |
"Modified: / 19-05-2010 / 16:25:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
468 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
469 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
470 |
!Annotation methodsFor:'printing & storing'! |
13403 | 471 |
|
472 |
storeOn:aStream |
|
14501 | 473 |
"superclass Annotation says that I am responsible to implement this method" |
13403 | 474 |
|
14501 | 475 |
aStream nextPutAll: '(Annotation key: '. |
476 |
key storeOn: aStream. |
|
477 |
aStream nextPutAll: ' arguments: '. |
|
478 |
arguments storeOn: aStream. |
|
479 |
aStream nextPut: $). |
|
13403 | 480 |
|
14501 | 481 |
"Modified: / 19-05-2010 / 16:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13403 | 482 |
! ! |
483 |
||
484 |
!Annotation methodsFor:'processing'! |
|
485 |
||
486 |
annotatesClass: aClass |
|
487 |
||
488 |
^self subclassResponsibility |
|
489 |
||
490 |
"Created: / 20-05-2010 / 11:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
491 |
! |
|
492 |
||
493 |
annotatesMethod: aMethod |
|
494 |
||
495 |
^self subclassResponsibility |
|
496 |
||
497 |
"Created: / 20-05-2010 / 11:15:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
498 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
499 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
500 |
sendTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
501 |
"Send the pragma keyword together with its arguments to anObject and answer the result." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
502 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
503 |
^ anObject perform: self keyword withArguments: self arguments |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
504 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
505 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
506 |
withArgumentsDo: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
507 |
"Pass the arguments of the receiving pragma into aBlock and answer the result." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
508 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
509 |
^ aBlock valueWithArguments: self arguments |
13403 | 510 |
! ! |
511 |
||
14254 | 512 |
!Annotation methodsFor:'queries'! |
513 |
||
514 |
refersToLiteral: anObject |
|
16264 | 515 |
"return true if the receiver or recursively any array element in the |
516 |
receiver refers to aLiteral (i.e. a deep search)" |
|
517 |
||
14501 | 518 |
(anObject == key) ifTrue:[ ^ true ]. |
519 |
(anObject == arguments) ifTrue:[ ^ true ]. |
|
520 |
arguments isArray ifTrue:[ ^ arguments refersToLiteral: anObject]. |
|
14254 | 521 |
^ false |
522 |
||
14501 | 523 |
"Created: / 26-07-2012 / 15:57:43 / cg" |
524 |
! |
|
525 |
||
526 |
refersToLiteralMatching: aMatchString |
|
527 |
(key isSymbol and:[aMatchString match:key])ifTrue:[ ^ true ]. |
|
528 |
(arguments isSymbol and:[aMatchString match:arguments])ifTrue:[ ^ true ]. |
|
529 |
arguments isArray ifTrue:[ ^ arguments refersToLiteralMatching: aMatchString]. |
|
530 |
^ false |
|
531 |
||
532 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
14254 | 533 |
! ! |
534 |
||
13403 | 535 |
!Annotation methodsFor:'testing'! |
536 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
537 |
hasLiteral: aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
538 |
^self keyword == aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
539 |
or: [self arguments hasLiteral: aLiteral] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
540 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
541 |
"Modified: / 21-08-2011 / 12:46:44 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
542 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
543 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
544 |
hasLiteralSuchThat: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
545 |
"Answer true if litBlock returns true for any literal in the receiver, even if embedded in further array structure. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
546 |
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
547 |
^(aBlock value: self keyword) |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
548 |
or: [self arguments hasLiteralSuchThat: aBlock] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
549 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
550 |
"Modified: / 21-08-2011 / 12:46:31 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
551 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
552 |
|
14212 | 553 |
isResource |
554 |
^ false |
|
555 |
||
556 |
"Created: / 18-07-2012 / 19:28:39 / cg" |
|
557 |
! |
|
558 |
||
13403 | 559 |
isUnknown |
560 |
^ false |
|
561 |
! ! |
|
562 |
||
563 |
!Annotation::NameSpace methodsFor:'accessing'! |
|
564 |
||
565 |
key |
|
566 |
||
567 |
^#namespace: |
|
568 |
||
569 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
570 |
! |
|
571 |
||
572 |
nameSpace |
|
14501 | 573 |
^ arguments first |
13403 | 574 |
! |
575 |
||
576 |
nameSpace:something |
|
14501 | 577 |
arguments := Array with:something. |
13403 | 578 |
! ! |
579 |
||
580 |
!Annotation::NameSpace methodsFor:'initialization'! |
|
581 |
||
582 |
nameSpaceName: aString |
|
583 |
||
584 |
self nameSpace: (NameSpace name: aString) |
|
585 |
||
586 |
"Created: / 19-05-2010 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
587 |
! ! |
|
588 |
||
589 |
!Annotation::NameSpace methodsFor:'printing & storing'! |
|
590 |
||
591 |
storeOn:aStream |
|
592 |
"superclass Annotation says that I am responsible to implement this method" |
|
593 |
||
594 |
aStream nextPutAll: '(Annotation namespace: '. |
|
14501 | 595 |
self nameSpace name storeOn: aStream. |
13403 | 596 |
aStream nextPut:$) |
597 |
||
598 |
"Modified: / 19-05-2010 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
599 |
! ! |
|
600 |
||
601 |
!Annotation::NameSpace methodsFor:'processing'! |
|
602 |
||
603 |
annotatesClass:aClass |
|
604 |
||
605 |
"Nothing to do" |
|
606 |
||
607 |
"Modified: / 20-05-2010 / 11:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
608 |
! |
|
609 |
||
610 |
annotatesMethod:aMethod |
|
611 |
||
612 |
aMethod lookupObject: NamespaceAwareLookup instance |
|
613 |
||
614 |
"Modified: / 20-05-2010 / 11:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
615 |
! ! |
|
616 |
||
617 |
!Annotation::Resource methodsFor:'accessing'! |
|
618 |
||
14501 | 619 |
type |
620 |
^ arguments at:1 |
|
13403 | 621 |
! |
622 |
||
14501 | 623 |
type:typeArg value:valueArg |
624 |
valueArg isNil ifTrue:[ |
|
625 |
key := #'resource:'. |
|
626 |
arguments := Array with:typeArg. |
|
627 |
] ifFalse:[ |
|
18751 | 628 |
key := #'resource:values:'. |
14501 | 629 |
arguments := Array with:typeArg with:valueArg. |
630 |
]. |
|
13403 | 631 |
! |
632 |
||
633 |
value |
|
14501 | 634 |
arguments size > 1 ifTrue:[ |
635 |
^ arguments at:2 |
|
636 |
]. |
|
637 |
^ nil |
|
13403 | 638 |
! ! |
639 |
||
640 |
!Annotation::Resource methodsFor:'printing & storing'! |
|
641 |
||
642 |
storeOn:aStream |
|
643 |
aStream nextPutAll: '(Annotation resource: '. |
|
14501 | 644 |
self type storeOn: aStream. |
645 |
self value notNil ifTrue: [ |
|
14254 | 646 |
aStream nextPutAll: ' value: '. |
14501 | 647 |
self value storeOn: aStream |
14254 | 648 |
]. |
13403 | 649 |
aStream nextPut:$) |
650 |
||
651 |
"Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13837 | 652 |
"Modified: / 29-11-2011 / 11:19:06 / cg" |
14254 | 653 |
"Modified (format): / 26-07-2012 / 15:59:14 / cg" |
13403 | 654 |
! ! |
655 |
||
656 |
!Annotation::Resource methodsFor:'processing'! |
|
657 |
||
658 |
annotatesClass:aClass |
|
659 |
||
660 |
"Nothing to do" |
|
661 |
||
662 |
"Modified: / 16-07-2010 / 11:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
663 |
! |
|
664 |
||
665 |
annotatesMethod:aMethod |
|
666 |
||
667 |
"Nothing to do" |
|
668 |
||
669 |
"Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
670 |
! ! |
|
671 |
||
14212 | 672 |
!Annotation::Resource methodsFor:'testing'! |
673 |
||
674 |
isResource |
|
675 |
^ true |
|
676 |
||
677 |
"Created: / 18-07-2012 / 19:28:46 / cg" |
|
678 |
! ! |
|
679 |
||
13403 | 680 |
!Annotation::Unknown methodsFor:'accessing'! |
681 |
||
14501 | 682 |
method |
683 |
^ method |
|
684 |
||
685 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
|
13403 | 686 |
! |
687 |
||
14501 | 688 |
setMethod:aMethod |
689 |
method := aMethod |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
690 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
691 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
13403 | 692 |
! ! |
693 |
||
694 |
!Annotation::Unknown methodsFor:'initialization'! |
|
695 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
696 |
method:methodArg key:keyArg arguments:argumentsArg |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
697 |
method := methodArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
698 |
key := keyArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
699 |
arguments := argumentsArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
700 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
701 |
"Created: / 05-09-2011 / 04:39:50 / cg" |
13403 | 702 |
! ! |
703 |
||
704 |
!Annotation::Unknown methodsFor:'processing'! |
|
705 |
||
706 |
annotatesClass:aClass |
|
707 |
||
708 |
"Nothing to do" |
|
709 |
||
710 |
"Modified: / 20-05-2010 / 11:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
711 |
! |
|
712 |
||
713 |
annotatesMethod:aMethod |
|
714 |
||
715 |
"Nothing to do" |
|
716 |
||
717 |
"Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
718 |
! ! |
|
719 |
||
14254 | 720 |
!Annotation::Unknown methodsFor:'queries'! |
721 |
||
722 |
refersToLiteral: anObject |
|
723 |
(anObject == method) ifTrue:[ ^ true ]. |
|
14501 | 724 |
^ super refersToLiteral: anObject |
14254 | 725 |
! |
726 |
||
727 |
refersToLiteralMatching: aMatchString |
|
728 |
(method isSymbol and:[aMatchString match:method])ifTrue:[ ^ true ]. |
|
14501 | 729 |
^ super refersToLiteralMatching: aMatchString |
14254 | 730 |
|
731 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
732 |
! ! |
|
733 |
||
13403 | 734 |
!Annotation::Unknown methodsFor:'testing'! |
735 |
||
736 |
isUnknown |
|
737 |
^ true |
|
738 |
! ! |
|
739 |
||
740 |
!Annotation class methodsFor:'documentation'! |
|
741 |
||
13670 | 742 |
version |
18751 | 743 |
^ '$Header$' |
13670 | 744 |
! |
745 |
||
13479 | 746 |
version_CVS |
18751 | 747 |
^ '$Header$' |
13479 | 748 |
! |
749 |
||
13403 | 750 |
version_SVN |
18751 | 751 |
^ '$Id$' |
13403 | 752 |
! ! |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
753 |
|
16134 | 754 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
755 |
Annotation initialize! |