Implicit definition in explicit scope generates incorrect code
The NaBL generator emits incorrect (does not compile) code for the following NaBL specification:
Assign(_, _, e, _): implicitly defines Variable "_" in e
Emits:
nabl-external-def-site(|partition__) = ?Assign(_, _, e, _) ; origin-track-forced( Assign(id, id, nabl-def-alias(|partition__, uri__), id) | )
Where variable
Submitted by Vlad Vergu on 8 January 2014 at 13:57uri__
is not bound. Leaving out the scope part (i.e. withoutin e
) emits correct code.
Issue Log
Fixed in https://github.com/metaborg/nabl/commit/f6dc33703486ee5b42f44df6bb250fa5581115d3 and https://github.com/metaborg/runtime-libraries/commit/9cb464d205b6950152162943d62339a35ab60bea
This doesn’t work for me yet. It compiles fine but it breaks at runtime. It actually breaks a few extra things. All
defines N n in t
are broken in the sense that for no such definition does a reference ton
int
actually resolve. I.e. i get only Unresolved reference. This happens for alldefines in ...
andimplicitly defines in ...
.
After some analysis, I found the issue.
- The scope of the definition is correctly annotated with an anonymous scope.
- The definition is correctly created in another anonymous scope (in the root scope).
- The alias from the name in the first scope to the actual definition is missing.
Ok, the missing alias was caused by a name collision for
uri__
, which is used to pass a dictionary for URIs around and was now used to store the URI of the definition. This is fixed now.However, implicit definitions in external scopes still produce uncompilable code, since they need to retrieve
def-uri__
from an implicit definition.
Thank you. Problem fixed!
Log in to post comments