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

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

Issue 186153005: New analzyer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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) 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 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 } 1686 }
1687 1687
1688 append(comment.toString().trim()); 1688 append(comment.toString().trim());
1689 } 1689 }
1690 1690
1691 /// Count spaces between these tokens. Tokens on different lines return 0. 1691 /// Count spaces between these tokens. Tokens on different lines return 0.
1692 int countSpacesBetween(Token last, Token current) => isEOF(last) || 1692 int countSpacesBetween(Token last, Token current) => isEOF(last) ||
1693 countNewlinesBetween(last, current) > 0 ? 0 : current.offset - last.end; 1693 countNewlinesBetween(last, current) > 0 ? 0 : current.offset - last.end;
1694 1694
1695 /// Count the blanks between these two nodes. 1695 /// Count the blanks between these two nodes.
1696 int countBlankLinesBetween(AstNode lastNode, AstNode currentNode) => 1696 int countBlankLinesBetween(AstNode lAstNode, AstNode currentNode) =>
Brian Wilkerson 2014/03/04 21:17:47 Was this rename intentional?
scheglov 2014/03/04 21:50:16 No, it wasn't. Thanks.
1697 countNewlinesBetween(lastNode.endToken, currentNode.beginToken); 1697 countNewlinesBetween(lAstNode.endToken, currentNode.beginToken);
1698 1698
1699 /// Count newlines preceeding this [node]. 1699 /// Count newlines preceeding this [node].
1700 int countPrecedingNewlines(AstNode node) => 1700 int countPrecedingNewlines(AstNode node) =>
1701 countNewlinesBetween(node.beginToken.previous, node.beginToken); 1701 countNewlinesBetween(node.beginToken.previous, node.beginToken);
1702 1702
1703 /// Count newlines succeeding this [node]. 1703 /// Count newlines succeeding this [node].
1704 int countSucceedingNewlines(AstNode node) => node == null ? 0 : 1704 int countSucceedingNewlines(AstNode node) => node == null ? 0 :
1705 countNewlinesBetween(node.endToken, node.endToken.next); 1705 countNewlinesBetween(node.endToken, node.endToken.next);
1706 1706
1707 /// Count the blanks between these two tokens. 1707 /// Count the blanks between these two tokens.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 var lastLine = 1752 var lastLine =
1753 lineInfo.getLocation(lastOffset).lineNumber; 1753 lineInfo.getLocation(lastOffset).lineNumber;
1754 var currentLine = 1754 var currentLine =
1755 lineInfo.getLocation(currentOffset).lineNumber; 1755 lineInfo.getLocation(currentOffset).lineNumber;
1756 return currentLine - lastLine; 1756 return currentLine - lastLine;
1757 } 1757 }
1758 1758
1759 String toString() => writer.toString(); 1759 String toString() => writer.toString();
1760 1760
1761 } 1761 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698