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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree/unparser.dart

Issue 11878043: Start adding support for mixin application syntax. We now parse the typedef variant of mixin applic… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix broken language test. Created 7 years, 11 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 part of tree; 5 part of tree;
6 6
7 String unparse(Node node) { 7 String unparse(Node node) {
8 Unparser unparser = new Unparser(); 8 Unparser unparser = new Unparser();
9 unparser.unparse(node); 9 unparser.unparse(node);
10 return unparser.result; 10 return unparser.result;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 for (final member in members) { 74 for (final member in members) {
75 visit(member); 75 visit(member);
76 } 76 }
77 sb.add('}'); 77 sb.add('}');
78 } 78 }
79 79
80 visitClassNode(ClassNode node) { 80 visitClassNode(ClassNode node) {
81 unparseClassWithBody(node, node.body.nodes); 81 unparseClassWithBody(node, node.body.nodes);
82 } 82 }
83 83
84 visitMixinApplication(MixinApplication node) {
85 if (!node.modifiers.nodes.isEmpty) {
86 visit(node.modifiers);
87 sb.add(' ');
88 }
89 visit(node.superclass);
90 sb.add(' with ');
91 visit(node.mixins);
92 }
93
94 visitNamedMixinApplication(NamedMixinApplication node) {
95 sb.add('typedef ');
96 visit(node.name);
97 if (node.typeParameters != null) {
98 visit(node.typeParameters);
99 }
100 sb.add(' = ');
101 visit(node.mixinApplication);
102 sb.add(';');
103 }
104
84 visitConditional(Conditional node) { 105 visitConditional(Conditional node) {
85 visit(node.condition); 106 visit(node.condition);
86 add(node.questionToken.value); 107 add(node.questionToken.value);
87 visit(node.thenExpression); 108 visit(node.thenExpression);
88 add(node.colonToken.value); 109 add(node.colonToken.value);
89 visit(node.elseExpression); 110 visit(node.elseExpression);
90 } 111 }
91 112
92 visitExpressionStatement(ExpressionStatement node) { 113 visitExpressionStatement(ExpressionStatement node) {
93 visit(node.expression); 114 visit(node.expression);
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 617 }
597 618
598 visitStatement(Statement node) { 619 visitStatement(Statement node) {
599 throw 'internal error'; // Should not be called. 620 throw 'internal error'; // Should not be called.
600 } 621 }
601 622
602 visitStringNode(StringNode node) { 623 visitStringNode(StringNode node) {
603 throw 'internal error'; // Should not be called. 624 throw 'internal error'; // Should not be called.
604 } 625 }
605 } 626 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698