| 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 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 } | 1524 } |
| 1525 | 1525 |
| 1526 @override | 1526 @override |
| 1527 void visitInterceptor(InterceptorConstantValue constant, [_]) { | 1527 void visitInterceptor(InterceptorConstantValue constant, [_]) { |
| 1528 addRoot(constant.dispatchedType.element.name); | 1528 addRoot(constant.dispatchedType.element.name); |
| 1529 add('methods'); | 1529 add('methods'); |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 @override | 1532 @override |
| 1533 void visitDummy(DummyConstantValue constant, [_]) { | 1533 void visitDummy(DummyConstantValue constant, [_]) { |
| 1534 add('dummy_receiver'); | 1534 switch (constant.kind) { |
| 1535 case DummyConstantKinds.dummyReceiver: |
| 1536 add('dummy_receiver'); |
| 1537 break; |
| 1538 case DummyConstantKinds.typeVariableReference: |
| 1539 add('type_variable_reference'); |
| 1540 break; |
| 1541 default: |
| 1542 compiler.internalError(compiler.currentElement, |
| 1543 "Unexpected DummyConstantValue"); |
| 1544 } |
| 1535 } | 1545 } |
| 1536 | 1546 |
| 1537 @override | 1547 @override |
| 1538 void visitDeferred(DeferredConstantValue constant, [_]) { | 1548 void visitDeferred(DeferredConstantValue constant, [_]) { |
| 1539 addRoot('Deferred'); | 1549 addRoot('Deferred'); |
| 1540 } | 1550 } |
| 1541 } | 1551 } |
| 1542 | 1552 |
| 1543 /** | 1553 /** |
| 1544 * Generates canonical hash values for [ConstantValue]s. | 1554 * Generates canonical hash values for [ConstantValue]s. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 } | 1637 } |
| 1628 | 1638 |
| 1629 @override | 1639 @override |
| 1630 int visitInterceptor(InterceptorConstantValue constant, [_]) { | 1640 int visitInterceptor(InterceptorConstantValue constant, [_]) { |
| 1631 String typeName = constant.dispatchedType.element.name; | 1641 String typeName = constant.dispatchedType.element.name; |
| 1632 return _hashString(5, typeName); | 1642 return _hashString(5, typeName); |
| 1633 } | 1643 } |
| 1634 | 1644 |
| 1635 @override | 1645 @override |
| 1636 visitDummy(DummyConstantValue constant, [_]) { | 1646 visitDummy(DummyConstantValue constant, [_]) { |
| 1637 compiler.internalError(NO_LOCATION_SPANNABLE, | 1647 switch (constant.kind) { |
| 1638 'DummyReceiverConstant should never be named and never be subconstant'); | 1648 case DummyConstantKinds.typeVariableReference: |
| 1649 return constant.payload.hashCode; |
| 1650 default: |
| 1651 compiler.internalError(NO_LOCATION_SPANNABLE, |
| 1652 'DummyConstantValue should never be named and ' |
| 1653 'never be subconstant'); |
| 1654 return null; |
| 1655 } |
| 1639 } | 1656 } |
| 1640 | 1657 |
| 1641 @override | 1658 @override |
| 1642 int visitDeferred(DeferredConstantValue constant, [_]) { | 1659 int visitDeferred(DeferredConstantValue constant, [_]) { |
| 1643 int hash = constant.prefix.hashCode; | 1660 int hash = constant.prefix.hashCode; |
| 1644 return _combine(hash, _visit(constant.referenced)); | 1661 return _combine(hash, _visit(constant.referenced)); |
| 1645 } | 1662 } |
| 1646 | 1663 |
| 1647 int _hashString(int hash, String s) { | 1664 int _hashString(int hash, String s) { |
| 1648 int length = s.length; | 1665 int length = s.length; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 if (!first) { | 1779 if (!first) { |
| 1763 sb.write('_'); | 1780 sb.write('_'); |
| 1764 } | 1781 } |
| 1765 sb.write('_'); | 1782 sb.write('_'); |
| 1766 visit(parameter); | 1783 visit(parameter); |
| 1767 first = true; | 1784 first = true; |
| 1768 } | 1785 } |
| 1769 } | 1786 } |
| 1770 } | 1787 } |
| 1771 } | 1788 } |
| OLD | NEW |