fix(compiler): lower variables with a closure by exporting the variable.

This e.g. leaves comments at the right place, which is important for closure.
This commit is contained in:
Tobias Bosch
2017-09-01 16:27:35 -07:00
committed by Matias Niemelä
parent b6833d1bbd
commit 5ef6e6366f
3 changed files with 134 additions and 101 deletions

View File

@ -28,6 +28,11 @@ describe('Expression lowering', () => {
class MyClass {}
`)).toContain('const l = () => null; exports.l = l;');
});
it('should be able to export a variable if the whole value is lowered', () => {
expect(convert('/*a*/ const a =◊b: () => null◊;'))
.toBe('/*a*/ const a = () => null; const b = a; export { b };');
});
});
describe('collector', () => {