[squeak-dev] The Trunk: Kernel-eem.1498.mcz
mail at jaromir.net
Sun Feb 12 22:44:13 UTC 2023
I guess the same fix should apply for #methodReturnContext.
I wanted to ask about this: #home and #methodReturnContext are synonymous; why is that? Some backward compatibility thing or historical reasons?
Similarly I’ve noticed #method and #homeMethod seem synonymous too if I’m not mistaken (in BlockClosure and FullBlockClosure). Is it intentional?
From: commits at source.squeak.org<mailto:commits at source.squeak.org>
Sent: Sunday, February 12, 2023 22:31
To: squeak-dev at lists.squeakfoundation.org<mailto:squeak-dev at lists.squeakfoundation.org>; packages at lists.squeakfoundation.org<mailto:packages at lists.squeakfoundation.org>
Subject: [squeak-dev] The Trunk: Kernel-eem.1498.mcz
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
==================== Summary ====================
Time: 12 February 2023, 1:30:55.883243 pm
In implementing BlockClosure>>hasMethodReturn, don't assume the byutecode set.
Implement Context>>#home so that it will code with clean blocks.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed:
----- Method: BlockClosure>>hasMethodReturn (in category 'testing') -----
"Answer whether the receiver has a method-return ('^') in its code."
| scanner endpc |
+ scanner := InstructionStream new method: self method pc: startpcOrMethod.
- scanner := InstructionStream new method: outerContext method pc: startpcOrMethod.
endpc := self endPC.
+ scanner scanFor:
+ [:byte |
+ scanner willReturn ifTrue:
+ [scanner willBlockReturn ifFalse:
+ scanner pc >= endpc].
- scanner scanFor: [:byte | (byte between: 120 and: 124) or: [scanner pc > endpc]].
- ^scanner pc <= endpc!
Item was changed:
----- Method: Context>>home (in category 'accessing') -----
+ "Answer the outermost context (along the static chain) for the receiver.
+ This is the outermost lexical scope in which the receiver's method is defined."
- "Answer the context in which the receiver was defined."
+ ifNil: [self] "normal method activation"
+ ifNotNil: "block activation"
+ closure outerContext
+ ifNil: [self] "clean block"
+ ifNotNil: [:outerContext| outerContext home]] "normal block"!
- closureOrNil == nil ifTrue:
- ^closureOrNil outerContext home!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev