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

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

Issue 10692186: Fix factory constructors unparse: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 * Dart backend helper for converting program IR back to source code. 6 * Dart backend helper for converting program IR back to source code.
7 */ 7 */
8 class Emitter { 8 class Emitter {
9 9
10 final Compiler compiler; 10 final Compiler compiler;
11 final StringBuffer sb; 11 final StringBuffer sb;
12 12
13 Emitter(this.compiler) : sb = new StringBuffer(); 13 Emitter(this.compiler) : sb = new StringBuffer();
14 14
15 /** 15 /**
16 * Outputs given class element with selected inner elements. 16 * Outputs given class element with selected inner elements.
17 */ 17 */
18 void outputClass(ClassElement classElement, Set<Element> innerElements) { 18 void outputClass(ClassElement classElement, Set<Element> innerElements) {
19 // TODO(smok): Very soon properly print out correct class declaration with 19 // TODO(smok): Very soon properly print out correct class declaration with
20 // extends, implements, etc. 20 // extends, implements, etc.
21 sb.add('class '); 21 sb.add(classElement.beginToken.slowToString()); // 'class' or 'interface'.
22 sb.add(' ');
22 sb.add(classElement.name.slowToString()); 23 sb.add(classElement.name.slowToString());
23 sb.add('{'); 24 sb.add('{');
24 innerElements.forEach((element) { 25 innerElements.forEach((element) {
25 // TODO(smok): Filter out default constructors here. 26 // TODO(smok): Filter out default constructors here.
26 outputElement(element); 27 outputElement(element);
27 }); 28 });
28 sb.add('}'); 29 sb.add('}');
29 } 30 }
30 31
31 void outputElement(Element element) { 32 void outputElement(Element element) {
(...skipping 17 matching lines...) Expand all
49 // but unparse initializer manually. 50 // but unparse initializer manually.
50 sb.add(element.parseNode(compiler).unparse()); 51 sb.add(element.parseNode(compiler).unparse());
51 sb.add(';'); 52 sb.add(';');
52 } else { 53 } else {
53 sb.add(element.parseNode(compiler).unparse()); 54 sb.add(element.parseNode(compiler).unparse());
54 } 55 }
55 } 56 }
56 57
57 String toString() => sb.toString(); 58 String toString() => sb.toString();
58 } 59 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | lib/compiler/implementation/tree/unparser.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698