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

Side by Side Diff: lib/src/rule/metadata.dart

Issue 1492683002: Change the way hard splits are handled. (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/rule/combinator.dart ('k') | lib/src/rule/rule.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) 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.metadata; 5 library dart_style.src.rule.metadata;
6 6
7 import 'argument.dart'; 7 import 'argument.dart';
8 import 'rule.dart'; 8 import 'rule.dart';
9 9
10 /// Rule for handling splits between parameter metadata annotations and the 10 /// Rule for handling splits between parameter metadata annotations and the
11 /// following parameter. 11 /// following parameter.
12 /// 12 ///
13 /// Metadata annotations for parameters (and type parameters) get some special 13 /// Metadata annotations for parameters (and type parameters) get some special
14 /// handling. We use a single rule for all annotations in the parameter list. 14 /// handling. We use a single rule for all annotations in the parameter list.
15 /// If any of the annotations split, they all do. 15 /// If any of the annotations split, they all do.
16 /// 16 ///
17 /// Also, if the annotations split, we force the entire parameter list to fully 17 /// Also, if the annotations split, we force the entire parameter list to fully
18 /// split, both named and positional. 18 /// split, both named and positional.
19 class MetadataRule extends SimpleRule { 19 class MetadataRule extends Rule {
20 Rule _positionalRule; 20 Rule _positionalRule;
21 Rule _namedRule; 21 Rule _namedRule;
22 22
23 /// Remembers that [rule] is the [PositionalRule] used by the argument list 23 /// Remembers that [rule] is the [PositionalRule] used by the argument list
24 /// containing the parameter metadata using this rule. 24 /// containing the parameter metadata using this rule.
25 void bindPositionalRule(PositionalRule rule) { 25 void bindPositionalRule(PositionalRule rule) {
26 _positionalRule = rule; 26 _positionalRule = rule;
27 } 27 }
28 28
29 /// Remembers that [rule] is the [NamedRule] used by the argument list 29 /// Remembers that [rule] is the [NamedRule] used by the argument list
(...skipping 27 matching lines...) Expand all
57 super.forgetUnusedRules(); 57 super.forgetUnusedRules();
58 if (_positionalRule != null && _positionalRule.index == null) { 58 if (_positionalRule != null && _positionalRule.index == null) {
59 _positionalRule = null; 59 _positionalRule = null;
60 } 60 }
61 61
62 if (_namedRule != null && _namedRule.index == null) { 62 if (_namedRule != null && _namedRule.index == null) {
63 _namedRule = null; 63 _namedRule = null;
64 } 64 }
65 } 65 }
66 } 66 }
OLDNEW
« no previous file with comments | « lib/src/rule/combinator.dart ('k') | lib/src/rule/rule.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698