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 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. | 9 // TODO(ahe): Rename prefix to 'api' when VM bug is fixed. |
10 import '../../compiler.dart' as api_e; | 10 import '../../compiler.dart' as api_e; |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 Token positionB = b.position(); | 2033 Token positionB = b.position(); |
2034 int r = positionA.charOffset.compareTo(positionB.charOffset); | 2034 int r = positionA.charOffset.compareTo(positionB.charOffset); |
2035 if (r != 0) return r; | 2035 if (r != 0) return r; |
2036 r = a.name.slowToString().compareTo(b.name.slowToString()); | 2036 r = a.name.slowToString().compareTo(b.name.slowToString()); |
2037 if (r != 0) return r; | 2037 if (r != 0) return r; |
2038 // Same file, position and name. If this happens, we should find out why | 2038 // Same file, position and name. If this happens, we should find out why |
2039 // and make the order total and independent of hashCode. | 2039 // and make the order total and independent of hashCode. |
2040 return a.hashCode.compareTo(b.hashCode); | 2040 return a.hashCode.compareTo(b.hashCode); |
2041 } | 2041 } |
2042 | 2042 |
2043 static List<Element> sortedByPosition(Collection<Element> elements) { | 2043 static List<Element> sortedByPosition(Iterable<Element> elements) { |
2044 return new List<Element>.from(elements)..sort(compareByPosition); | 2044 return elements.toList()..sort(compareByPosition); |
2045 } | 2045 } |
2046 } | 2046 } |
2047 | 2047 |
2048 class LabelElement extends Element { | 2048 class LabelElement extends Element { |
2049 // We store the original label here so it can be returned by [parseNode]. | 2049 // We store the original label here so it can be returned by [parseNode]. |
2050 final Label label; | 2050 final Label label; |
2051 final String labelName; | 2051 final String labelName; |
2052 final TargetElement target; | 2052 final TargetElement target; |
2053 bool isBreakTarget = false; | 2053 bool isBreakTarget = false; |
2054 bool isContinueTarget = false; | 2054 bool isContinueTarget = false; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 | 2170 |
2171 MetadataAnnotation ensureResolved(Compiler compiler) { | 2171 MetadataAnnotation ensureResolved(Compiler compiler) { |
2172 if (resolutionState == STATE_NOT_STARTED) { | 2172 if (resolutionState == STATE_NOT_STARTED) { |
2173 compiler.resolver.resolveMetadataAnnotation(this); | 2173 compiler.resolver.resolveMetadataAnnotation(this); |
2174 } | 2174 } |
2175 return this; | 2175 return this; |
2176 } | 2176 } |
2177 | 2177 |
2178 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2178 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
2179 } | 2179 } |
OLD | NEW |