BlockContext.st
author Claus Gittinger <cg@exept.de>
Fri, 29 Aug 2003 21:16:52 +0200
changeset 7587 89864caa2665
parent 5528 2a96dd29ca28
child 8666 66e7d5922ae9
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5528
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    13
"{ Package: 'stx:libbasic' }"
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    14
4623
f5a12735a692 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3324
diff changeset
    15
Context variableSubclass:#BlockContext
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    16
	instanceVariableNames:''
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    17
	classVariableNames:''
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    18
	poolDictionaries:''
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    19
	category:'Kernel-Methods'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    22
!BlockContext class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    23
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    24
copyright
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    25
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    26
 COPYRIGHT (c) 1993 by Claus Gittinger
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
    27
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    28
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    29
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    30
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    32
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    33
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    34
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    36
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    37
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    38
documentation
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    39
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    40
    BlockContexts represent the stack context objects of blocks. 
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    41
    The layout is the same as for other contexts - this class has been added 
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    42
    to avoid a flag in an instance variable.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    43
    (has become necessary with cheap blocks, which have no home).
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    44
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    45
    WARNING: layout and size known by compiler and runtime system - 
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    46
             do not change.
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    47
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    48
    [author:]
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    49
        Claus Gittinger
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    50
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    51
    [see also:]
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    52
        Context Block Method
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
    53
        Exception Signal
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    54
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    55
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    56
a27a279701f8 Initial revision
claus
parents:
diff changeset
    57
!BlockContext methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    58
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    59
canReturn
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    60
    "return true, if the receiver allows returning through it.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    61
     For normal method contexts, this normally returns true;
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    62
     for blocks, it (currently) always returns false."
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    63
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    64
    ^ false
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    65
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    66
5528
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    67
guessedHome
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    68
    "a temporary kludge: optimized block contexts do (currently) not provide
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    69
     any home info. The code below tries to guess the home."
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    70
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    71
    |sender tryVars selSender possibleBlocks method mWho|
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    72
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    73
    (home isNil or:[home isContext not]) ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    74
        (sender := self sender) notNil ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    75
            tryVars := false.
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    76
            (selSender := sender selector) notNil ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    77
                (selSender endsWith:'do:') ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    78
                    tryVars := true.
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    79
                ] ifFalse:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    80
                    (selSender endsWith:'Do:') ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    81
                        tryVars := true.
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    82
                    ]
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    83
                ]
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    84
            ].
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    85
            tryVars ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    86
                possibleBlocks := sender argsAndVars select:[:v | v isBlock].
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    87
                possibleBlocks := possibleBlocks select:[:b | b home isNil].
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    88
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    89
                possibleBlocks size == 1 ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    90
                    method := possibleBlocks first method.
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    91
                    ^ method.
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    92
                ].
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    93
            ]
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    94
        ].
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    95
    ].
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    96
    ^ nil
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    97
!
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
    98
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    99
home
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   100
    "return the immediate home of the receiver.
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   101
     normally this is the methodcontext, where the block was created,
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   102
     for nested block contexts, this is the surrounding blocks context."
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   103
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   104
    home isContext ifFalse:[^ nil]. "copying blocks have no home"
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   105
    ^ home
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   106
!
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   107
3324
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   108
homeReceiver
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   109
    "return the receiver from the context, where the receiver was defined"
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   110
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   111
    home isContext ifFalse:[^ nil]. "copying blocks have no home"
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   112
    ^ home receiver
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   113
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   114
    "Created: / 5.3.1998 / 16:20:31 / stefan"
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   115
!
0295f7b3b208 Add #homeReceiver (as in ST80).
Stefan Vogel <sv@exept.de>
parents: 2157
diff changeset
   116
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   117
isBlockContext
a27a279701f8 Initial revision
claus
parents:
diff changeset
   118
    "return true, iff the receiver is a BlockContext, false otherwise"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   119
a27a279701f8 Initial revision
claus
parents:
diff changeset
   120
    ^ true
a27a279701f8 Initial revision
claus
parents:
diff changeset
   121
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   122
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   123
method
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   124
    "return the method in which the current contexts block was created."
360
claus
parents: 357
diff changeset
   125
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   126
    home notNil ifTrue:[^ home method].
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   127
    ^ nil
360
claus
parents: 357
diff changeset
   128
!
claus
parents: 357
diff changeset
   129
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   130
methodHome
a27a279701f8 Initial revision
claus
parents:
diff changeset
   131
    "return the method-home for block contexts"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   132
a27a279701f8 Initial revision
claus
parents:
diff changeset
   133
    |con h|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
a27a279701f8 Initial revision
claus
parents:
diff changeset
   135
    home isNil ifTrue:[^ nil]. "XXX will change soon"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   136
    home isContext ifFalse:[^ nil]. "copying blocks have no method home"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   137
