| OLD | NEW |
| 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 String unparse(Node node) { | 5 String unparse(Node node) { |
| 6 Unparser unparser = new Unparser(); | 6 Unparser unparser = new Unparser(); |
| 7 unparser.unparse(node); | 7 unparser.unparse(node); |
| 8 return unparser.result; | 8 return unparser.result; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 String opString = op !== null ? op.source.stringValue : null; | 262 String opString = op !== null ? op.source.stringValue : null; |
| 263 bool spacesNeeded = opString === 'is' || opString === 'as'; | 263 bool spacesNeeded = opString === 'is' || opString === 'as'; |
| 264 | 264 |
| 265 if (node.isPrefix) visit(node.selector); | 265 if (node.isPrefix) visit(node.selector); |
| 266 unparseSendReceiver(node, spacesNeeded: spacesNeeded); | 266 unparseSendReceiver(node, spacesNeeded: spacesNeeded); |
| 267 if (!node.isPrefix && !node.isIndex) visit(node.selector); | 267 if (!node.isPrefix && !node.isIndex) visit(node.selector); |
| 268 if (spacesNeeded) sb.add(' '); | 268 if (spacesNeeded) sb.add(' '); |
| 269 // Also add a space for sequences like x + +1 and y - -y. | 269 // Also add a space for sequences like x + +1 and y - -y. |
| 270 if (opString === '-' || opString === '+') { | 270 if (opString === '-' || opString === '+') { |
| 271 Token beginToken = node.argumentsNode.getBeginToken(); | 271 Token beginToken = node.argumentsNode.getBeginToken(); |
| 272 if (beginToken !== null && beginToken.stringValue === opString) sb.add(' '
); | 272 if (beginToken !== null && beginToken.stringValue === opString) { |
| 273 sb.add(' '); |
| 274 } |
| 273 } | 275 } |
| 274 visit(node.argumentsNode); | 276 visit(node.argumentsNode); |
| 275 } | 277 } |
| 276 | 278 |
| 277 visitSendSet(SendSet node) { | 279 visitSendSet(SendSet node) { |
| 278 if (node.isPrefix) { | 280 if (node.isPrefix) { |
| 279 sb.add(' '); | 281 sb.add(' '); |
| 280 visit(node.assignmentOperator); | 282 visit(node.assignmentOperator); |
| 281 } | 283 } |
| 282 unparseSendReceiver(node); | 284 unparseSendReceiver(node); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 add(node.getEndToken().value); | 538 add(node.getEndToken().value); |
| 537 } | 539 } |
| 538 | 540 |
| 539 visitPartOf(PartOf node) { | 541 visitPartOf(PartOf node) { |
| 540 addToken(node.partKeyword); | 542 addToken(node.partKeyword); |
| 541 addToken(node.ofKeyword); | 543 addToken(node.ofKeyword); |
| 542 visit(node.name); | 544 visit(node.name); |
| 543 add(node.getEndToken().value); | 545 add(node.getEndToken().value); |
| 544 } | 546 } |
| 545 } | 547 } |
| OLD | NEW |