fix(transpiler/dart): re-exporting only some bindings

```
export {Foo, Bar} from ‘./foo’;
==>
export ‘./foo’ show Foo, Bar;
```
This commit is contained in:
Vojta Jina
2014-11-10 10:40:07 -08:00
parent 7a70f8f92d
commit c5153175b6
4 changed files with 45 additions and 6 deletions

View File

@ -0,0 +1,3 @@
export var Bar1 = 'BAR1';
export var Bar2 = 'BAR2';
export function Bar3() {}

View File

@ -1 +1,2 @@
export * from './foo';
export {Bar1, Bar2} from './bar';

View File

@ -1,4 +1,4 @@
import {describe, it, expect} from 'test_lib/test_lib';
import {describe, it, expect, IS_DARTIUM} from 'test_lib/test_lib';
import {Foo, Bar} from './foo';
// TODO: Does not work, as dart does not support renaming imports
@ -21,6 +21,18 @@ export function main() {
expect(exportModule.Foo).toBe('FOO');
expect(exportModule.Bar).toBe('BAR');
expect(exportModule.Bar1).toBe('BAR1');
expect(exportModule.Bar2).toBe('BAR2');
// Make sure Bar3 is not re-exported.
expect(function() {
exportModule.Bar3();
}).toThrowError(IS_DARTIUM ?
// Dart
"No top-level method 'exportModule.Bar3' declared.":
// JavaScript
'undefined is not a function'
);
expect(Type).toBeTruthy();
});