Chromium Code Reviews| Index: lib/compiler/implementation/tree/unparser.dart |
| diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart |
| index a1d0fad161293cc63ed5aa3fc20af1c23fbcb288..3e868de6db70d8b8a7d1bfe4dc27c7880c6c3cdc 100644 |
| --- a/lib/compiler/implementation/tree/unparser.dart |
| +++ b/lib/compiler/implementation/tree/unparser.dart |
| @@ -279,13 +279,18 @@ class Unparser implements Visitor { |
| visitSend(Send node) { |
| Operator op = node.selector.asOperator(); |
| - bool spacesNeeded = op !== null && |
| - (op.source.stringValue === 'is' || op.source.stringValue == 'as'); |
| + String opString = op !== null ? op.source.stringValue : null; |
| + bool spacesNeeded = opString === 'is' || opString === 'as'; |
| if (node.isPrefix) visit(node.selector); |
| unparseSendReceiver(node, spacesNeeded: spacesNeeded); |
| if (!node.isPrefix && !node.isIndex) visit(node.selector); |
| if (spacesNeeded) sb.add(' '); |
| + // Also add a space for sequences like x + +1 and y - -y. |
| + if (opString === '-' || opString === '+') { |
| + Token beginToken = node.argumentsNode.getBeginToken(); |
| + if (beginToken !== null && beginToken.stringValue === opString) sb.add(' '); |
|
Roman
2012/10/02 13:22:24
80 chars
|
| + } |
| visit(node.argumentsNode); |
| } |