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

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

Issue 10837343: Unify private names treatment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « lib/compiler/implementation/dart_backend/placeholder_collector.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/renamer.dart
diff --git a/lib/compiler/implementation/dart_backend/renamer.dart b/lib/compiler/implementation/dart_backend/renamer.dart
index 3a6a051167493abff3ea3b1e92113d772ad87e6a..6db65cbf2ec4b81d7478f43c4134e7cad34d98f4 100644
--- a/lib/compiler/implementation/dart_backend/renamer.dart
+++ b/lib/compiler/implementation/dart_backend/renamer.dart
@@ -14,14 +14,6 @@ void renamePlaceholders(
final Map<LibraryElement, Map<String, String>> renamed
= new Map<LibraryElement, Map<String, String>>();
final Set<String> usedTopLevelIdentifiers = new Set<String>();
- int privateNameCounter = 0;
-
- String getName(LibraryElement library, String originalName, renamer) =>
- renamed.putIfAbsent(library, () => <String>{})
- .putIfAbsent(originalName, renamer);
-
- String renamePrivateIdentifier(LibraryElement library, String id) =>
- getName(library, id, () => '_${privateNameCounter++}${id}');
Generator topLevelGenerator =
true ? conservativeGenerator : new MinifyingGenerator('ABCD').generate;
@@ -32,6 +24,10 @@ void renamePlaceholders(
return newName;
}
+ rename(library, originalName) =>
+ renamed.putIfAbsent(library, () => <String>{})
+ .putIfAbsent(originalName, () => generateUniqueName(originalName));
+
String renameElement(Element element) {
assert(element.isTopLevel());
// TODO(smok): Make sure that the new name does not conflict with existing
@@ -44,8 +40,7 @@ void renamePlaceholders(
return '$prefix.$originalName';
}
- return getName(library, originalName,
- () => generateUniqueName(originalName));
+ return rename(library, originalName);
}
renameNodes(Collection<Node> nodes, renamer) {
@@ -73,7 +68,7 @@ void renamePlaceholders(
placeholderCollector.privateNodes.forEach(
(LibraryElement library, Set<Identifier> nodes) {
renameNodes(nodes, (node) =>
- renamePrivateIdentifier(library, node.source.slowToString()));
+ rename(library, node.source.slowToString()));
});
}
« no previous file with comments | « lib/compiler/implementation/dart_backend/placeholder_collector.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698