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