author | Claus Gittinger <cg@exept.de> |
Sun, 29 Jul 2018 15:03:15 +0200 | |
changeset 23242 | 7f3b0c84697e |
parent 23225 | 5449dbd3cc02 |
child 23315 | 40e61e9592e9 |
permissions | -rw-r--r-- |
23242 | 1 |
"{ Encoding: utf8 }" |
2 |
||
13403 | 3 |
" |
13479 | 4 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
13403 | 5 |
All Rights Reserved |
6 |
||
13479 | 7 |
Permission is hereby granted, free of charge, to any person |
8 |
obtaining a copy of this software and associated documentation |
|
9 |
files (the 'Software'), to deal in the Software without |
|
10 |
restriction, including without limitation the rights to use, |
|
11 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
12 |
copies of the Software, and to permit persons to whom the |
|
13 |
Software is furnished to do so, subject to the following |
|
14 |
conditions: |
|
15 |
||
16 |
The above copyright notice and this permission notice shall be |
|
17 |
included in all copies or substantial portions of the Software. |
|
18 |
||
19 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
20 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
21 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
22 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
23 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
24 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
25 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
26 |
OTHER DEALINGS IN THE SOFTWARE. |
|
13403 | 27 |
" |
28 |
"{ Package: 'stx:libbasic' }" |
|
29 |
||
17300 | 30 |
"{ NameSpace: Smalltalk }" |
31 |
||
13403 | 32 |
Object subclass:#Annotation |
14501 | 33 |
instanceVariableNames:'key arguments' |
13403 | 34 |
classVariableNames:'' |
35 |
poolDictionaries:'' |
|
36 |
category:'Kernel-Extensions' |
|
37 |
! |
|
38 |
||
39 |
Annotation subclass:#NameSpace |
|
14501 | 40 |
instanceVariableNames:'' |
13403 | 41 |
classVariableNames:'' |
42 |
poolDictionaries:'' |
|
43 |
privateIn:Annotation |
|
44 |
! |
|
45 |
||
46 |
Annotation subclass:#Resource |
|
14501 | 47 |
instanceVariableNames:'' |
23242 | 48 |
classVariableNames:'SharedSimpleResources' |
13403 | 49 |
poolDictionaries:'' |
50 |
privateIn:Annotation |
|
51 |
! |
|
52 |
||
53 |
Annotation subclass:#Unknown |
|
14501 | 54 |
instanceVariableNames:'method' |
13403 | 55 |
classVariableNames:'' |
56 |
poolDictionaries:'' |
|
57 |
privateIn:Annotation |
|
58 |
! |
|
59 |
||
60 |
!Annotation class methodsFor:'documentation'! |
|
61 |
||
62 |
copyright |
|
63 |
" |
|
13479 | 64 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
13403 | 65 |
All Rights Reserved |
66 |
||
13479 | 67 |
Permission is hereby granted, free of charge, to any person |
68 |
obtaining a copy of this software and associated documentation |
|
69 |
files (the 'Software'), to deal in the Software without |
|
70 |
restriction, including without limitation the rights to use, |
|
71 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
72 |
copies of the Software, and to permit persons to whom the |
|
73 |
Software is furnished to do so, subject to the following |
|
74 |
conditions: |
|
75 |
||
76 |
The above copyright notice and this permission notice shall be |
|
77 |
included in all copies or substantial portions of the Software. |
|
78 |
||
79 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
80 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
81 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
82 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
83 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
84 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
85 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
86 |
OTHER DEALINGS IN THE SOFTWARE. |
|
13403 | 87 |
" |
14430 | 88 |
! |
89 |
||
90 |
documentation |
|
91 |
" |
|
92 |
I represent an occurrence of a pragma in a compiled method. |
|
22021 | 93 |
|
14430 | 94 |
A pragma is a literal message pattern that occurs between angle brackets at the start of a method after any temporaries. |
95 |
A common example is the primitive pragma: |
|
96 |
<primitive: 123 errorCode: 'errorCode'> |
|
14447
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
97 |
but you can add your own and use them as metadata attached to a method. |
22021 | 98 |
|
14447
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
99 |
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
|
100 |
One can query a method for its pragmas by sending it the pragmas message, which answers an Array of instances of me, |
14430 | 101 |
one for each pragma in the method. |
102 |
I can provide information about the defining class, method, its selector, |
|
103 |
as well as the information about the pragma keyword and its arguments. See the two 'accessing' protocols for details. |
|
104 |
'accessing-method' provides information about the method the pragma is found in, |
|
105 |
while 'accessing-pragma' is about the pragma itself. |
|
106 |
Instances are retrieved using one of the pragma search methods of the 'finding' protocol on the class side. |
|
22021 | 107 |
|
14430 | 108 |
To browse all methods with pragmas in the system evaluate |
22021 | 109 |
SystemBrowser default browseAllSelect: [:m| m pragmas notEmpty] |
110 |
or: |
|
111 |
Smalltalk browseAllSelect: [:m| m pragmas notEmpty] |
|
112 |
||
113 |
(in Squeak/Pharo): to browse all nonprimitive methods with pragmas evaluate |
|
114 |
SystemBrowser default browseAllSelect: [:m| m primitive isZero and: [m pragmas notEmpty]] |
|
22030 | 115 |
|
116 |
knownPragmas |
|
117 |
context flagging: |
|
118 |
<context: #return> |
|
119 |
tells the compiler that this context will be returned through |
|
120 |
via 'thisContext sender ... sender return' from a lower context. |
|
121 |
The compiler's will create a returnable context |
|
122 |
(i.e. to prevent context optimizations) |
|
22021 | 123 |
|
22030 | 124 |
exception handling: |
125 |
<exception: #handle> |
|
126 |
marks contexts as exception handlers. |
|
127 |
||
128 |
<exception: #unwind> |
|
129 |
marks contexts which contain unwind actions |
|
130 |
||
131 |
<exception: #raise> |
|
132 |
marks contexts which raise an exception |
|
22021 | 133 |
|
22030 | 134 |
misc: |
135 |
<resource: #skipInDebuggersWalkBack> |
|
136 |
will not be shown in the debugger |
|
22021 | 137 |
|
22030 | 138 |
<resource: #style (...)> |
139 |
affected by style sheet |
|
22021 | 140 |
|
22030 | 141 |
<resource: #obsolete> |
142 |
marks obsolete methods |
|
22029 | 143 |
|
22030 | 144 |
<modifier: #super> |
145 |
must be called if redefined i.e. redefiners MUST do a super-send |
|
22021 | 146 |
|
22030 | 147 |
<inspector2Tab> |
148 |
<postLoad> |
|
149 |
<swizzle: selector> |
|
22022 | 150 |
|
22030 | 151 |
<category: '...'> |
152 |
GNU-smalltalk's way of defining method categories |
|
14430 | 153 |
" |
13403 | 154 |
! ! |
155 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
156 |
!Annotation class methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
157 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
158 |
initialize |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
159 |
"Invoked at system start or when the class is dynamically loaded." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
160 |
|
13670 | 161 |
Smalltalk at:#Pragma put:self. |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
162 |
|
13670 | 163 |
"Modified: / 09-09-2011 / 07:16:26 / cg" |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
164 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
165 |
|
13403 | 166 |
!Annotation class methodsFor:'instance creation'! |
167 |
||
168 |
key: key arguments: arguments |
|
21381 | 169 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
170 |
"/ (self respondsTo: key) |
|
171 |
(self class includesSelector:key) ifTrue: [ |
|
172 |
^ self |
|
173 |
perform: key |
|
174 |
withArguments: arguments |
|
22022 | 175 |
]. |
23242 | 176 |
^ Annotation::Unknown key:key arguments:arguments |
13403 | 177 |
|
178 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
179 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
22022 | 180 |
"Modified (format): / 16-07-2017 / 13:23:00 / cg" |
23242 | 181 |
"Modified: / 29-07-2018 / 14:52:13 / Claus Gittinger" |
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
182 |
! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
183 |
|
23242 | 184 |
nameSpace:aString |
14262 | 185 |
|
23242 | 186 |
^Annotation::NameSpace nameSpaceName:aString |
14262 | 187 |
|
188 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
189 |
"Created: / 26-07-2012 / 23:05:28 / cg" |
|
23242 | 190 |
"Modified (format): / 29-07-2018 / 14:55:44 / Claus Gittinger" |
14262 | 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 |
||
23242 | 201 |
resource:type |
22022 | 202 |
"resource method - returns menu, spec or image, |
203 |
or accesses/uses the viewStyle" |
|
204 |
||
23242 | 205 |
^Annotation::Resource 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" |
23242 | 209 |
"Modified (format): / 29-07-2018 / 14:55:50 / Claus Gittinger" |
13403 | 210 |
! |
211 |
||
18751 | 212 |
resource:type values:value |
22022 | 213 |
"resource method - returns menu, spec or image, |
214 |
or accesses/uses the viewStyle" |
|
215 |
||
23242 | 216 |
^ Annotation::Resource type:type value:value |
13403 | 217 |
|
218 |
"Created: / 16-07-2010 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
22022 | 219 |
"Modified (comment): / 16-07-2017 / 13:23:53 / cg" |
23242 | 220 |
"Modified: / 29-07-2018 / 14:50:49 / Claus Gittinger" |
13403 | 221 |
! ! |
222 |
||
16134 | 223 |
!Annotation class methodsFor:'finding'! |
14500 | 224 |
|
17645 | 225 |
allInMethod: aMethod |
226 |
"VisualWorks compatibility. |
|
227 |
Answer a collection of all pragmas found in the given method" |
|
228 |
||
229 |
^ aMethod annotations |
|
230 |
! |
|
231 |
||
16134 | 232 |
allNamed:aSymbol |
233 |
"Answer a collection of all pragmas found in all methods of all classes whose keyword is aSymbol." |
|
234 |
||
19820 | 235 |
^ Array |
236 |
streamContents: [ :stream | |
|
237 |
Smalltalk allClassesDo:[:eachClass | |
|
238 |
self withPragmasIn: eachClass do: [ :pragma | |
|
239 |
pragma keyword = aSymbol ifTrue: [ |
|
240 |
stream nextPut: pragma |
|
241 |
] |
|
242 |
] |
|
243 |
] |
|
244 |
]. |
|
16134 | 245 |
|
246 |
" |
|
247 |
Annotation allNamed:'worldMenu' |
|
248 |
" |
|
249 |
! |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
250 |
|
19820 | 251 |
allNamed:aSymbol from:aSubClass to:aSuperClass |
252 |
"Answer a collection of all pragmas found in methods of all classes |
|
253 |
between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol." |
|
254 |
||
255 |
^ Array |
|
256 |
streamContents:[:stream | |
|
257 |
aSubClass withAllSuperclassesDo:[:class | |
|
258 |
self withPragmasIn:class do:[:pragma | |
|
259 |
pragma keyword = aSymbol ifTrue: [ |
|
260 |
stream nextPut: pragma |
|
261 |
] |
|
262 |
]. |
|
263 |
aSuperClass = class ifTrue: [ |
|
264 |
^ stream contents |
|
265 |
] |
|
266 |
] |
|
267 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
268 |
! |
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 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
271 |
"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
|
272 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
273 |
^ 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
|
274 |
! |
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 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
277 |
"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
|
278 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
279 |
^ (self allNamed: aSymbol from: aSubClass to: aSuperClass) sort: aSortBlock. |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
282 |
allNamed: aSymbol in: aClass |
19820 | 283 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol." |
284 |
||
285 |
^ Array |
|
286 |
streamContents: [ :stream | |
|
287 |
self withPragmasIn: aClass do: [ :pragma | |
|
288 |
pragma keyword = aSymbol ifTrue: [ |
|
289 |
stream nextPut: pragma |
|
290 |
] |
|
291 |
] |
|
292 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
293 |
! |
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 |
allNamed: aSymbol in: aClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
296 |
"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
|
297 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
298 |
^ 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
|
299 |
! |
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 |
allNamed: aSymbol in: aClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
302 |
"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
|
303 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
304 |
^ (self allNamed: aSymbol in: aClass) sort: aSortBlock. |
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 |
|
22022 | 307 |
!Annotation class methodsFor:'instance creation - basic'! |
308 |
||
309 |
for: aMethod selector: aSelector arguments: anArray |
|
310 |
^self new |
|
311 |
setMethod: aMethod; |
|
312 |
setKeyword: aSelector; |
|
313 |
setArguments: anArray; |
|
314 |
yourself |
|
315 |
! |
|
13613
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 |
keyword: aSymbol arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
318 |
^ self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
319 |
setKeyword: aSymbol; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
320 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
321 |
yourself. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
322 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
323 |
|
22022 | 324 |
method:method key:key arguments:arguments |
325 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
|
326 |
"/ (self respondsTo: key) |
|
327 |
(self class includesSelector:key) ifTrue: [ |
|
328 |
^ self perform: key withArguments: arguments |
|
329 |
]. |
|
330 |
^ Annotation::Unknown new |
|
331 |
method: method key: key arguments: arguments |
|
332 |
||
333 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
334 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
335 |
"Created: / 05-09-2011 / 04:39:17 / cg" |
|
336 |
"Modified (format): / 16-07-2017 / 13:22:53 / cg" |
|
337 |
! ! |
|
338 |
||
339 |
!Annotation class methodsFor:'private'! |
|
340 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
341 |
withPragmasIn: aClass do: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
342 |
aClass selectorsAndMethodsDo: [ :selector :method | method annotationsDo: aBlock ]. |
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 |
"Modified: / 20-08-2011 / 21:31:49 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
345 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
346 |
|
13403 | 347 |
!Annotation methodsFor:'accessing'! |
348 |
||
14501 | 349 |
arguments |
350 |
^ arguments |
|
351 |
! |
|
352 |
||
13403 | 353 |
first |
354 |
||
355 |
^self key |
|
356 |
||
357 |
"Created: / 10-07-2010 / 21:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
358 |
! |
|
359 |
||
360 |
key |
|
14501 | 361 |
^ key |
13403 | 362 |
! ! |
363 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
364 |
!Annotation methodsFor:'accessing-method'! |
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 |
method |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
367 |
"Answer the compiled-method containing the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
368 |
|
22701 | 369 |
self halt:'unimplemented' |
13613
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 |
"Modified: / 21-08-2011 / 12:44:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
372 |
! |
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 |
methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
375 |
"Answer the class of the method containing the pragma." |
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 |
^ self method methodClass |
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 |
"Modified: / 21-08-2011 / 12:44:47 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
380 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
381 |
|
17694 | 382 |
methodSelector |
383 |
"Answer the selector of the method containing the pragma. |
|
384 |
Added to not confuse this with the selector (i.e. key) of the pragma's message pattern." |
|
385 |
||
386 |
^ self method selector |
|
387 |
||
388 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
|
389 |
! |
|
390 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
391 |
selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
392 |
"Answer the selector of the method containing the pragma. |
17694 | 393 |
Do not confuse this with the selector (i.e. key) of the pragma's message pattern. |
394 |
(use methodSelector, to make this clear)" |
|
13613
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 |
^ self method selector |
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 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
399 |
! ! |
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 |
!Annotation methodsFor:'accessing-pragma'! |
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 |
argumentAt: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
404 |
"Answer one of the arguments of the pragma." |
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 |
^ self arguments at: anInteger. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
407 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
408 |
|
18432 | 409 |
argumentCount |
410 |
"Answer the number of arguments in the pragma." |
|
411 |
||
412 |
^ self arguments size. |
|
413 |
! |
|
414 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
415 |
message |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
416 |
"Answer the message of the receiving pragma." |
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 |
^ Message selector: self keyword arguments: self 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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
421 |
numArgs |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
422 |
"Answer the number of arguments in the pragma." |
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 |
^ self arguments size. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
425 |
! ! |
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 |
!Annotation methodsFor:'comparing'! |
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 |
analogousCodeTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
430 |
^self class == anObject class |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
431 |
and: [self keyword == anObject keyword |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
432 |
and: [self arguments = anObject arguments]] |
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 |
"Modified: / 21-08-2011 / 12:45:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
435 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
436 |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
437 |
!Annotation methodsFor:'compatibility - squeak'! |
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 |
keyword |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
440 |
^ self key |
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 |
"Created: / 05-09-2011 / 04:34:26 / cg" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
443 |
! ! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
444 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
445 |
!Annotation methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
446 |
|
17300 | 447 |
key:keyArg |
448 |
key := keyArg. |
|
449 |
! |
|
450 |
||
14501 | 451 |
key:keyArg arguments:argumentsArg |
452 |
key := keyArg. |
|
453 |
arguments := argumentsArg. |
|
454 |
! |
|
455 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
456 |
setArguments: anArray |
14501 | 457 |
arguments := anArray |
13613
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 |
"Modified: / 21-08-2011 / 12:45:51 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
460 |
! |
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 |
setKeyword: aSymbol |
14501 | 463 |
key := aSymbol |
13613
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 |
"Modified: / 21-08-2011 / 12:46:06 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
466 |
! |
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 |
setMethod: aCompiledMethod |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
469 |
self subclassResponsibility |
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 |
"Modified: / 21-08-2011 / 12:46:16 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
472 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
473 |
|
23225 | 474 |
!Annotation methodsFor:'printing & storing'! |
13403 | 475 |
|
476 |
printOn:aStream |
|
20217 | 477 |
"append a printed representation of the receiver to the argument, aStream" |
13403 | 478 |
|
479 |
self storeOn:aStream. |
|
480 |
||
481 |
"Modified: / 19-05-2010 / 16:25:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
23225 | 482 |
! |
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 |
||
23242 | 575 |
!Annotation::NameSpace class methodsFor:'instance creation'! |
576 |
||
577 |
nameSpaceName:aString |
|
578 |
^ self new nameSpaceName:aString |
|
579 |
||
580 |
"Created: / 29-07-2018 / 14:51:26 / Claus Gittinger" |
|
581 |
! ! |
|
582 |
||
13403 | 583 |
!Annotation::NameSpace methodsFor:'accessing'! |
584 |
||
585 |
key |
|
586 |
||
587 |
^#namespace: |
|
588 |
||
589 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
590 |
! |
|
591 |
||
592 |
nameSpace |
|
14501 | 593 |
^ arguments first |
13403 | 594 |
! |
595 |
||
596 |
nameSpace:something |
|
14501 | 597 |
arguments := Array with:something. |
13403 | 598 |
! ! |
599 |
||
600 |
!Annotation::NameSpace methodsFor:'initialization'! |
|
601 |
||
602 |
nameSpaceName: aString |
|
603 |
||
604 |
self nameSpace: (NameSpace name: aString) |
|
605 |
||
606 |
"Created: / 19-05-2010 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
607 |
! ! |
|
608 |
||
609 |
!Annotation::NameSpace methodsFor:'printing & storing'! |
|
610 |
||
611 |
storeOn:aStream |
|
612 |
"superclass Annotation says that I am responsible to implement this method" |
|
613 |
||
614 |
aStream nextPutAll: '(Annotation namespace: '. |
|
14501 | 615 |
self nameSpace name storeOn: aStream. |
13403 | 616 |
aStream nextPut:$) |
617 |
||
618 |
"Modified: / 19-05-2010 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
619 |
! ! |
|
620 |
||
621 |
!Annotation::NameSpace methodsFor:'processing'! |
|
622 |
||
623 |
annotatesClass:aClass |
|
624 |
||
625 |
"Nothing to do" |
|
626 |
||
627 |
"Modified: / 20-05-2010 / 11:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
628 |
! |
|
629 |
||
630 |
annotatesMethod:aMethod |
|
631 |
||
632 |
aMethod lookupObject: NamespaceAwareLookup instance |
|
633 |
||
634 |
"Modified: / 20-05-2010 / 11:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
635 |
! ! |
|
636 |
||
23242 | 637 |
!Annotation::Resource class methodsFor:'documentation'! |
638 |
||
639 |
documentation |
|
640 |
" |
|
641 |
documentation to be added. |
|
642 |
||
643 |
[author:] |
|
644 |
Claus Gittinger |
|
645 |
||
646 |
[instance variables:] |
|
647 |
||
648 |
[class variables:] |
|
649 |
||
650 |
[see also:] |
|
651 |
||
652 |
" |
|
653 |
! ! |
|
654 |
||
655 |
!Annotation::Resource class methodsFor:'instance creation'! |
|
656 |
||
657 |
type:type value:value |
|
658 |
(value isNil) ifTrue:[ |
|
659 |
SharedSimpleResources isNil ifTrue:[ |
|
660 |
SharedSimpleResources := IdentityDictionary new. |
|
661 |
]. |
|
662 |
^ SharedSimpleResources at:type ifAbsentPut:[self new type:type value:value] |
|
663 |
]. |
|
664 |
^ self new type:type value:value |
|
665 |
||
666 |
"Created: / 29-07-2018 / 14:50:33 / Claus Gittinger" |
|
667 |
! ! |
|
668 |
||
13403 | 669 |
!Annotation::Resource methodsFor:'accessing'! |
670 |
||
14501 | 671 |
type |
672 |
^ arguments at:1 |
|
13403 | 673 |
! |
674 |
||
14501 | 675 |
type:typeArg value:valueArg |
676 |
valueArg isNil ifTrue:[ |
|
677 |
key := #'resource:'. |
|
678 |
arguments := Array with:typeArg. |
|
679 |
] ifFalse:[ |
|
18751 | 680 |
key := #'resource:values:'. |
14501 | 681 |
arguments := Array with:typeArg with:valueArg. |
682 |
]. |
|
13403 | 683 |
! |
684 |
||
685 |
value |
|
14501 | 686 |
arguments size > 1 ifTrue:[ |
687 |
^ arguments at:2 |
|
688 |
]. |
|
689 |
^ nil |
|
13403 | 690 |
! ! |
691 |
||
692 |
!Annotation::Resource methodsFor:'printing & storing'! |
|
693 |
||
694 |
storeOn:aStream |
|
695 |
aStream nextPutAll: '(Annotation resource: '. |
|
14501 | 696 |
self type storeOn: aStream. |
697 |
self value notNil ifTrue: [ |
|
14254 | 698 |
aStream nextPutAll: ' value: '. |
14501 | 699 |
self value storeOn: aStream |
14254 | 700 |
]. |
13403 | 701 |
aStream nextPut:$) |
702 |
||
703 |
"Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13837 | 704 |
"Modified: / 29-11-2011 / 11:19:06 / cg" |
14254 | 705 |
"Modified (format): / 26-07-2012 / 15:59:14 / cg" |
13403 | 706 |
! ! |
707 |
||
708 |
!Annotation::Resource methodsFor:'processing'! |
|
709 |
||
710 |
annotatesClass:aClass |
|
711 |
||
712 |
"Nothing to do" |
|
713 |
||
714 |
"Modified: / 16-07-2010 / 11:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
715 |
! |
|
716 |
||
717 |
annotatesMethod:aMethod |
|
718 |
||
719 |
"Nothing to do" |
|
720 |
||
721 |
"Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
722 |
! ! |
|
723 |
||
14212 | 724 |
!Annotation::Resource methodsFor:'testing'! |
725 |
||
726 |
isResource |
|
727 |
^ true |
|
728 |
||
729 |
"Created: / 18-07-2012 / 19:28:46 / cg" |
|
730 |
! ! |
|
731 |
||
23242 | 732 |
!Annotation::Unknown class methodsFor:'instance creation'! |
733 |
||
734 |
key:key arguments:arguments |
|
735 |
^ self new key:key arguments:arguments |
|
736 |
||
737 |
"Created: / 29-07-2018 / 14:52:00 / Claus Gittinger" |
|
738 |
! ! |
|
739 |
||
13403 | 740 |
!Annotation::Unknown methodsFor:'accessing'! |
741 |
||
14501 | 742 |
method |
743 |
^ method |
|
744 |
||
745 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
|
13403 | 746 |
! |
747 |
||
14501 | 748 |
setMethod:aMethod |
749 |
method := aMethod |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
750 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
751 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
13403 | 752 |
! ! |
753 |
||
754 |
!Annotation::Unknown methodsFor:'initialization'! |
|
755 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
756 |
method:methodArg key:keyArg arguments:argumentsArg |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
757 |
method := methodArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
758 |
key := keyArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
759 |
arguments := argumentsArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
760 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
761 |
"Created: / 05-09-2011 / 04:39:50 / cg" |
13403 | 762 |
! ! |
763 |
||
764 |
!Annotation::Unknown methodsFor:'processing'! |
|
765 |
||
766 |
annotatesClass:aClass |
|
767 |
||
768 |
"Nothing to do" |
|
769 |
||
770 |
"Modified: / 20-05-2010 / 11:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
771 |
! |
|
772 |
||
773 |
annotatesMethod:aMethod |
|
774 |
||
775 |
"Nothing to do" |
|
776 |
||
777 |
"Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
778 |
! ! |
|
779 |
||
14254 | 780 |
!Annotation::Unknown methodsFor:'queries'! |
781 |
||
782 |
refersToLiteral: anObject |
|
783 |
(anObject == method) ifTrue:[ ^ true ]. |
|
14501 | 784 |
^ super refersToLiteral: anObject |
14254 | 785 |
! |
786 |
||
787 |
refersToLiteralMatching: aMatchString |
|
788 |
(method isSymbol and:[aMatchString match:method])ifTrue:[ ^ true ]. |
|
14501 | 789 |
^ super refersToLiteralMatching: aMatchString |
14254 | 790 |
|
791 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
792 |
! ! |
|
793 |
||
13403 | 794 |
!Annotation::Unknown methodsFor:'testing'! |
795 |
||
796 |
isUnknown |
|
797 |
^ true |
|
798 |
! ! |
|
799 |
||
800 |
!Annotation class methodsFor:'documentation'! |
|
801 |
||
13670 | 802 |
version |
18751 | 803 |
^ '$Header$' |
13670 | 804 |
! |
805 |
||
13479 | 806 |
version_CVS |
18751 | 807 |
^ '$Header$' |
13479 | 808 |
! |
809 |
||
13403 | 810 |
version_SVN |
18751 | 811 |
^ '$Id$' |
13403 | 812 |
! ! |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
813 |
|
16134 | 814 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
815 |
Annotation initialize! |