[Cuis-dev] RenameTemporary of var with same name fix

Eric Brandwein brandweineric at gmail.com
Tue Dec 17 20:51:16 PST 2019


Great! I was actually working on that but your approach seems better than
mine. I got a little bit stuck solving another issue with it, that happens
when changing the name to one already used in another block. For example,
one should be able to rename the temp variable 'old' to 'new' in the method:

method
    [ | old | ^old ].
    [ | new | ^new ].

, but the current implementation doesn't support it. Attached is a
ChangeSet with a test demonstrating this.

I was stuck because it meant we should be able to determine if the block B
declaring the new variable A neither has any inner blocks defining the same
variable nor any block that contains B defines A. If both these things are
true (and all the other checks pass), the variable can be renamed. This, in
turn, meant we should go through all the parse tree looking for the branch
that corresponds to B, and just check for A in the nodes on that branch. It
can be done probably with a ParseNodeVisitor; it just was too late when I
was programming this and it seemed that it was going to take me a longer
while to implement it, so I just left it there to continue later. I'll
probably do it tomorrow if I have some time.

Cheers,
Eric

El mar., 17 dic. 2019 a las 19:30, Hernan Wilkinson via Cuis-dev (<
cuis-dev at lists.cuis.st>) escribió:

> Hi,
>  I just uploaded to the repo a fix for that bug.
>  Now if two different blocks define a var with the same name, the rename
> works as expected.
>
> Cheers!
> Hernan.
>
> --
>
> *Hernán WilkinsonAgile Software Development, Teaching & Coaching*
> *Phone: +54-011*-4893-2057
> *Twitter: @HernanWilkinson*
> *site: http://www.10Pines.com <http://www.10pines.com/>*
> Address: Alem 896, Floor 6, Buenos Aires, Argentina
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191218/5ca7310f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RenameTemporaryWithOtherBlockDeclaringTheVariable-BaseImageTests-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 815 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191218/5ca7310f/attachment-0001.bin>


More information about the Cuis-dev mailing list