a27a279701f8 Initial revision
claus
parents:
diff changeset
   138
    con := self.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   139
    h := home.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   140
    [h notNil] whileTrue:[
165
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
   141
	con := h.
63341654cfb8 *** empty log message ***
claus
parents: 154
diff changeset
   142
	h := con home
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   143
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   144
    ^ con
a27a279701f8 Initial revision
claus
parents:
diff changeset
   145
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   146
a27a279701f8 Initial revision
claus
parents:
diff changeset
   147
selector
a27a279701f8 Initial revision
claus
parents:
diff changeset
   148
    "return the selector of the context - which is one of the value
281
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   149
     selectors. This selector is not found in the context, but synthesized."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   150
a27a279701f8 Initial revision
claus
parents:
diff changeset
   151
    |nargs|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   152
154
d4236ec280a6 *** empty log message ***
claus
parents: 92
diff changeset
   153
    nargs := self numArgs.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   154
    (nargs == 0) ifTrue:[^ #value].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   155
    (nargs == 1) ifTrue:[^ #value:].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   156
    (nargs == 2) ifTrue:[^ #value:value:].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   157
    (nargs == 3) ifTrue:[^ #value:value:value:].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   158
    (nargs == 4) ifTrue:[^ #value:value:value:value:].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   159
    (nargs == 5) ifTrue:[^ #value:value:value:value:value:].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   160
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
   161
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   162
92
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
   163
!BlockContext methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   164
a27a279701f8 Initial revision
claus
parents:
diff changeset
   165
receiverPrintString
281
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   166
    "return a printString describing the contexts receiver.
357
claus
parents: 293
diff changeset
   167
claus
parents: 293
diff changeset
   168
     Since this is also used by the debugger(s), be very careful to
281
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   169
     return something useful, even in case internals of the system
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   170
     got corrupted ... (i.e. avoid messageNotUnderstood here)"
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   171
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   172
    |cls who mHome m className sel 
2157
436ad20004f4 prepare for #doIt: (with context)
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   173
     sender selSender tryVars possibleBlocks method mWho
436ad20004f4 prepare for #doIt: (with context)
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   174
     homeSel|
357
claus
parents: 293
diff changeset
   175
claus
parents: 293
diff changeset
   176
    (home isNil or:[home isContext not]) ifTrue:[
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   177
        "
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   178
         mhmh - an optimized blocks context
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   179
         should get the block here, and get the method from
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   180
         that one ...
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   181
         ... but in 2.x, there is no easy way to get to the block
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   182
         since that one is not in the context.
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   183
         Starting with 3.x, the new block calling scheme will fix this.
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   184
        "
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   185
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   186
        "temporary kludge - peek into the sender context.
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   187
         If its a do-like method and there is a single block variable 
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   188
         in the args or temporaries, that must be the one.
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   189
         This helps in some cases.
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   190
        "
5528
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
   191
        m isNil ifTrue:[
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
   192
            ^ '[] (optimized) in ???'.  
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   193
        ].
5528
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
   194
        ^ '[] (optimized) in ' , m mclass name , '-' , m selector.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   195
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   196
281
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   197
    mHome := self methodHome.
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   198
    mHome isNil ifTrue:[
2128
7201897ff4db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
   199
        'BlockContext [warning]: no methodHome' errorPrintCR.
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   200
        ^ '[] in ???'
281
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   201
    ].
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   202
293
31df3850e98c *** empty log message ***
claus
parents: 281
diff changeset
   203
    "
31df3850e98c *** empty log message ***
claus
parents: 281
diff changeset
   204
     kludge to avoid slow search for containing class
31df3850e98c *** empty log message ***
claus
parents: 281
diff changeset
   205
    "
2157
436ad20004f4 prepare for #doIt: (with context)
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   206
    ((homeSel := mHome selector) == #doIt
436ad20004f4 prepare for #doIt: (with context)
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   207
    or:[homeSel == #doIt:]) ifTrue:[
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   208
        sel := #doIt.
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   209
        cls := mHome receiver class.
293
31df3850e98c *** empty log message ***
claus
parents: 281
diff changeset
   210
    ] ifFalse:[
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   211
        m := mHome method.
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   212
        m isNil ifTrue:[
2128
7201897ff4db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
   213
            'BlockContext [warning]: no method' errorPrintCR.
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   214
            ^ '[] in ???'
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   215
        ].
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   216
        who := m who.
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   217
        who notNil ifTrue:[
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   218
            cls := who methodClass
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   219
        ] ifFalse:[
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   220
            cls := receiver class.
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   221
        ].
2157
436ad20004f4 prepare for #doIt: (with context)
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   222
        sel := homeSel printString.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   223
    ].
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   224
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   225
    cls isNil ifTrue:[
2128
7201897ff4db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
   226
        'BlockContext [warning]: no home class' errorPrintCR.
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   227
        className := '???'
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   228
    ] ifFalse:[
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   229
        className := cls name.
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   230
        className isNil ifTrue:[
2128
7201897ff4db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
   231
            'BlockContext [warning]: nameless class' errorPrintCR.
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   232
            className := '???'
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   233
        ]
281
d63a7d2c31a6 *** empty log message ***
claus
parents: 241
diff changeset
   234
    ].
1852
89b2328f4203 use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   235
    ^ '[] in ' , className , '-' , sel
1444
cb2493aa4d0c fixed homeless-optimized-block printString
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
   236
2157
436ad20004f4 prepare for #doIt: (with context)
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   237
    "Modified: 10.1.1997 / 21:26:21 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   238
! !
623
6795a71e39d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   239
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   240
!BlockContext class methodsFor:'documentation'!
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   241
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   242
version
5528
2a96dd29ca28 guess home of optimized block contexts
Claus Gittinger <cg@exept.de>
parents: 4623
diff changeset
   243
    ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.29 2000-08-16 15:01:57 cg Exp $'
1183
e3d58d115e53 subclasses of fixed classes are still possible
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   244
! !