| 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 '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 if (identical(op, '<<=')) return '<<'; | 669 if (identical(op, '<<=')) return '<<'; |
| 670 if (identical(op, '>>=')) return '>>'; | 670 if (identical(op, '>>=')) return '>>'; |
| 671 if (identical(op, '&=')) return '&'; | 671 if (identical(op, '&=')) return '&'; |
| 672 if (identical(op, '^=')) return '^'; | 672 if (identical(op, '^=')) return '^'; |
| 673 if (identical(op, '|=')) return '|'; | 673 if (identical(op, '|=')) return '|'; |
| 674 if (identical(op, '??=')) return '??'; | 674 if (identical(op, '??=')) return '??'; |
| 675 | 675 |
| 676 return null; | 676 return null; |
| 677 } | 677 } |
| 678 | 678 |
| 679 static bool isNumberOrStringSupertype( | |
| 680 Element element, CommonElements commonElements) { | |
| 681 LibraryElement coreLibrary = commonElements.coreLibrary; | |
| 682 return (element == coreLibrary.find('Comparable')); | |
| 683 } | |
| 684 | |
| 685 static bool isStringOnlySupertype( | |
| 686 Element element, CommonElements commonElements) { | |
| 687 LibraryElement coreLibrary = commonElements.coreLibrary; | |
| 688 return element == coreLibrary.find('Pattern'); | |
| 689 } | |
| 690 | |
| 691 static bool isListSupertype(Element element, CommonElements commonElements) { | |
| 692 LibraryElement coreLibrary = commonElements.coreLibrary; | |
| 693 return element == coreLibrary.find('Iterable'); | |
| 694 } | |
| 695 | |
| 696 /// A `compareTo` function that places [Element]s in a consistent order based | 679 /// A `compareTo` function that places [Element]s in a consistent order based |
| 697 /// on the source code order. | 680 /// on the source code order. |
| 698 static int compareByPosition(Element a, Element b) { | 681 static int compareByPosition(Element a, Element b) { |
| 699 if (identical(a, b)) return 0; | 682 if (identical(a, b)) return 0; |
| 700 int r = _compareLibraries(a.library, b.library); | 683 int r = _compareLibraries(a.library, b.library); |
| 701 if (r != 0) return r; | 684 if (r != 0) return r; |
| 702 r = _compareCompilationUnits(a.compilationUnit, b.compilationUnit); | 685 r = _compareCompilationUnits(a.compilationUnit, b.compilationUnit); |
| 703 if (r != 0) return r; | 686 if (r != 0) return r; |
| 704 int offsetA = a.sourceOffset ?? -1; | 687 int offsetA = a.sourceOffset ?? -1; |
| 705 int offsetB = b.sourceOffset ?? -1; | 688 int offsetB = b.sourceOffset ?? -1; |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 /// by a field. | 1917 /// by a field. |
| 1935 bool get isDeclaredByField; | 1918 bool get isDeclaredByField; |
| 1936 | 1919 |
| 1937 /// Returns `true` if this member is abstract. | 1920 /// Returns `true` if this member is abstract. |
| 1938 bool get isAbstract; | 1921 bool get isAbstract; |
| 1939 | 1922 |
| 1940 /// If abstract, [implementation] points to the overridden concrete member, | 1923 /// If abstract, [implementation] points to the overridden concrete member, |
| 1941 /// if any. Otherwise [implementation] points to the member itself. | 1924 /// if any. Otherwise [implementation] points to the member itself. |
| 1942 Member get implementation; | 1925 Member get implementation; |
| 1943 } | 1926 } |
| OLD | NEW |