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

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

Issue 10830356: Fix the order in which elements are emitted. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/dart_backend/emitter.dart
diff --git a/lib/compiler/implementation/dart_backend/emitter.dart b/lib/compiler/implementation/dart_backend/emitter.dart
index 132c49a2951641e9c1c2304f74efe833fef652f6..5b53e6472024de92a8bbb2a27eb7aa9ef8bbe1ad 100644
--- a/lib/compiler/implementation/dart_backend/emitter.dart
+++ b/lib/compiler/implementation/dart_backend/emitter.dart
@@ -9,11 +9,12 @@ class Emitter {
final Compiler compiler;
final Map<Node, String> renames;
+ final Map<ClassElement, Collection<Element>> classMembers;
final StringBuffer sb;
final Set<VariableListElement> processedVariableLists;
Unparser unparser;
- Emitter(this.compiler, this.renames) :
+ Emitter(this.compiler, this.renames, this.classMembers) :
sb = new StringBuffer(),
processedVariableLists = new Set<VariableListElement>() {
unparser = new Unparser.withRenamer((Node node) => renames[node]);
@@ -22,7 +23,7 @@ class Emitter {
/**
* Outputs given class element with selected inner elements.
*/
- void outputClass(ClassElement classElement, Set<Element> innerElements) {
+ void outputClass(ClassElement classElement, Collection<Element> members) {
ClassNode classNode = classElement.parseNode(compiler);
// classElement.beginToken is 'class', 'interface', or 'abstract'.
sb.add(classNode.beginToken.slowToString());
@@ -50,7 +51,7 @@ class Emitter {
sb.add(unparser.unparse(classNode.defaultClause));
}
sb.add('{');
- innerElements.forEach((element) {
+ members.forEach((element) {
// TODO(smok): Filter out default constructors here.
outputElement(element);
});
@@ -58,6 +59,11 @@ class Emitter {
}
void outputElement(Element element) {
+ if (element is ClassElement) {
+ outputClass(element, classMembers[element]);
+ return;
+ }
+
// TODO(smok): Figure out why AbstractFieldElement appears here,
// we have used getters/setters resolved instead of it.
if (element is SynthesizedConstructorElement

Powered by Google App Engine
This is Rietveld 408576698