| OLD | NEW |
| 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.argument_list_visitor; | 5 library dart_style.src.argument_list_visitor; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/scanner.dart'; | 8 import 'package:analyzer/src/generated/scanner.dart'; |
| 9 | 9 |
| 10 import 'chunk.dart'; | 10 import 'chunk.dart'; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 return new ArgumentSublist._(allArguments, positional, named, collections, | 284 return new ArgumentSublist._(allArguments, positional, named, collections, |
| 285 leadingCollections, trailingCollections); | 285 leadingCollections, trailingCollections); |
| 286 } | 286 } |
| 287 | 287 |
| 288 ArgumentSublist._(this._allArguments, this._positional, this._named, | 288 ArgumentSublist._(this._allArguments, this._positional, this._named, |
| 289 this._collections, this._leadingCollections, this._trailingCollections); | 289 this._collections, this._leadingCollections, this._trailingCollections); |
| 290 | 290 |
| 291 void visit(SourceVisitor visitor) { | 291 void visit(SourceVisitor visitor) { |
| 292 if (_collections.isNotEmpty) { | 292 if (_collections.isNotEmpty) { |
| 293 _collectionRule = new SimpleRule(Cost.splitCollections); | 293 _collectionRule = new Rule(Cost.splitCollections); |
| 294 } | 294 } |
| 295 | 295 |
| 296 var rule = _visitPositional(visitor); | 296 var rule = _visitPositional(visitor); |
| 297 _visitNamed(visitor, rule); | 297 _visitNamed(visitor, rule); |
| 298 } | 298 } |
| 299 | 299 |
| 300 /// Writes the positional arguments, if any. | 300 /// Writes the positional arguments, if any. |
| 301 PositionalRule _visitPositional(SourceVisitor visitor) { | 301 PositionalRule _visitPositional(SourceVisitor visitor) { |
| 302 if (_positional.isEmpty) return null; | 302 if (_positional.isEmpty) return null; |
| 303 | 303 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 // TODO(rnystrom): Should we step into parenthesized expressions? | 423 // TODO(rnystrom): Should we step into parenthesized expressions? |
| 424 | 424 |
| 425 if (expression is ListLiteral) return expression.leftBracket; | 425 if (expression is ListLiteral) return expression.leftBracket; |
| 426 if (expression is MapLiteral) return expression.leftBracket; | 426 if (expression is MapLiteral) return expression.leftBracket; |
| 427 | 427 |
| 428 // Not a collection literal. | 428 // Not a collection literal. |
| 429 return null; | 429 return null; |
| 430 } | 430 } |
| 431 } | 431 } |
| OLD | NEW |