| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 return nameString; | 361 return nameString; |
| 362 } else { | 362 } else { |
| 363 // Make sure to return a private name that starts with _ so it | 363 // Make sure to return a private name that starts with _ so it |
| 364 // cannot clash with any public names. | 364 // cannot clash with any public names. |
| 365 String libraryName = getNameOfLibrary(library); | 365 String libraryName = getNameOfLibrary(library); |
| 366 return '_$libraryName\$$nameString'; | 366 return '_$libraryName\$$nameString'; |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 | 369 |
| 370 String instanceMethodName(FunctionElement element) { | 370 String instanceMethodName(FunctionElement element) { |
| 371 // TODO(ahe): Could this be: return invocationName(new |
| 372 // Selector.fromElement(element))? |
| 371 String elementName = element.name; | 373 String elementName = element.name; |
| 372 String name = operatorNameToIdentifier(elementName); | 374 String name = operatorNameToIdentifier(elementName); |
| 373 if (name != elementName) return getMappedOperatorName(name); | 375 if (name != elementName) return getMappedOperatorName(name); |
| 374 | 376 |
| 375 LibraryElement library = element.getLibrary(); | 377 LibraryElement library = element.getLibrary(); |
| 376 if (element.isGenerativeConstructorBody()) { | 378 if (element.isGenerativeConstructorBody()) { |
| 377 name = Elements.reconstructConstructorNameSourceString(element); | 379 name = Elements.reconstructConstructorNameSourceString(element); |
| 378 } | 380 } |
| 379 FunctionSignature signature = element.computeSignature(compiler); | 381 FunctionSignature signature = element.computeSignature(compiler); |
| 380 String methodName = | 382 String methodName = |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 885 |
| 884 String isolateAccess(Element element) { | 886 String isolateAccess(Element element) { |
| 885 return "${globalObjectFor(element)}.${getNameX(element)}"; | 887 return "${globalObjectFor(element)}.${getNameX(element)}"; |
| 886 } | 888 } |
| 887 | 889 |
| 888 String isolateLazyInitializerAccess(Element element) { | 890 String isolateLazyInitializerAccess(Element element) { |
| 889 return "${globalObjectFor(element)}.${getLazyInitializerName(element)}"; | 891 return "${globalObjectFor(element)}.${getLazyInitializerName(element)}"; |
| 890 } | 892 } |
| 891 | 893 |
| 892 String isolateStaticClosureAccess(Element element) { | 894 String isolateStaticClosureAccess(Element element) { |
| 893 return "${globalObjectFor(element)}.${getStaticClosureName(element)}"; | 895 return "${globalObjectFor(element)}.${getStaticClosureName(element)}()"; |
| 894 } | 896 } |
| 895 | 897 |
| 896 String globalObjectForConstant(Constant constant) => 'C'; | 898 String globalObjectForConstant(Constant constant) => 'C'; |
| 897 | 899 |
| 898 String operatorIsPrefix() => r'$is'; | 900 String operatorIsPrefix() => r'$is'; |
| 899 | 901 |
| 900 String operatorAsPrefix() => r'$as'; | 902 String operatorAsPrefix() => r'$as'; |
| 901 | 903 |
| 902 String operatorSignature() => r'$signature'; | 904 String operatorSignature() => r'$signature'; |
| 903 | 905 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 if (!first) { | 1393 if (!first) { |
| 1392 sb.write('_'); | 1394 sb.write('_'); |
| 1393 } | 1395 } |
| 1394 sb.write('_'); | 1396 sb.write('_'); |
| 1395 visit(link.head); | 1397 visit(link.head); |
| 1396 first = true; | 1398 first = true; |
| 1397 } | 1399 } |
| 1398 } | 1400 } |
| 1399 } | 1401 } |
| 1400 } | 1402 } |
| OLD | NEW |