Lookup.st
author Claus Gittinger <cg@exept.de>
Mon, 27 Jan 2020 13:47:24 +0100
changeset 25204 b12f8693fe6f
parent 21101 3311b5c4d2eb
child 21242 19fabe339f8b
permissions -rw-r--r--
#BUGFIX by cg class: CharacterArray added: #asImmutableCollection #asImmutableString
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
     1
"
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     2
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
     3
	      All Rights Reserved
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
     4
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     5
Permission is hereby granted, free of charge, to any person
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     6
obtaining a copy of this software and associated documentation
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     7
files (the 'Software'), to deal in the Software without
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     8
restriction, including without limitation the rights to use,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     9
copy, modify, merge, publish, distribute, sublicense, and/or sell
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    10
copies of the Software, and to permit persons to whom the
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    11
Software is furnished to do so, subject to the following
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    12
conditions:
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    13
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    14
The above copyright notice and this permission notice shall be
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    15
included in all copies or substantial portions of the Software.
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    16
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    17
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    18
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    19
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    20
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    21
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    22
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    24
OTHER DEALINGS IN THE SOFTWARE.
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    25
"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    26
"{ Package: 'stx:libbasic' }"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    27
18373
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    28
"{ NameSpace: Smalltalk }"
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    29
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    30
Object subclass:#Lookup
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    31
	instanceVariableNames:''
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    32
	classVariableNames:''
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    33
	poolDictionaries:''
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    34
	category:'Kernel-Extensions'
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    35
!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    36
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    37
!Lookup class methodsFor:'documentation'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    38
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    39
copyright
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    40
"
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    41
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    42
	      All Rights Reserved
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    43
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    44
Permission is hereby granted, free of charge, to any person
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    45
obtaining a copy of this software and associated documentation
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    46
files (the 'Software'), to deal in the Software without
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    47
restriction, including without limitation the rights to use,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    48
copy, modify, merge, publish, distribute, sublicense, and/or sell
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    49
copies of the Software, and to permit persons to whom the
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    50
Software is furnished to do so, subject to the following
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    51
conditions:
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    52
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    53
The above copyright notice and this permission notice shall be
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    54
included in all copies or substantial portions of the Software.
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    55
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    56
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    57
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    58
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    59
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    60
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    61
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    62
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    63
OTHER DEALINGS IN THE SOFTWARE.
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    64
"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    65
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    66
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    67
!Lookup class methodsFor:'initialization'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    68
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    69
initialize
18373
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    70
    "/ do we really need this?
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    71
    "/ i.e. my own messages can be resolved by the VM - can't they ?
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    72
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    73
    "/ self lookupObject: Lookup builtin
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    74
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    75
    "Created: / 26-04-2010 / 21:15:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    76
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    77
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    78
!Lookup class methodsFor:'accessing'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    79
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    80
builtin
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    81
    ^BuiltinLookup instance
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    82
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    83
    "Created: / 26-04-2010 / 19:26:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    84
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    85
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    86
!Lookup methodsFor:'lookup'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    87
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    88
lookupMethodForSelector: selector directedTo: initialSearchClass
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    89
    |cls md method|
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    90
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    91
    "Following C code is just a performance optimization.
21101
3311b5c4d2eb #OTHER by mawalch
mawalch
parents: 20803
diff changeset
    92
     It is not necessary, however it speeds up UI code,
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    93
     since it heavily uses perform:"
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    94
%{
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    95
    RETURN (  __lookup(initialSearchClass, selector) );
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    96
%}.
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    97
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    98
    cls := initialSearchClass.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    99
    [ cls notNil ] whileTrue:[
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   100
       md := cls methodDictionary.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   101
       method := md at:selector ifAbsent:nil.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   102
       method notNil ifTrue:[^ method ].
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   103
       cls := cls superclass.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   104
    ].
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   105
    ^ nil
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   106
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   107
    "Created: / 27-04-2010 / 15:30:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   108
!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   109
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   110
lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   111
    <resource: #obsolete>
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   112
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   113
    "
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   114
     This method is no longer sent by the VM as it nows pass
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   115
     inline/poly cache object.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   116
    "
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   117
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   118
    "invoked by the VM to ask me for a method to call.
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   119
     The arguments are: the selector, receiver and arguments,
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   120
     the class to start the search in (for here-, super and directed sends)
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   121
     the sending context.
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   122
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   123
     The returned method object will be put into the inline- and polyCache
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   124
     at the call site; it might therefore be called more than once for the
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   125
     same receiver-class/selector combination (once for each call site).
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   126
     If I return nil, a doesNotUnderstand will be invoked."
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   127
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   128
     |cls md method|
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   129
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   130
    "Following C code is just a performance optimization.
21101
3311b5c4d2eb #OTHER by mawalch
mawalch
parents: 20803
diff changeset
   131
     It is not necessary, however it speeds up UI code,
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   132
     since it heavily uses perform:"
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   133
%{
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   134
    RETURN (  __lookup(initialSearchClass, selector) );
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   135
%}.
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   136
    ^ self lookupMethodForSelector: selector
21101
3311b5c4d2eb #OTHER by mawalch
mawalch
parents: 20803
diff changeset
   137
                   directedTo: initialSearchClass
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   138
!
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   139
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   140
lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilcCache
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   141
    "Invoked by the VM to ask me for a method to call.
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   142
     The arguments are: the selector, receiver and arguments,
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   143
     the class to start the search in (for here-, super and directed sends)
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   144
     the sending context and the inline/poly cache (instance of
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   145
         PolymorphicInlineCache).
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   146
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   147
     The returned method object will NOT be put into the inline- and
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   148
         polyCache bu default. To update the call site's cache, you have to
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   149
         call ilcCache bindTo: method forClass: initialSearch class. If you
20803
8351844d9d61 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 18706
diff changeset
   150
         don't call it, inline/poly cache won't be updated and next call
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   151
         won't be cached (therefore it will be relatively slow.
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   152
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   153
     If I return nil, a doesNotUnderstand: will be send."
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   154
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   155
    | method |
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   156
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   157
    "Following C code is just a performance optimization.
21101
3311b5c4d2eb #OTHER by mawalch
mawalch
parents: 20803
diff changeset
   158
     It is not necessary, however it speeds up UI code,
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   159
     since it heavily uses perform:"
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   160
%{
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   161
    method = __lookup(initialSearchClass, selector);
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   162
    if ( method ) {
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   163
        __ilcBind(ilcCache, initialSearchClass, method, selector);
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   164
    }
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   165
    RETURN (method);
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   166
%}.
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   167
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   168
    method := self lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext.
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   169
    ilcCache notNil ifTrue:[
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   170
        ilcCache bindTo: method forClass: initialSearchClass.
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   171
    ].
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   172
    ^ method.
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   173
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   174
    "Created: / 01-10-2011 / 13:18:40 / Jan Kurs <kursjan@fit.cvut.cz>"
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   175
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   176
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   177
!Lookup class methodsFor:'documentation'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   178
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
   179
version_CVS
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   180
    ^ '$Header$'
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
   181
!
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
   182
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   183
version_SVN
18706
59b1a62da74e class: Lookup
Stefan Vogel <sv@exept.de>
parents: 18373
diff changeset
   184
    ^ '$Id$'
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   185
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   186
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   187
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   188
Lookup initialize!