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

Unified Diff: lib/compiler/implementation/tree/unparser.dart

Issue 10828121: Improve renaming of constructors and factories. (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/tree/unparser.dart
diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart
index 9c7a23e6b727aa87a4e0287ae00ff88a23580d25..224153833020695e1231e4c6db6ced8cea47584d 100644
--- a/lib/compiler/implementation/tree/unparser.dart
+++ b/lib/compiler/implementation/tree/unparser.dart
@@ -100,17 +100,27 @@ class Unparser implements Visitor {
// names are modelled with Send and it emits operator[] as only
// operator, without [] which are expected to be emitted with
// arguments.
+ emitName(Identifier name) {
+ final newName = renamer.renameIdentifier(name);
Roman 2012/08/02 05:44:53 Looks like now renameIdentifier is only used for f
Anton Muhin 2012/08/03 13:57:57 It should be used for getters/setters, maybe even
+ if (newName === null) {
+ visit(name);
+ } else {
+ sb.add(newName);
+ }
+ }
if (node.name is Send) {
Send send = node.name;
assert(send is !SendSet);
- visit(send.receiver);
if (!send.isOperator) {
// Looks like a factory method.
+ emitName(send.receiver);
sb.add('.');
+ } else {
+ visit(send.receiver);
}
visit(send.selector);
} else {
- visit(node.name);
+ if (node.name !== null) emitName(node.name);
}
visit(node.parameters);
visit(node.initializers);
@@ -118,12 +128,7 @@ class Unparser implements Visitor {
}
visitIdentifier(Identifier node) {
- String newName = renamer.renameIdentifier(node);
- if (newName == null) {
- add(node.token.value);
- } else {
- sb.add(newName);
- }
+ add(node.token.value);
}
visitIf(If node) {

Powered by Google App Engine
This is Rietveld 408576698