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

Side by Side Diff: packages/dart_style/lib/src/rule/type_argument.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.rule.type_argument; 5 library dart_style.src.rule.type_argument;
6 6
7 import '../chunk.dart'; 7 import '../chunk.dart';
8 import 'rule.dart'; 8 import 'rule.dart';
9 9
10 /// Rule for splitting a list of type arguments or type parameters. Type 10 /// Rule for splitting a list of type arguments or type parameters. Type
(...skipping 25 matching lines...) Expand all
36 int get numValues => _arguments.length == 1 ? 2 : _arguments.length + 2; 36 int get numValues => _arguments.length == 1 ? 2 : _arguments.length + 2;
37 37
38 /// Remembers [chunk] as containing the split that occurs right before a type 38 /// Remembers [chunk] as containing the split that occurs right before a type
39 /// argument in the list. 39 /// argument in the list.
40 void beforeArgument(Chunk chunk) { 40 void beforeArgument(Chunk chunk) {
41 _arguments.add(chunk); 41 _arguments.add(chunk);
42 } 42 }
43 43
44 bool isSplit(int value, Chunk chunk) { 44 bool isSplit(int value, Chunk chunk) {
45 // Don't split at all. 45 // Don't split at all.
46 if (value == 0) return false; 46 if (value == Rule.unsplit) return false;
47 47
48 // Split before every argument. 48 // Split before every argument.
49 if (value == numValues - 1) return true; 49 if (value == numValues - 1) return true;
50 50
51 // Split before a single argument. Try later arguments before earlier ones 51 // Split before a single argument. Try later arguments before earlier ones
52 // to try to keep as much on the first line as possible. 52 // to try to keep as much on the first line as possible.
53 return chunk == _arguments[_arguments.length - value]; 53 return chunk == _arguments[_arguments.length - value];
54 } 54 }
55
56 String toString() => "TypeArg${super.toString()}";
55 } 57 }
OLDNEW
« no previous file with comments | « packages/dart_style/lib/src/rule/rule.dart ('k') | packages/dart_style/lib/src/source_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698