| 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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 if (library == backend.interceptorsLibrary) return 'J'; | 849 if (library == backend.interceptorsLibrary) return 'J'; |
| 850 if (library.isInternalLibrary) return 'H'; | 850 if (library.isInternalLibrary) return 'H'; |
| 851 if (library.isPlatformLibrary) { | 851 if (library.isPlatformLibrary) { |
| 852 if ('${library.canonicalUri}' == 'dart:html') return 'W'; | 852 if ('${library.canonicalUri}' == 'dart:html') return 'W'; |
| 853 return 'P'; | 853 return 'P'; |
| 854 } | 854 } |
| 855 return userGlobalObjects[ | 855 return userGlobalObjects[ |
| 856 library.getLibraryOrScriptName().hashCode % userGlobalObjects.length]; | 856 library.getLibraryOrScriptName().hashCode % userGlobalObjects.length]; |
| 857 } | 857 } |
| 858 | 858 |
| 859 jsAst.PropertyAccess elementAccess(Element element) { | |
| 860 String name = getNameX(element); | |
| 861 return new jsAst.PropertyAccess.field( | |
| 862 new jsAst.VariableUse(globalObjectFor(element)), | |
| 863 name); | |
| 864 } | |
| 865 | |
| 866 String getLazyInitializerName(Element element) { | 859 String getLazyInitializerName(Element element) { |
| 867 assert(Elements.isStaticOrTopLevelField(element)); | 860 assert(Elements.isStaticOrTopLevelField(element)); |
| 868 return getMappedGlobalName("$getterPrefix${getNameX(element)}"); | 861 return getMappedGlobalName("$getterPrefix${getNameX(element)}"); |
| 869 } | 862 } |
| 870 | 863 |
| 871 String getStaticClosureName(Element element) { | 864 String getStaticClosureName(Element element) { |
| 872 assert(Elements.isStaticOrTopLevelFunction(element)); | 865 assert(Elements.isStaticOrTopLevelFunction(element)); |
| 873 return getMappedGlobalName("${getNameX(element)}\$closure"); | 866 return getMappedGlobalName("${getNameX(element)}\$closure"); |
| 874 } | 867 } |
| 875 | 868 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 if (!first) { | 1390 if (!first) { |
| 1398 sb.write('_'); | 1391 sb.write('_'); |
| 1399 } | 1392 } |
| 1400 sb.write('_'); | 1393 sb.write('_'); |
| 1401 visit(parameter); | 1394 visit(parameter); |
| 1402 first = true; | 1395 first = true; |
| 1403 } | 1396 } |
| 1404 } | 1397 } |
| 1405 } | 1398 } |
| 1406 } | 1399 } |
| OLD | NEW |