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

Unified Diff: lib/compiler/implementation/emitter.dart

Issue 10310040: Sort the output (for now just the classes and instance members). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/emitter.dart
diff --git a/lib/compiler/implementation/emitter.dart b/lib/compiler/implementation/emitter.dart
index dda702ae1b39e367d535a9e8d545d9378d995eb1..a89d44a4ac91eb8a2504fe855f2b321ab10a3b59 100644
--- a/lib/compiler/implementation/emitter.dart
+++ b/lib/compiler/implementation/emitter.dart
@@ -426,12 +426,19 @@ function() {
buffer.add(' $name: $value,\n');
}
+ List<Element> instanceMembers = <Element>[];
classElement.forEachMember(includeBackendMembers: true,
f: (ClassElement enclosing, Element member) {
if (member.isInstanceMember()) {
- addInstanceMember(member, defineInstanceMember);
+ instanceMembers.add(member);
}
});
+ instanceMembers.sort((Element member1, Element member2) {
+ return member1.compareTo(member2);
ngeoffray 2012/05/08 07:58:02 Should the list already be sorted? After all, thes
floitsch 2012/05/09 10:55:07 Removed sorting of instance members.
+ });
+ for (Element member in instanceMembers) {
+ addInstanceMember(member, defineInstanceMember);
+ }
generateTypeTests(classElement, (Element other) {
if (nativeEmitter.requiresNativeIsCheck(other)) {
@@ -487,7 +494,12 @@ function() {
neededClasses.add(superclass);
}
}
- for (ClassElement element in neededClasses) {
+ List<ClassElement> sortedClasses =
+ new List<ClassElement>.from(neededClasses);
+ sortedClasses.sort((ClassElement class1, ClassElement class2) {
ngeoffray 2012/05/08 07:58:02 I guess this one is hard to sort eagerly. How abou
floitsch 2012/05/09 10:55:07 Done.
+ return class1.compareTo(class2);
+ });
+ for (ClassElement element in sortedClasses) {
generateClass(element, buffer);
}
@@ -570,7 +582,9 @@ function() {
// The closure class.
SourceString name = const SourceString("BoundClosure");
ClassElement closureClassElement =
- new ClosureClassElement(compiler, member.getCompilationUnit());
+ new ClosureClassElement(compiler,
+ member.getCompilationUnit(),
+ member.position());
ngeoffray 2012/05/08 07:58:02 Maybe a FunctionElement should contain a list of c
floitsch 2012/05/09 10:55:07 change reverted.
String mangledName = namer.getName(closureClassElement);
String superName = namer.getName(closureClassElement.superclass);
needsClosureClass = true;
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/scanner/byte_strings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698