File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
pkg/compiler/lib/src/js_backend Expand file tree Collapse file tree 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 {
209209 return h;
210210 }
211211
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+
212216 /// If we can't find a hash based name in the three-letter space, then base
213217 /// the name on a letter and a counter.
214218 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 ;
216223 String name;
217224 int i = 0 ;
218225 do {
You can’t perform that action at this time.
0 commit comments