[squeak-dev] UndeclaredVariable correction raises Error in Parser
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Dec 20 20:22:25 UTC 2019
Hi all,
any chance to fix this until 5.3? Could anyone review the attached changeset? It only patches three methods :)
Best,
Christoph
________________________________
Von: Thiede, Christoph
Gesendet: Samstag, 14. September 2019 00:47:41
An: The general-purpose Squeak developers list
Betreff: UndeclaredVariable correction raises Error in Parser
Hi all,
maybe someone has time and knowledge to fix the following bug?
Scenario:
Try to compile the following method:
foo
ba := nil.
42 ifNotNil: [:ba | ba].
Then accept it and answer the UndeclaredVariable dialog with 'declare temp variable'.
Expected behavior:
The method should be corrected to:
foo
| ba |
ba := nil.
42 ifNotNil: [: "Name already used in this method ->"ba | ba].
Actual behavior:
UndeclaredVariableNode>>#sizeCodeForStorePop: is called and raises a #shouldNotImplement.
Interpretation:
I guess the problem is in #undeclaredTemps, where the encoder does not declare ba which was shadowed by the declaration in the block. How could that be solved? My first approach would be to store all UndeclaredTempVars in #bindUndeclaredTemp: separately, but I'm quite sure this is not efficient ... How would you solve this problem the best way?
However, I attached a change set for my attempt, all tests are green.
I'm excited to hear your answers! :)
Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191220/4cef8425/attachment.html>
More information about the Squeak-dev
mailing list
|