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

Unified Diff: sdk/lib/_internal/compiler/implementation/util/util.dart

Issue 476583003: Allow dart2dart to output one file per library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address floitsch's comments Created 6 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 | « sdk/lib/_internal/compiler/implementation/tree/unparser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/util/util.dart
diff --git a/sdk/lib/_internal/compiler/implementation/util/util.dart b/sdk/lib/_internal/compiler/implementation/util/util.dart
index bf18c10b569463f33abadb53a221eb3b150b8ca8..7dbc572ec123728d5b3e082b40e5d7d46696f9a4 100644
--- a/sdk/lib/_internal/compiler/implementation/util/util.dart
+++ b/sdk/lib/_internal/compiler/implementation/util/util.dart
@@ -194,3 +194,20 @@ int longestCommonPrefixLength(List a, List b) {
}
return index;
}
+
+/// Returns [suggestedName] if it is not in [usedNames]. Otherwise concatenates
+/// the smallest number that makes it not appear in [usedNames].
+///
+/// Adds the result to [usedNames].
+String makeUnique(String suggestedName, Set<String> usedNames) {
+ String result = suggestedName;
+ if (usedNames.contains(suggestedName)) {
+ int counter = 0;
+ while (usedNames.contains(result)) {
+ counter++;
+ result = "$suggestedName$counter";
+ }
+ }
+ usedNames.add(result);
+ return result;
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/tree/unparser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698