| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #library('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('dart:uri'); | 7 #import('dart:uri'); |
| 8 | 8 |
| 9 #import('../tree/tree.dart'); | 9 #import('../tree/tree.dart'); |
| 10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
| (...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 // TODO(ahe): Remove this case: Legacy support for pre-0.11 spec. | 1648 // TODO(ahe): Remove this case: Legacy support for pre-0.11 spec. |
| 1649 return selector; | 1649 return selector; |
| 1650 } else if (str === '?') { | 1650 } else if (str === '?') { |
| 1651 return selector; | 1651 return selector; |
| 1652 } else { | 1652 } else { |
| 1653 throw new Exception('Unhandled selector: ${selector.slowToString()}'); | 1653 throw new Exception('Unhandled selector: ${selector.slowToString()}'); |
| 1654 } | 1654 } |
| 1655 return new SourceString('operator\$$str'); | 1655 return new SourceString('operator\$$str'); |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 static SourceString mapToUserOperator(SourceString op) { |
| 1659 String value = op.stringValue; |
| 1660 |
| 1661 if (value === '!=') return const SourceString('=='); |
| 1662 if (value === '*=') return const SourceString('*'); |
| 1663 if (value === '/=') return const SourceString('/'); |
| 1664 if (value === '%=') return const SourceString('%'); |
| 1665 if (value === '~/=') return const SourceString('~/'); |
| 1666 if (value === '+=') return const SourceString('+'); |
| 1667 if (value === '-=') return const SourceString('-'); |
| 1668 if (value === '<<=') return const SourceString('<<'); |
| 1669 if (value === '>>=') return const SourceString('>>'); |
| 1670 if (value === '&=') return const SourceString('&'); |
| 1671 if (value === '^=') return const SourceString('^'); |
| 1672 if (value === '|=') return const SourceString('|'); |
| 1673 |
| 1674 throw 'Unhandled operator: ${op.slowToString()}'; |
| 1675 } |
| 1676 |
| 1658 static bool isNumberOrStringSupertype(Element element, Compiler compiler) { | 1677 static bool isNumberOrStringSupertype(Element element, Compiler compiler) { |
| 1659 LibraryElement coreLibrary = compiler.coreLibrary; | 1678 LibraryElement coreLibrary = compiler.coreLibrary; |
| 1660 return (element == coreLibrary.find(const SourceString('Comparable'))) | 1679 return (element == coreLibrary.find(const SourceString('Comparable'))) |
| 1661 || (element == coreLibrary.find(const SourceString('Hashable'))); | 1680 || (element == coreLibrary.find(const SourceString('Hashable'))); |
| 1662 } | 1681 } |
| 1663 | 1682 |
| 1664 static bool isStringOnlySupertype(Element element, Compiler compiler) { | 1683 static bool isStringOnlySupertype(Element element, Compiler compiler) { |
| 1665 LibraryElement coreLibrary = compiler.coreLibrary; | 1684 LibraryElement coreLibrary = compiler.coreLibrary; |
| 1666 return element == coreLibrary.find(const SourceString('Pattern')); | 1685 return element == coreLibrary.find(const SourceString('Pattern')); |
| 1667 } | 1686 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 | 1811 |
| 1793 MetadataAnnotation ensureResolved(Compiler compiler) { | 1812 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1794 if (resolutionState == STATE_NOT_STARTED) { | 1813 if (resolutionState == STATE_NOT_STARTED) { |
| 1795 compiler.resolver.resolveMetadataAnnotation(this); | 1814 compiler.resolver.resolveMetadataAnnotation(this); |
| 1796 } | 1815 } |
| 1797 return this; | 1816 return this; |
| 1798 } | 1817 } |
| 1799 | 1818 |
| 1800 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1819 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1801 } | 1820 } |
| OLD | NEW |