mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Use a period in disambiguated loadIds
This allows the original loadId to be determined when the original ends in a digit. Change-Id: I37231229c538c66fd54c79dffbfded3aa9e3973b Reviewed-on: https://dart-review.googlesource.com/36490 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
762b336f2b
commit
079a4b08f5
|
@ -515,8 +515,9 @@ abstract class DeferredLoadTask extends CompilerTask {
|
|||
String result = computeImportDeferName(import, compiler);
|
||||
assert(result != null);
|
||||
// Note: tools that process the json file to build multi-part initial load
|
||||
// bundles depend on the fact that makeUnique appends only digits.
|
||||
_importDeferName[import] = makeUnique(result, usedImportNames);
|
||||
// bundles depend on the fact that makeUnique appends only digits, or a
|
||||
// period followed by digits.
|
||||
_importDeferName[import] = makeUnique(result, usedImportNames, '.');
|
||||
}
|
||||
|
||||
// Sort the output units in descending order of the number of imports they
|
||||
|
|
|
@ -245,13 +245,14 @@ int longestCommonPrefixLength(List a, List b) {
|
|||
/// the smallest number that makes it not appear in [usedNames].
|
||||
///
|
||||
/// Adds the result to [usedNames].
|
||||
String makeUnique(String suggestedName, Set<String> usedNames) {
|
||||
String makeUnique(String suggestedName, Set<String> usedNames,
|
||||
[String separator = '']) {
|
||||
String result = suggestedName;
|
||||
if (usedNames.contains(suggestedName)) {
|
||||
int counter = 0;
|
||||
while (usedNames.contains(result)) {
|
||||
counter++;
|
||||
result = "$suggestedName$counter";
|
||||
result = "$suggestedName$separator$counter";
|
||||
}
|
||||
}
|
||||
usedNames.add(result);
|
||||
|
|
Loading…
Reference in a new issue