More variants of import added (#1738)

- `import * from "x.js"`
- `import * as Name from "x.js"`
This commit is contained in:
Ondřej Španěl
2017-03-31 11:52:56 +02:00
committed by Alex Lam S.L
parent a729c43e87
commit 2f93058c6e
3 changed files with 51 additions and 40 deletions

View File

@@ -1242,17 +1242,21 @@ function OutputStream(options) {
output.space();
}
if (self.imported_names) {
output.print("{");
self.imported_names.forEach(function(name_import, i) {
output.space();
name_import.print(output);
if (i < self.imported_names.length - 1) {
output.print(",");
if (self.imported_names.length === 1 && self.imported_names[0].foreign_name.name === "*") {
self.imported_names[0].print(output);
} else {
output.print("{");
self.imported_names.forEach(function (name_import, i) {
output.space();
}
});
output.space();
output.print("}");
name_import.print(output);
if (i < self.imported_names.length - 1) {
output.print(",");
output.space();
}
});
output.space();
output.print("}");
}
}
if (self.imported_name || self.imported_names) {
output.space();