[Cuis-dev] Removing unused temps from inside blocks

Eric Brandwein brandweineric at gmail.com
Wed Dec 11 22:02:43 PST 2019


Sorry, I just realised this doesn't work if you're erasing many variables
at a time. The obvious solution is to just reparse each time a temporary
variable is removed, and that is what this new attached ChangeSet does.

This is maybe slow, and I guess the alternative would be to go through all
the declarations of all blocks inside the parsed method from the bottom to
the top, so as to not change the positions of other possibly unused
declarations when removing one of them. Let me know if this other solution
seems better or if the one that reparses every time is fine.

Cheers,
Eric

El jue., 12 dic. 2019 a las 2:23, Eric Brandwein (<brandweineric at gmail.com>)
escribió:

> Hi all,
>
> Currently, when you save a method with an unused temporary variable
> declared, it prompts you to decide if you want to remove it or not. If you
> click yes, it removes the declaration, but only if it's declared in the
> method scope, and not if it is declared inside a block.
>
> To reproduce, just create a method with an unused temporary variable
> declared inside a block, save it, and click 'Yes' on the popup that appears.
>
> This is because the Parser only looks for the variable in the temps
> declared in the method scope. Here's a ChangeSet that fixes it making the
> Parser look inside blocks too, taking advantage of the fact that the
> Encoder has already found the positions for each variable.
>
> Cheers,
> Eric
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191212/874ad8ca/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3961-ReparseAfterRemovingEachUnusedTemp-EricBrandwein-2019Dec12-02h15m-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 850 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191212/874ad8ca/attachment.bin>


More information about the Cuis-dev mailing list