Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Unified Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 11026006: Do not put renaming logic into Unparser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/backend.dart
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index c28f41669fb1b6a6459c321ba65ee648f22ee231..de00a48d13d1f34632cf1a65d1991ead3b6f332b 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -423,7 +423,7 @@ class DartBackend extends Backend {
}
}
- final unparser = new Unparser.withRenamer((Node node) => renames[node]);
+ final unparser = new EmitterUnparser(renames);
emitCode(unparser, imports, topLevelNodes, memberNodes);
compiler.assembledCode = unparser.result;
@@ -450,6 +450,27 @@ class DartBackend extends Backend {
log(String message) => compiler.log('[DartBackend] $message');
}
+class EmitterUnparser extends Unparser {
+ final Map<Node, String> renames;
+
+ EmitterUnparser(this.renames);
+
+ visit(Node node) {
+ if (node !== null && renames.containsKey(node)) {
+ sb.add(renames[node]);
+ } else {
+ super.visit(node);
+ }
+ }
+
+ unparseSendReceiver(Send node, [bool spacesNeeded=false]) {
+ // TODO(smok): Remove ugly hack for library prefices.
Roman 2012/10/02 07:55:55 prefixes ?
Anton Muhin 2012/10/02 08:48:42 O tempora, o mores! Let's wait for Peter's opinio
+ if (node.receiver !== null && renames[node.receiver] == '') return;
ahe 2012/10/02 14:27:39 I'm not sure what problem this is solving. If you
Anton Muhin 2012/10/02 14:32:15 That'd be great, Peter. The problem. Imagine you
ahe 2012/10/09 07:40:59 Anton, could you give me an example with actual co
Anton Muhin 2012/10/10 07:21:40 I assume you're asking for code being transformed.
+ super.unparseSendReceiver(node, spacesNeeded);
+ }
+}
+
+
/**
* Some elements are not recorded by resolver now,
* for example, typedefs or classes which are only
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698