author | Jan Vrany <jan.vrany@labware.com> |
Wed, 02 Aug 2023 13:04:52 +0100 | |
branch | jv |
changeset 25462 | 548cb62b20c7 |
parent 23107 | 40173e082cbc |
permissions | -rw-r--r-- |
13403 | 1 |
" |
13479 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
23107 | 3 |
COPYRIGHT (c) 2010 Jan Vrany |
13403 | 4 |
All Rights Reserved |
5 |
||
13479 | 6 |
Permission is hereby granted, free of charge, to any person |
7 |
obtaining a copy of this software and associated documentation |
|
8 |
files (the 'Software'), to deal in the Software without |
|
9 |
restriction, including without limitation the rights to use, |
|
10 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 |
copies of the Software, and to permit persons to whom the |
|
12 |
Software is furnished to do so, subject to the following |
|
13 |
conditions: |
|
14 |
||
15 |
The above copyright notice and this permission notice shall be |
|
16 |
included in all copies or substantial portions of the Software. |
|
17 |
||
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
19 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
20 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
21 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
22 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
23 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
25 |
OTHER DEALINGS IN THE SOFTWARE. |
|
13403 | 26 |
" |
27 |
"{ Package: 'stx:libbasic' }" |
|
28 |
||
17300 | 29 |
"{ NameSpace: Smalltalk }" |
30 |
||
13403 | 31 |
Object subclass:#Annotation |
14501 | 32 |
instanceVariableNames:'key arguments' |
13403 | 33 |
classVariableNames:'' |
34 |
poolDictionaries:'' |
|
35 |
category:'Kernel-Extensions' |
|
36 |
! |
|
37 |
||
38 |
Annotation subclass:#NameSpace |
|
14501 | 39 |
instanceVariableNames:'' |
13403 | 40 |
classVariableNames:'' |
41 |
poolDictionaries:'' |
|
42 |
privateIn:Annotation |
|
43 |
! |
|
44 |
||
45 |
Annotation subclass:#Resource |
|
14501 | 46 |
instanceVariableNames:'' |
13403 | 47 |
classVariableNames:'' |
48 |
poolDictionaries:'' |
|
49 |
privateIn:Annotation |
|
50 |
! |
|
51 |
||
52 |
Annotation subclass:#Unknown |
|
14501 | 53 |
instanceVariableNames:'method' |
13403 | 54 |
classVariableNames:'' |
55 |
poolDictionaries:'' |
|
56 |
privateIn:Annotation |
|
57 |
! |
|
58 |
||
59 |
!Annotation class methodsFor:'documentation'! |
|
60 |
||
61 |
copyright |
|
62 |
" |
|
13479 | 63 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
23107 | 64 |
COPYRIGHT (c) 2010 Jan Vrany |
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. |
|
93 |
A pragma is a literal message pattern that occurs between angle brackets at the start of a method after any temporaries. |
|
94 |
A common example is the primitive pragma: |
|
95 |
<primitive: 123 errorCode: 'errorCode'> |
|
14447
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
96 |
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
|
97 |
Because pragmas are messages one can browse senders and implementors and perform them. |
20f864eaec94
comment/format in: #documentation
Claus Gittinger <cg@exept.de>
parents:
14430
diff
changeset
|
98 |
One can query a method for its pragmas by sending it the pragmas message, which answers an Array of instances of me, |
14430 | 99 |
one for each pragma in the method. |
100 |
I can provide information about the defining class, method, its selector, |
|
101 |
as well as the information about the pragma keyword and its arguments. See the two 'accessing' protocols for details. |
|
102 |
'accessing-method' provides information about the method the pragma is found in, |
|
103 |
while 'accessing-pragma' is about the pragma itself. |
|
104 |
Instances are retrieved using one of the pragma search methods of the 'finding' protocol on the class side. |
|
105 |
To browse all methods with pragmas in the system evaluate |
|
106 |
SystemNavigation default browseAllSelect: [:m| m pragmas notEmpty] |
|
107 |
in ST/X: Smalltalk browseAllSelect: [:m| m pragmas notEmpty] |
|
108 |
and to browse all nonprimitive methods with pragmas evaluate |
|
109 |
SystemNavigation default browseAllSelect: [:m| m primitive isZero and: [m pragmas notEmpty]] |
|
110 |
" |
|
13403 | 111 |
! ! |
112 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
113 |
!Annotation class methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
114 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
115 |
initialize |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
116 |
"Invoked at system start or when the class is dynamically loaded." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
117 |
|
13670 | 118 |
Smalltalk at:#Pragma put:self. |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
119 |
|
13670 | 120 |
"Modified: / 09-09-2011 / 07:16:26 / cg" |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
121 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
122 |
|
13403 | 123 |
!Annotation class methodsFor:'instance creation'! |
124 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
125 |
for: aMethod selector: aSelector arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
126 |
^self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
127 |
setMethod: aMethod; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
128 |
setKeyword: aSelector; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
129 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
130 |
yourself |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
131 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
132 |
|
13403 | 133 |
key: key arguments: arguments |
134 |
||
135 |
^(self respondsTo: key) |
|
136 |
ifTrue: |
|
137 |
[self |
|
138 |
perform: key |
|
139 |
withArguments: arguments] |
|
140 |
ifFalse: |
|
141 |
[Annotation::Unknown new |
|
142 |
key: key |
|
143 |
arguments: arguments] |
|
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>" |
|
147 |
! |
|
148 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
149 |
method:method key:key arguments:arguments |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
150 |
|
13663
5e08299c39f1
changed: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13625
diff
changeset
|
151 |
^ |
5e08299c39f1
changed: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13625
diff
changeset
|
152 |
"/ cg: do not react on all those methods inherited from Object (such as inline:) |
14500 | 153 |
"/ (self respondsTo: key) |
13663
5e08299c39f1
changed: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13625
diff
changeset
|
154 |
(self class includesSelector:key) |
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
155 |
ifTrue: |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
156 |
[self |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
157 |
perform: key |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
158 |
withArguments: arguments] |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
159 |
ifFalse: |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
160 |
[Annotation::Unknown new |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
161 |
method: method |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
162 |
key: key |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
163 |
arguments: arguments] |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
164 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
165 |
"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
|
166 |
"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
|
167 |
"Created: / 05-09-2011 / 04:39:17 / cg" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
168 |
! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
169 |
|
14262 | 170 |
nameSpace: aString |
171 |
||
172 |
^Annotation::NameSpace new nameSpaceName: aString |
|
173 |
||
174 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 |
"Created: / 26-07-2012 / 23:05:28 / cg" |
|
176 |
! |
|
177 |
||
13403 | 178 |
namespace: aString |
14262 | 179 |
<resource: #obsolete> |
13403 | 180 |
|
14501 | 181 |
^ self nameSpace:aString |
13403 | 182 |
|
183 |
"Created: / 19-05-2010 / 16:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
184 |
! |
|
185 |
||
186 |
resource: type |
|
187 |
||
14501 | 188 |
^Annotation::Resource new type: type value:nil |
13403 | 189 |
|
190 |
"Created: / 16-07-2010 / 11:31:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
191 |
! |
|
192 |
||
18751 | 193 |
resource:type values:value |
194 |
^ Annotation::Resource new type:type value:value |
|
13403 | 195 |
|
196 |
"Created: / 16-07-2010 / 11:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
197 |
! ! |
|
198 |
||
16134 | 199 |
!Annotation class methodsFor:'finding'! |
14500 | 200 |
|
17645 | 201 |
allInMethod: aMethod |
202 |
"VisualWorks compatibility. |
|
203 |
Answer a collection of all pragmas found in the given method" |
|
204 |
||
205 |
^ aMethod annotations |
|
206 |
! |
|
207 |
||
16134 | 208 |
allNamed:aSymbol |
209 |
"Answer a collection of all pragmas found in all methods of all classes whose keyword is aSymbol." |
|
210 |
||
19820 | 211 |
^ Array |
212 |
streamContents: [ :stream | |
|
213 |
Smalltalk allClassesDo:[:eachClass | |
|
214 |
self withPragmasIn: eachClass do: [ :pragma | |
|
215 |
pragma keyword = aSymbol ifTrue: [ |
|
216 |
stream nextPut: pragma |
|
217 |
] |
|
218 |
] |
|
219 |
] |
|
220 |
]. |
|
16134 | 221 |
|
222 |
" |
|
223 |
Annotation allNamed:'worldMenu' |
|
224 |
" |
|
225 |
! |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
226 |
|
19820 | 227 |
allNamed:aSymbol from:aSubClass to:aSuperClass |
228 |
"Answer a collection of all pragmas found in methods of all classes |
|
229 |
between aSubClass and aSuperClass (inclusive) whose keyword is aSymbol." |
|
230 |
||
231 |
^ Array |
|
232 |
streamContents:[:stream | |
|
233 |
aSubClass withAllSuperclassesDo:[:class | |
|
234 |
self withPragmasIn:class do:[:pragma | |
|
235 |
pragma keyword = aSymbol ifTrue: [ |
|
236 |
stream nextPut: pragma |
|
237 |
] |
|
238 |
]. |
|
239 |
aSuperClass = class ifTrue: [ |
|
240 |
^ stream contents |
|
241 |
] |
|
242 |
] |
|
243 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
244 |
! |
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 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
247 |
"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
|
248 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
249 |
^ 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
|
250 |
! |
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 |
allNamed: aSymbol from: aSubClass to: aSuperClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
253 |
"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
|
254 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
255 |
^ (self allNamed: aSymbol from: aSubClass to: aSuperClass) sort: aSortBlock. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
256 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
257 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
258 |
allNamed: aSymbol in: aClass |
19820 | 259 |
"Answer a collection of all pragmas found in methods of aClass whose keyword is aSymbol." |
260 |
||
261 |
^ Array |
|
262 |
streamContents: [ :stream | |
|
263 |
self withPragmasIn: aClass do: [ :pragma | |
|
264 |
pragma keyword = aSymbol ifTrue: [ |
|
265 |
stream nextPut: pragma |
|
266 |
] |
|
267 |
] |
|
268 |
]. |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
269 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
270 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
271 |
allNamed: aSymbol in: aClass sortedByArgument: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
272 |
"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
|
273 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
274 |
^ 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
|
275 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
276 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
277 |
allNamed: aSymbol in: aClass sortedUsing: aSortBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
278 |
"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
|
279 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
280 |
^ (self allNamed: aSymbol in: aClass) sort: aSortBlock. |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
283 |
!Annotation class methodsFor:'private'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
284 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
285 |
keyword: aSymbol arguments: anArray |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
286 |
^ self new |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
287 |
setKeyword: aSymbol; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
288 |
setArguments: anArray; |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
289 |
yourself. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
290 |
! |
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 |
withPragmasIn: aClass do: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
293 |
aClass selectorsAndMethodsDo: [ :selector :method | method annotationsDo: aBlock ]. |
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 |
"Modified: / 20-08-2011 / 21:31:49 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
296 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
297 |
|
13403 | 298 |
!Annotation methodsFor:'accessing'! |
299 |
||
14501 | 300 |
arguments |
301 |
^ arguments |
|
302 |
! |
|
303 |
||
13403 | 304 |
first |
305 |
||
306 |
^self key |
|
307 |
||
308 |
"Created: / 10-07-2010 / 21:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
309 |
! |
|
310 |
||
311 |
key |
|
14501 | 312 |
^ key |
13403 | 313 |
! ! |
314 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
315 |
!Annotation methodsFor:'accessing-method'! |
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 |
method |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
318 |
"Answer the compiled-method containing the pragma." |
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 |
self halt:'inimplemented' |
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 |
"Modified: / 21-08-2011 / 12:44:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
323 |
! |
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 |
methodClass |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
326 |
"Answer the class of the method containing the pragma." |
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 |
^ self method methodClass |
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 |
"Modified: / 21-08-2011 / 12:44:47 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
331 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
332 |
|
17694 | 333 |
methodSelector |
334 |
"Answer the selector of the method containing the pragma. |
|
335 |
Added to not confuse this with the selector (i.e. key) of the pragma's message pattern." |
|
336 |
||
337 |
^ self method selector |
|
338 |
||
339 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
|
340 |
! |
|
341 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
342 |
selector |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
343 |
"Answer the selector of the method containing the pragma. |
17694 | 344 |
Do not confuse this with the selector (i.e. key) of the pragma's message pattern. |
345 |
(use methodSelector, to make this clear)" |
|
13613
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 |
^ self method selector |
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 |
"Modified: / 21-08-2011 / 12:45:20 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
350 |
! ! |
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 |
!Annotation methodsFor:'accessing-pragma'! |
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 |
argumentAt: anInteger |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
355 |
"Answer one of the arguments of the pragma." |
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 |
^ self arguments at: anInteger. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
358 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
359 |
|
18432 | 360 |
argumentCount |
361 |
"Answer the number of arguments in the pragma." |
|
362 |
||
363 |
^ self arguments size. |
|
364 |
! |
|
365 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
366 |
message |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
367 |
"Answer the message of the receiving pragma." |
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 |
^ Message selector: self keyword arguments: self arguments. |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
370 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
371 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
372 |
numArgs |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
373 |
"Answer the number of arguments in the pragma." |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
374 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
375 |
^ self arguments size. |
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 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
378 |
!Annotation methodsFor:'comparing'! |
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 |
analogousCodeTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
381 |
^self class == anObject class |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
382 |
and: [self keyword == anObject keyword |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
383 |
and: [self arguments = anObject arguments]] |
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 |
"Modified: / 21-08-2011 / 12:45:37 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
386 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
387 |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
388 |
!Annotation methodsFor:'compatibility - squeak'! |
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 |
keyword |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
391 |
^ self key |
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 |
"Created: / 05-09-2011 / 04:34:26 / cg" |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
394 |
! ! |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
395 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
396 |
!Annotation methodsFor:'initialization'! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
397 |
|
17300 | 398 |
key:keyArg |
399 |
key := keyArg. |
|
400 |
! |
|
401 |
||
14501 | 402 |
key:keyArg arguments:argumentsArg |
403 |
key := keyArg. |
|
404 |
arguments := argumentsArg. |
|
405 |
! |
|
406 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
407 |
setArguments: anArray |
14501 | 408 |
arguments := anArray |
13613
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 |
"Modified: / 21-08-2011 / 12:45:51 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
411 |
! |
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 |
setKeyword: aSymbol |
14501 | 414 |
key := aSymbol |
13613
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 |
"Modified: / 21-08-2011 / 12:46:06 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
417 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
418 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
419 |
setMethod: aCompiledMethod |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
420 |
self subclassResponsibility |
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 |
"Modified: / 21-08-2011 / 12:46:16 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
423 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
424 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
425 |
!Annotation methodsFor:'printing'! |
13403 | 426 |
|
427 |
printOn:aStream |
|
20217 | 428 |
"append a printed representation of the receiver to the argument, aStream" |
13403 | 429 |
|
430 |
self storeOn:aStream. |
|
431 |
||
432 |
"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
|
433 |
! ! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
434 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
435 |
!Annotation methodsFor:'printing & storing'! |
13403 | 436 |
|
437 |
storeOn:aStream |
|
14501 | 438 |
"superclass Annotation says that I am responsible to implement this method" |
13403 | 439 |
|
14501 | 440 |
aStream nextPutAll: '(Annotation key: '. |
441 |
key storeOn: aStream. |
|
442 |
aStream nextPutAll: ' arguments: '. |
|
443 |
arguments storeOn: aStream. |
|
444 |
aStream nextPut: $). |
|
13403 | 445 |
|
14501 | 446 |
"Modified: / 19-05-2010 / 16:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13403 | 447 |
! ! |
448 |
||
449 |
!Annotation methodsFor:'processing'! |
|
450 |
||
451 |
annotatesClass: aClass |
|
452 |
||
453 |
^self subclassResponsibility |
|
454 |
||
455 |
"Created: / 20-05-2010 / 11:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
456 |
! |
|
457 |
||
458 |
annotatesMethod: aMethod |
|
459 |
||
460 |
^self subclassResponsibility |
|
461 |
||
462 |
"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
|
463 |
! |
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 |
sendTo: anObject |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
466 |
"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
|
467 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
468 |
^ anObject perform: self keyword withArguments: self arguments |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
469 |
! |
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 |
withArgumentsDo: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
472 |
"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
|
473 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
474 |
^ aBlock valueWithArguments: self arguments |
13403 | 475 |
! ! |
476 |
||
14254 | 477 |
!Annotation methodsFor:'queries'! |
478 |
||
479 |
refersToLiteral: anObject |
|
16264 | 480 |
"return true if the receiver or recursively any array element in the |
481 |
receiver refers to aLiteral (i.e. a deep search)" |
|
482 |
||
14501 | 483 |
(anObject == key) ifTrue:[ ^ true ]. |
484 |
(anObject == arguments) ifTrue:[ ^ true ]. |
|
485 |
arguments isArray ifTrue:[ ^ arguments refersToLiteral: anObject]. |
|
14254 | 486 |
^ false |
487 |
||
14501 | 488 |
"Created: / 26-07-2012 / 15:57:43 / cg" |
489 |
! |
|
490 |
||
491 |
refersToLiteralMatching: aMatchString |
|
492 |
(key isSymbol and:[aMatchString match:key])ifTrue:[ ^ true ]. |
|
493 |
(arguments isSymbol and:[aMatchString match:arguments])ifTrue:[ ^ true ]. |
|
494 |
arguments isArray ifTrue:[ ^ arguments refersToLiteralMatching: aMatchString]. |
|
495 |
^ false |
|
496 |
||
497 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
14254 | 498 |
! ! |
499 |
||
13403 | 500 |
!Annotation methodsFor:'testing'! |
501 |
||
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
502 |
hasLiteral: aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
503 |
^self keyword == aLiteral |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
504 |
or: [self arguments hasLiteral: aLiteral] |
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 |
"Modified: / 21-08-2011 / 12:46:44 / cg" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
507 |
! |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
508 |
|
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
509 |
hasLiteralSuchThat: aBlock |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
510 |
"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
|
511 |
This method is only intended for private use by CompiledMethod hasLiteralSuchThat:" |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
512 |
^(aBlock value: self keyword) |
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
513 |
or: [self arguments hasLiteralSuchThat: aBlock] |
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 |
"Modified: / 21-08-2011 / 12:46:31 / cg" |
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 |
|
14212 | 518 |
isResource |
519 |
^ false |
|
520 |
||
521 |
"Created: / 18-07-2012 / 19:28:39 / cg" |
|
522 |
! |
|
523 |
||
13403 | 524 |
isUnknown |
525 |
^ false |
|
526 |
! ! |
|
527 |
||
528 |
!Annotation::NameSpace methodsFor:'accessing'! |
|
529 |
||
530 |
key |
|
531 |
||
532 |
^#namespace: |
|
533 |
||
534 |
"Created: / 19-05-2010 / 16:23:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
535 |
! |
|
536 |
||
537 |
nameSpace |
|
14501 | 538 |
^ arguments first |
13403 | 539 |
! |
540 |
||
541 |
nameSpace:something |
|
14501 | 542 |
arguments := Array with:something. |
13403 | 543 |
! ! |
544 |
||
545 |
!Annotation::NameSpace methodsFor:'initialization'! |
|
546 |
||
547 |
nameSpaceName: aString |
|
548 |
||
549 |
self nameSpace: (NameSpace name: aString) |
|
550 |
||
551 |
"Created: / 19-05-2010 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
552 |
! ! |
|
553 |
||
554 |
!Annotation::NameSpace methodsFor:'printing & storing'! |
|
555 |
||
556 |
storeOn:aStream |
|
557 |
"superclass Annotation says that I am responsible to implement this method" |
|
558 |
||
559 |
aStream nextPutAll: '(Annotation namespace: '. |
|
14501 | 560 |
self nameSpace name storeOn: aStream. |
13403 | 561 |
aStream nextPut:$) |
562 |
||
563 |
"Modified: / 19-05-2010 / 16:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
564 |
! ! |
|
565 |
||
566 |
!Annotation::NameSpace methodsFor:'processing'! |
|
567 |
||
568 |
annotatesClass:aClass |
|
569 |
||
570 |
"Nothing to do" |
|
571 |
||
572 |
"Modified: / 20-05-2010 / 11:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
573 |
! |
|
574 |
||
575 |
annotatesMethod:aMethod |
|
576 |
||
577 |
aMethod lookupObject: NamespaceAwareLookup instance |
|
578 |
||
579 |
"Modified: / 20-05-2010 / 11:18:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
580 |
! ! |
|
581 |
||
582 |
!Annotation::Resource methodsFor:'accessing'! |
|
583 |
||
14501 | 584 |
type |
585 |
^ arguments at:1 |
|
13403 | 586 |
! |
587 |
||
14501 | 588 |
type:typeArg value:valueArg |
589 |
valueArg isNil ifTrue:[ |
|
590 |
key := #'resource:'. |
|
591 |
arguments := Array with:typeArg. |
|
592 |
] ifFalse:[ |
|
18751 | 593 |
key := #'resource:values:'. |
14501 | 594 |
arguments := Array with:typeArg with:valueArg. |
595 |
]. |
|
13403 | 596 |
! |
597 |
||
598 |
value |
|
14501 | 599 |
arguments size > 1 ifTrue:[ |
600 |
^ arguments at:2 |
|
601 |
]. |
|
602 |
^ nil |
|
13403 | 603 |
! ! |
604 |
||
605 |
!Annotation::Resource methodsFor:'printing & storing'! |
|
606 |
||
607 |
storeOn:aStream |
|
608 |
aStream nextPutAll: '(Annotation resource: '. |
|
14501 | 609 |
self type storeOn: aStream. |
610 |
self value notNil ifTrue: [ |
|
14254 | 611 |
aStream nextPutAll: ' value: '. |
14501 | 612 |
self value storeOn: aStream |
14254 | 613 |
]. |
13403 | 614 |
aStream nextPut:$) |
615 |
||
616 |
"Modified: / 16-07-2010 / 11:36:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13837 | 617 |
"Modified: / 29-11-2011 / 11:19:06 / cg" |
14254 | 618 |
"Modified (format): / 26-07-2012 / 15:59:14 / cg" |
13403 | 619 |
! ! |
620 |
||
621 |
!Annotation::Resource methodsFor:'processing'! |
|
622 |
||
623 |
annotatesClass:aClass |
|
624 |
||
625 |
"Nothing to do" |
|
626 |
||
627 |
"Modified: / 16-07-2010 / 11:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
628 |
! |
|
629 |
||
630 |
annotatesMethod:aMethod |
|
631 |
||
632 |
"Nothing to do" |
|
633 |
||
634 |
"Modified: / 16-07-2010 / 11:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
635 |
! ! |
|
636 |
||
14212 | 637 |
!Annotation::Resource methodsFor:'testing'! |
638 |
||
639 |
isResource |
|
640 |
^ true |
|
641 |
||
642 |
"Created: / 18-07-2012 / 19:28:46 / cg" |
|
643 |
! ! |
|
644 |
||
13403 | 645 |
!Annotation::Unknown methodsFor:'accessing'! |
646 |
||
14501 | 647 |
method |
648 |
^ method |
|
649 |
||
650 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
|
13403 | 651 |
! |
652 |
||
14501 | 653 |
setMethod:aMethod |
654 |
method := aMethod |
|
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
655 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
656 |
"Created: / 05-09-2011 / 04:38:33 / cg" |
13403 | 657 |
! ! |
658 |
||
659 |
!Annotation::Unknown methodsFor:'initialization'! |
|
660 |
||
13625
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
661 |
method:methodArg key:keyArg arguments:argumentsArg |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
662 |
method := methodArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
663 |
key := keyArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
664 |
arguments := argumentsArg. |
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
665 |
|
fffe5dbb451b
added: #method:key:arguments:
Claus Gittinger <cg@exept.de>
parents:
13613
diff
changeset
|
666 |
"Created: / 05-09-2011 / 04:39:50 / cg" |
13403 | 667 |
! ! |
668 |
||
669 |
!Annotation::Unknown methodsFor:'processing'! |
|
670 |
||
671 |
annotatesClass:aClass |
|
672 |
||
673 |
"Nothing to do" |
|
674 |
||
675 |
"Modified: / 20-05-2010 / 11:15:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
676 |
! |
|
677 |
||
678 |
annotatesMethod:aMethod |
|
679 |
||
680 |
"Nothing to do" |
|
681 |
||
682 |
"Modified: / 20-05-2010 / 11:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
683 |
! ! |
|
684 |
||
14254 | 685 |
!Annotation::Unknown methodsFor:'queries'! |
686 |
||
687 |
refersToLiteral: anObject |
|
688 |
(anObject == method) ifTrue:[ ^ true ]. |
|
14501 | 689 |
^ super refersToLiteral: anObject |
14254 | 690 |
! |
691 |
||
692 |
refersToLiteralMatching: aMatchString |
|
693 |
(method isSymbol and:[aMatchString match:method])ifTrue:[ ^ true ]. |
|
14501 | 694 |
^ super refersToLiteralMatching: aMatchString |
14254 | 695 |
|
696 |
"Created: / 26-07-2012 / 16:00:58 / cg" |
|
697 |
! ! |
|
698 |
||
13403 | 699 |
!Annotation::Unknown methodsFor:'testing'! |
700 |
||
701 |
isUnknown |
|
702 |
^ true |
|
703 |
! ! |
|
704 |
||
705 |
!Annotation class methodsFor:'documentation'! |
|
706 |
||
13670 | 707 |
version |
18751 | 708 |
^ '$Header$' |
13670 | 709 |
! |
710 |
||
13479 | 711 |
version_CVS |
18751 | 712 |
^ '$Header$' |
13479 | 713 |
! |
714 |
||
13403 | 715 |
version_SVN |
18751 | 716 |
^ '$Id$' |
13403 | 717 |
! ! |
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
718 |
|
16134 | 719 |
|
13613
f3c2a2ac07a1
Pragma (squeak compatibility)
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
720 |
Annotation initialize! |