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

Side by Side Diff: pkg/analyzer/lib/src/services/formatter_impl.dart

Issue 882233004: Async/await/yield[*] support for dart_fmt (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 | pkg/analyzer/test/services/data/cu_tests.data » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library formatter_impl; 5 library formatter_impl;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/parser.dart'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 if (!node.statements.isEmpty) { 500 if (!node.statements.isEmpty) {
501 visitNodes(node.statements, precededBy: newlines, separatedBy: newlines); 501 visitNodes(node.statements, precededBy: newlines, separatedBy: newlines);
502 newlines(); 502 newlines();
503 } else { 503 } else {
504 preserveLeadingNewlines(); 504 preserveLeadingNewlines();
505 } 505 }
506 token(node.rightBracket, precededBy: unindent); 506 token(node.rightBracket, precededBy: unindent);
507 } 507 }
508 508
509 visitBlockFunctionBody(BlockFunctionBody node) { 509 visitBlockFunctionBody(BlockFunctionBody node) {
510 token(node.keyword, followedBy: nonBreakingSpace); 510 // sync[*] or async[*]
511 token(node.keyword);
512 token(node.star);
513 if (node.keyword != null) {
514 nonBreakingSpace();
515 }
516
511 visit(node.block); 517 visit(node.block);
512 } 518 }
513 519
514 visitBooleanLiteral(BooleanLiteral node) { 520 visitBooleanLiteral(BooleanLiteral node) {
515 token(node.literal); 521 token(node.literal);
516 } 522 }
517 523
518 visitBreakStatement(BreakStatement node) { 524 visitBreakStatement(BreakStatement node) {
519 token(node.keyword); 525 token(node.keyword);
520 visitNode(node.label, precededBy: space); 526 visitNode(node.label, precededBy: space);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 visitFieldFormalParameter(FieldFormalParameter node) { 835 visitFieldFormalParameter(FieldFormalParameter node) {
830 token(node.keyword, followedBy: space); 836 token(node.keyword, followedBy: space);
831 visitNode(node.type, followedBy: space); 837 visitNode(node.type, followedBy: space);
832 token(node.thisToken); 838 token(node.thisToken);
833 token(node.period); 839 token(node.period);
834 visit(node.identifier); 840 visit(node.identifier);
835 visit(node.parameters); 841 visit(node.parameters);
836 } 842 }
837 843
838 visitForEachStatement(ForEachStatement node) { 844 visitForEachStatement(ForEachStatement node) {
845 token(node.awaitKeyword, followedBy: nonBreakingSpace);
839 token(node.forKeyword); 846 token(node.forKeyword);
840 space(); 847 space();
841 token(node.leftParenthesis); 848 token(node.leftParenthesis);
842 if (node.loopVariable != null) { 849 if (node.loopVariable != null) {
843 visit(node.loopVariable); 850 visit(node.loopVariable);
844 } else { 851 } else {
845 visit(node.identifier); 852 visit(node.identifier);
846 } 853 }
847 space(); 854 space();
848 token(node.inKeyword); 855 token(node.inKeyword);
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 int linesBetween(int lastOffset, int currentOffset) { 1860 int linesBetween(int lastOffset, int currentOffset) {
1854 var lastLine = 1861 var lastLine =
1855 lineInfo.getLocation(lastOffset).lineNumber; 1862 lineInfo.getLocation(lastOffset).lineNumber;
1856 var currentLine = 1863 var currentLine =
1857 lineInfo.getLocation(currentOffset).lineNumber; 1864 lineInfo.getLocation(currentOffset).lineNumber;
1858 return currentLine - lastLine; 1865 return currentLine - lastLine;
1859 } 1866 }
1860 1867
1861 String toString() => writer.toString(); 1868 String toString() => writer.toString();
1862 } 1869 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/cu_tests.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698