Index: pkg/compiler/lib/src/elements/elements.dart |
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart |
index a6683cf1b35018a35338e8b3227bc3602de00ea1..32bdc6c73b991c585787a5b33017a8d8b205aeb0 100644 |
--- a/pkg/compiler/lib/src/elements/elements.dart |
+++ b/pkg/compiler/lib/src/elements/elements.dart |
@@ -329,6 +329,12 @@ abstract class Element implements Entity { |
bool get impliesType; |
+ /// The character offset of the declaration of this element within its |
+ /// compilation unit, if available. |
+ /// |
+ /// This is used to sort the elements. |
+ int get sourceOffset; |
+ |
// TODO(johnniwinther): Remove this. |
Token get position; |
@@ -683,10 +689,8 @@ class Elements { |
if (r != 0) return r; |
r = a.compilationUnit.compareTo(b.compilationUnit); |
if (r != 0) return r; |
- Token positionA = a.position; |
- Token positionB = b.position; |
- int offsetA = positionA == null ? -1 : positionA.charOffset; |
- int offsetB = positionB == null ? -1 : positionB.charOffset; |
+ int offsetA = a.sourceOffset ?? -1; |
+ int offsetB = b.sourceOffset ?? -1; |
r = offsetA.compareTo(offsetB); |
if (r != 0) return r; |
r = a.name.compareTo(b.name); |
@@ -697,7 +701,7 @@ class Elements { |
} |
static List<Element> sortedByPosition(Iterable<Element> elements) { |
- return elements.toList()..sort(compareByPosition); |
+ return elements.toList(); //..sort(compareByPosition); |
Siggi Cherem (dart-lang)
2016/04/28 17:23:15
uncomment?
Johnni Winther
2016/04/29 09:31:37
Good idea ;-)
|
} |
static bool isFixedListConstructorCall( |
@@ -1228,7 +1232,7 @@ abstract class ConstructorElement extends FunctionElement |
/// The effective target of this constructor, that is the non-redirecting |
/// constructor that is called on invocation of this constructor. |
/// |
- /// Consider for instance this hierachy: |
+ /// Consider for instance this hierarchy: |
/// |
/// class C { factory C.c() = D.d; } |
/// class D { factory D.d() = E.e2; } |
@@ -1241,7 +1245,7 @@ abstract class ConstructorElement extends FunctionElement |
/// The immediate redirection target of a redirecting factory constructor. |
/// |
- /// Consider for instance this hierachy: |
+ /// Consider for instance this hierarchy: |
/// |
/// class C { factory C() = D; } |
/// class D { factory D() = E; } |