richardhundt/nyanga — pull request #8 by franko (2013-09-11 19:35:48+00:00)
Title: Improve codegen mechanism for exported variables

Improve the generated code. In case of exported function the function body is not duplicated.

For example, for the following code snippet

```lua
export module boo

export function foo(x)
return x + 10
end

end
```

the generated code is:
```lua
local boo;
do
local foo = function (x)
do return x + (10) end
end
boo = {
["foo"] = foo;
};
end
do return {
["boo"] = boo;
} end
```

instead of
```lua
local boo;
local export = {
};
export.boo = (function ()
local export = {
};
export.foo = function (x)
do return x + (10) end
end
local foo = function (x)
do return x + (10) end
end
do return export end
end)();
boo = export.boo;
do return export end
```