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