erde-lang / erde

A programming language that compiles to Lua.
https://erde-lang.github.io
MIT License
39 stars 4 forks source link

`_MODULE` does not update with local definition #22

Closed bsuth closed 1 year ago

bsuth commented 1 year ago

Updating a module definition does not update the _MODULE table after declaration.

module myvar = 4
print(_MODULE.myvar) -- 4

myvar = 5
print(_MODULE.myvar) -- 4

We should keep track of declarations and update _MODULE accordingly when necessary

bsuth commented 1 year ago

We should also update _G with global declarations. If we are going to track declarations during compilation, we may also be able to fix https://github.com/erde-lang/erde/issues/18 by updating the (non-translated) field in _G

bsuth commented 1 year ago

closed by https://github.com/erde-lang/erde/commit/10898e493c109494087b9eacdd4e61bb0775b943