Index: pkg/js_ast/lib/src/printer.dart |
diff --git a/pkg/js_ast/lib/src/printer.dart b/pkg/js_ast/lib/src/printer.dart |
index ff757b4cbd90d87ec1863be0751e3c695f2e6ad4..94cec32f28548dafcc48ce024f3bd34d1be333ef 100644 |
--- a/pkg/js_ast/lib/src/printer.dart |
+++ b/pkg/js_ast/lib/src/printer.dart |
@@ -5,15 +5,21 @@ |
part of js_ast; |
+typedef String Renamer(Name); |
+ |
class JavaScriptPrintingOptions { |
final bool shouldCompressOutput; |
final bool minifyLocalVariables; |
final bool preferSemicolonToNewlineInMinifiedOutput; |
+ final Renamer renamerForNames; |
JavaScriptPrintingOptions( |
{this.shouldCompressOutput: false, |
this.minifyLocalVariables: false, |
- this.preferSemicolonToNewlineInMinifiedOutput: false}); |
+ this.preferSemicolonToNewlineInMinifiedOutput: false, |
+ this.renamerForNames: identityRenamer}); |
+ |
+ static String identityRenamer(Name name) => name.name; |
} |
@@ -930,7 +936,7 @@ class Printer implements NodeVisitor { |
} else if (selector is Name) { |
if (access.receiver is LiteralNumber) out(" ", isWhitespace: true); |
out("."); |
- out(selector.name); |
+ selector.accept(this); |
return; |
} |
out("["); |
@@ -998,7 +1004,7 @@ class Printer implements NodeVisitor { |
@override |
visitName(Name node) { |
- out(node.name); |
+ out(options.renamerForNames(node)); |
} |
@override |