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

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

Issue 11117022: Fix a crash related to obsolete factory syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Operator op = node.selector.asOperator(); 264 Operator op = node.selector.asOperator();
265 String opString = op !== null ? op.source.stringValue : null; 265 String opString = op !== null ? op.source.stringValue : null;
266 bool spacesNeeded = opString === 'is' || opString === 'as'; 266 bool spacesNeeded = opString === 'is' || opString === 'as';
267 267
268 if (node.isPrefix) visit(node.selector); 268 if (node.isPrefix) visit(node.selector);
269 unparseSendReceiver(node, spacesNeeded: spacesNeeded); 269 unparseSendReceiver(node, spacesNeeded: spacesNeeded);
270 if (!node.isPrefix && !node.isIndex) visit(node.selector); 270 if (!node.isPrefix && !node.isIndex) visit(node.selector);
271 if (spacesNeeded) sb.add(' '); 271 if (spacesNeeded) sb.add(' ');
272 // Also add a space for sequences like x + +1 and y - -y. 272 // Also add a space for sequences like x + +1 and y - -y.
273 if (opString === '-' || opString === '+') { 273 if (opString === '-' || opString === '+') {
274 Token beginToken = node.argumentsNode.getBeginToken(); 274 if (node.argumentsNode != null) {
karlklose 2012/10/15 07:59:26 You could add this condition to the if above.
Lasse Reichstein Nielsen 2012/10/15 08:34:37 And eventually remove the '+' case when we drop su
275 if (beginToken !== null && beginToken.stringValue === opString) { 275 Token beginToken = node.argumentsNode.getBeginToken();
276 sb.add(' '); 276 if (beginToken !== null && beginToken.stringValue === opString) {
277 sb.add(' ');
278 }
277 } 279 }
278 } 280 }
279 visit(node.argumentsNode); 281 visit(node.argumentsNode);
280 } 282 }
281 283
282 visitSendSet(SendSet node) { 284 visitSendSet(SendSet node) {
283 if (node.isPrefix) { 285 if (node.isPrefix) {
284 sb.add(' '); 286 sb.add(' ');
285 visit(node.assignmentOperator); 287 visit(node.assignmentOperator);
286 } 288 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 } 590 }
589 591
590 visitStatement(Statement node) { 592 visitStatement(Statement node) {
591 throw 'internal error'; // Should not be called. 593 throw 'internal error'; // Should not be called.
592 } 594 }
593 595
594 visitStringNode(StringNode node) { 596 visitStringNode(StringNode node) {
595 throw 'internal error'; // Should not be called. 597 throw 'internal error'; // Should not be called.
596 } 598 }
597 } 599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698