OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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; | 5 part of js_backend; |
6 | 6 |
7 /** | 7 /** |
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
9 */ | 9 */ |
10 class MinifyNamer extends Namer { | 10 class MinifyNamer extends Namer { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // This list of popular instance variable names generated with: | 88 // This list of popular instance variable names generated with: |
89 // cat out.js | | 89 // cat out.js | |
90 // perl -ne '$_=~s/(?<![^a-z0-9_\$]\$)\.([a-z0-9_\$]+)/print("$1\n")/gei' | | 90 // perl -ne '$_=~s/(?<![^a-z0-9_\$]\$)\.([a-z0-9_\$]+)/print("$1\n")/gei' | |
91 // sort | uniq -c | sort -nr | head -40 | 91 // sort | uniq -c | sort -nr | head -40 |
92 // Removed: html, call*, hasOwnProperty. | 92 // Removed: html, call*, hasOwnProperty. |
93 _populateSuggestedNames( | 93 _populateSuggestedNames( |
94 suggestedInstanceNames, | 94 suggestedInstanceNames, |
95 usedInstanceNames, | 95 usedInstanceNames, |
96 const <String>[ | 96 const <String>[ |
97 r'$add', r'add$1', r'box_0', r'charCodeAt$1', r'constructor', | 97 r'$add', r'add$1', r'box_0', r'codeUnitAt$1', r'constructor', |
98 r'current', r'$defineNativeClass', r'$eq', r'$ne', | 98 r'current', r'$defineNativeClass', r'$eq', r'$ne', |
99 r'getPrototypeOf', r'hasOwnProperty', r'$index', r'$indexSet', | 99 r'getPrototypeOf', r'hasOwnProperty', r'$index', r'$indexSet', |
100 r'$isJavaScriptIndexingBehavior', r'$isolateProperties', | 100 r'$isJavaScriptIndexingBehavior', r'$isolateProperties', |
101 r'iterator', r'length', r'$lt', r'$gt', r'$le', r'$ge', | 101 r'iterator', r'length', r'$lt', r'$gt', r'$le', r'$ge', |
102 r'moveNext$0', r'node', r'on', r'prototype', r'push', r'self', | 102 r'moveNext$0', r'node', r'on', r'prototype', r'push', r'self', |
103 r'start', r'target', r'this_0', r'value', r'width', r'style']); | 103 r'start', r'target', r'this_0', r'value', r'width', r'style']); |
104 | 104 |
105 _populateSuggestedNames( | 105 _populateSuggestedNames( |
106 suggestedGlobalNames, | 106 suggestedGlobalNames, |
107 usedGlobalNames, | 107 usedGlobalNames, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 212 } |
213 | 213 |
214 int _alphaNumericNumber(int x) { | 214 int _alphaNumericNumber(int x) { |
215 if (x >= ALPHANUMERIC_CHARACTERS) x %= ALPHANUMERIC_CHARACTERS; | 215 if (x >= ALPHANUMERIC_CHARACTERS) x %= ALPHANUMERIC_CHARACTERS; |
216 if (x < 26) return $a + x; | 216 if (x < 26) return $a + x; |
217 if (x < 52) return $A + x - 26; | 217 if (x < 52) return $A + x - 26; |
218 return $0 + x - 52; | 218 return $0 + x - 52; |
219 } | 219 } |
220 | 220 |
221 } | 221 } |
OLD | NEW |