Allows self in nested anonymous function.
For example:
local mod = { x = 0 } function mod:foo() local function inner () return self.x end return inner end
works perfectly in typedlua, but if I changed inner() function into an anonymous function:
local mod = { x = 0 } function mod:foo() return function () return self.x end end
It would cause an type error in typedlua (cannot index 'x' for 'nil') because the inner function cannot find correspond 'self' declaration in mod:foo().
This patch is a workaround for this problem. I'm not sure whether it would introduce any side effects or not. :)
I'm sorry for the late response, but we are migrating to a new project, so I accepted your PR at this new project.
Please, check it out at https://github.com/titan-lang.
Many thanks!
Allows self in nested anonymous function. For example:
local mod = { x = 0 } function mod:foo() local function inner () return self.x end return inner end
works perfectly in typedlua, but if I changed inner() function into an anonymous function:local mod = { x = 0 } function mod:foo() return function () return self.x end end
It would cause an type error in typedlua (cannot index 'x' for 'nil') because the inner function cannot find correspond 'self' declaration in mod:foo().
This patch is a workaround for this problem. I'm not sure whether it would introduce any side effects or not. :)