author | HG Automerge |
Mon, 26 Dec 2016 10:13:07 +0000 | |
branch | jv |
changeset 21247 | 9ee1206fc247 |
parent 21242 | 19fabe339f8b |
child 23107 | 40173e082cbc |
permissions | -rw-r--r-- |
13403 | 1 |
" |
13478 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
18359 | 3 |
All Rights Reserved |
13403 | 4 |
|
13478 | 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 |
||
21100 | 28 |
"{ NameSpace: Smalltalk }" |
29 |
||
13403 | 30 |
Lookup subclass:#NamespaceAwareLookup |
31 |
instanceVariableNames:'' |
|
32 |
classVariableNames:'Instance' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Kernel-Extensions' |
|
35 |
! |
|
36 |
||
37 |
!NamespaceAwareLookup class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
13478 | 41 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
18359 | 42 |
All Rights Reserved |
13403 | 43 |
|
13478 | 44 |
Permission is hereby granted, free of charge, to any person |
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
13403 | 64 |
" |
65 |
! ! |
|
66 |
||
67 |
!NamespaceAwareLookup class methodsFor:'initialization'! |
|
68 |
||
69 |
initialize |
|
70 |
||
71 |
Instance := self basicNew |
|
72 |
||
73 |
"Created: / 10-07-2010 / 21:12:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! ! |
|
75 |
||
76 |
!NamespaceAwareLookup class methodsFor:'accessing'! |
|
77 |
||
78 |
instance |
|
79 |
||
80 |
^Instance |
|
81 |
||
82 |
"Created: / 20-05-2010 / 11:18:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
83 |
"Modified: / 10-07-2010 / 21:12:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
84 |
! ! |
|
85 |
||
86 |
!NamespaceAwareLookup class methodsFor:'lookup'! |
|
87 |
||
20133
fefb47dc71f6
Issue #73: Updated NamespaceAeareLookup to use new lookup callback signature
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20132
diff
changeset
|
88 |
lookupMethodForSelector: selector directedTo: initialSearchClass for: receiver withArguments: argArrayOrNil from: sendingContext ilc: ilc |
13403 | 89 |
|
90 |
"JV @ 2010-07-24 |
|
91 |
Following C code is just a performance optimization. |
|
21100 | 92 |
It is not necessary, however it speeds things in most |
13403 | 93 |
cases. Such optimization significantly speeds up the IDE |
94 |
since class browser involves dozens of super-polymorphic |
|
18359 | 95 |
sends (> 1000 receiver classes per send-site). |
21100 | 96 |
" |
13403 | 97 |
|
18359 | 98 |
%{ |
21086
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
99 |
OBJ sendingMthd = nil; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
100 |
OBJ ctx = sendingContext; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
101 |
while ( ctx && |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
102 |
(__isLazy(ctx) |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
103 |
? __isLazyBCon(ctx) |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
104 |
: __qIsBlockContextLike(ctx))) { |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
105 |
ctx = __ContextInstPtr(ctx)->c_home; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
106 |
} |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
107 |
if ( (ctx != nil) && |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
108 |
(((INT)(__ContextInstPtr(ctx)->c_flags) & __MASKSMALLINT(__METHOD_VALID))) ) { |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
109 |
sendingMthd = __ContextInstPtr(sendingContext)->c_method; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
110 |
} |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
111 |
|
18359 | 112 |
if (__Class(sendingMthd) == Method && |
21100 | 113 |
__MethodInstPtr(sendingMthd)->m_annotation == nil) { |
114 |
OBJ m = __lookup(initialSearchClass, selector); |
|
115 |
if (m != nil) RETURN ( m ); |
|
18359 | 116 |
} |
13403 | 117 |
%}. |
118 |
||
119 |
^Instance lookupMethodForSelector: selector directedTo: initialSearchClass |
|
21100 | 120 |
for: receiver withArguments: argArrayOrNil |
121 |
from: sendingContext |
|
20133
fefb47dc71f6
Issue #73: Updated NamespaceAeareLookup to use new lookup callback signature
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20132
diff
changeset
|
122 |
ilc: ilc |
13403 | 123 |
! ! |
124 |
||
125 |
!NamespaceAwareLookup methodsFor:'lookup'! |
|
126 |
||
18359 | 127 |
lookupMethodForSelector: selector directedTo: initialSearchClass for: receiver withArguments: argArrayOrNil from: sendingContext ilc: ilcCache |
13403 | 128 |
"Invoked by the VM to ask me for a method to fire. |
129 |
For details, see comment inLookup>>lookupMethodForSelector:directedTo:for:withArguments:from:" |
|
130 |
||
18359 | 131 |
| sendingNs sendingMthd queue seen namespaces methods imports numMethods| |
13403 | 132 |
|
133 |
"JV @ 2010-07-24 |
|
134 |
Following C code is just a performance optimization. |
|
21100 | 135 |
It is not necessary, however it speeds things in most |
13403 | 136 |
cases. Such optimization significantly speeds up the IDE |
137 |
since class browser involves dozens of super-polymorphic |
|
18359 | 138 |
sends (> 1000 receiver classes per send-site). |
139 |
" |
|
21086
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
140 |
|
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
141 |
%{ |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
142 |
OBJ ctx = sendingContext; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
143 |
sendingMthd = nil; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
144 |
while ( ctx && |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
145 |
(__isLazy(ctx) |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
146 |
? __isLazyBCon(ctx) |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
147 |
: __qIsBlockContextLike(ctx))) { |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
148 |
ctx = __ContextInstPtr(ctx)->c_home; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
149 |
} |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
150 |
if ( (ctx != nil) && |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
151 |
(((INT)(__ContextInstPtr(ctx)->c_flags) & __MASKSMALLINT(__METHOD_VALID))) ) { |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
152 |
sendingMthd = __ContextInstPtr(ctx)->c_method; |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
153 |
} |
dae6aabc5a14
Block-in-context: fixed NamespaceAwareLookup to handle Block in context's method slot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20133
diff
changeset
|
154 |
|
18359 | 155 |
if (__Class(sendingMthd) == Method && |
21100 | 156 |
__MethodInstPtr(sendingMthd)->m_annotation == nil) { |
157 |
OBJ m = __lookup(initialSearchClass, selector); |
|
158 |
if (m != nil) { |
|
159 |
if (ilcCache != nil) __ilcBind(ilcCache, initialSearchClass, m, selector); |
|
160 |
RETURN ( m ); |
|
161 |
} |
|
18359 | 162 |
} |
13403 | 163 |
%}. |
164 |
"If you remove C code above, uncomment the line below." |
|
165 |
"sendingMthd := sendingContext method." |
|
166 |
sendingNs := sendingMthd isNil |
|
21100 | 167 |
ifTrue:[nil] |
168 |
ifFalse:[sendingMthd nameSpace]. |
|
13403 | 169 |
|
21100 | 170 |
"Second chance to speed up things (in case sending method |
171 |
has resource or so)" |
|
13403 | 172 |
%{ |
16080
e12fe7f621a8
class: NamespaceAwareLookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13478
diff
changeset
|
173 |
if (sendingNs == nil) { |
21100 | 174 |
OBJ m = __lookup(initialSearchClass, selector); |
175 |
if (m != nil) { |
|
176 |
if (ilcCache != nil) __ilcBind(ilcCache, initialSearchClass, m, selector); |
|
177 |
RETURN ( m ); |
|
178 |
} |
|
13403 | 179 |
} |
180 |
%}. |
|
181 |
" |
|
182 |
Stderr |
|
21100 | 183 |
show: 'sel='; show: selector; show: ' ns='; show: sendingNs printString; |
184 |
show: ' method=', sendingMthd printString; cr. |
|
185 |
" |
|
13403 | 186 |
sendingNs notNil ifTrue: [ |
21100 | 187 |
seen := Set new. |
188 |
namespaces := Array with: sendingNs. |
|
13403 | 189 |
|
21100 | 190 |
[namespaces notEmpty] whileTrue:[ |
191 |
methods := self |
|
192 |
lookupMethodsForSelector: selector |
|
193 |
directedTo: initialSearchClass |
|
194 |
inNamespaces: namespaces. |
|
195 |
numMethods := methods size. |
|
196 |
numMethods == 1 ifTrue:[ |
|
197 |
^ methods anyOne |
|
198 |
]. |
|
199 |
numMethods > 1 ifTrue:[ |
|
200 |
^self ambiguousMessageSend: selector withArgs: argArrayOrNil |
|
201 |
]. |
|
202 |
"No method found" |
|
203 |
seen addAll: namespaces. |
|
204 |
imports := Set new. |
|
205 |
namespaces do:[:namespace| |
|
206 |
namespace notNil ifTrue:[ |
|
207 |
namespace imports do:[:import| |
|
208 |
(seen includes: import) ifFalse: [ |
|
209 |
imports add: import |
|
210 |
] |
|
211 |
] |
|
212 |
] |
|
213 |
]. |
|
214 |
namespaces := imports |
|
215 |
]. |
|
18359 | 216 |
]. |
217 |
||
218 |
methods := self lookupMethodsForSelector: selector |
|
21100 | 219 |
directedTo: initialSearchClass. |
16080
e12fe7f621a8
class: NamespaceAwareLookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13478
diff
changeset
|
220 |
methods size == 1 ifTrue:[ |
21100 | 221 |
| m | |
16080
e12fe7f621a8
class: NamespaceAwareLookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13478
diff
changeset
|
222 |
|
21100 | 223 |
m := methods anyOne. |
224 |
ilcCache notNil ifTrue:[ ilcCache bindTo: m forClass: initialSearchClass ]. |
|
225 |
^ m |
|
16080
e12fe7f621a8
class: NamespaceAwareLookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13478
diff
changeset
|
226 |
]. |
18359 | 227 |
|
13403 | 228 |
^nil |
229 |
||
16080
e12fe7f621a8
class: NamespaceAwareLookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13478
diff
changeset
|
230 |
"Created: / 19-02-2014 / 21:49:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
20132
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
231 |
"Modified: / 21-06-2016 / 07:32:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13403 | 232 |
! ! |
233 |
||
234 |
!NamespaceAwareLookup methodsFor:'lookup - helpers'! |
|
235 |
||
18359 | 236 |
lookupMethodsForSelector: selector directedTo: initialSearchClass |
13403 | 237 |
"Searches initialSearchClass for a methods with in any namespace" |
18359 | 238 |
|
239 |
^self |
|
240 |
lookupMethodsForSelector: selector |
|
241 |
directedTo: initialSearchClass |
|
242 |
suchThat:[:sel :mthd|true]. |
|
13403 | 243 |
|
244 |
"Created: / 19-07-2010 / 15:37:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
245 |
! |
|
246 |
||
247 |
lookupMethodsForSelector: selector directedTo: initialSearchClass inNamespaces: namespaces |
|
18359 | 248 |
"Searches initialSearchClass for a methods with given selector in given namespaces." |
13403 | 249 |
|
18359 | 250 |
^self |
251 |
lookupMethodsForSelector: selector |
|
252 |
directedTo: initialSearchClass |
|
253 |
suchThat:[:sel :mthd|namespaces includes: mthd nameSpace]. |
|
13403 | 254 |
|
255 |
"Created: / 19-07-2010 / 15:13:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
256 |
! |
|
257 |
||
258 |
lookupMethodsForSelector: selector directedTo: initialSearchClass suchThat: block |
|
18359 | 259 |
"Searches initialSearchClass for a method with given selector in given nameSpace. |
13403 | 260 |
|
261 |
if no method in given namespace is found, returns nil" |
|
262 |
||
263 |
| searchClass methods seen | |
|
264 |
||
265 |
searchClass := initialSearchClass. |
|
266 |
methods := Set new. |
|
267 |
seen := OrderedCollection new. |
|
18359 | 268 |
[ searchClass notNil ] whileTrue:[ |
20132
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
269 |
searchClass selectorsAndMethodsDo:[:sel :mthd| |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
270 |
(sel selectorWithoutNameSpace = selector |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
271 |
and:[ (seen includes: mthd nameSpace) not |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
272 |
and:[ block value: sel value: mthd]] |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
273 |
) ifTrue:[ |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
274 |
methods add: mthd. |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
275 |
seen add: mthd nameSpace |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
276 |
] |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
277 |
]. |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
278 |
searchClass := searchClass superclass |
18359 | 279 |
]. |
13403 | 280 |
^methods |
281 |
||
282 |
"Created: / 19-07-2010 / 15:34:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
20132
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
283 |
"Modified: / 21-06-2016 / 00:25:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13403 | 284 |
! ! |
285 |
||
286 |
!NamespaceAwareLookup methodsFor:'trampolines'! |
|
287 |
||
288 |
ambiguousMessageSend |
|
289 |
||
290 |
^self ambiguousMessage: |
|
18359 | 291 |
(Message |
292 |
selector: #__placeholder__ |
|
293 |
arguments: #() |
|
294 |
) |
|
13403 | 295 |
|
296 |
"Created: / 19-08-2010 / 22:05:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
297 |
! |
|
298 |
||
299 |
ambiguousMessageSend: selector withArgs: argArrayOrNil |
|
300 |
||
301 |
| trampoline | |
|
302 |
||
303 |
trampoline := self class methodDictionary at: |
|
18359 | 304 |
(#(" 0"ambiguousMessageSend |
305 |
" 1"ambiguousMessageSendWith: |
|
306 |
" 2"ambiguousMessageSendWith:with: |
|
307 |
" 3"ambiguousMessageSendWith:with:with: |
|
308 |
" 4"ambiguousMessageSendWith:with:with:with: |
|
309 |
" 5"ambiguousMessageSendWith:with:with:with:with: |
|
310 |
" 6"ambiguousMessageSendWith:with:with:with:with:with: |
|
311 |
" 7"ambiguousMessageSendWith:with:with:with:with:with:with: |
|
312 |
" 8"ambiguousMessageSendWith:with:with:with:with:with:with:with: |
|
313 |
) |
|
314 |
at: argArrayOrNil size + 1). |
|
13403 | 315 |
trampoline := trampoline asByteCodeMethod. |
18359 | 316 |
1 to: trampoline numLiterals do: [:litNr| |
317 |
(trampoline literalAt: litNr) == #__placeholder__ ifTrue:[ |
|
318 |
(trampoline literalAt: litNr put: selector) |
|
319 |
] |
|
320 |
]. |
|
13403 | 321 |
^trampoline |
322 |
||
323 |
"Created: / 19-08-2010 / 22:09:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
! |
|
325 |
||
326 |
ambiguousMessageSendWith: a1 |
|
327 |
||
328 |
^self ambiguousMessage: |
|
18359 | 329 |
(Message |
330 |
selector: #__placeholder__ |
|
331 |
arguments: (Array with: a1) |
|
332 |
) |
|
13403 | 333 |
|
334 |
"Created: / 19-08-2010 / 22:06:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
335 |
! |
|
336 |
||
337 |
ambiguousMessageSendWith: a1 with: a2 |
|
338 |
||
339 |
^self ambiguousMessage: |
|
18359 | 340 |
(Message |
341 |
selector: #__placeholder__ |
|
342 |
arguments: (Array with: a1 with: a2) |
|
343 |
) |
|
13403 | 344 |
|
345 |
"Created: / 19-08-2010 / 22:06:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
346 |
! |
|
347 |
||
348 |
ambiguousMessageSendWith: a1 with: a2 with: a3 |
|
349 |
||
350 |
^self ambiguousMessage: |
|
18359 | 351 |
(Message |
352 |
selector: #__placeholder__ |
|
353 |
arguments: (Array with: a1 with: a2 with: a3) |
|
354 |
) |
|
13403 | 355 |
|
356 |
"Created: / 19-08-2010 / 22:06:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
357 |
! |
|
358 |
||
359 |
ambiguousMessageSendWith: a1 with: a2 with: a3 with: a4 |
|
360 |
||
361 |
^self ambiguousMessage: |
|
18359 | 362 |
(Message |
363 |
selector: #__placeholder__ |
|
364 |
arguments: (Array with: a1 with: a2 with: a3 with: a4) |
|
365 |
) |
|
13403 | 366 |
|
367 |
"Created: / 19-08-2010 / 22:06:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
368 |
! |
|
369 |
||
370 |
ambiguousMessageSendWith: a1 with: a2 with: a3 with: a4 |
|
18359 | 371 |
with: a5 |
13403 | 372 |
|
373 |
^self ambiguousMessage: |
|
18359 | 374 |
(Message |
375 |
selector: #__placeholder__ |
|
376 |
arguments: (Array with: a1 with: a2 with: a3 with: a4 |
|
377 |
with: a5) |
|
378 |
) |
|
13403 | 379 |
|
380 |
"Created: / 19-08-2010 / 22:07:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
381 |
! |
|
382 |
||
383 |
ambiguousMessageSendWith: a1 with: a2 with: a3 with: a4 |
|
18359 | 384 |
with: a5 with: a6 |
13403 | 385 |
|
386 |
^self ambiguousMessage: |
|
18359 | 387 |
(Message |
388 |
selector: #__placeholder__ |
|
389 |
arguments: (Array with: a1 with: a2 with: a3 with: a4 |
|
390 |
with: a5 with: a6) |
|
391 |
) |
|
13403 | 392 |
|
393 |
"Created: / 19-08-2010 / 22:07:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
394 |
! |
|
395 |
||
396 |
ambiguousMessageSendWith: a1 with: a2 with: a3 with: a4 |
|
18359 | 397 |
with: a5 with: a6 with: a7 |
13403 | 398 |
|
399 |
^self ambiguousMessage: |
|
18359 | 400 |
(Message |
401 |
selector: #__placeholder__ |
|
402 |
arguments: (Array with: a1 with: a2 with: a3 with: a4 |
|
403 |
with: a5 with: a6 with: a7) |
|
404 |
) |
|
13403 | 405 |
|
406 |
"Created: / 19-08-2010 / 22:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
407 |
! |
|
408 |
||
409 |
ambiguousMessageSendWith: a1 with: a2 with: a3 with: a4 |
|
18359 | 410 |
with: a5 with: a6 with: a7 with: a8 |
13403 | 411 |
|
412 |
^self ambiguousMessage: |
|
18359 | 413 |
(Message |
414 |
selector: #__placeholder__ |
|
415 |
arguments: (Array with: a1 with: a2 with: a3 with: a4 |
|
416 |
with: a5 with: a6 with: a7 with: a8) |
|
417 |
) |
|
13403 | 418 |
|
419 |
"Created: / 19-08-2010 / 22:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
420 |
! ! |
|
421 |
||
422 |
!NamespaceAwareLookup class methodsFor:'documentation'! |
|
423 |
||
13478 | 424 |
version_CVS |
21100 | 425 |
^ '$Header$' |
13478 | 426 |
! |
427 |
||
20132
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
428 |
version_HG |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
429 |
|
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
430 |
^ '$Changeset: <not expanded> $' |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
431 |
! |
f7206036949e
Issue #73: Send #selectorWithoutNameSpace instead of #selector
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18366
diff
changeset
|
432 |
|
13403 | 433 |
version_SVN |
21100 | 434 |
^ '$Id$' |
13403 | 435 |
! ! |
436 |
||
16080
e12fe7f621a8
class: NamespaceAwareLookup
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13478
diff
changeset
|
437 |
|
13403 | 438 |
NamespaceAwareLookup initialize! |