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

Side by Side 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: Remove (now) unnecessary changes. 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 unified diff | Download patch | Annotate | Revision Log
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 /** 5 /**
6 * A function element that represents a closure call. The signature is copied 6 * A function element that represents a closure call. The signature is copied
7 * from the given element. 7 * from the given element.
8 */ 8 */
9 class ClosureInvocationElement extends FunctionElement { 9 class ClosureInvocationElement extends FunctionElement {
10 ClosureInvocationElement(SourceString name, 10 ClosureInvocationElement(SourceString name,
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 Set<ClassElement> neededClasses = 480 Set<ClassElement> neededClasses =
481 new Set<ClassElement>.from(instantiatedClasses); 481 new Set<ClassElement>.from(instantiatedClasses);
482 for (ClassElement element in instantiatedClasses) { 482 for (ClassElement element in instantiatedClasses) {
483 for (ClassElement superclass = element.superclass; 483 for (ClassElement superclass = element.superclass;
484 superclass !== null; 484 superclass !== null;
485 superclass = superclass.superclass) { 485 superclass = superclass.superclass) {
486 if (neededClasses.contains(superclass)) break; 486 if (neededClasses.contains(superclass)) break;
487 neededClasses.add(superclass); 487 neededClasses.add(superclass);
488 } 488 }
489 } 489 }
490 for (ClassElement element in neededClasses) { 490 List<ClassElement> sortedClasses =
491 new List<ClassElement>.from(neededClasses);
492 sortedClasses.sort((ClassElement class1, ClassElement class2) {
kasperl 2012/05/09 08:15:20 Maybe describe what kind of sorting this implies?
floitsch 2012/05/09 10:55:08 I added a comment. We don't rely on the sorting an
493 return class2.id - class1.id;
494 });
495 for (ClassElement element in sortedClasses) {
491 generateClass(element, buffer); 496 generateClass(element, buffer);
492 } 497 }
493 498
494 // The closure class could have become necessary because of the generation 499 // The closure class could have become necessary because of the generation
495 // of stubs. 500 // of stubs.
496 ClassElement closureClass = compiler.closureClass; 501 ClassElement closureClass = compiler.closureClass;
497 if (needsClosureClass && !instantiatedClasses.contains(closureClass)) { 502 if (needsClosureClass && !instantiatedClasses.contains(closureClass)) {
498 generateClass(closureClass, buffer); 503 generateClass(closureClass, buffer);
499 } 504 }
500 } 505 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 mainBuffer.add('function init() {\n'); 903 mainBuffer.add('function init() {\n');
899 mainBuffer.add(' $isolateProperties = {};\n'); 904 mainBuffer.add(' $isolateProperties = {};\n');
900 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer); 905 addDefineClassAndFinishClassFunctionsIfNecessary(mainBuffer);
901 emitFinishIsolateConstructor(mainBuffer); 906 emitFinishIsolateConstructor(mainBuffer);
902 mainBuffer.add('}\n'); 907 mainBuffer.add('}\n');
903 compiler.assembledCode = mainBuffer.toString(); 908 compiler.assembledCode = mainBuffer.toString();
904 }); 909 });
905 return compiler.assembledCode; 910 return compiler.assembledCode;
906 } 911 }
907 } 912 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698