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

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

Issue 196983003: Fix handling of 'else if' statement blocks (dartbug.com/17363). (Closed) Base URL: http://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
« 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/parser.dart'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 token(node.leftParenthesis); 917 token(node.leftParenthesis);
918 visit(node.condition); 918 visit(node.condition);
919 token(node.rightParenthesis); 919 token(node.rightParenthesis);
920 }); 920 });
921 space(); 921 space();
922 if (hasElse) { 922 if (hasElse) {
923 printAsBlock(node.thenStatement); 923 printAsBlock(node.thenStatement);
924 space(); 924 space();
925 token(node.elseKeyword); 925 token(node.elseKeyword);
926 space(); 926 space();
927 printAsBlock(node.elseStatement); 927 if (node.elseStatement is IfStatement) {
928 visit(node.elseStatement);
929 } else {
930 printAsBlock(node.elseStatement);
931 }
928 } else { 932 } else {
929 visit(node.thenStatement); 933 visit(node.thenStatement);
930 } 934 }
931 } 935 }
932 936
933 visitImplementsClause(ImplementsClause node) { 937 visitImplementsClause(ImplementsClause node) {
934 token(node.keyword); 938 token(node.keyword);
935 space(); 939 space();
936 visitCommaSeparatedNodes(node.interfaces); 940 visitCommaSeparatedNodes(node.interfaces);
937 } 941 }
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 var lastLine = 1753 var lastLine =
1750 lineInfo.getLocation(lastOffset).lineNumber; 1754 lineInfo.getLocation(lastOffset).lineNumber;
1751 var currentLine = 1755 var currentLine =
1752 lineInfo.getLocation(currentOffset).lineNumber; 1756 lineInfo.getLocation(currentOffset).lineNumber;
1753 return currentLine - lastLine; 1757 return currentLine - lastLine;
1754 } 1758 }
1755 1759
1756 String toString() => writer.toString(); 1760 String toString() => writer.toString();
1757 1761
1758 } 1762 }
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