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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 static const ElementKind STATEMENT = | 100 static const ElementKind STATEMENT = |
101 const ElementKind('statement', ElementCategory.NONE); | 101 const ElementKind('statement', ElementCategory.NONE); |
102 static const ElementKind LABEL = | 102 static const ElementKind LABEL = |
103 const ElementKind('label', ElementCategory.NONE); | 103 const ElementKind('label', ElementCategory.NONE); |
104 static const ElementKind VOID = | 104 static const ElementKind VOID = |
105 const ElementKind('void', ElementCategory.NONE); | 105 const ElementKind('void', ElementCategory.NONE); |
106 | 106 |
107 toString() => id; | 107 toString() => id; |
108 } | 108 } |
109 | 109 |
110 class Element implements Hashable, Spannable { | 110 class Element implements Spannable { |
111 final SourceString name; | 111 final SourceString name; |
112 final ElementKind kind; | 112 final ElementKind kind; |
113 final Element enclosingElement; | 113 final Element enclosingElement; |
114 Link<MetadataAnnotation> metadata = const EmptyLink<MetadataAnnotation>(); | 114 Link<MetadataAnnotation> metadata = const EmptyLink<MetadataAnnotation>(); |
115 | 115 |
116 Element(this.name, this.kind, this.enclosingElement) { | 116 Element(this.name, this.kind, this.enclosingElement) { |
117 assert(getLibrary() !== null); | 117 assert(getLibrary() !== null); |
118 } | 118 } |
119 | 119 |
120 Modifiers get modifiers => null; | 120 Modifiers get modifiers => null; |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 if (value === '>>=') return const SourceString('>>'); | 1689 if (value === '>>=') return const SourceString('>>'); |
1690 if (value === '&=') return const SourceString('&'); | 1690 if (value === '&=') return const SourceString('&'); |
1691 if (value === '^=') return const SourceString('^'); | 1691 if (value === '^=') return const SourceString('^'); |
1692 if (value === '|=') return const SourceString('|'); | 1692 if (value === '|=') return const SourceString('|'); |
1693 | 1693 |
1694 throw 'Unhandled operator: ${op.slowToString()}'; | 1694 throw 'Unhandled operator: ${op.slowToString()}'; |
1695 } | 1695 } |
1696 | 1696 |
1697 static bool isNumberOrStringSupertype(Element element, Compiler compiler) { | 1697 static bool isNumberOrStringSupertype(Element element, Compiler compiler) { |
1698 LibraryElement coreLibrary = compiler.coreLibrary; | 1698 LibraryElement coreLibrary = compiler.coreLibrary; |
1699 return (element == coreLibrary.find(const SourceString('Comparable'))) | 1699 return (element == coreLibrary.find(const SourceString('Comparable'))); |
1700 || (element == coreLibrary.find(const SourceString('Hashable'))); | |
1701 } | 1700 } |
1702 | 1701 |
1703 static bool isStringOnlySupertype(Element element, Compiler compiler) { | 1702 static bool isStringOnlySupertype(Element element, Compiler compiler) { |
1704 LibraryElement coreLibrary = compiler.coreLibrary; | 1703 LibraryElement coreLibrary = compiler.coreLibrary; |
1705 return element == coreLibrary.find(const SourceString('Pattern')); | 1704 return element == coreLibrary.find(const SourceString('Pattern')); |
1706 } | 1705 } |
1707 | 1706 |
1708 static bool isListSupertype(Element element, Compiler compiler) { | 1707 static bool isListSupertype(Element element, Compiler compiler) { |
1709 LibraryElement coreLibrary = compiler.coreLibrary; | 1708 LibraryElement coreLibrary = compiler.coreLibrary; |
1710 return (element == coreLibrary.find(const SourceString('Collection'))) | 1709 return (element == coreLibrary.find(const SourceString('Collection'))) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 | 1830 |
1832 MetadataAnnotation ensureResolved(Compiler compiler) { | 1831 MetadataAnnotation ensureResolved(Compiler compiler) { |
1833 if (resolutionState == STATE_NOT_STARTED) { | 1832 if (resolutionState == STATE_NOT_STARTED) { |
1834 compiler.resolver.resolveMetadataAnnotation(this); | 1833 compiler.resolver.resolveMetadataAnnotation(this); |
1835 } | 1834 } |
1836 return this; | 1835 return this; |
1837 } | 1836 } |
1838 | 1837 |
1839 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1838 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
1840 } | 1839 } |
OLD | NEW |