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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 element = backend.getImplementationClass(element); | 717 element = backend.getImplementationClass(element); |
718 String name = getPrimitiveInterceptorRuntimeName(element); | 718 String name = getPrimitiveInterceptorRuntimeName(element); |
719 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to | 719 // TODO(ahe): Creating a string here is unfortunate. It is slow (due to |
720 // string concatenation in the implementation), and may prevent | 720 // string concatenation in the implementation), and may prevent |
721 // segmentation of '$'. | 721 // segmentation of '$'. |
722 return name != null ? name : getNameForRti(element); | 722 return name != null ? name : getNameForRti(element); |
723 } | 723 } |
724 | 724 |
725 /** | 725 /** |
726 * Return a string to be used as the runtime name of this class (instead of | 726 * Return a string to be used as the runtime name of this class (instead of |
727 * the class name) or [null] if the class name should be used. | 727 * the class name) or [:null:] if the class name should be used. |
728 */ | 728 */ |
729 String getPrimitiveInterceptorRuntimeName(Element cls) { | 729 String getPrimitiveInterceptorRuntimeName(Element cls) { |
730 JavaScriptBackend backend = compiler.backend; | 730 JavaScriptBackend backend = compiler.backend; |
731 if (cls == backend.jsIntClass) { | 731 if (cls == backend.jsIntClass) { |
732 return 'int'; | 732 return 'int'; |
733 } else if (cls == backend.jsNumberClass) { | 733 } else if (cls == backend.jsNumberClass) { |
734 return 'num'; | 734 return 'num'; |
735 } else if (cls == backend.jsBoolClass) { | 735 } else if (cls == backend.jsBoolClass) { |
736 return 'bool'; | 736 return 'bool'; |
737 } else if (cls == backend.jsDoubleClass) { | 737 } else if (cls == backend.jsDoubleClass) { |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 if (!first) { | 1391 if (!first) { |
1392 sb.write('_'); | 1392 sb.write('_'); |
1393 } | 1393 } |
1394 sb.write('_'); | 1394 sb.write('_'); |
1395 visit(link.head); | 1395 visit(link.head); |
1396 first = true; | 1396 first = true; |
1397 } | 1397 } |
1398 } | 1398 } |
1399 } | 1399 } |
1400 } | 1400 } |
OLD | NEW |