[squeak-dev] stepping over non local return in a protected block

Jaromir Matas m at jaromir.net
Fri May 14 14:28:52 UTC 2021

Hi Nicolas,

thanks for your quick response; stepping over #aboutToReturn:through: now
works perfectly, however the same problem remains on lower levels, i.e. for
stepping over #return:through: and #resume:through: - same example, same
incorrect behavior:

[^2] ensure: [Transcript showln: 'done']

step into ^2 then repeat step over until you step over the return:through:
and cannot return is back. Same on the level below: step into ^2 then into
return:through: and then step over #resume:through: - and again, you get the
cannot return error. Once you're inside #resume:through: it seems safe.

So I'm wondering whether it's possible to invoke a simulated version of
#resume:through: somehow instead of #aboutToReturn:through: - I guess you'd
know the answer :)

BTW: I tried your fix in Cuis and it works perfectly there as well :)

During testing I realized I'd missed one more detail in my #terminate fix so
here's the latest version in the Inbox: Kernel-jar.1408 (including your fix

The point is the Debugger actually resumes after finding an error and only
updates its title ( which I never fully noticed :o ) but during termination
each nested error opens a new debugger - this means I can't override
#runUntilErrorOrReturnFrom: as I suggested previously so I created its copy
named #runUnwindUntilErrorOrReturnFrom: with the modified functionality
required by #terminate. (It's a code duplication, I know, but I'd like to
get it working now)

On top of that I extracted a repeating part of #terminate's code to a new
method #complete:to: to improve readability and avoid further code

So you can now debug safely (and correctly) even examples like:

[self error] ensure: [^2] 

Thanks again,

^[^ Jaromir
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

More information about the Squeak-dev mailing list