author | Stefan Vogel <sv@exept.de> |
Fri, 19 Jan 2018 10:40:24 +0100 | |
changeset 22453 | 5935c74b8ca0 |
parent 22030 | 0d0851bf7815 |
child 22701 | 8940df382f2f |
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]] |
|
22030 | 113 |
|
114 |
knownPragmas |
|
115 |
context flagging: |
|
116 |
<context: #return> |
|
117 |
tells the compiler that this context will be returned through |
|
118 |
via 'thisContext sender ... sender return' from a lower context. |
|
119 |
The compiler's will create a returnable context |
|
120 |
(i.e. to prevent context optimizations) |
|
22021 | 121 |
|
22030 | 122 |
exception handling: |
123 |
<exception: #handle> |
|
124 |
marks contexts as exception handlers. |
|
125 |
||
126 |
<exception: #unwind> |
|
127 |
marks contexts which contain unwind actions |
|
128 |
||
129 |
<exception: #raise> |
|
130 |
marks contexts which raise an exception |
|
22021 | 131 |
|
22030 | 132 |
misc: |
133 |
<resource: #skipInDebuggersWalkBack> |
|
134 |
will not be shown in the debugger |
|
22021 | 135 |
|
22030 | 136 |
<resource: #style (...)> |
137 |
affected by style sheet |
|
22021 | 138 |
|
22030 | 139 |
<resource: #obsolete> |
140 |
marks obsolete methods |
|
22029 | 141 |
|
22030 | 142 |
<modifier: #super> |
143 |
must be called if redefined i.e. redefiners MUST do a super-send |
|
22021 | 144 |
|
22030 | 145 |
<inspector2Tab> |
146 |
<postLoad> |
|
147 |
<swizzle: selector> |
|
22022 | 148 |
|
22030 | 149 |
<category: '...'> |
150 |
GNU-smalltalk's way of defining method categories |
|
14430 | 151 |
" |
13403 | 152 |
! ! |
153 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
154 |
!Annotation class methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
155 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
156 |
initialize |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
157 |
"Invoked at system start or when the class is dynamically loaded." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
158 |
|
13670 | 159 |
Smalltalk at:#Pragma put:self. |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
160 |
|
13670 | 161 |
"Modified: / 09-09-2011 / 07:16:26 / cg" |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
162 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
163 |
|
13403 | 164 |
!Annotation class methodsFor:'instance creation'! |
165 |
||
166 |
key: key arguments: arguments |
|
21381 | 167 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
168 |
"/ (self respondsTo: key) |
|
169 |
(self class includesSelector:key) ifTrue: [ |
|
170 |
^ self |
|
171 |
perform: key |
|
172 |
withArguments: arguments |
|
22022 | 173 |
]. |
174 |
^ Annotation::Unknown new |
|
175 |
key: key arguments: arguments |
|
13403 | 176 |
|
177 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
178 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
22022 | 179 |
"Modified (format): / 16-07-2017 / 13:23:00 / cg" |
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
180 |
! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
181 |
|
14262 | 182 |
nameSpace: aString |
183 |
||
184 |
^Annotation::NameSpace new nameSpaceName: aString |
|
185 |
||
186 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
187 |
"Created: / 26-07-2012 / 23:05:28 / cg" |
|
188 |
! |
|
189 |
||
13403 | 190 |
namespace: aString |
14262 | 191 |
<resource: #obsolete> |
13403 | 192 |
|
14501 | 193 |
^ self nameSpace:aString |
13403 | 194 |
|
195 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
196 |
! |
|
197 |
||
198 |
resource: type |
|
22022 | 199 |
"resource method - returns menu, spec or image, |
200 |
or accesses/uses the viewStyle" |
|
201 |
||
14501 | 202 |
^Annotation::Resource new type: type value:nil |
13403 | 203 |
|
204 |
"Created: / 16-07-2010 / 11:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
22022 | 205 |
"Modified (comment): / 16-07-2017 / 13:23:47 / cg" |
13403 | 206 |
! |
207 |
||
18751 | 208 |
resource:type values:value |
22022 | 209 |
"resource method - returns menu, spec or image, |
210 |
or accesses/uses the viewStyle" |
|
211 |
||
18751 | 212 |
^ Annotation::Resource new type:type value:value |
13403 | 213 |
|
214 |
"Created: / 16-07-2010 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
22022 | 215 |
"Modified (comment): / 16-07-2017 / 13:23:53 / cg" |
13403 | 216 |
! ! |
217 |
||
16134 | 218 |
!Annotation class methodsFor:'finding'! |
14500 | 219 |
|
17645 | 220 |
allInMethod: aMethod |
221 |
"VisualWorks compatibility. |
|
222 |
Answer a collection of all pragmas found in the given method" |
|
223 |
||
224 |
^ aMethod annotations |
|
225 |
! |
|
226 |
||
16134 | 227 |
allNamed:aSymbol |
228 |
"Answer a collection of all pragmas found in all methods of all classes whose keyword is aSymbol." |
|
229 |
||
19820 | 230 |
^ Array |
231 |
streamContents: [ :stream | |
|
232 |
Smalltalk allClassesDo:[:eachClass | |
|
233 |
self withPragmasIn: eachClass do: [ :pragma | |
|
234 |
pragma keyword = aSymbol ifTrue: [ |
|
235 |
stream nextPut: pragma |
|
236 |
] |
|
237 |
] |
|
238 |
] |
|
239 |
]. |
|
16134 | 240 |
|
241 |
" |
|
242 |
Annotation allNamed:'worldMenu' |
|
243 |
" |
|
244 |
! |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
245 |
|
19820 | 246 |
allNamed:aSymbol from:aSubClass to:aSuperClass |
247 |
"Answer a collection of all pragmas found in methods of all classes |
|
248 |
between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol." |
|
249 |
||
250 |
^ Array |
|
251 |
streamContents:[:stream | |
|
252 |
aSubClass withAllSuperclassesDo:[:class | |
|
253 |
self withPragmasIn:class do:[:pragma | |
|
254 |
pragma keyword = aSymbol ifTrue: [ |
|
255 |
stream nextPut: pragma |
|
256 |
] |
|
257 |
]. |
|
258 |
aSuperClass = class ifTrue: [ |
|
259 |
^ stream contents |
|
260 |
] |
|
261 |
] |
|
262 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
263 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
264 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
265 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
266 |
"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
|
267 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
268 |
^ 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
|
269 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
270 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
271 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
272 |
"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
|
273 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
274 |
^ (self allNamed: aSymbol from: aSubClass to: aSuperClass) sort: aSortBlock. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
275 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
276 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
277 |
allNamed: aSymbol in: aClass |
19820 | 278 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol." |
279 |
||
280 |
^ Array |
|
281 |
streamContents: [ :stream | |
|
282 |
self withPragmasIn: aClass do: [ :pragma | |
|
283 |
pragma keyword = aSymbol ifTrue: [ |
|
284 |
stream nextPut: pragma |
|
285 |
] |
|
286 |
] |
|
287 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
288 |
! |
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 |
allNamed: aSymbol in: aClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
291 |
"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
|
292 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
293 |
^ 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
|
294 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
295 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
296 |
allNamed: aSymbol in: aClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
297 |
"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
|
298 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
299 |
^ (self allNamed: aSymbol in: aClass) sort: aSortBlock. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
300 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
301 |
|
22022 | 302 |
!Annotation class methodsFor:'instance creation - basic'! |
303 |
||
304 |
for: aMethod selector: aSelector arguments: anArray |
|
305 |
^self new |
|
306 |
setMethod: aMethod; |
|
307 |
setKeyword: aSelector; |
|
308 |
setArguments: anArray; |
|
309 |
yourself |
|
310 |
! |
|
13613
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 |
keyword: aSymbol arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
313 |
^ self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
314 |
setKeyword: aSymbol; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
315 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
316 |
yourself. |
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 |
|
22022 | 319 |
method:method key:key arguments:arguments |
320 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
|
321 |
"/ (self respondsTo: key) |
|
322 |
(self class includesSelector:key) ifTrue: [ |
|
323 |
^ self perform: key withArguments: arguments |
|
324 |
]. |
|
325 |
^ Annotation::Unknown new |
|
326 |
method: method key: key arguments: arguments |
|
327 |
||
328 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
329 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
330 |
"Created: / 05-09-2011 / 04:39:17 / cg" |
|
331 |
"Modified (format): / 16-07-2017 / 13:22:53 / cg" |
|
332 |
! ! |
|
333 |
||
334 |
!Annotation class methodsFor:'private'! |
|
335 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
336 |
withPragmasIn: aClass do: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
337 |
aClass selectorsAndMethodsDo: [ :selector :method | method annotationsDo: aBlock ]. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
338 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
339 |
"Modified: / 20-08-2011 / 21:31:49 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
340 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
341 |
|
13403 | 342 |
!Annotation methodsFor:'accessing'! |
343 |
||
14501 | 344 |
arguments |
345 |
^ arguments |
|
346 |
! |
|
347 |
||
13403 | 348 |
first |
349 |
||
350 |
^self key |
|
351 |
||
352 |
"Created: / 10-07-2010 / 21:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
353 |
! |
|
354 |
||
355 |
key |
|
14501 | 356 |
^ key |
13403 | 357 |
! ! |
358 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
359 |
!Annotation methodsFor:'accessing-method'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
360 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
361 |
method |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
362 |
"Answer the compiled-method containing the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
363 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
364 |
self halt:'inimplemented' |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
365 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
366 |
"Modified: / 21-08-2011 / 12:44:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
367 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
368 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
369 |
methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
370 |
"Answer the class of the method containing the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
371 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
372 |
^ self method methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
373 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
374 |
"Modified: / 21-08-2011 / 12:44:47 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
375 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
376 |
|
17694 | 377 |
methodSelector |
378 |
"Answer the selector of the method containing the pragma. |
|
379 |
Added to not confuse this with the selector (i.e. key) of the pragma's message pattern." |
|
380 |
||
381 |
^ self method selector |
|
382 |
||
383 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
|
384 |
! |
|
385 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
386 |
selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
387 |
"Answer the selector of the method containing the pragma. |
17694 | 388 |
Do not confuse this with the selector (i.e. key) of the pragma's message pattern. |
389 |
(use methodSelector, to make this clear)" |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
390 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
391 |
^ self method selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
392 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
393 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
394 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
395 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
396 |
!Annotation methodsFor:'accessing-pragma'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
397 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
398 |
argumentAt: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
399 |
"Answer one of the arguments of the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
400 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
401 |
^ self arguments at: anInteger. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
402 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
403 |
|
18432 | 404 |
argumentCount |
405 |
"Answer the number of arguments in the pragma." |
|
406 |
||
407 |
^ self arguments size. |
|
408 |
! |
|
409 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
410 |
message |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
411 |
"Answer the message of the receiving pragma." |
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 |
^ Message selector: self keyword arguments: self arguments. |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
416 |
numArgs |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
417 |
"Answer the number of arguments in the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
418 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
419 |
^ self arguments size. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
420 |
! ! |
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 |
!Annotation methodsFor:'comparing'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
423 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
424 |
analogousCodeTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
425 |
^self class == anObject class |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
426 |
and: [self keyword == anObject keyword |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
427 |
and: [self arguments = anObject arguments]] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
428 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
429 |
"Modified: / 21-08-2011 / 12:45:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
430 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
431 |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
432 |
!Annotation methodsFor:'compatibility - squeak'! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
433 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
434 |
keyword |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
435 |
^ self key |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
436 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
437 |
"Created: / 05-09-2011 / 04:34:26 / cg" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
438 |
! ! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
439 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
440 |
!Annotation methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
441 |
|
17300 | 442 |
key:keyArg |
443 |
key := keyArg. |
|
444 |
! |
|
445 |
||
14501 | 446 |
key:keyArg arguments:argumentsArg |
447 |
key := keyArg. |
|
448 |
arguments := argumentsArg. |
|
449 |
! |
|
450 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
451 |
setArguments: anArray |
14501 | 452 |
arguments := anArray |
13613
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 |
"Modified: / 21-08-2011 / 12:45:51 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
455 |
! |
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 |
setKeyword: aSymbol |
14501 | 458 |
key := aSymbol |
13613
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 |
"Modified: / 21-08-2011 / 12:46:06 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
461 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
462 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
463 |
setMethod: aCompiledMethod |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
464 |
self subclassResponsibility |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
465 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
466 |
"Modified: / 21-08-2011 / 12:46:16 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
467 |
! ! |
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 |
!Annotation methodsFor:'printing'! |
13403 | 470 |
|
471 |
printOn:aStream |
|
20217 | 472 |
"append a printed representation of the receiver to the argument, aStream" |
13403 | 473 |
|
474 |
self storeOn:aStream. |
|
475 |
||
476 |
"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
|
477 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
478 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
479 |
!Annotation methodsFor:'printing & storing'! |
13403 | 480 |
|
481 |
storeOn:aStream |
|
14501 | 482 |
"superclass Annotation says that I am responsible to implement this method" |
13403 | 483 |
|
14501 | 484 |
aStream nextPutAll: '(Annotation key: '. |
485 |
key storeOn: aStream. |
|
486 |
aStream nextPutAll: ' arguments: '. |
|
487 |
arguments storeOn: aStream. |
|
488 |
aStream nextPut: $). |
|
13403 | 489 |
|
14501 | 490 |
"Modified: / 19-05-2010 / 16:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13403 | 491 |
! ! |
492 |
||
493 |
!Annotation methodsFor:'processing'! |
|
494 |
||
495 |
annotatesClass: aClass |
|
496 |
||
497 |
^self subclassResponsibility |
|
498 |
||
499 |
"Created: / 20-05-2010 / 11:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
500 |
! |
|
501 |
||
502 |
annotatesMethod: aMethod |
|
503 |
||
504 |
^self subclassResponsibility |
|
505 |
||
506 |
"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
|
507 |
! |
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 |
sendTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
510 |
"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
|
511 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
512 |
^ anObject perform: self keyword withArguments: self arguments |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
513 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
514 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
515 |
withArgumentsDo: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
516 |
"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
|
517 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
518 |
^ aBlock valueWithArguments: self arguments |
13403 | 519 |
! ! |
520 |
||
14254 | 521 |
!Annotation methodsFor:'queries'! |
522 |
||
523 |
refersToLiteral: anObject |
|
16264 | 524 |
"return true if the receiver or recursively any array element in the |
525 |
receiver refers to aLiteral (i.e. a deep search)" |
|
526 |
||
14501 | 527 |
(anObject == key) ifTrue:[ ^ true ]. |
528 |
(anObject == arguments) ifTrue:[ ^ true ]. |
|
529 |
arguments isArray ifTrue:[ ^ arguments refersToLiteral: anObject]. |
|
14254 | 530 |
^ false |
531 |
||
14501 | 532 |
"Created: / 26-07-2012 / 15:57:43 / cg" |
533 |
! |
|
534 |
||
535 |
refersToLiteralMatching: aMatchString |
|
536 |
(key isSymbol and:[aMatchString match:key])ifTrue:[ ^ true ]. |
|
537 |
(arguments isSymbol and:[aMatchString match:arguments])ifTrue:[ ^ true ]. |
|
538 |
arguments isArray ifTrue:[ ^ arguments refersToLiteralMatching: aMatchString]. |
|
539 |
^ false |
|
540 |
||
541 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
14254 | 542 |
! ! |
543 |
||
13403 | 544 |
!Annotation methodsFor:'testing'! |
545 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
546 |
hasLiteral: aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
547 |
^self keyword == aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
548 |
or: [self arguments hasLiteral: aLiteral] |
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:44 / 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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
553 |
hasLiteralSuchThat: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
554 |
"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
|
555 |
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
556 |
^(aBlock value: self keyword) |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
557 |
or: [self arguments hasLiteralSuchThat: aBlock] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
558 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
559 |
"Modified: / 21-08-2011 / 12:46:31 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
560 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
561 |
|
14212 | 562 |
isResource |
563 |
^ false |
|
564 |
||
565 |
"Created: / 18-07-2012 / 19:28:39 / cg" |
|
566 |
! |
|
567 |
||
13403 | 568 |
isUnknown |
569 |
^ false |
|
570 |
! ! |
|
571 |
||
572 |
!Annotation::NameSpace methodsFor:'accessing'! |
|
573 |
||
574 |
key |
|
575 |
||
576 |
^#namespace: |
|
577 |
||
578 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
579 |
! |
|
580 |
||
581 |
nameSpace |
|
14501 | 582 |
^ arguments first |
13403 | 583 |
! |
584 |
||
585 |
nameSpace:something |
|
14501 | 586 |
arguments := Array with:something. |
13403 | 587 |
! ! |
588 |
||
589 |
!Annotation::NameSpace methodsFor:'initialization'! |
|
590 |
||
591 |
nameSpaceName: aString |
|
592 |
||
593 |
self nameSpace: (NameSpace name: aString) |
|
594 |
||
595 |
"Created: / 19-05-2010 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
596 |
! ! |
|
597 |
||
598 |
!Annotation::NameSpace methodsFor:'printing & storing'! |
|
599 |
||
600 |
storeOn:aStream |
|
601 |
"superclass Annotation says that I am responsible to implement this method" |
|
602 |
||
603 |
aStream nextPutAll: '(Annotation namespace: '. |
|
14501 | 604 |
self nameSpace name storeOn: aStream. |
13403 | 605 |
aStream nextPut:$) |
606 |
||
607 |
"Modified: / 19-05-2010 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
608 |
! ! |
|
609 |
||
610 |
!Annotation::NameSpace methodsFor:'processing'! |
|
611 |
||
612 |
annotatesClass:aClass |
|
613 |
||
614 |
"Nothing to do" |
|
615 |
||
616 |
"Modified: / 20-05-2010 / 11:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
617 |
! |
|
618 |
||
619 |
annotatesMethod:aMethod |
|
620 |
||
621 |
aMethod lookupObject: NamespaceAwareLookup instance |
|
622 |
||
623 |
"Modified: / 20-05-2010 / 11:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
624 |
! ! |
|
625 |
||
626 |
!Annotation::Resource methodsFor:'accessing'! |
|
627 |
||
14501 | 628 |
type |
629 |
^ arguments at:1 |
|
13403 | 630 |
! |
631 |
||
14501 | 632 |
type:typeArg value:valueArg |
633 |
valueArg isNil ifTrue:[ |
|
634 |
key := #'resource:'. |
|
635 |
arguments := Array with:typeArg. |
|
636 |
] ifFalse:[ |
|
18751 | 637 |
key := #'resource:values:'. |
14501 | 638 |
arguments := Array with:typeArg with:valueArg. |
639 |
]. |
|
13403 | 640 |
! |
641 |
||
642 |
value |
|
14501 | 643 |
arguments size > 1 ifTrue:[ |
644 |
^ arguments at:2 |
|
645 |
]. |
|
646 |
^ nil |
|
13403 | 647 |
! ! |
648 |
||
649 |
!Annotation::Resource methodsFor:'printing & storing'! |
|
650 |
||
651 |
storeOn:aStream |
|
652 |
aStream nextPutAll: '(Annotation resource: '. |
|
14501 | 653 |
self type storeOn: aStream. |
654 |
self value notNil ifTrue: [ |
|
14254 | 655 |
aStream nextPutAll: ' value: '. |
14501 | 656 |
self value storeOn: aStream |
14254 | 657 |
]. |
13403 | 658 |
aStream nextPut:$) |
659 |
||
660 |
"Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13837 | 661 |
"Modified: / 29-11-2011 / 11:19:06 / cg" |
14254 | 662 |
"Modified (format): / 26-07-2012 / 15:59:14 / cg" |
13403 | 663 |
! ! |
664 |
||
665 |
!Annotation::Resource methodsFor:'processing'! |
|
666 |
||
667 |
annotatesClass:aClass |
|
668 |
||
669 |
"Nothing to do" |
|
670 |
||
671 |
"Modified: / 16-07-2010 / 11:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
672 |
! |
|
673 |
||
674 |
annotatesMethod:aMethod |
|
675 |
||
676 |
"Nothing to do" |
|
677 |
||
678 |
"Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
679 |
! ! |
|
680 |
||
14212 | 681 |
!Annotation::Resource methodsFor:'testing'! |
682 |
||
683 |
isResource |
|
684 |
^ true |
|
685 |
||
686 |
"Created: / 18-07-2012 / 19:28:46 / cg" |
|
687 |
! ! |
|
688 |
||
13403 | 689 |
!Annotation::Unknown methodsFor:'accessing'! |
690 |
||
14501 | 691 |
method |
692 |
^ method |
|
693 |
||
694 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
|
13403 | 695 |
! |
696 |
||
14501 | 697 |
setMethod:aMethod |
698 |
method := aMethod |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
699 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
700 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
13403 | 701 |
! ! |
702 |
||
703 |
!Annotation::Unknown methodsFor:'initialization'! |
|
704 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
705 |
method:methodArg key:keyArg arguments:argumentsArg |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
706 |
method := methodArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
707 |
key := keyArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
708 |
arguments := argumentsArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
709 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
710 |
"Created: / 05-09-2011 / 04:39:50 / cg" |
13403 | 711 |
! ! |
712 |
||
713 |
!Annotation::Unknown methodsFor:'processing'! |
|
714 |
||
715 |
annotatesClass:aClass |
|
716 |
||
717 |
"Nothing to do" |
|
718 |
||
719 |
"Modified: / 20-05-2010 / 11:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
720 |
! |
|
721 |
||
722 |
annotatesMethod:aMethod |
|
723 |
||
724 |
"Nothing to do" |
|
725 |
||
726 |
"Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
727 |
! ! |
|
728 |
||
14254 | 729 |
!Annotation::Unknown methodsFor:'queries'! |
730 |
||
731 |
refersToLiteral: anObject |
|
732 |
(anObject == method) ifTrue:[ ^ true ]. |
|
14501 | 733 |
^ super refersToLiteral: anObject |
14254 | 734 |
! |
735 |
||
736 |
refersToLiteralMatching: aMatchString |
|
737 |
(method isSymbol and:[aMatchString match:method])ifTrue:[ ^ true ]. |
|
14501 | 738 |
^ super refersToLiteralMatching: aMatchString |
14254 | 739 |
|
740 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
741 |
! ! |
|
742 |
||
13403 | 743 |
!Annotation::Unknown methodsFor:'testing'! |
744 |
||
745 |
isUnknown |
|
746 |
^ true |
|
747 |
! ! |
|
748 |
||
749 |
!Annotation class methodsFor:'documentation'! |
|
750 |
||
13670 | 751 |
version |
18751 | 752 |
^ '$Header$' |
13670 | 753 |
! |
754 |
||
13479 | 755 |
version_CVS |
18751 | 756 |
^ '$Header$' |
13479 | 757 |
! |
758 |
||
13403 | 759 |
version_SVN |
18751 | 760 |
^ '$Id$' |
13403 | 761 |
! ! |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
762 |
|
16134 | 763 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
764 |
Annotation initialize! |