diff options
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/lib/output.js b/lib/output.js index 150f270a..2950e3cb 100644 --- a/lib/output.js +++ b/lib/output.js @@ -892,10 +892,6 @@ function OutputStream(options) { use_asm = was_asm; } - DEFPRINT(AST_Statement, function(output) { - this.body.print(output); - output.semicolon(); - }); DEFPRINT(AST_Toplevel, function(output) { display_body(this.body, true, output, true); output.print(""); @@ -1011,6 +1007,64 @@ function OutputStream(options) { output.space(); force_statement(self.body, output); }); + DEFPRINT(AST_ExportDeclaration, function(output) { + output.print("export"); + output.space(); + this.body.print(output); + }); + DEFPRINT(AST_ExportDefault, function(output) { + output.print("export"); + output.space(); + output.print("default"); + output.space(); + this.body.print(output); + output.semicolon(); + }); + DEFPRINT(AST_ExportForeign, function(output) { + var self = this; + output.print("export"); + output.space(); + var len = self.keys.length; + if (len == 0) { + print_braced_empty(self, output); + } else if (self.keys[0] == "*") { + print_entry(0); + } else output.with_block(function() { + output.indent(); + print_entry(0); + for (var i = 1; i < len; i++) { + output.print(","); + output.newline(); + output.indent(); + print_entry(i); + } + output.newline(); + }); + output.space(); + output.print("from"); + output.space(); + output.print_string(self.path, self.quote); + output.semicolon(); + + function print_entry(index) { + var alias = self.aliases[index]; + var key = self.keys[index]; + output.print_name(key); + if (alias != key) { + output.space(); + output.print("as"); + output.space(); + output.print_name(alias); + } + } + }); + DEFPRINT(AST_ExportReferences, function(output) { + var self = this; + output.print("export"); + output.space(); + print_properties(self, output); + output.semicolon(); + }); DEFPRINT(AST_Import, function(output) { var self = this; output.print("import"); @@ -1543,6 +1597,16 @@ function OutputStream(options) { DEFPRINT(AST_Symbol, function(output) { print_symbol(this, output); }); + DEFPRINT(AST_SymbolExport, function(output) { + var self = this; + print_symbol(self, output); + if (self.alias) { + output.space(); + output.print("as"); + output.space(); + output.print_name(self.alias); + } + }); DEFPRINT(AST_SymbolImport, function(output) { var self = this; if (self.key) { |