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