Move variable definitions to <local-def>#78
Conversation
And the reason to do this refactoring is what exactly? Is it because the programs without these refactoring(s) are erroneous (i.e. not allowed by the Dana language specification) or is just because "they look/feel better" ? If it is the former, then I think you should amend the PR with some justification why they are erroneous. If it is the latter, then I think you are missing the point for having these programs in the list of valid programs of the Dana test suite: namely to also have "somewhat weird albeit correct programs" that a correct (i.e. specification-conforming) compiler for the Dana language should better handle. |
|
It's the former, because in Dana specs in the grammar ⟨var-def⟩ are allowed only in the following case: not inside the block of the function. Our parser throws an error when the var definitions are inside the block, and that's why I created this and the previous Pull Request (named "Update test file"). |
|
You are right, of course. Thanks for noticing this and for your contribution. I will merge. |
Refactors the placement of
vardefinitions in function bodies so they appear in the<local-def>section at the top of the function, rather than inside the<block>of statements.