| 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.
|
| +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;
|
| +}
|
|
|