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

Side by Side Diff: frog/leg/tree/unparser.dart

Issue 9616058: Implement parsing and resolving of type-variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix merge error. Created 8 years, 9 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) 2011, 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 class Unparser implements Visitor { 5 class Unparser implements Visitor {
6 StringBuffer sb; 6 StringBuffer sb;
7 final bool printDebugInfo; 7 final bool printDebugInfo;
8 8
9 Unparser([this.printDebugInfo = false]); 9 Unparser([this.printDebugInfo = false]);
10 10
11 String unparse(Node node) { 11 String unparse(Node node) {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 sb.add(' '); 205 sb.add(' ');
206 visit(node.expression); 206 visit(node.expression);
207 } 207 }
208 node.endToken.value.printOn(sb); 208 node.endToken.value.printOn(sb);
209 } 209 }
210 210
211 visitTypeAnnotation(TypeAnnotation node) { 211 visitTypeAnnotation(TypeAnnotation node) {
212 node.visitChildren(this); 212 node.visitChildren(this);
213 } 213 }
214 214
215 visitTypeVariable(TypeVariable node) {
216 visit(node.name);
217 if (node.bound !== null) {
218 sb.add(' extends ');
219 visit(node.bound);
220 }
221 }
222
215 visitVariableDefinitions(VariableDefinitions node) { 223 visitVariableDefinitions(VariableDefinitions node) {
216 if (node.type !== null) { 224 if (node.type !== null) {
217 visit(node.type); 225 visit(node.type);
218 } else { 226 } else {
219 sb.add('var'); 227 sb.add('var');
220 } 228 }
221 sb.add(' '); 229 sb.add(' ');
222 // TODO(karlklose): print modifiers. 230 // TODO(karlklose): print modifiers.
223 visit(node.definitions); 231 visit(node.definitions);
224 if (node.endToken.value == const SourceString(';')) { 232 if (node.endToken.value == const SourceString(';')) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 sb.add(' '); 395 sb.add(' ');
388 } 396 }
389 visit(node.name); 397 visit(node.name);
390 if (node.typeParameters !== null) { 398 if (node.typeParameters !== null) {
391 visit(node.typeParameters); 399 visit(node.typeParameters);
392 } 400 }
393 visit(node.formals); 401 visit(node.formals);
394 add(node.endToken.value); 402 add(node.endToken.value);
395 } 403 }
396 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698