| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of js_backend.namer; | 5 part of js_backend.namer; |
| 6 | 6 |
| 7 class FrequencyBasedNamer extends Namer | 7 class FrequencyBasedNamer extends Namer |
| 8 with _MinifiedFieldNamer, _MinifiedOneShotInterceptorNamer | 8 with _MinifiedFieldNamer, _MinifiedOneShotInterceptorNamer |
| 9 implements jsAst.TokenFinalizer { | 9 implements jsAst.TokenFinalizer { |
| 10 _FieldNamingRegistry fieldRegistry; | 10 _FieldNamingRegistry fieldRegistry; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 String proposed = _generateFreshStringForName(proposedName, scope, | 57 String proposed = _generateFreshStringForName(proposedName, scope, |
| 58 sanitizeForNatives: sanitizeForNatives, | 58 sanitizeForNatives: sanitizeForNatives, |
| 59 sanitizeForAnnotations: sanitizeForAnnotations); | 59 sanitizeForAnnotations: sanitizeForAnnotations); |
| 60 | 60 |
| 61 TokenName name = new TokenName(tokenScope, proposed); | 61 TokenName name = new TokenName(tokenScope, proposed); |
| 62 tokens.add(name); | 62 tokens.add(name); |
| 63 return name; | 63 return name; |
| 64 } | 64 } |
| 65 | 65 |
| 66 @override | 66 @override |
| 67 jsAst.Name instanceFieldPropertyName(Element element) { | 67 jsAst.Name instanceFieldPropertyName(FieldElement element) { |
| 68 jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element); | 68 jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element); |
| 69 if (proposed != null) { | 69 if (proposed != null) { |
| 70 return proposed; | 70 return proposed; |
| 71 } | 71 } |
| 72 return super.instanceFieldPropertyName(element); | 72 return super.instanceFieldPropertyName(element); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @override | 75 @override |
| 76 void finalizeTokens() { | 76 void finalizeTokens() { |
| 77 int compareReferenceCount(TokenName a, TokenName b) { | 77 int compareReferenceCount(TokenName a, TokenName b) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 String proposal; | 133 String proposal; |
| 134 do { | 134 do { |
| 135 proposal = new String.fromCharCodes(_nextName); | 135 proposal = new String.fromCharCodes(_nextName); |
| 136 _incrementName(); | 136 _incrementName(); |
| 137 } while (MinifyNamer._hasBannedPrefix(proposal) || | 137 } while (MinifyNamer._hasBannedPrefix(proposal) || |
| 138 illegalNames.contains(proposal)); | 138 illegalNames.contains(proposal)); |
| 139 | 139 |
| 140 return proposal; | 140 return proposal; |
| 141 } | 141 } |
| 142 } | 142 } |
| OLD | NEW |