Chromium Code Reviews| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 'show', 'SINE', 'size', 'span', 'stat', 'step', 'stop', 'tags', 'text', | 70 'show', 'SINE', 'size', 'span', 'stat', 'step', 'stop', 'tags', 'text', |
| 71 'Text', 'time', 'type', 'view', 'warn', 'wrap', 'ZERO']; | 71 'Text', 'time', 'type', 'view', 'warn', 'wrap', 'ZERO']; |
| 72 for (var name in reservedNativeProperties) { | 72 for (var name in reservedNativeProperties) { |
| 73 if (name.length < 2) { | 73 if (name.length < 2) { |
| 74 instanceNameMap[name] = name; | 74 instanceNameMap[name] = name; |
| 75 } | 75 } |
| 76 usedInstanceNames.add(name); | 76 usedInstanceNames.add(name); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // This list of popular instance variable names generated with: | 79 // This list of popular instance variable names generated with: |
| 80 // cat out.js | | 80 // cat out.js | |
|
ngeoffray
2013/02/12 22:11:31
Not your code, but on which generated application
| |
| 81 // perl -ne '$_=~s/(?<![^a-z0-9_\$]\$)\.([a-z0-9_\$]+)/print("$1\n")/gei' | | 81 // perl -ne '$_=~s/(?<![^a-z0-9_\$]\$)\.([a-z0-9_\$]+)/print("$1\n")/gei' | |
| 82 // sort | uniq -c | sort -nr | head -40 | 82 // sort | uniq -c | sort -nr | head -40 |
| 83 // Removed: html, call*, hasOwnProperty. | 83 // Removed: html, call*, hasOwnProperty. |
| 84 _populateSuggestedNames( | 84 _populateSuggestedNames( |
| 85 suggestedInstanceNames, | 85 suggestedInstanceNames, |
| 86 usedInstanceNames, | 86 usedInstanceNames, |
| 87 const <String>[ | 87 const <String>[ |
| 88 r'$add', r'add$1', r'box_0', r'charCodeAt$1', r'constructor', | 88 r'$add', r'add$1', r'box_0', r'charCodeAt$1', r'constructor', |
| 89 r'current', r'$defineNativeClass', r'$eq', r'$ne', | 89 r'current', r'$defineNativeClass', r'$eq', r'$ne', |
| 90 r'getPrototypeOf', r'hasOwnProperty', r'$index', r'$indexSet', | 90 r'getPrototypeOf', r'hasOwnProperty', r'$index', r'$indexSet', |
| 91 r'$isJavaScriptIndexingBehavior', r'$isolateProperties', | 91 r'$isJavaScriptIndexingBehavior', r'$isolateProperties', |
| 92 r'iterator', r'length', r'$lt', r'$gt', r'$le', r'$ge', | 92 r'iterator', r'length', r'$lt', r'$gt', r'$le', r'$ge', |
| 93 r'moveNext$0', r'node', r'on', r'prototype', r'push', r'self', | 93 r'moveNext$0', r'node', r'on', r'prototype', r'push', r'self', |
| 94 r'start', r'target', r'this_0', r'value', r'width', r'style']); | 94 r'start', r'target', r'this_0', r'value', r'width', r'style']); |
| 95 | 95 |
| 96 _populateSuggestedNames( | 96 _populateSuggestedNames( |
| 97 suggestedGlobalNames, | 97 suggestedGlobalNames, |
| 98 usedGlobalNames, | 98 usedGlobalNames, |
| 99 const <String>[ | 99 const <String>[ |
| 100 r'Object', r'$throw', r'$eq', r'S', r'ioore', r'UnsupportedError$', | 100 r'Object', r'$throw', r'$eq', r'S', r'ioore', r'UnsupportedError$', |
| 101 r'length', r'$sub', r'getInterceptor$JSStringJSArray', r'$add', | 101 r'length', r'$sub', r'getInterceptor$JSArrayJSString', r'$add', |
| 102 r'$gt', r'$ge', r'$lt', r'$le', r'add', r'getInterceptor$JSNumber', | 102 r'$gt', r'$ge', r'$lt', r'$le', r'add', r'getInterceptor$JSNumber', |
| 103 r'iterator', r'$index', r'iae', r'getInterceptor$JSArray', | 103 r'iterator', r'$index', r'iae', r'getInterceptor$JSArray', |
| 104 r'ArgumentError$', r'BoundClosure', r'StateError$', | 104 r'ArgumentError$', r'BoundClosure', r'StateError$', |
| 105 r'getInterceptor', r'max', r'$mul', r'List_List', r'Map_Map', | 105 r'getInterceptor', r'max', r'$mul', r'List_List', r'Map_Map', |
| 106 r'getInterceptor$JSString', r'$div', r'$indexSet', | 106 r'getInterceptor$JSString', r'$div', r'$indexSet', |
| 107 r'List_List$from', r'Set_Set$from', r'toString', r'toInt', r'min', | 107 r'List_List$from', r'Set_Set$from', r'toString', r'toInt', r'min', |
| 108 r'StringBuffer_StringBuffer', r'contains1', r'WhereIterable$', | 108 r'StringBuffer_StringBuffer', r'contains1', r'WhereIterable$', |
| 109 r'RangeError$value', r'JSString', r'JSNumber', | 109 r'RangeError$value', r'JSString', r'JSNumber', |
| 110 r'JSArray' | 110 r'JSArray' |
| 111 ]); | 111 ]); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 } | 191 } |
| 192 | 192 |
| 193 int _alphaNumericNumber(int x) { | 193 int _alphaNumericNumber(int x) { |
| 194 if (x >= ALPHANUMERIC_CHARACTERS) x %= ALPHANUMERIC_CHARACTERS; | 194 if (x >= ALPHANUMERIC_CHARACTERS) x %= ALPHANUMERIC_CHARACTERS; |
| 195 if (x < 26) return $a + x; | 195 if (x < 26) return $a + x; |
| 196 if (x < 52) return $A + x - 26; | 196 if (x < 52) return $A + x - 26; |
| 197 return $0 + x - 52; | 197 return $0 + x - 52; |
| 198 } | 198 } |
| 199 | 199 |
| 200 } | 200 } |
| OLD | NEW |