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

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

Issue 14211008: Add support for rethrow and start treating throw <expr> as an expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use ?:. Created 7 years, 8 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (node.nodes != null) { 259 if (node.nodes != null) {
260 unparseNodeListFrom(node, node.nodes); 260 unparseNodeListFrom(node, node.nodes);
261 } 261 }
262 if (node.endToken != null) add(node.endToken.value); 262 if (node.endToken != null) add(node.endToken.value);
263 } 263 }
264 264
265 visitOperator(Operator node) { 265 visitOperator(Operator node) {
266 visitIdentifier(node); 266 visitIdentifier(node);
267 } 267 }
268 268
269 visitRethrow(Rethrow node) {
270 sb.write('rethrow;');
271 }
272
269 visitReturn(Return node) { 273 visitReturn(Return node) {
270 if (node.isRedirectingFactoryBody) { 274 if (node.isRedirectingFactoryBody) {
271 sb.write(' '); 275 sb.write(' ');
272 } 276 }
273 add(node.beginToken.value); 277 add(node.beginToken.value);
274 if (node.hasExpression && node.beginToken.stringValue != '=>') { 278 if (node.hasExpression && node.beginToken.stringValue != '=>') {
275 sb.write(' '); 279 sb.write(' ');
276 } 280 }
277 visit(node.expression); 281 visit(node.expression);
278 if (node.endToken != null) add(node.endToken.value); 282 if (node.endToken != null) add(node.endToken.value);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (!node.isPrefix) { 333 if (!node.isPrefix) {
330 visit(node.assignmentOperator); 334 visit(node.assignmentOperator);
331 if (node.assignmentOperator.source.slowToString() != '=') sb.write(' '); 335 if (node.assignmentOperator.source.slowToString() != '=') sb.write(' ');
332 } 336 }
333 visit(node.argumentsNode); 337 visit(node.argumentsNode);
334 } 338 }
335 } 339 }
336 340
337 visitThrow(Throw node) { 341 visitThrow(Throw node) {
338 add(node.throwToken.value); 342 add(node.throwToken.value);
339 if (node.expression != null) { 343 sb.write(' ');
340 sb.write(' '); 344 visit(node.expression);
341 visit(node.expression);
342 }
343 node.endToken.value.printOn(sb);
344 } 345 }
345 346
346 visitTypeAnnotation(TypeAnnotation node) { 347 visitTypeAnnotation(TypeAnnotation node) {
347 visit(node.typeName); 348 visit(node.typeName);
348 visit(node.typeArguments); 349 visit(node.typeArguments);
349 } 350 }
350 351
351 visitTypeVariable(TypeVariable node) { 352 visitTypeVariable(TypeVariable node) {
352 visit(node.name); 353 visit(node.name);
353 if (node.bound != null) { 354 if (node.bound != null) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } 619 }
619 620
620 visitStatement(Statement node) { 621 visitStatement(Statement node) {
621 throw 'internal error'; // Should not be called. 622 throw 'internal error'; // Should not be called.
622 } 623 }
623 624
624 visitStringNode(StringNode node) { 625 visitStringNode(StringNode node) {
625 throw 'internal error'; // Should not be called. 626 throw 'internal error'; // Should not be called.
626 } 627 }
627 } 628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698