Closed Totktonada closed 5 years ago
from https://www.lua.org/pil/4.2.html A common idiom in Lua is
local foo = foo
This code creates a local variable, foo, and initializes it with the value of the global variable foo. That idiom is useful when the chunk needs to preserve the original value of foo even if later some other function changes the value of the global foo; it also speeds up access to foo.
@sergos See more here (don't sure how much it matters for LuaJIT). But it is not relevant to this issue.
My proposal is to revert the commit to fix the customer's problem. Maybe it would be good to reimplement the ability to save variable names under an option for debugging purposes.
BTW, I wrote a small script to obfuscate customer's avro-schema: https://gist.github.com/Totktonada/4158f63b99bbca19a6f0d1a0c9a26717
Reproducer (reduced here for readability):
Full code: case.lua.txt
Expected: no error. Got: LuajitError::: function at line has more than 200 local variables
Bisect log:
The reason of the issue is that commit c122bd1 breaks reusing of local variables in a generated code.