[Cuis-dev] RenameTemporary of var with same name fix
Eric Brandwein
brandweineric at gmail.com
Wed Dec 18 14:04:15 PST 2019
Here we go, a ChangeSet that fixes this issue. Attached also is another
test for the class.
Cheers,
Eric
El mié., 18 dic. 2019 a las 10:29, Hernan Wilkinson (<
hernan.wilkinson at 10pines.com>) escribió:
>
>
> On Wed, Dec 18, 2019 at 1:51 AM Eric Brandwein <brandweineric at gmail.com>
> wrote:
>
>> 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.
>>
>
> hehe, yeap, I saw that problem too... we should work together man! :-) or
> communicate more :-)
>
>
>> 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.
>>
>
> Cool! Let me know if you can solve it.
>
> The scopeTable is the problem, it does not support levels of
> environments... that is the root of all the problems we are having with the
> rename, shadowing, etc etc.
> Changing how the scopeTable is right not is not easy, maybe some day I'll
> have time to look at it.
>
> Cheers!
> Hernan.
>
>
>> 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
>>>
>>
>
> --
>
> *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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191218/7ab666f5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3980-RenameTemporaryWithOtherBlocksDeclaringNewVariable-EricBrandwein-2019Dec18-16h29m-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 5696 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191218/7ab666f5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CantRenameTemporaryToNameUsedInUpperBlock-BaseImageTests-EB.1.cs.st
Type: application/vnd.sailingtracker.track
Size: 1647 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20191218/7ab666f5/attachment-0001.bin>
More information about the Cuis-dev
mailing list