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

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

Issue 149793003: Empty map formatting fix (dartbug.com/16382). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/stmt_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/java_core.dart' show CharSequence; 10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence;
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 visitCommaSeparatedNodes(node.elements /*, followedBy: breakableSpace*/); 995 visitCommaSeparatedNodes(node.elements /*, followedBy: breakableSpace*/);
996 optionalTrailingComma(node.rightBracket); 996 optionalTrailingComma(node.rightBracket);
997 unindent(); 997 unindent();
998 token(node.rightBracket); 998 token(node.rightBracket);
999 } 999 }
1000 1000
1001 visitMapLiteral(MapLiteral node) { 1001 visitMapLiteral(MapLiteral node) {
1002 modifier(node.constKeyword); 1002 modifier(node.constKeyword);
1003 visitNode(node.typeArguments, followedBy: space); 1003 visitNode(node.typeArguments, followedBy: space);
1004 token(node.leftBracket); 1004 token(node.leftBracket);
1005 newlines(); 1005 if (!node.entries.isEmpty) {
1006 indent(); 1006 newlines();
1007 visitCommaSeparatedNodes(node.entries, followedBy: newlines); 1007 indent();
1008 optionalTrailingComma(node.rightBracket); 1008 visitCommaSeparatedNodes(node.entries, followedBy: newlines);
1009 unindent(); 1009 optionalTrailingComma(node.rightBracket);
1010 newlines(); 1010 unindent();
1011 newlines();
1012 }
1011 token(node.rightBracket); 1013 token(node.rightBracket);
1012 } 1014 }
1013 1015
1014 visitMapLiteralEntry(MapLiteralEntry node) { 1016 visitMapLiteralEntry(MapLiteralEntry node) {
1015 visit(node.key); 1017 visit(node.key);
1016 token(node.separator); 1018 token(node.separator);
1017 space(); 1019 space();
1018 visit(node.value); 1020 visit(node.value);
1019 } 1021 }
1020 1022
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 var lastLine = 1686 var lastLine =
1685 lineInfo.getLocation(lastOffset).lineNumber; 1687 lineInfo.getLocation(lastOffset).lineNumber;
1686 var currentLine = 1688 var currentLine =
1687 lineInfo.getLocation(currentOffset).lineNumber; 1689 lineInfo.getLocation(currentOffset).lineNumber;
1688 return currentLine - lastLine; 1690 return currentLine - lastLine;
1689 } 1691 }
1690 1692
1691 String toString() => writer.toString(); 1693 String toString() => writer.toString();
1692 1694
1693 } 1695 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/services/data/stmt_tests.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698