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