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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 // TODO(johnniwinther): Change factory name encoding as to not include | 534 // TODO(johnniwinther): Change factory name encoding as to not include |
535 // the class-name twice. | 535 // the class-name twice. |
536 String className = element.getEnclosingClass().name.slowToString(); | 536 String className = element.getEnclosingClass().name.slowToString(); |
537 name = '${className}_${Elements.reconstructConstructorName(element)}'; | 537 name = '${className}_${Elements.reconstructConstructorName(element)}'; |
538 } else if (Elements.isStaticOrTopLevel(element)) { | 538 } else if (Elements.isStaticOrTopLevel(element)) { |
539 if (element.isMember()) { | 539 if (element.isMember()) { |
540 ClassElement enclosingClass = element.getEnclosingClass(); | 540 ClassElement enclosingClass = element.getEnclosingClass(); |
541 name = "${enclosingClass.name.slowToString()}_" | 541 name = "${enclosingClass.name.slowToString()}_" |
542 "${element.name.slowToString()}"; | 542 "${element.name.slowToString()}"; |
543 } else { | 543 } else { |
544 name = element.name.slowToString(); | 544 name = element.name.slowToString().replaceAll('+', '_'); |
545 } | 545 } |
546 } else if (element.isLibrary()) { | 546 } else if (element.isLibrary()) { |
547 name = LIBRARY_PREFIX; | 547 name = LIBRARY_PREFIX; |
548 } else { | 548 } else { |
549 name = element.name.slowToString(); | 549 name = element.name.slowToString(); |
550 } | 550 } |
551 return name; | 551 return name; |
552 } | 552 } |
553 | 553 |
554 String getInterceptorSuffix(Iterable<ClassElement> classes) { | 554 String getInterceptorSuffix(Iterable<ClassElement> classes) { |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 if (!first) { | 1262 if (!first) { |
1263 sb.write('_'); | 1263 sb.write('_'); |
1264 } | 1264 } |
1265 sb.write('_'); | 1265 sb.write('_'); |
1266 visit(link.head); | 1266 visit(link.head); |
1267 first = true; | 1267 first = true; |
1268 } | 1268 } |
1269 } | 1269 } |
1270 } | 1270 } |
1271 } | 1271 } |
OLD | NEW |