| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 return userGlobalObjects[ | 858 return userGlobalObjects[ |
| 859 library.getLibraryOrScriptName().hashCode % userGlobalObjects.length]; | 859 library.getLibraryOrScriptName().hashCode % userGlobalObjects.length]; |
| 860 } | 860 } |
| 861 | 861 |
| 862 String getLazyInitializerName(Element element) { | 862 String getLazyInitializerName(Element element) { |
| 863 assert(Elements.isStaticOrTopLevelField(element)); | 863 assert(Elements.isStaticOrTopLevelField(element)); |
| 864 return getMappedGlobalName("$getterPrefix${getNameX(element)}"); | 864 return getMappedGlobalName("$getterPrefix${getNameX(element)}"); |
| 865 } | 865 } |
| 866 | 866 |
| 867 String getStaticClosureName(Element element) { | 867 String getStaticClosureName(Element element) { |
| 868 assert(Elements.isStaticOrTopLevelFunction(element)); | 868 assert(invariant(element, Elements.isStaticOrTopLevelFunction(element))); |
| 869 return getMappedGlobalName("${getNameX(element)}\$closure"); | 869 return getMappedGlobalName("${getNameX(element)}\$closure"); |
| 870 } | 870 } |
| 871 | 871 |
| 872 // This name is used as part of the name of a TypeConstant | 872 // This name is used as part of the name of a TypeConstant |
| 873 String uniqueNameForTypeConstantElement(Element element) { | 873 String uniqueNameForTypeConstantElement(Element element) { |
| 874 // TODO(sra): If we replace the period with an identifier character, | 874 // TODO(sra): If we replace the period with an identifier character, |
| 875 // TypeConstants will have better names in unminified code. | 875 // TypeConstants will have better names in unminified code. |
| 876 return "${globalObjectFor(element)}.${getNameX(element)}"; | 876 return "${globalObjectFor(element)}.${getNameX(element)}"; |
| 877 } | 877 } |
| 878 | 878 |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 if (!first) { | 1416 if (!first) { |
| 1417 sb.write('_'); | 1417 sb.write('_'); |
| 1418 } | 1418 } |
| 1419 sb.write('_'); | 1419 sb.write('_'); |
| 1420 visit(parameter); | 1420 visit(parameter); |
| 1421 first = true; | 1421 first = true; |
| 1422 } | 1422 } |
| 1423 } | 1423 } |
| 1424 } | 1424 } |
| 1425 } | 1425 } |
| OLD | NEW |