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

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

Issue 10916053: Get rid of duplication of class node unparsing. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15a5987ba1118b3d428264921b6c6f5333dc0653..0dfc71c973480c08a3fa51ac2e3b57862a248396 100644
--- a/lib/compiler/implementation/dart_backend/emitter.dart
+++ b/lib/compiler/implementation/dart_backend/emitter.dart
@@ -29,35 +29,12 @@ String emitCode(
}
void outputClass(ClassElement classElement, Collection<Element> members) {
- ClassNode classNode = classElement.parseNode(compiler);
- // classElement.beginToken is 'class', 'interface', or 'abstract'.
- unparser.addToken(classNode.beginToken);
- if (classNode.beginToken.stringValue == 'abstract') {
- unparser.addToken(classNode.beginToken.next);
- }
- unparser.unparse(classNode.name);
- if (classNode.typeParameters !== null) {
- unparser.unparse(classNode.typeParameters);
- }
- if (classNode.extendsKeyword !== null) {
- unparser.addString(' ');
- unparser.addToken(classNode.extendsKeyword);
- unparser.unparse(classNode.superclass);
- }
- if (!classNode.interfaces.isEmpty()) {
- unparser.addString(' ');
- unparser.unparse(classNode.interfaces);
- }
- if (classNode.defaultClause !== null) {
- unparser.addString(' default ');
- unparser.unparse(classNode.defaultClause);
- }
- unparser.addString('{');
- members.forEach((element) {
- // TODO(smok): Filter out default constructors here.
- outputElement(element);
+ unparser.unparseClassWithBody(classElement.parseNode(compiler), () {
+ members.forEach((element) {
+ // TODO(smok): Filter out default constructors here.
+ outputElement(element);
+ });
});
- unparser.addString('}');
}
imports.forEach((libraryElement, prefix) {
« 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