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

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

Issue 10698092: Fix unparsing of prefix increments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 class Unparser implements Visitor { 5 class Unparser implements Visitor {
6 StringBuffer sb; 6 StringBuffer sb;
7 7
8 Unparser(); 8 Unparser();
9 9
10 String unparse(Node node) { 10 String unparse(Node node) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 visitSend(Send node) { 218 visitSend(Send node) {
219 unparseSendPart(node); 219 unparseSendPart(node);
220 visit(node.argumentsNode); 220 visit(node.argumentsNode);
221 } 221 }
222 222
223 /** 223 /**
224 * Special case for assignments like "list[0] = 1". 224 * Special case for assignments like "list[0] = 1".
225 */ 225 */
226 unparseIndexedSet(SendSet node) { 226 unparseIndexedSet(SendSet node) {
227 if (node.isPrefix) {
228 add(node.assignmentOperator.token.value);
229 }
227 visit(node.receiver); 230 visit(node.receiver);
228 sb.add('['); 231 sb.add('[');
229 sb.add(node.arguments.head); 232 sb.add(node.arguments.head);
230 sb.add(']'); 233 sb.add(']');
231 add(node.assignmentOperator.token.value); 234 if (!node.isPrefix) {
235 add(node.assignmentOperator.token.value);
236 }
232 unparseNodeListFrom(node.argumentsNode, node.argumentsNode.nodes.tail); 237 unparseNodeListFrom(node.argumentsNode, node.argumentsNode.nodes.tail);
233 } 238 }
234 239
235 visitSendSet(SendSet node) { 240 visitSendSet(SendSet node) {
236 if (node.isIndex) { 241 if (node.isIndex) {
237 unparseIndexedSet(node); 242 unparseIndexedSet(node);
238 } else { 243 } else {
244 if (node.isPrefix) {
245 add(node.assignmentOperator.token.value);
246 }
239 unparseSendPart(node); 247 unparseSendPart(node);
240 add(node.assignmentOperator.token.value); 248 if (!node.isPrefix) {
249 add(node.assignmentOperator.token.value);
250 }
241 visit(node.argumentsNode); 251 visit(node.argumentsNode);
242 } 252 }
243 } 253 }
244 254
245 visitThrow(Throw node) { 255 visitThrow(Throw node) {
246 add(node.throwToken.value); 256 add(node.throwToken.value);
247 if (node.expression !== null) { 257 if (node.expression !== null) {
248 sb.add(' '); 258 sb.add(' ');
249 visit(node.expression); 259 visit(node.expression);
250 } 260 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 sb.add(' '); 453 sb.add(' ');
444 } 454 }
445 visit(node.name); 455 visit(node.name);
446 if (node.typeParameters !== null) { 456 if (node.typeParameters !== null) {
447 visit(node.typeParameters); 457 visit(node.typeParameters);
448 } 458 }
449 visit(node.formals); 459 visit(node.formals);
450 add(node.endToken.value); 460 add(node.endToken.value);
451 } 461 }
452 } 462 }
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