author | Claus Gittinger <cg@exept.de> |
Fri, 17 Feb 2017 10:25:31 +0100 | |
changeset 21480 | 20b4ddb4ba7a |
parent 21381 | 26838cd5e876 |
child 22021 | fe6f188d987e |
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. |
|
91 |
A pragma is a literal message pattern that occurs between angle brackets at the start of a method after any temporaries. |
|
92 |
A common example is the primitive pragma: |
|
93 |
<primitive: 123 errorCode: 'errorCode'> |
|
14447
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
94 |
but you can add your own and use them as metadata attached to a method. |
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
95 |
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
|
96 |
One can query a method for its pragmas by sending it the pragmas message, which answers an Array of instances of me, |
14430 | 97 |
one for each pragma in the method. |
98 |
I can provide information about the defining class, method, its selector, |
|
99 |
as well as the information about the pragma keyword and its arguments. See the two 'accessing' protocols for details. |
|
100 |
'accessing-method' provides information about the method the pragma is found in, |
|
101 |
while 'accessing-pragma' is about the pragma itself. |
|
102 |
Instances are retrieved using one of the pragma search methods of the 'finding' protocol on the class side. |
|
103 |
To browse all methods with pragmas in the system evaluate |
|
104 |
SystemNavigation default browseAllSelect: [:m| m pragmas notEmpty] |
|
105 |
in ST/X: Smalltalk browseAllSelect: [:m| m pragmas notEmpty] |
|
106 |
and to browse all nonprimitive methods with pragmas evaluate |
|
107 |
SystemNavigation default browseAllSelect: [:m| m primitive isZero and: [m pragmas notEmpty]] |
|
108 |
" |
|
13403 | 109 |
! ! |
110 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
111 |
!Annotation class methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
112 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
113 |
initialize |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
114 |
"Invoked at system start or when the class is dynamically loaded." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
115 |
|
13670 | 116 |
Smalltalk at:#Pragma put:self. |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
117 |
|
13670 | 118 |
"Modified: / 09-09-2011 / 07:16:26 / cg" |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
119 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
120 |
|
13403 | 121 |
!Annotation class methodsFor:'instance creation'! |
122 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
123 |
for: aMethod selector: aSelector arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
124 |
^self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
125 |
setMethod: aMethod; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
126 |
setKeyword: aSelector; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
127 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
128 |
yourself |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
129 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
130 |
|
13403 | 131 |
key: key arguments: arguments |
132 |
||
21381 | 133 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
134 |
"/ (self respondsTo: key) |
|
135 |
(self class includesSelector:key) ifTrue: [ |
|
136 |
^ self |
|
137 |
perform: key |
|
138 |
withArguments: arguments |
|
139 |
] ifFalse:[ |
|
140 |
^ Annotation::Unknown new |
|
13403 | 141 |
key: key |
21381 | 142 |
arguments: arguments |
143 |
] |
|
13403 | 144 |
|
145 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
146 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
21381 | 147 |
"Modified: / 07-02-2017 / 20:27:49 / cg" |
13403 | 148 |
! |
149 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
150 |
method:method key:key arguments:arguments |
13663
5e08299c39f1
changed: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13625
diff
changeset
|
151 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
14500 | 152 |
"/ (self respondsTo: key) |
21381 | 153 |
(self class includesSelector:key) ifTrue: [ |
154 |
^ self perform: key withArguments: arguments |
|
155 |
] ifFalse: [ |
|
156 |
^ Annotation::Unknown new method: method key: key arguments: arguments |
|
157 |
] |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
158 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
159 |
"Created: / 19-05-2010 / 16:47:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
160 |
"Modified: / 02-07-2010 / 16:22:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
161 |
"Created: / 05-09-2011 / 04:39:17 / cg" |
21381 | 162 |
"Modified: / 07-02-2017 / 20:15:55 / cg" |
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
163 |
! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
164 |
|
14262 | 165 |
nameSpace: aString |
166 |
||
167 |
^Annotation::NameSpace new nameSpaceName: aString |
|
168 |
||
169 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
170 |
"Created: / 26-07-2012 / 23:05:28 / cg" |
|
171 |
! |
|
172 |
||
13403 | 173 |
namespace: aString |
14262 | 174 |
<resource: #obsolete> |
13403 | 175 |
|
14501 | 176 |
^ self nameSpace:aString |
13403 | 177 |
|
178 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
179 |
! |
|
180 |
||
181 |
resource: type |
|
182 |
||
14501 | 183 |
^Annotation::Resource new type: type value:nil |
13403 | 184 |
|
185 |
"Created: / 16-07-2010 / 11:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
186 |
! |
|
187 |
||
18751 | 188 |
resource:type values:value |
189 |
^ Annotation::Resource new type:type value:value |
|
13403 | 190 |
|
191 |
"Created: / 16-07-2010 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
192 |
! ! |
|
193 |
||
16134 | 194 |
!Annotation class methodsFor:'finding'! |
14500 | 195 |
|
17645 | 196 |
allInMethod: aMethod |
197 |
"VisualWorks compatibility. |
|
198 |
Answer a collection of all pragmas found in the given method" |
|
199 |
||
200 |
^ aMethod annotations |
|
201 |
! |
|
202 |
||
16134 | 203 |
allNamed:aSymbol |
204 |
"Answer a collection of all pragmas found in all methods of all classes whose keyword is aSymbol." |
|
205 |
||
19820 | 206 |
^ Array |
207 |
streamContents: [ :stream | |
|
208 |
Smalltalk allClassesDo:[:eachClass | |
|
209 |
self withPragmasIn: eachClass do: [ :pragma | |
|
210 |
pragma keyword = aSymbol ifTrue: [ |
|
211 |
stream nextPut: pragma |
|
212 |
] |
|
213 |
] |
|
214 |
] |
|
215 |
]. |
|
16134 | 216 |
|
217 |
" |
|
218 |
Annotation allNamed:'worldMenu' |
|
219 |
" |
|
220 |
! |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
221 |
|
19820 | 222 |
allNamed:aSymbol from:aSubClass to:aSuperClass |
223 |
"Answer a collection of all pragmas found in methods of all classes |
|
224 |
between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol." |
|
225 |
||
226 |
^ Array |
|
227 |
streamContents:[:stream | |
|
228 |
aSubClass withAllSuperclassesDo:[:class | |
|
229 |
self withPragmasIn:class do:[:pragma | |
|
230 |
pragma keyword = aSymbol ifTrue: [ |
|
231 |
stream nextPut: pragma |
|
232 |
] |
|
233 |
]. |
|
234 |
aSuperClass = class ifTrue: [ |
|
235 |
^ stream contents |
|
236 |
] |
|
237 |
] |
|
238 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
239 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
240 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
241 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
242 |
"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
|
243 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
244 |
^ 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
|
245 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
246 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
247 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
248 |
"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
|
249 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
250 |
^ (self allNamed: aSymbol from: aSubClass to: aSuperClass) sort: aSortBlock. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
251 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
252 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
253 |
allNamed: aSymbol in: aClass |
19820 | 254 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol." |
255 |
||
256 |
^ Array |
|
257 |
streamContents: [ :stream | |
|
258 |
self withPragmasIn: aClass do: [ :pragma | |
|
259 |
pragma keyword = aSymbol ifTrue: [ |
|
260 |
stream nextPut: pragma |
|
261 |
] |
|
262 |
] |
|
263 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
264 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
265 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
266 |
allNamed: aSymbol in: aClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
267 |
"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
|
268 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
269 |
^ 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
|
270 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
271 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
272 |
allNamed: aSymbol in: aClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
273 |
"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
|
274 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
275 |
^ (self allNamed: aSymbol in: aClass) sort: 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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
278 |
!Annotation class methodsFor:'private'! |
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 |
keyword: aSymbol arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
281 |
^ self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
282 |
setKeyword: aSymbol; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
283 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
284 |
yourself. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
285 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
286 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
287 |
withPragmasIn: aClass do: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
288 |
aClass selectorsAndMethodsDo: [ :selector :method | method annotationsDo: aBlock ]. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
289 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
290 |
"Modified: / 20-08-2011 / 21:31:49 / cg" |
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 |
|
13403 | 293 |
!Annotation methodsFor:'accessing'! |
294 |
||
14501 | 295 |
arguments |
296 |
^ arguments |
|
297 |
! |
|
298 |
||
13403 | 299 |
first |
300 |
||
301 |
^self key |
|
302 |
||
303 |
"Created: / 10-07-2010 / 21:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
304 |
! |
|
305 |
||
306 |
key |
|
14501 | 307 |
^ key |
13403 | 308 |
! ! |
309 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
310 |
!Annotation methodsFor:'accessing-method'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
311 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
312 |
method |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
313 |
"Answer the compiled-method containing the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
314 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
315 |
self halt:'inimplemented' |
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 |
"Modified: / 21-08-2011 / 12:44:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
318 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
319 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
320 |
methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
321 |
"Answer the class of the method containing the pragma." |
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 |
^ self method methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
324 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
325 |
"Modified: / 21-08-2011 / 12:44:47 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
326 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
327 |
|
17694 | 328 |
methodSelector |
329 |
"Answer the selector of the method containing the pragma. |
|
330 |
Added to not confuse this with the selector (i.e. key) of the pragma's message pattern." |
|
331 |
||
332 |
^ self method selector |
|
333 |
||
334 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
|
335 |
! |
|
336 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
337 |
selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
338 |
"Answer the selector of the method containing the pragma. |
17694 | 339 |
Do not confuse this with the selector (i.e. key) of the pragma's message pattern. |
340 |
(use methodSelector, to make this clear)" |
|
13613
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 |
^ self method selector |
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: / 21-08-2011 / 12:45:20 / 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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
347 |
!Annotation methodsFor:'accessing-pragma'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
348 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
349 |
argumentAt: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
350 |
"Answer one of the arguments of the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
351 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
352 |
^ self arguments at: anInteger. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
353 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
354 |
|
18432 | 355 |
argumentCount |
356 |
"Answer the number of arguments in the pragma." |
|
357 |
||
358 |
^ self arguments size. |
|
359 |
! |
|
360 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
361 |
message |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
362 |
"Answer the message of the receiving pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
363 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
364 |
^ Message selector: self keyword arguments: self arguments. |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
367 |
numArgs |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
368 |
"Answer the number of arguments in the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
369 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
370 |
^ self arguments size. |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
373 |
!Annotation methodsFor:'comparing'! |
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 |
analogousCodeTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
376 |
^self class == anObject class |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
377 |
and: [self keyword == anObject keyword |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
378 |
and: [self arguments = anObject arguments]] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
379 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
380 |
"Modified: / 21-08-2011 / 12:45:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
381 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
382 |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
383 |
!Annotation methodsFor:'compatibility - squeak'! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
384 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
385 |
keyword |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
386 |
^ self key |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
387 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
388 |
"Created: / 05-09-2011 / 04:34:26 / cg" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
389 |
! ! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
390 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
391 |
!Annotation methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
392 |
|
17300 | 393 |
key:keyArg |
394 |
key := keyArg. |
|
395 |
! |
|
396 |
||
14501 | 397 |
key:keyArg arguments:argumentsArg |
398 |
key := keyArg. |
|
399 |
arguments := argumentsArg. |
|
400 |
! |
|
401 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
402 |
setArguments: anArray |
14501 | 403 |
arguments := anArray |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
404 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
405 |
"Modified: / 21-08-2011 / 12:45:51 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
406 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
407 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
408 |
setKeyword: aSymbol |
14501 | 409 |
key := aSymbol |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
410 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
411 |
"Modified: / 21-08-2011 / 12:46:06 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
412 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
413 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
414 |
setMethod: aCompiledMethod |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
415 |
self subclassResponsibility |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
416 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
417 |
"Modified: / 21-08-2011 / 12:46:16 / cg" |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
420 |
!Annotation methodsFor:'printing'! |
13403 | 421 |
|
422 |
printOn:aStream |
|
20217 | 423 |
"append a printed representation of the receiver to the argument, aStream" |
13403 | 424 |
|
425 |
self storeOn:aStream. |
|
426 |
||
427 |
"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
|
428 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
429 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
430 |
!Annotation methodsFor:'printing & storing'! |
13403 | 431 |
|
432 |
storeOn:aStream |
|
14501 | 433 |
"superclass Annotation says that I am responsible to implement this method" |
13403 | 434 |
|
14501 | 435 |
aStream nextPutAll: '(Annotation key: '. |
436 |
key storeOn: aStream. |
|
437 |
aStream nextPutAll: ' arguments: '. |
|
438 |
arguments storeOn: aStream. |
|
439 |
aStream nextPut: $). |
|
13403 | 440 |
|
14501 | 441 |
"Modified: / 19-05-2010 / 16:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13403 | 442 |
! ! |
443 |
||
444 |
!Annotation methodsFor:'processing'! |
|
445 |
||
446 |
annotatesClass: aClass |
|
447 |
||
448 |
^self subclassResponsibility |
|
449 |
||
450 |
"Created: / 20-05-2010 / 11:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
451 |
! |
|
452 |
||
453 |
annotatesMethod: aMethod |
|
454 |
||
455 |
^self subclassResponsibility |
|
456 |
||
457 |
"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
|
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 |
sendTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
461 |
"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
|
462 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
463 |
^ anObject perform: self keyword withArguments: self arguments |
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 |
withArgumentsDo: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
467 |
"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
|
468 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
469 |
^ aBlock valueWithArguments: self arguments |
13403 | 470 |
! ! |
471 |
||
14254 | 472 |
!Annotation methodsFor:'queries'! |
473 |
||
474 |
refersToLiteral: anObject |
|
16264 | 475 |
"return true if the receiver or recursively any array element in the |
476 |
receiver refers to aLiteral (i.e. a deep search)" |
|
477 |
||
14501 | 478 |
(anObject == key) ifTrue:[ ^ true ]. |
479 |
(anObject == arguments) ifTrue:[ ^ true ]. |
|
480 |
arguments isArray ifTrue:[ ^ arguments refersToLiteral: anObject]. |
|
14254 | 481 |
^ false |
482 |
||
14501 | 483 |
"Created: / 26-07-2012 / 15:57:43 / cg" |
484 |
! |
|
485 |
||
486 |
refersToLiteralMatching: aMatchString |
|
487 |
(key isSymbol and:[aMatchString match:key])ifTrue:[ ^ true ]. |
|
488 |
(arguments isSymbol and:[aMatchString match:arguments])ifTrue:[ ^ true ]. |
|
489 |
arguments isArray ifTrue:[ ^ arguments refersToLiteralMatching: aMatchString]. |
|
490 |
^ false |
|
491 |
||
492 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
14254 | 493 |
! ! |
494 |
||
13403 | 495 |
!Annotation methodsFor:'testing'! |
496 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
497 |
hasLiteral: aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
498 |
^self keyword == aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
499 |
or: [self arguments hasLiteral: aLiteral] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
500 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
501 |
"Modified: / 21-08-2011 / 12:46:44 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
502 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
503 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
504 |
hasLiteralSuchThat: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
505 |
"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
|
506 |
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
507 |
^(aBlock value: self keyword) |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
508 |
or: [self arguments hasLiteralSuchThat: aBlock] |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
509 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
510 |
"Modified: / 21-08-2011 / 12:46:31 / cg" |
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 |
|
14212 | 513 |
isResource |
514 |
^ false |
|
515 |
||
516 |
"Created: / 18-07-2012 / 19:28:39 / cg" |
|
517 |
! |
|
518 |
||
13403 | 519 |
isUnknown |
520 |
^ false |
|
521 |
! ! |
|
522 |
||
523 |
!Annotation::NameSpace methodsFor:'accessing'! |
|
524 |
||
525 |
key |
|
526 |
||
527 |
^#namespace: |
|
528 |
||
529 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
530 |
! |
|
531 |
||
532 |
nameSpace |
|
14501 | 533 |
^ arguments first |
13403 | 534 |
! |
535 |
||
536 |
nameSpace:something |
|
14501 | 537 |
arguments := Array with:something. |
13403 | 538 |
! ! |
539 |
||
540 |
!Annotation::NameSpace methodsFor:'initialization'! |
|
541 |
||
542 |
nameSpaceName: aString |
|
543 |
||
544 |
self nameSpace: (NameSpace name: aString) |
|
545 |
||
546 |
"Created: / 19-05-2010 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
547 |
! ! |
|
548 |
||
549 |
!Annotation::NameSpace methodsFor:'printing & storing'! |
|
550 |
||
551 |
storeOn:aStream |
|
552 |
"superclass Annotation says that I am responsible to implement this method" |
|
553 |
||
554 |
aStream nextPutAll: '(Annotation namespace: '. |
|
14501 | 555 |
self nameSpace name storeOn: aStream. |
13403 | 556 |
aStream nextPut:$) |
557 |
||
558 |
"Modified: / 19-05-2010 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
559 |
! ! |
|
560 |
||
561 |
!Annotation::NameSpace methodsFor:'processing'! |
|
562 |
||
563 |
annotatesClass:aClass |
|
564 |
||
565 |
"Nothing to do" |
|
566 |
||
567 |
"Modified: / 20-05-2010 / 11:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
568 |
! |
|
569 |
||
570 |
annotatesMethod:aMethod |
|
571 |
||
572 |
aMethod lookupObject: NamespaceAwareLookup instance |
|
573 |
||
574 |
"Modified: / 20-05-2010 / 11:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
575 |
! ! |
|
576 |
||
577 |
!Annotation::Resource methodsFor:'accessing'! |
|
578 |
||
14501 | 579 |
type |
580 |
^ arguments at:1 |
|
13403 | 581 |
! |
582 |
||
14501 | 583 |
type:typeArg value:valueArg |
584 |
valueArg isNil ifTrue:[ |
|
585 |
key := #'resource:'. |
|
586 |
arguments := Array with:typeArg. |
|
587 |
] ifFalse:[ |
|
18751 | 588 |
key := #'resource:values:'. |
14501 | 589 |
arguments := Array with:typeArg with:valueArg. |
590 |
]. |
|
13403 | 591 |
! |
592 |
||
593 |
value |
|
14501 | 594 |
arguments size > 1 ifTrue:[ |
595 |
^ arguments at:2 |
|
596 |
]. |
|
597 |
^ nil |
|
13403 | 598 |
! ! |
599 |
||
600 |
!Annotation::Resource methodsFor:'printing & storing'! |
|
601 |
||
602 |
storeOn:aStream |
|
603 |
aStream nextPutAll: '(Annotation resource: '. |
|
14501 | 604 |
self type storeOn: aStream. |
605 |
self value notNil ifTrue: [ |
|
14254 | 606 |
aStream nextPutAll: ' value: '. |
14501 | 607 |
self value storeOn: aStream |
14254 | 608 |
]. |
13403 | 609 |
aStream nextPut:$) |
610 |
||
611 |
"Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13837 | 612 |
"Modified: / 29-11-2011 / 11:19:06 / cg" |
14254 | 613 |
"Modified (format): / 26-07-2012 / 15:59:14 / cg" |
13403 | 614 |
! ! |
615 |
||
616 |
!Annotation::Resource methodsFor:'processing'! |
|
617 |
||
618 |
annotatesClass:aClass |
|
619 |
||
620 |
"Nothing to do" |
|
621 |
||
622 |
"Modified: / 16-07-2010 / 11:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
623 |
! |
|
624 |
||
625 |
annotatesMethod:aMethod |
|
626 |
||
627 |
"Nothing to do" |
|
628 |
||
629 |
"Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
630 |
! ! |
|
631 |
||
14212 | 632 |
!Annotation::Resource methodsFor:'testing'! |
633 |
||
634 |
isResource |
|
635 |
^ true |
|
636 |
||
637 |
"Created: / 18-07-2012 / 19:28:46 / cg" |
|
638 |
! ! |
|
639 |
||
13403 | 640 |
!Annotation::Unknown methodsFor:'accessing'! |
641 |
||
14501 | 642 |
method |
643 |
^ method |
|
644 |
||
645 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
|
13403 | 646 |
! |
647 |
||
14501 | 648 |
setMethod:aMethod |
649 |
method := aMethod |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
650 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
651 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
13403 | 652 |
! ! |
653 |
||
654 |
!Annotation::Unknown methodsFor:'initialization'! |
|
655 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
656 |
method:methodArg key:keyArg arguments:argumentsArg |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
657 |
method := methodArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
658 |
key := keyArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
659 |
arguments := argumentsArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
660 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
661 |
"Created: / 05-09-2011 / 04:39:50 / cg" |
13403 | 662 |
! ! |
663 |
||
664 |
!Annotation::Unknown methodsFor:'processing'! |
|
665 |
||
666 |
annotatesClass:aClass |
|
667 |
||
668 |
"Nothing to do" |
|
669 |
||
670 |
"Modified: / 20-05-2010 / 11:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
671 |
! |
|
672 |
||
673 |
annotatesMethod:aMethod |
|
674 |
||
675 |
"Nothing to do" |
|
676 |
||
677 |
"Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
678 |
! ! |
|
679 |
||
14254 | 680 |
!Annotation::Unknown methodsFor:'queries'! |
681 |
||
682 |
refersToLiteral: anObject |
|
683 |
(anObject == method) ifTrue:[ ^ true ]. |
|
14501 | 684 |
^ super refersToLiteral: anObject |
14254 | 685 |
! |
686 |
||
687 |
refersToLiteralMatching: aMatchString |
|
688 |
(method isSymbol and:[aMatchString match:method])ifTrue:[ ^ true ]. |
|
14501 | 689 |
^ super refersToLiteralMatching: aMatchString |
14254 | 690 |
|
691 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
692 |
! ! |
|
693 |
||
13403 | 694 |
!Annotation::Unknown methodsFor:'testing'! |
695 |
||
696 |
isUnknown |
|
697 |
^ true |
|
698 |
! ! |
|
699 |
||
700 |
!Annotation class methodsFor:'documentation'! |
|
701 |
||
13670 | 702 |
version |
18751 | 703 |
^ '$Header$' |
13670 | 704 |
! |
705 |
||
13479 | 706 |
version_CVS |
18751 | 707 |
^ '$Header$' |
13479 | 708 |
! |
709 |
||
13403 | 710 |
version_SVN |
18751 | 711 |
^ '$Id$' |
13403 | 712 |
! ! |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
713 |
|
16134 | 714 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
715 |
Annotation initialize! |