split up export variable declarations - fixes #939, fixes #964

This commit is contained in:
Sebastian McKenzie
2015-03-08 02:52:10 +11:00
parent 9c9af6dbbd
commit 5d32432e67
23 changed files with 124 additions and 50 deletions

View File

@@ -52,6 +52,16 @@ export function ExportDeclaration(node, parent, scope) {
node.declaration = null;
node._blockHoist = 2;
return [getDeclar(), node];
} else if (t.isVariableDeclaration(declar)) {
var specifiers = [];
var bindings = t.getBindingIdentifiers(declar);
for (var key in bindings) {
var id = bindings[key];
specifiers.push(t.exportSpecifier(id, id));
}
return [declar, t.exportDeclaration(null, specifiers)];
}
}
}