--- a/BlockContext.st Wed Dec 15 12:34:21 2004 +0100
+++ b/BlockContext.st Thu Dec 16 12:21:17 2004 +0100
@@ -37,20 +37,20 @@
documentation
"
- BlockContexts represent the stack context objects of blocks.
- The layout is the same as for other contexts - this class has been added
+ BlockContexts represent the stack context objects of blocks.
+ The layout is the same as for other contexts - this class has been added
to avoid a flag in an instance variable.
(has become necessary with cheap blocks, which have no home).
- WARNING: layout and size known by compiler and runtime system -
- do not change.
+ WARNING: layout and size known by compiler and runtime system -
+ do not change.
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- Context Block Method
- Exception Signal
+ Context Block Method
+ Exception Signal
"
! !
@@ -68,30 +68,30 @@
"a temporary kludge: optimized block contexts do (currently) not provide
any home info. The code below tries to guess the home."
- |sender tryVars selSender possibleBlocks method mWho|
+ |sender tryVars selSender possibleBlocks method|
(home isNil or:[home isContext not]) ifTrue:[
- (sender := self sender) notNil ifTrue:[
- tryVars := false.
- (selSender := sender selector) notNil ifTrue:[
- (selSender endsWith:'do:') ifTrue:[
- tryVars := true.
- ] ifFalse:[
- (selSender endsWith:'Do:') ifTrue:[
- tryVars := true.
- ]
- ]
- ].
- tryVars ifTrue:[
- possibleBlocks := sender argsAndVars select:[:v | v isBlock].
- possibleBlocks := possibleBlocks select:[:b | b home isNil].
+ (sender := self sender) notNil ifTrue:[
+ tryVars := false.
+ (selSender := sender selector) notNil ifTrue:[
+ (selSender endsWith:'do:') ifTrue:[
+ tryVars := true.
+ ] ifFalse:[
+ (selSender endsWith:'Do:') ifTrue:[
+ tryVars := true.
+ ]
+ ]
+ ].
+ tryVars ifTrue:[
+ possibleBlocks := sender argsAndVars select:[:v | v isBlock].
+ possibleBlocks := possibleBlocks select:[:b | b home isNil].
- possibleBlocks size == 1 ifTrue:[
- method := possibleBlocks first method.
- ^ method.
- ].
- ]
- ].
+ possibleBlocks size == 1 ifTrue:[
+ method := possibleBlocks first method.
+ ^ method.
+ ].
+ ]
+ ].
].
^ nil
!
@@ -169,35 +169,34 @@
return something useful, even in case internals of the system
got corrupted ... (i.e. avoid messageNotUnderstood here)"
- |cls who mHome m className sel
- sender selSender tryVars possibleBlocks method mWho
- homeSel|
+ |cls who mHome m className sel
+ method homeSel|
(home isNil or:[home isContext not]) ifTrue:[
- "
- mhmh - an optimized blocks context
- should get the block here, and get the method from
- that one ...
- ... but in 2.x, there is no easy way to get to the block
- since that one is not in the context.
- Starting with 3.x, the new block calling scheme will fix this.
- "
+ "
+ mhmh - an optimized blocks context
+ should get the block here, and get the method from
+ that one ...
+ ... but in 2.x, there is no easy way to get to the block
+ since that one is not in the context.
+ Starting with 3.x, the new block calling scheme will fix this.
+ "
- "temporary kludge - peek into the sender context.
- If its a do-like method and there is a single block variable
- in the args or temporaries, that must be the one.
- This helps in some cases.
- "
- m isNil ifTrue:[
- ^ '[] (optimized) in ???'.
- ].
- ^ '[] (optimized) in ' , m mclass name , '-' , m selector.
+ "temporary kludge - peek into the sender context.
+ If its a do-like method and there is a single block variable
+ in the args or temporaries, that must be the one.
+ This helps in some cases.
+ "
+ m isNil ifTrue:[
+ ^ '[] (optimized) in ???'.
+ ].
+ ^ '[] (optimized) in ' , m mclass name , '-' , m selector.
].
mHome := self methodHome.
mHome isNil ifTrue:[
- 'BlockContext [warning]: no methodHome' errorPrintCR.
- ^ '[] in ???'
+ 'BlockContext [warning]: no methodHome' errorPrintCR.
+ ^ '[] in ???'
].
"
@@ -205,32 +204,32 @@
"
((homeSel := mHome selector) == #doIt
or:[homeSel == #doIt:]) ifTrue:[
- sel := #doIt.
- cls := mHome receiver class.
+ sel := #doIt.
+ cls := mHome receiver class.
] ifFalse:[
- m := mHome method.
- m isNil ifTrue:[
- 'BlockContext [warning]: no method' errorPrintCR.
- ^ '[] in ???'
- ].
- who := m who.
- who notNil ifTrue:[
- cls := who methodClass
- ] ifFalse:[
- cls := receiver class.
- ].
- sel := homeSel printString.
+ m := mHome method.
+ m isNil ifTrue:[
+ 'BlockContext [warning]: no method' errorPrintCR.
+ ^ '[] in ???'
+ ].
+ who := m who.
+ who notNil ifTrue:[
+ cls := who methodClass
+ ] ifFalse:[
+ cls := receiver class.
+ ].
+ sel := homeSel printString.
].
cls isNil ifTrue:[
- 'BlockContext [warning]: no home class' errorPrintCR.
- className := '???'
+ 'BlockContext [warning]: no home class' errorPrintCR.
+ className := '???'
] ifFalse:[
- className := cls name.
- className isNil ifTrue:[
- 'BlockContext [warning]: nameless class' errorPrintCR.
- className := '???'
- ]
+ className := cls name.
+ className isNil ifTrue:[
+ 'BlockContext [warning]: nameless class' errorPrintCR.
+ className := '???'
+ ]
].
^ '[] in ' , className , '-' , sel
@@ -240,5 +239,5 @@
!BlockContext class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.29 2000-08-16 15:01:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.30 2004-12-16 11:21:17 cg Exp $'
! !