Chromium Code Reviews| 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); |
| + } |
| + } |
| +} |