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

Side by Side Diff: lib/compiler/implementation/dart_backend/emitter.dart

Issue 10918054: Introduce a helper to emit import script tags. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698