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

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

Issue 10795064: dart2dart: Introduce Renamer that is used by renaming unparser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
Index: lib/compiler/implementation/dart_backend/renaming_unparser.dart
diff --git a/lib/compiler/implementation/dart_backend/renaming_unparser.dart b/lib/compiler/implementation/dart_backend/renaming_unparser.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b617d82522aa582ccb02193cb8197b194a3821ea
--- /dev/null
+++ b/lib/compiler/implementation/dart_backend/renaming_unparser.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class RenamingUnparser extends Unparser {
Anton Muhin 2012/07/23 11:23:10 do we need both RenamingUnparser and Unparser? I
Roman 2012/07/23 15:34:15 Merged.
+ final Renamer renamer;
+
+ RenamingUnparser(this.renamer);
+
+ visitSend(Send node) {
+ if (node.selector !== null && node.selector is TypeAnnotation) {
Anton Muhin 2012/07/23 11:23:10 no need in !== check, null is TypeAnnotation shoul
Roman 2012/07/23 15:34:15 (null is AnyType) == true
+ super.visitSend(node);
Anton Muhin 2012/07/23 11:23:10 return super.visitSend(node)?
+ return;
+ }
+ String newMethod = renamer.renameSendMethod(node);
+ if (newMethod !== null) {
+ sb.add(newMethod);
+ visit(node.argumentsNode);
+ } else {
+ super.visitSend(node);
+ }
+ }
+
+ visitTypeAnnotation(TypeAnnotation node) {
+ String newName = renamer.renameTypeName(node);
+ if (newName !== null) {
+ sb.add(newName);
+ visit(node.typeArguments);
+ } else {
+ super.visitTypeAnnotation(node);
+ }
+ }
+
+ visitIdentifier(Identifier node) {
+ String newName = renamer.renameIdentifier(node);
+ if (newName == null) {
+ super.visitIdentifier(node);
+ } else {
+ sb.add(newName);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698