Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: pkg/compiler/lib/src/elements/elements.dart

Issue 2958553002: Sort type tests. (Closed)
Patch Set: Cleanup Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../constants/constructors.dart'; 9 import '../constants/constructors.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if (identical(op, '<<=')) return '<<'; 637 if (identical(op, '<<=')) return '<<';
638 if (identical(op, '>>=')) return '>>'; 638 if (identical(op, '>>=')) return '>>';
639 if (identical(op, '&=')) return '&'; 639 if (identical(op, '&=')) return '&';
640 if (identical(op, '^=')) return '^'; 640 if (identical(op, '^=')) return '^';
641 if (identical(op, '|=')) return '|'; 641 if (identical(op, '|=')) return '|';
642 if (identical(op, '??=')) return '??'; 642 if (identical(op, '??=')) return '??';
643 643
644 return null; 644 return null;
645 } 645 }
646 646
647 /// If `true`, injected members are sorted with their corresponding class or
648 /// library.
649 ///
650 /// This is used for ensuring equivalent output order when testing against
651 /// .dill using the patched_dart2js_sdk.
652 static bool usePatchedDart2jsSdkSorting = false;
Siggi Cherem (dart-lang) 2017/06/23 20:36:34 +TODO - delete when patching is implemented in pac
Johnni Winther 2017/06/26 10:15:09 Done.
653
647 /// A `compareTo` function that places [Element]s in a consistent order based 654 /// A `compareTo` function that places [Element]s in a consistent order based
648 /// on the source code order. 655 /// on the source code order.
649 static int compareByPosition(Element a, Element b) { 656 static int compareByPosition(Element a, Element b) {
650 if (identical(a, b)) return 0; 657 if (identical(a, b)) return 0;
651 int r = utils.compareLibrariesUris( 658 int r = utils.compareLibrariesUris(
652 a.library.canonicalUri, b.library.canonicalUri); 659 a.library.canonicalUri, b.library.canonicalUri);
653 if (r != 0) return r; 660 if (r != 0) return r;
654 r = utils.compareSourceUris(a.compilationUnit.script.readableUri, 661 Uri aUri = a.compilationUnit.script.readableUri;
655 b.compilationUnit.script.readableUri); 662 Uri bUri = b.compilationUnit.script.readableUri;
663 if (usePatchedDart2jsSdkSorting) {
664 Uri computePatchedDart2jsUri(Element e, Uri uri) {
665 if (!e.isInjected) return uri;
666 if (e.enclosingClass != null) {
667 return e.enclosingClass.compilationUnit.script.readableUri;
668 } else {
669 return e.library.compilationUnit.script.readableUri;
670 }
671 }
672
673 aUri = computePatchedDart2jsUri(a, aUri);
674 bUri = computePatchedDart2jsUri(b, bUri);
675 }
676 r = utils.compareSourceUris(aUri, bUri);
656 if (r != 0) return r; 677 if (r != 0) return r;
657 return utils.compareEntities(a, a.sourceOffset, -1, b, b.sourceOffset, -1); 678 return utils.compareEntities(a, a.sourceOffset, -1, b, b.sourceOffset, -1);
658 } 679 }
659 680
660 static List<E> sortedByPosition<E extends Element>(Iterable<E> elements) { 681 static List<E> sortedByPosition<E extends Element>(Iterable<E> elements) {
661 return elements.toList()..sort(compareByPosition); 682 return elements.toList()..sort(compareByPosition);
662 } 683 }
663 684
664 static bool isFixedListConstructorCall( 685 static bool isFixedListConstructorCall(
665 ConstructorEntity element, Send node, CommonElements commonElements) { 686 ConstructorEntity element, Send node, CommonElements commonElements) {
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 /// by a field. 1893 /// by a field.
1873 bool get isDeclaredByField; 1894 bool get isDeclaredByField;
1874 1895
1875 /// Returns `true` if this member is abstract. 1896 /// Returns `true` if this member is abstract.
1876 bool get isAbstract; 1897 bool get isAbstract;
1877 1898
1878 /// If abstract, [implementation] points to the overridden concrete member, 1899 /// If abstract, [implementation] points to the overridden concrete member,
1879 /// if any. Otherwise [implementation] points to the member itself. 1900 /// if any. Otherwise [implementation] points to the member itself.
1880 Member get implementation; 1901 Member get implementation;
1881 } 1902 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698