importing names in the modules, not just default imports

This commit is contained in:
Fábio Santos
2016-02-26 21:12:19 +00:00
committed by Richard van Velzen
parent d35a9e7839
commit 59e1601fb8
4 changed files with 89 additions and 2 deletions

View File

@@ -1042,6 +1042,25 @@ function OutputStream(options) {
output.space();
if (self.imported_name) {
self.imported_name.print(output);
}
if (self.imported_name && self.imported_names) {
output.print(",");
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(",");
output.space();
}
});
output.space();
output.print("}");
}
if (self.imported_name || self.imported_names) {
output.space();
output.print("from")
output.space();
@@ -1050,6 +1069,18 @@ function OutputStream(options) {
output.semicolon();
});
DEFPRINT(AST_NameImport, function(self, output) {
if (self.foreign_name) {
self.foreign_name.print(output);
output.space();
output.print("as");
output.space();
self.name.print(output);
} else {
self.name.print(output);
}
});
function parenthesize_for_noin(node, output, noin) {
if (!noin) node.print(output);
else try {