Marcel Taeumel uploaded a new version of Kernel to project The Treated Inbox: http://source.squeak.org/treated/Kernel-jar.1415.mcz
==================== Summary ====================
Name: Kernel-jar.1415 Author: jar Time: 20 November 2021, 12:22:39.046144 pm UUID: 2058b1fd-425a-fa46-a2e0-297d1bfab952 Ancestors: Kernel-jar.1414
Fix a bug: when debugging things like this:
[^2] ensure: [Transcript cr; show: 'done']
if we step into the protected block [^2] and then step over ^2, we incorrectly get a BlockCannotReturn error.
This is an alternative proposal to Kernel-jar.1421 (and Kernel-jar.1413); the solution remains the same but it attempts to present a cleaner code (trying to address Christoph's objection in [2] and [3]).
The bug is described in detail in Kernel-nice.1407 and discussed in [1] and most recently in [2] and [3]: [1] http://forum.world.st/stepping-over-non-local-return-in-a-protected-block-td... [2] http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-August/216214.ht... [3] http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-November/216971....
=============== Diff against Kernel-jar.1414 ===============
Item was changed: ----- Method: Context>>resume:through: (in category 'controlling') ----- resume: value through: firstUnwindCtxt "Unwind thisContext to self and resume with value as result of last send. Execute any unwind blocks while unwinding. ASSUMES self is a sender of thisContext."
| ctxt unwindBlock | self isDead ifTrue: [self cannotReturn: value to: self]. + ctxt := firstUnwindCtxt value. "evaluate in case firstUnwindCtxt is a block (used in simulation)" - ctxt := firstUnwindCtxt ifNil: [thisContext findNextUnwindContextUpTo: self]. [ctxt isNil] whileFalse: [(ctxt tempAt: 2) ifNil: [ctxt tempAt: 2 put: true. unwindBlock := ctxt tempAt: 1. thisContext terminateTo: ctxt. unwindBlock value]. ctxt := ctxt findNextUnwindContextUpTo: self]. thisContext terminateTo: self. ^value !
Item was changed: ----- Method: Context>>return:from: (in category 'instruction decoding') ----- return: value from: aSender "For simulation. Roll back self to aSender and return value from it. Execute any unwind blocks on the way. ASSUMES aSender is a sender of self"
| newTop | aSender isDead ifTrue: [^self send: #cannotReturn: to: self with: {value}]. newTop := aSender sender. (self findNextUnwindContextUpTo: newTop) ifNotNil: + [^self send: #aboutToReturn:through: to: self with: {value. [thisContext findNextUnwindContextUpTo: newTop]}]. - [^self send: #aboutToReturn:through: to: self with: {value. nil}]. self releaseTo: newTop. newTop ifNotNil: [newTop push: value]. ^newTop!
packages@lists.squeakfoundation.org