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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 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.
6 final Renamer renamer;
7
8 RenamingUnparser(this.renamer);
9
10 visitSend(Send node) {
11 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
12 super.visitSend(node);
Anton Muhin 2012/07/23 11:23:10 return super.visitSend(node)?
13 return;
14 }
15 String newMethod = renamer.renameSendMethod(node);
16 if (newMethod !== null) {
17 sb.add(newMethod);
18 visit(node.argumentsNode);
19 } else {
20 super.visitSend(node);
21 }
22 }
23
24 visitTypeAnnotation(TypeAnnotation node) {
25 String newName = renamer.renameTypeName(node);
26 if (newName !== null) {
27 sb.add(newName);
28 visit(node.typeArguments);
29 } else {
30 super.visitTypeAnnotation(node);
31 }
32 }
33
34 visitIdentifier(Identifier node) {
35 String newName = renamer.renameIdentifier(node);
36 if (newName == null) {
37 super.visitIdentifier(node);
38 } else {
39 sb.add(newName);
40 }
41 }
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698