| 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 Namer implements ClosureNamer { | 10 class Namer implements ClosureNamer { |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // The name is not guaranteed to be unique. | 717 // The name is not guaranteed to be unique. |
| 718 return safeName(guess); | 718 return safeName(guess); |
| 719 } | 719 } |
| 720 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR || | 720 if (kind == ElementKind.GENERATIVE_CONSTRUCTOR || |
| 721 kind == ElementKind.FUNCTION || | 721 kind == ElementKind.FUNCTION || |
| 722 kind == ElementKind.CLASS || | 722 kind == ElementKind.CLASS || |
| 723 kind == ElementKind.FIELD || | 723 kind == ElementKind.FIELD || |
| 724 kind == ElementKind.GETTER || | 724 kind == ElementKind.GETTER || |
| 725 kind == ElementKind.SETTER || | 725 kind == ElementKind.SETTER || |
| 726 kind == ElementKind.TYPEDEF || | 726 kind == ElementKind.TYPEDEF || |
| 727 kind == ElementKind.LIBRARY || | 727 kind == ElementKind.LIBRARY) { |
| 728 kind == ElementKind.MALFORMED_TYPE) { | |
| 729 bool fixedName = false; | 728 bool fixedName = false; |
| 730 if (kind == ElementKind.CLASS) { | 729 if (kind == ElementKind.CLASS) { |
| 731 ClassElement classElement = element; | 730 ClassElement classElement = element; |
| 732 } | 731 } |
| 733 if (Elements.isInstanceField(element)) { | 732 if (Elements.isInstanceField(element)) { |
| 734 fixedName = element.hasFixedBackendName(); | 733 fixedName = element.hasFixedBackendName(); |
| 735 } | 734 } |
| 736 String result = fixedName | 735 String result = fixedName |
| 737 ? guess | 736 ? guess |
| 738 : getFreshName(guess, usedGlobalNames, suggestedGlobalNames, | 737 : getFreshName(guess, usedGlobalNames, suggestedGlobalNames, |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 if (!first) { | 1262 if (!first) { |
| 1264 sb.write('_'); | 1263 sb.write('_'); |
| 1265 } | 1264 } |
| 1266 sb.write('_'); | 1265 sb.write('_'); |
| 1267 visit(link.head); | 1266 visit(link.head); |
| 1268 first = true; | 1267 first = true; |
| 1269 } | 1268 } |
| 1270 } | 1269 } |
| 1271 } | 1270 } |
| 1272 } | 1271 } |
| OLD | NEW |