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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 if (cls == backend.jsArrayClass) return "a"; | 562 if (cls == backend.jsArrayClass) return "a"; |
563 if (cls == backend.jsDoubleClass) return "d"; | 563 if (cls == backend.jsDoubleClass) return "d"; |
564 if (cls == backend.jsIntClass) return "i"; | 564 if (cls == backend.jsIntClass) return "i"; |
565 if (cls == backend.jsNumberClass) return "n"; | 565 if (cls == backend.jsNumberClass) return "n"; |
566 if (cls == backend.jsNullClass) return "u"; | 566 if (cls == backend.jsNullClass) return "u"; |
567 if (cls == backend.jsBoolClass) return "b"; | 567 if (cls == backend.jsBoolClass) return "b"; |
568 if (cls == backend.jsInterceptorClass) return "I"; | 568 if (cls == backend.jsInterceptorClass) return "I"; |
569 return cls.name.slowToString(); | 569 return cls.name.slowToString(); |
570 } | 570 } |
571 List<String> names = classes | 571 List<String> names = classes |
572 .where((cls) => !cls.isNative()) | 572 .where((cls) => !Elements.isNativeOrExtendsNative(cls)) |
573 .map(abbreviate) | 573 .map(abbreviate) |
574 .toList(); | 574 .toList(); |
575 // There is one dispatch mechanism for all native classes. | 575 // There is one dispatch mechanism for all native classes. |
576 if (classes.any((cls) => cls.isNative())) { | 576 if (classes.any((cls) => Elements.isNativeOrExtendsNative(cls))) { |
577 names.add("x"); | 577 names.add("x"); |
578 } | 578 } |
579 // Sort the names of the classes after abbreviating them to ensure | 579 // Sort the names of the classes after abbreviating them to ensure |
580 // the suffix is stable and predictable for the suggested names. | 580 // the suffix is stable and predictable for the suggested names. |
581 names.sort(); | 581 names.sort(); |
582 return names.join(); | 582 return names.join(); |
583 } | 583 } |
584 | 584 |
585 String getInterceptorName(Element element, Iterable<ClassElement> classes) { | 585 String getInterceptorName(Element element, Iterable<ClassElement> classes) { |
586 JavaScriptBackend backend = compiler.backend; | 586 JavaScriptBackend backend = compiler.backend; |
(...skipping 680 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 |