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

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

Issue 10826245: Fix some operator madness (see incr_op_test for more details.) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Returns null if no need to rename a node. 5 // Returns null if no need to rename a node.
6 typedef String Renamer(Node node); 6 typedef String Renamer(Node node);
7 7
8 class Unparser implements Visitor { 8 class Unparser implements Visitor {
9 Renamer rename; 9 Renamer rename;
10 StringBuffer sb; 10 StringBuffer sb;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 add(node.assignmentOperator.token.value); 293 add(node.assignmentOperator.token.value);
294 } 294 }
295 unparseNodeListFrom(node.argumentsNode, node.argumentsNode.nodes.tail); 295 unparseNodeListFrom(node.argumentsNode, node.argumentsNode.nodes.tail);
296 } 296 }
297 297
298 visitSendSet(SendSet node) { 298 visitSendSet(SendSet node) {
299 if (node.isIndex) { 299 if (node.isIndex) {
300 unparseIndexedSet(node); 300 unparseIndexedSet(node);
301 } else { 301 } else {
302 if (node.isPrefix) { 302 if (node.isPrefix) {
303 add(node.assignmentOperator.token.value); 303 sb.add(' ');
304 add(node.assignmentOperator.source);
304 } 305 }
305 unparseSendPart(node); 306 if (node.receiver !== null && rename(node.receiver) != '') {
307 visit(node.receiver);
308 CascadeReceiver asCascadeReceiver = node.receiver.asCascadeReceiver();
309 if (asCascadeReceiver !== null) {
310 add(asCascadeReceiver.cascadeOperator.value);
311 } else {
312 sb.add('.');
313 }
314 }
315 visit(node.selector);
306 if (!node.isPrefix) { 316 if (!node.isPrefix) {
307 add(node.assignmentOperator.token.value); 317 SourceString source = node.assignmentOperator.source;
318 add(source);
319 if (source.slowToString() != '=') sb.add(' ');
308 } 320 }
309 visit(node.argumentsNode); 321 visit(node.argumentsNode);
310 } 322 }
311 } 323 }
312 324
313 visitThrow(Throw node) { 325 visitThrow(Throw node) {
314 add(node.throwToken.value); 326 add(node.throwToken.value);
315 if (node.expression !== null) { 327 if (node.expression !== null) {
316 sb.add(' '); 328 sb.add(' ');
317 visit(node.expression); 329 visit(node.expression);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 sb.add(' '); 518 sb.add(' ');
507 } 519 }
508 visit(node.name); 520 visit(node.name);
509 if (node.typeParameters !== null) { 521 if (node.typeParameters !== null) {
510 visit(node.typeParameters); 522 visit(node.typeParameters);
511 } 523 }
512 visit(node.formals); 524 visit(node.formals);
513 add(node.endToken.value); 525 add(node.endToken.value);
514 } 526 }
515 } 527 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698