File tree 1 file changed +8
-1
lines changed
pkg/compiler/lib/src/js_backend
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -209,10 +209,17 @@ class MinifyNamer extends Namer {
209
209
return h;
210
210
}
211
211
212
+ /// Remember bad hashes to avoid using a the same character with long numbers
213
+ /// for frequent hashes. For example, `closure` is a very common name.
214
+ Map <int , int > _badNames = new Map <int , int >();
215
+
212
216
/// If we can't find a hash based name in the three-letter space, then base
213
217
/// the name on a letter and a counter.
214
218
String _badName (int hash, Set <String > usedNames) {
215
- String startLetter = new String .fromCharCodes ([_letterNumber (hash)]);
219
+ int count = _badNames.putIfAbsent (hash, () => 0 );
220
+ String startLetter =
221
+ new String .fromCharCodes ([_letterNumber (hash + count)]);
222
+ _badNames[hash] = count + 1 ;
216
223
String name;
217
224
int i = 0 ;
218
225
do {
You can’t perform that action at this time.
0 commit comments