| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 return nameString; | 362 return nameString; |
| 363 } else { | 363 } else { |
| 364 // Make sure to return a private name that starts with _ so it | 364 // Make sure to return a private name that starts with _ so it |
| 365 // cannot clash with any public names. | 365 // cannot clash with any public names. |
| 366 String libraryName = getNameOfLibrary(library); | 366 String libraryName = getNameOfLibrary(library); |
| 367 return '_$libraryName\$$nameString'; | 367 return '_$libraryName\$$nameString'; |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 String instanceMethodName(FunctionElement element) { | 371 String instanceMethodName(FunctionElement element) { |
| 372 // TODO(ahe): Could this be: return invocationName(new |
| 373 // Selector.fromElement(element))? |
| 372 String elementName = element.name; | 374 String elementName = element.name; |
| 373 String name = operatorNameToIdentifier(elementName); | 375 String name = operatorNameToIdentifier(elementName); |
| 374 if (name != elementName) return getMappedOperatorName(name); | 376 if (name != elementName) return getMappedOperatorName(name); |
| 375 | 377 |
| 376 LibraryElement library = element.getLibrary(); | 378 LibraryElement library = element.getLibrary(); |
| 377 if (element.isGenerativeConstructorBody()) { | 379 if (element.isGenerativeConstructorBody()) { |
| 378 name = Elements.reconstructConstructorNameSourceString(element); | 380 name = Elements.reconstructConstructorNameSourceString(element); |
| 379 } | 381 } |
| 380 FunctionSignature signature = element.computeSignature(compiler); | 382 FunctionSignature signature = element.computeSignature(compiler); |
| 381 String methodName = | 383 String methodName = |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 | 876 |
| 875 String isolateAccess(Element element) { | 877 String isolateAccess(Element element) { |
| 876 return "${globalObjectFor(element)}.${getNameX(element)}"; | 878 return "${globalObjectFor(element)}.${getNameX(element)}"; |
| 877 } | 879 } |
| 878 | 880 |
| 879 String isolateLazyInitializerAccess(Element element) { | 881 String isolateLazyInitializerAccess(Element element) { |
| 880 return "${globalObjectFor(element)}.${getLazyInitializerName(element)}"; | 882 return "${globalObjectFor(element)}.${getLazyInitializerName(element)}"; |
| 881 } | 883 } |
| 882 | 884 |
| 883 String isolateStaticClosureAccess(Element element) { | 885 String isolateStaticClosureAccess(Element element) { |
| 884 return "${globalObjectFor(element)}.${getStaticClosureName(element)}"; | 886 return "${globalObjectFor(element)}.${getStaticClosureName(element)}()"; |
| 885 } | 887 } |
| 886 | 888 |
| 887 String globalObjectForConstant(Constant constant) => 'C'; | 889 String globalObjectForConstant(Constant constant) => 'C'; |
| 888 | 890 |
| 889 String operatorIsPrefix() => r'$is'; | 891 String operatorIsPrefix() => r'$is'; |
| 890 | 892 |
| 891 String operatorAsPrefix() => r'$as'; | 893 String operatorAsPrefix() => r'$as'; |
| 892 | 894 |
| 893 String operatorSignature() => r'$signature'; | 895 String operatorSignature() => r'$signature'; |
| 894 | 896 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 if (!first) { | 1382 if (!first) { |
| 1381 sb.write('_'); | 1383 sb.write('_'); |
| 1382 } | 1384 } |
| 1383 sb.write('_'); | 1385 sb.write('_'); |
| 1384 visit(link.head); | 1386 visit(link.head); |
| 1385 first = true; | 1387 first = true; |
| 1386 } | 1388 } |
| 1387 } | 1389 } |
| 1388 } | 1390 } |
| 1389 } | 1391 } |
| OLD | NEW |