[ES6] Implemented parse for export Name from Module variants. (#1701)

- add `AST_Export` new variants output
- add tests to `test/compress/`
- update `$propdoc` of `AST_Export` ("exported_names" & "module_name")
- add tests for `export ...  as ...` variants
This commit is contained in:
Ondřej Španěl
2017-03-30 11:07:50 +02:00
committed by Alex Lam S.L
parent fccefbeaca
commit 5dea52266b
6 changed files with 182 additions and 2 deletions

View File

@@ -1277,11 +1277,37 @@ function OutputStream(options) {
output.print("default");
output.space();
}
if (self.exported_value) {
if (self.exported_names) {
output.space();
if (self.exported_names.length === 1 && self.exported_names[0].name.name === "*") {
self.exported_names[0].print(output);
} else {
output.print("{");
self.exported_names.forEach(function (name_import, i) {
output.space();
name_import.print(output);
if (i < self.exported_names.length - 1) {
output.print(",");
output.space();
}
});
output.space();
output.print("}");
}
output.space();
}
else if (self.exported_value) {
self.exported_value.print(output);
} else if (self.exported_definition) {
self.exported_definition.print(output);
}
if (self.module_name) {
output.space();
output.print("from");
output.space();
self.module_name.print(output);
}
output.semicolon();
});