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