[squeak-dev] 'Method for block not found on stack, can''t edit and continue'

Eliot Miranda eliot.miranda at gmail.com
Mon Jan 20 23:47:28 UTC 2014


Hi Frank,


On Mon, Jan 20, 2014 at 2:01 PM, Frank Shearar <frank.shearar at gmail.com>wrote:

> I often use Blocks for holding tiny bits of state not worth
> formalising as a class. As a result, I often get this error because I
> also spend a lot of time developing in the Debugger.
>
> Is the following a completely crazy idea?
>
> self selectedContext activeHome ifNil: [ |ctxt|
>     ctxt := self selectedContext.
>     "look up ctxt method methodClass >> ctxt selector."
>     "Save the code as normal"
>     ctxt method become: ctxt method methodClass >> ctxt selector].
>

All but the last line is sane ;-)  You can't expect a become: to do the
right thing. It'll leave the context's pc wrong, and perhaps its stack
pointer too.  You're looking for

    ctxt privRefreshWith: ctxt method methodClass >> ctxt selector

But what do you want to do?  Are you rewriting a block as a block or as a
method?  What yu have above will do the latter, not the former.


>
> You'd need to fiddle the stack pointer, but that you have to do anyway
> in edit-and-continue.
>
> frank
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140120/690a0a9d/attachment.htm


More information about the Squeak-dev mailing list