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

Unified Diff: dart_style/lib/src/rule/type_argument.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart_style/lib/src/rule/rule.dart ('k') | dart_style/lib/src/source_code.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart_style/lib/src/rule/type_argument.dart
diff --git a/dart_style/lib/src/rule/type_argument.dart b/dart_style/lib/src/rule/type_argument.dart
deleted file mode 100644
index ebac6c8a7b5422f3df405dd905fb604f1d950aec..0000000000000000000000000000000000000000
--- a/dart_style/lib/src/rule/type_argument.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart_style.src.rule.type_argument;
-
-import '../chunk.dart';
-import 'rule.dart';
-
-/// Rule for splitting a list of type arguments or type parameters. Type
-/// parameters split a little differently from normal value argument lists. In
-/// particular, this tries harder to avoid splitting before the first type
-/// argument since that looks stranger with `<...>` than it does with `(...)`.
-///
-/// The values for a rule for `n` arguments are:
-///
-/// 3 args
-/// 0 : no
-/// 1 : before arg 2
-/// 2: before arg 1
-/// 3: before arg 0
-/// 4: all
-///
-/// * `0`: No splits at all.
-/// * `1 ... n`: Split before one argument, starting from the last.
-/// * `n + 1`: Split before all arguments.
-///
-/// If there is only one type argument, the last two cases collapse and there
-/// are only two values.
-class TypeArgumentRule extends Rule {
- /// The chunks prior to each positional type argument.
- final List<Chunk> _arguments = [];
-
- int get cost => Cost.typeArgument;
-
- int get numValues => _arguments.length == 1 ? 2 : _arguments.length + 2;
-
- /// Remembers [chunk] as containing the split that occurs right before a type
- /// argument in the list.
- void beforeArgument(Chunk chunk) {
- _arguments.add(chunk);
- }
-
- bool isSplit(int value, Chunk chunk) {
- // Don't split at all.
- if (value == 0) return false;
-
- // Split before every argument.
- if (value == numValues - 1) return true;
-
- // Split before a single argument. Try later arguments before earlier ones
- // to try to keep as much on the first line as possible.
- return chunk == _arguments[_arguments.length - value];
- }
-}
« no previous file with comments | « dart_style/lib/src/rule/rule.dart ('k') | dart_style/lib/src/source_code.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698