| 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 * Names are generated through three stages: | 10 * Names are generated through three stages: |
| (...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 return hash; | 1704 return hash; |
| 1705 } | 1705 } |
| 1706 | 1706 |
| 1707 static int _finish(int hash) { | 1707 static int _finish(int hash) { |
| 1708 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3)); | 1708 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3)); |
| 1709 hash = hash & (hash >> 11); | 1709 hash = hash & (hash >> 11); |
| 1710 return _MASK & (hash + (((_MASK >> 15) & hash) << 15)); | 1710 return _MASK & (hash + (((_MASK >> 15) & hash) << 15)); |
| 1711 } | 1711 } |
| 1712 } | 1712 } |
| 1713 | 1713 |
| 1714 class FunctionTypeNamer extends DartTypeVisitor { | 1714 class FunctionTypeNamer extends BaseDartTypeVisitor { |
| 1715 final Compiler compiler; | 1715 final Compiler compiler; |
| 1716 StringBuffer sb; | 1716 StringBuffer sb; |
| 1717 | 1717 |
| 1718 FunctionTypeNamer(this.compiler); | 1718 FunctionTypeNamer(this.compiler); |
| 1719 | 1719 |
| 1720 JavaScriptBackend get backend => compiler.backend; | 1720 JavaScriptBackend get backend => compiler.backend; |
| 1721 | 1721 |
| 1722 String computeName(DartType type) { | 1722 String computeName(DartType type) { |
| 1723 sb = new StringBuffer(); | 1723 sb = new StringBuffer(); |
| 1724 visit(type); | 1724 visit(type); |
| 1725 return sb.toString(); | 1725 return sb.toString(); |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 visit(DartType type) { | 1728 visit(DartType type, [_]) { |
| 1729 type.accept(this, null); | 1729 type.accept(this, null); |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 visitType(DartType type, _) { | 1732 visitType(DartType type, _) { |
| 1733 sb.write(type.name); | 1733 sb.write(type.name); |
| 1734 } | 1734 } |
| 1735 | 1735 |
| 1736 visitFunctionType(FunctionType type, _) { | 1736 visitFunctionType(FunctionType type, _) { |
| 1737 if (backend.rti.isSimpleFunctionType(type)) { | 1737 if (backend.rti.isSimpleFunctionType(type)) { |
| 1738 sb.write('args${type.parameterTypes.length}'); | 1738 sb.write('args${type.parameterTypes.length}'); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1759 if (!first) { | 1759 if (!first) { |
| 1760 sb.write('_'); | 1760 sb.write('_'); |
| 1761 } | 1761 } |
| 1762 sb.write('_'); | 1762 sb.write('_'); |
| 1763 visit(parameter); | 1763 visit(parameter); |
| 1764 first = true; | 1764 first = true; |
| 1765 } | 1765 } |
| 1766 } | 1766 } |
| 1767 } | 1767 } |
| 1768 } | 1768 } |
| OLD | NEW |