Lookup.st
author Merge Script
Sun, 07 Jun 2015 06:38:49 +0200
branchjv
changeset 18457 214d760f8247
parent 18374 122c2dc2d0a5
child 18708 bb9a9708f010
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18373
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
     1
"{ Encoding: utf8 }"
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
     2
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
     3
"
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     4
 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
     5
	      All Rights Reserved
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
     6
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     7
Permission is hereby granted, free of charge, to any person
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     8
obtaining a copy of this software and associated documentation
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
     9
files (the 'Software'), to deal in the Software without
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    10
restriction, including without limitation the rights to use,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    11
copy, modify, merge, publish, distribute, sublicense, and/or sell
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    12
copies of the Software, and to permit persons to whom the
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    13
Software is furnished to do so, subject to the following
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    14
conditions:
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    15
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    16
The above copyright notice and this permission notice shall be
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    17
included in all copies or substantial portions of the Software.
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    18
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    19
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    20
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    21
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    22
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    23
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    24
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    25
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
    26
OTHER DEALINGS IN THE SOFTWARE.
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    27
"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    28
"{ Package: 'stx:libbasic' }"
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    29
18373
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    30
"{ NameSpace: Smalltalk }"
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
    31
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    32
Object subclass:#Lookup
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    33
	instanceVariableNames:''
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    34
	classVariableNames:''
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    35
	poolDictionaries:''
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    36
	category:'Kernel-Extensions'
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    37
!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    38
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    39
!Lookup class methodsFor:'documentation'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    40
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    41
copyright
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
    42
"
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
    43
 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
    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.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
    94
     It is not neccessary, however it speeds up UI code,
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.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   133
     It is not neccessary, however it speeds up UI code,
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
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   139
		   directedTo: initialSearchClass
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   140
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   141
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   142
!
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   143
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   144
lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilcCache
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   145
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   146
    "Invoked by the VM to ask me for a method to call.
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   147
     The arguments are: the selector, receiver and arguments,
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   148
     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
   149
     the sending context and the inline/poly cache (instance of
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   150
	 PolymorphicInlineCache).
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   151
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   152
     The returned method object will NOT be put into the inline- and
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   153
	 polyCache bu default. To update the call site's cache, you have to
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   154
	 call ilcCache bindTo: method forClass: initialSearch class. If you
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   155
	 dont call it, inline/poly cache won't be updated and next call
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   156
	 won't be cached (therefore it will be relatively slow.
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   157
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   158
     If I return nil, a doesNotUnderstand: will be send."
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   159
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 |
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   162
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   163
    "Following C code is just a performance optimization.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   164
     It is not neccessary, however it speeds up UI code,
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   165
     since it heavily uses perform:"
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
%{
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   168
    method = __lookup(initialSearchClass, selector);
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   169
    if ( method ) {
18365
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   170
	__ilcBind(ilcCache, initialSearchClass, method, selector);
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   171
    }
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   172
    RETURN (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
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   175
    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
   176
    ilcCache notNil ifTrue:[
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   177
	ilcCache bindTo: method forClass: initialSearchClass.
806d5402c9c0 FIX: care for nil ilc passed to fallback code
Claus Gittinger <cg@exept.de>
parents: 15957
diff changeset
   178
    ].
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   179
    ^ method.
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   180
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   181
    "Created: / 01-10-2011 / 13:18:40 / Jan Kurs <kursjan@fit.cvut.cz>"
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   182
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   183
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   184
!Lookup class methodsFor:'documentation'!
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   185
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
   186
version_CVS
18373
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
   187
    ^ '$Header: /cvs/stx/stx/libbasic/Lookup.st,v 1.5 2015-05-18 15:34:46 cg Exp $'
13405
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
   188
!
13dea24362ff initial checkin
Claus Gittinger <cg@exept.de>
parents: 13401
diff changeset
   189
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   190
version_SVN
18373
beb5f8695d8b class: Lookup
Claus Gittinger <cg@exept.de>
parents: 18365
diff changeset
   191
    ^ '$Id: Lookup.st,v 1.5 2015-05-18 15:34:46 cg Exp $'
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   192
! !
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   193
15957
b8ad4b672f8a class: Lookup
Claus Gittinger <cg@exept.de>
parents: 13405
diff changeset
   194
13401
36713d9bc967 Added Lookup.st BuiltinLookup.st
vrany
parents:
diff changeset
   195
Lookup initialize!