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

Side by Side Diff: lib/src/dart_formatter.dart

Issue 1493553002: Smarter splitting around named collection arguments. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « lib/src/call_chain_visitor.dart ('k') | lib/src/debug.dart » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart_style.src.dart_formatter; 5 library dart_style.src.dart_formatter;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 var node; 104 var node;
105 if (source.isCompilationUnit) { 105 if (source.isCompilationUnit) {
106 node = parser.parseCompilationUnit(startToken); 106 node = parser.parseCompilationUnit(startToken);
107 } else { 107 } else {
108 node = parser.parseStatement(startToken); 108 node = parser.parseStatement(startToken);
109 109
110 // Make sure we consumed all of the source. 110 // Make sure we consumed all of the source.
111 var token = node.endToken.next; 111 var token = node.endToken.next;
112 if (token.type != TokenType.EOF) { 112 if (token.type != TokenType.EOF) {
113 var error = new AnalysisError.con2( 113 var error = new AnalysisError(
114 stringSource, 114 stringSource,
115 token.offset, 115 token.offset,
116 math.max(token.length, 1), 116 math.max(token.length, 1),
117 ParserErrorCode.UNEXPECTED_TOKEN, 117 ParserErrorCode.UNEXPECTED_TOKEN,
118 [token.lexeme]); 118 [token.lexeme]);
119 119
120 throw new FormatterException([error]); 120 throw new FormatterException([error]);
121 } 121 }
122 } 122 }
123 123
124 errorListener.throwIfErrors(); 124 errorListener.throwIfErrors();
125 125
126 // Format it. 126 // Format it.
127 var visitor = new SourceVisitor(this, lineInfo, source); 127 var visitor = new SourceVisitor(this, lineInfo, source);
128 return visitor.run(node); 128 return visitor.run(node);
129 } 129 }
130 } 130 }
OLDNEW
« no previous file with comments | « lib/src/call_chain_visitor.dart ('k') | lib/src/debug.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698