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 'modelx.dart'; | 9 import 'modelx.dart'; |
10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 return (element == coreLibrary.find(const SourceString('Comparable'))); | 455 return (element == coreLibrary.find(const SourceString('Comparable'))); |
456 } | 456 } |
457 | 457 |
458 static bool isStringOnlySupertype(Element element, Compiler compiler) { | 458 static bool isStringOnlySupertype(Element element, Compiler compiler) { |
459 LibraryElement coreLibrary = compiler.coreLibrary; | 459 LibraryElement coreLibrary = compiler.coreLibrary; |
460 return element == coreLibrary.find(const SourceString('Pattern')); | 460 return element == coreLibrary.find(const SourceString('Pattern')); |
461 } | 461 } |
462 | 462 |
463 static bool isListSupertype(Element element, Compiler compiler) { | 463 static bool isListSupertype(Element element, Compiler compiler) { |
464 LibraryElement coreLibrary = compiler.coreLibrary; | 464 LibraryElement coreLibrary = compiler.coreLibrary; |
465 return (element == coreLibrary.find(const SourceString('Collection'))) | 465 return element == coreLibrary.find(const SourceString('Iterable')); |
466 || (element == coreLibrary.find(const SourceString('Iterable'))); | |
467 } | 466 } |
468 | 467 |
469 /// A `compareTo` function that places [Element]s in a consistent order based | 468 /// A `compareTo` function that places [Element]s in a consistent order based |
470 /// on the source code order. | 469 /// on the source code order. |
471 static int compareByPosition(Element a, Element b) { | 470 static int compareByPosition(Element a, Element b) { |
472 CompilationUnitElement unitA = a.getCompilationUnit(); | 471 CompilationUnitElement unitA = a.getCompilationUnit(); |
473 CompilationUnitElement unitB = b.getCompilationUnit(); | 472 CompilationUnitElement unitB = b.getCompilationUnit(); |
474 if (!identical(unitA, unitB)) { | 473 if (!identical(unitA, unitB)) { |
475 int r = unitA.script.uri.path.compareTo(unitB.script.uri.path); | 474 int r = unitA.script.uri.path.compareTo(unitB.script.uri.path); |
476 if (r != 0) return r; | 475 if (r != 0) return r; |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 int get resolutionState; | 860 int get resolutionState; |
862 Token get beginToken; | 861 Token get beginToken; |
863 Token get endToken; | 862 Token get endToken; |
864 | 863 |
865 // TODO(kasperl): Try to get rid of these. | 864 // TODO(kasperl): Try to get rid of these. |
866 void set annotatedElement(Element value); | 865 void set annotatedElement(Element value); |
867 void set resolutionState(int value); | 866 void set resolutionState(int value); |
868 | 867 |
869 MetadataAnnotation ensureResolved(Compiler compiler); | 868 MetadataAnnotation ensureResolved(Compiler compiler); |
870 } | 869 } |
OLD | NEW |