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