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

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: Insert library-names in generateds libraries. Fix bug of previous upload 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
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 04854e6ea602afeb0138cbc1c2953da572353158..c766739799edf7b73195d572be3d0d1e660b6774 100644
--- a/sdk/lib/_internal/compiler/implementation/util/util.dart
+++ b/sdk/lib/_internal/compiler/implementation/util/util.dart
@@ -165,3 +165,19 @@ String modifiersToString({bool isStatic: false,
builder.toLink().printOn(buffer, ', ');
return buffer.toString();
}
+
+// 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.
floitsch 2014/08/28 20:10:07 New line before.
sigurdm 2014/09/03 08:24:16 Done.
+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;
+}

Powered by Google App Engine
This is Rietveld 408576698