split up module class declarations - fixes #1021

This commit is contained in:
Sebastian McKenzie
2015-03-16 01:44:10 +11:00
parent cc0f43813c
commit 1bbe52a022
5 changed files with 23 additions and 10 deletions

View File

@@ -50,7 +50,12 @@ export function ExportDeclaration(node, parent, scope) {
return [getDeclar(), node];
}
} else {
if (t.isFunctionDeclaration(declar)) {
if (t.isClassDeclaration(declar)) {
// export class Foo {}
node.specifiers = [t.importSpecifier(declar.id, declar.id)];
node.declaration = null;
return [getDeclar(), node];
} else if (t.isFunctionDeclaration(declar)) {
// export function Foo() {}
node.specifiers = [t.importSpecifier(declar.id, declar.id)];
node.declaration = null;