| 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 | 669 |
| 670 /** | 670 /** |
| 671 * Returns a preferred JS-id for the given element. The returned id is | 671 * Returns a preferred JS-id for the given element. The returned id is |
| 672 * guaranteed to be a valid JS-id. Globals and static fields are furthermore | 672 * guaranteed to be a valid JS-id. Globals and static fields are furthermore |
| 673 * guaranteed to be unique. | 673 * guaranteed to be unique. |
| 674 * | 674 * |
| 675 * For accessing statics consider calling | 675 * For accessing statics consider calling |
| 676 * [isolateAccess]/[isolateBailoutAccess] or [isolatePropertyAccess] instead. | 676 * [isolateAccess]/[isolateBailoutAccess] or [isolatePropertyAccess] instead. |
| 677 */ | 677 */ |
| 678 String getName(Element element) { | 678 String getName(Element element) { |
| 679 if (element.hasFixedBackendName()) { | |
| 680 return element.fixedBackendName(); | |
| 681 } | |
| 682 if (element.isInstanceMember()) { | 679 if (element.isInstanceMember()) { |
| 683 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY | 680 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY |
| 684 || element.kind == ElementKind.FUNCTION) { | 681 || element.kind == ElementKind.FUNCTION) { |
| 685 return instanceMethodName(element); | 682 return instanceMethodName(element); |
| 686 } else if (element.kind == ElementKind.GETTER) { | 683 } else if (element.kind == ElementKind.GETTER) { |
| 687 return getterName(element); | 684 return getterName(element); |
| 688 } else if (element.kind == ElementKind.SETTER) { | 685 } else if (element.kind == ElementKind.SETTER) { |
| 689 return setterName(element); | 686 return setterName(element); |
| 690 } else if (element.kind == ElementKind.FIELD) { | 687 } else if (element.kind == ElementKind.FIELD) { |
| 691 return instanceFieldName(element); | 688 return instanceFieldName(element); |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 if (!first) { | 1250 if (!first) { |
| 1254 sb.write('_'); | 1251 sb.write('_'); |
| 1255 } | 1252 } |
| 1256 sb.write('_'); | 1253 sb.write('_'); |
| 1257 visit(link.head); | 1254 visit(link.head); |
| 1258 first = true; | 1255 first = true; |
| 1259 } | 1256 } |
| 1260 } | 1257 } |
| 1261 } | 1258 } |
| 1262 } | 1259 } |
| OLD | NEW |