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
```