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.namer; | 5 part of js_backend.namer; |
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 | 288 |
289 int _alphaNumericNumber(int x) { | 289 int _alphaNumericNumber(int x) { |
290 if (x >= ALPHANUMERIC_CHARACTERS) x %= ALPHANUMERIC_CHARACTERS; | 290 if (x >= ALPHANUMERIC_CHARACTERS) x %= ALPHANUMERIC_CHARACTERS; |
291 if (x < 26) return $a + x; | 291 if (x < 26) return $a + x; |
292 if (x < 52) return $A + x - 26; | 292 if (x < 52) return $A + x - 26; |
293 return $0 + x - 52; | 293 return $0 + x - 52; |
294 } | 294 } |
295 | 295 |
296 @override | 296 @override |
297 jsAst.Name instanceFieldPropertyName(FieldElement element) { | 297 jsAst.Name instanceFieldPropertyName(FieldEntity element) { |
298 jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element); | 298 jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element); |
299 if (proposed != null) { | 299 if (proposed != null) { |
300 return proposed; | 300 return proposed; |
301 } | 301 } |
302 return super.instanceFieldPropertyName(element); | 302 return super.instanceFieldPropertyName(element); |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 /// Implements naming for constructor bodies. | 306 /// Implements naming for constructor bodies. |
307 /// | 307 /// |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 String prefix = | 383 String prefix = |
384 selector.isGetter ? r"$get" : selector.isSetter ? r"$set" : ""; | 384 selector.isGetter ? r"$get" : selector.isSetter ? r"$set" : ""; |
385 String callSuffix = selector.isCall | 385 String callSuffix = selector.isCall |
386 ? callSuffixForStructure(selector.callStructure).join() | 386 ? callSuffixForStructure(selector.callStructure).join() |
387 : ""; | 387 : ""; |
388 String suffix = suffixForGetInterceptor(classes); | 388 String suffix = suffixForGetInterceptor(classes); |
389 String fullName = "\$intercepted$prefix\$$root$callSuffix\$$suffix"; | 389 String fullName = "\$intercepted$prefix\$$root$callSuffix\$$suffix"; |
390 return _disambiguateInternalGlobal(fullName); | 390 return _disambiguateInternalGlobal(fullName); |
391 } | 391 } |
392 } | 392 } |
OLD | NEW |