| 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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 String getLazyInitializerName(Element element) { | 859 String getLazyInitializerName(Element element) { |
| 860 assert(Elements.isStaticOrTopLevelField(element)); | 860 assert(Elements.isStaticOrTopLevelField(element)); |
| 861 return getMappedGlobalName("$getterPrefix${getNameX(element)}"); | 861 return getMappedGlobalName("$getterPrefix${getNameX(element)}"); |
| 862 } | 862 } |
| 863 | 863 |
| 864 String getStaticClosureName(Element element) { | 864 String getStaticClosureName(Element element) { |
| 865 assert(Elements.isStaticOrTopLevelFunction(element)); | 865 assert(Elements.isStaticOrTopLevelFunction(element)); |
| 866 return getMappedGlobalName("${getNameX(element)}\$closure"); | 866 return getMappedGlobalName("${getNameX(element)}\$closure"); |
| 867 } | 867 } |
| 868 | 868 |
| 869 jsAst.Expression isolateLazyInitializerAccess(Element element) { | |
| 870 return js('#.#', | |
| 871 [globalObjectFor(element), getLazyInitializerName(element)]); | |
| 872 } | |
| 873 | |
| 874 jsAst.Expression isolateStaticClosureAccess(Element element) { | |
| 875 return js('#.#()', | |
| 876 [globalObjectFor(element), getStaticClosureName(element)]); | |
| 877 } | |
| 878 | |
| 879 // This name is used as part of the name of a TypeConstant | 869 // This name is used as part of the name of a TypeConstant |
| 880 String uniqueNameForTypeConstantElement(Element element) { | 870 String uniqueNameForTypeConstantElement(Element element) { |
| 881 // TODO(sra): If we replace the period with an identifier character, | 871 // TODO(sra): If we replace the period with an identifier character, |
| 882 // TypeConstants will have better names in unminified code. | 872 // TypeConstants will have better names in unminified code. |
| 883 return "${globalObjectFor(element)}.${getNameX(element)}"; | 873 return "${globalObjectFor(element)}.${getNameX(element)}"; |
| 884 } | 874 } |
| 885 | 875 |
| 886 String globalObjectForConstant(ConstantValue constant) => 'C'; | 876 String globalObjectForConstant(ConstantValue constant) => 'C'; |
| 887 | 877 |
| 888 String get operatorIsPrefix => r'$is'; | 878 String get operatorIsPrefix => r'$is'; |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1390 if (!first) { | 1380 if (!first) { |
| 1391 sb.write('_'); | 1381 sb.write('_'); |
| 1392 } | 1382 } |
| 1393 sb.write('_'); | 1383 sb.write('_'); |
| 1394 visit(parameter); | 1384 visit(parameter); |
| 1395 first = true; | 1385 first = true; |
| 1396 } | 1386 } |
| 1397 } | 1387 } |
| 1398 } | 1388 } |
| 1399 } | 1389 } |
| OLD | NEW |