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

Side by Side Diff: pkg/compiler/lib/src/tree/unparser.dart

Issue 1151163004: Implementation of null-aware operators. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
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 part of tree; 5 part of tree;
6 6
7 String unparse(Node node, {minify: true}) { 7 String unparse(Node node, {minify: true}) {
8 Unparser unparser = new Unparser(minify: minify); 8 Unparser unparser = new Unparser(minify: minify);
9 unparser.unparse(node); 9 unparser.unparse(node);
10 return unparser.result; 10 return unparser.result;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 visit(node.receiver); 419 visit(node.receiver);
420 CascadeReceiver asCascadeReceiver = node.receiver.asCascadeReceiver(); 420 CascadeReceiver asCascadeReceiver = node.receiver.asCascadeReceiver();
421 if (asCascadeReceiver != null) { 421 if (asCascadeReceiver != null) {
422 newline(); 422 newline();
423 indentMore(); 423 indentMore();
424 indentMore(); 424 indentMore();
425 write(asCascadeReceiver.cascadeOperator.value); 425 write(asCascadeReceiver.cascadeOperator.value);
426 indentLess(); 426 indentLess();
427 indentLess(); 427 indentLess();
428 } else if (node.selector.asOperator() == null) { 428 } else if (node.selector.asOperator() == null) {
429 write('.'); 429 write(node.isConditional ? '?.' : '.');
430 } else if (spacesNeeded) { 430 } else if (spacesNeeded) {
431 write(' '); 431 write(' ');
432 } 432 }
433 } 433 }
434 434
435 unparseSendArgument(Send node, {bool spacesNeeded: false}) { 435 unparseSendArgument(Send node, {bool spacesNeeded: false}) {
436 if (node.argumentsNode == null) return; 436 if (node.argumentsNode == null) return;
437 437
438 if(node.isIsNotCheck) { 438 if(node.isIsNotCheck) {
439 Send argNode = node.arguments.head; 439 Send argNode = node.arguments.head;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 852 }
853 853
854 visitStatement(Statement node) { 854 visitStatement(Statement node) {
855 throw 'internal error'; // Should not be called. 855 throw 'internal error'; // Should not be called.
856 } 856 }
857 857
858 visitStringNode(StringNode node) { 858 visitStringNode(StringNode node) {
859 throw 'internal error'; // Should not be called. 859 throw 'internal error'; // Should not be called.
860 } 860 }
861 } 861 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698