| OLD | NEW |
| 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 String emitCode( | 5 String emitCode( |
| 6 Compiler compiler, | 6 Compiler compiler, |
| 7 Unparser unparser, | 7 Unparser unparser, |
| 8 Map<LibraryElement, String> imports, | 8 Map<LibraryElement, String> imports, |
| 9 Collection<Element> topLevelElements, | 9 Collection<Element> topLevelElements, |
| 10 Map<ClassElement, Collection<Element>> classMembers) { | 10 Map<ClassElement, Collection<Element>> classMembers) { |
| 11 void outputElement(Element element) { | 11 void outputElement(Element element) { |
| 12 unparser.unparse(element.parseNode(compiler)); | 12 unparser.unparse(element.parseNode(compiler)); |
| 13 } | 13 } |
| 14 | 14 |
| 15 void outputClass(ClassElement classElement, Collection<Element> members) { | 15 void outputClass(ClassElement classElement, Collection<Element> members) { |
| 16 unparser.unparseClassWithBody(classElement.parseNode(compiler), () { | 16 unparser.unparseClassWithBody(classElement.parseNode(compiler), () { |
| 17 members.forEach((element) { | 17 members.forEach((element) { |
| 18 // TODO(smok): Filter out default constructors here. | 18 // TODO(smok): Filter out default constructors here. |
| 19 outputElement(element); | 19 outputElement(element); |
| 20 }); | 20 }); |
| 21 }); | 21 }); |
| 22 } | 22 } |
| 23 | 23 |
| 24 imports.forEach((libraryElement, prefix) { | 24 imports.forEach((libraryElement, prefix) { |
| 25 unparser.addString('#import("${libraryElement.uri}",prefix:"$prefix");'); | 25 unparser.unparseImportTag('${libraryElement.uri}', prefix); |
| 26 }); | 26 }); |
| 27 | 27 |
| 28 for (final element in topLevelElements) { | 28 for (final element in topLevelElements) { |
| 29 if (element is ClassElement) { | 29 if (element is ClassElement) { |
| 30 outputClass(element, classMembers[element]); | 30 outputClass(element, classMembers[element]); |
| 31 } else { | 31 } else { |
| 32 outputElement(element); | 32 outputElement(element); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 } | 35 } |
| OLD | NEW |