| 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 | 7 |
| 8 import '../tree/tree.dart'; | 8 import '../tree/tree.dart'; |
| 9 import '../util/util.dart'; | 9 import '../util/util.dart'; |
| 10 import '../resolution/resolution.dart'; | 10 import '../resolution/resolution.dart'; |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 488 } |
| 489 | 489 |
| 490 static bool isListSupertype(Element element, Compiler compiler) { | 490 static bool isListSupertype(Element element, Compiler compiler) { |
| 491 LibraryElement coreLibrary = compiler.coreLibrary; | 491 LibraryElement coreLibrary = compiler.coreLibrary; |
| 492 return element == coreLibrary.find(const SourceString('Iterable')); | 492 return element == coreLibrary.find(const SourceString('Iterable')); |
| 493 } | 493 } |
| 494 | 494 |
| 495 /// A `compareTo` function that places [Element]s in a consistent order based | 495 /// A `compareTo` function that places [Element]s in a consistent order based |
| 496 /// on the source code order. | 496 /// on the source code order. |
| 497 static int compareByPosition(Element a, Element b) { | 497 static int compareByPosition(Element a, Element b) { |
| 498 if (identical(a, b)) return 0; |
| 498 int r = a.getLibrary().compareTo(b.getLibrary()); | 499 int r = a.getLibrary().compareTo(b.getLibrary()); |
| 499 if (r != 0) return r; | 500 if (r != 0) return r; |
| 500 r = a.getCompilationUnit().compareTo(b.getCompilationUnit()); | 501 r = a.getCompilationUnit().compareTo(b.getCompilationUnit()); |
| 501 if (r != 0) return r; | 502 if (r != 0) return r; |
| 502 Token positionA = a.position(); | 503 Token positionA = a.position(); |
| 503 Token positionB = b.position(); | 504 Token positionB = b.position(); |
| 504 int offsetA = positionA == null ? -1 : positionA.charOffset; | 505 int offsetA = positionA == null ? -1 : positionA.charOffset; |
| 505 int offsetB = positionB == null ? -1 : positionB.charOffset; | 506 int offsetB = positionB == null ? -1 : positionB.charOffset; |
| 506 r = offsetA.compareTo(offsetB); | 507 r = offsetA.compareTo(offsetB); |
| 507 if (r != 0) return r; | 508 if (r != 0) return r; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 int get resolutionState; | 944 int get resolutionState; |
| 944 Token get beginToken; | 945 Token get beginToken; |
| 945 Token get endToken; | 946 Token get endToken; |
| 946 | 947 |
| 947 // TODO(kasperl): Try to get rid of these. | 948 // TODO(kasperl): Try to get rid of these. |
| 948 void set annotatedElement(Element value); | 949 void set annotatedElement(Element value); |
| 949 void set resolutionState(int value); | 950 void set resolutionState(int value); |
| 950 | 951 |
| 951 MetadataAnnotation ensureResolved(Compiler compiler); | 952 MetadataAnnotation ensureResolved(Compiler compiler); |
| 952 } | 953 } |
| OLD | NEW |