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