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

Side by Side Diff: lib/src/line_splitting/solve_state.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/debug.dart ('k') | lib/src/rule/argument.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.line_splitting.solve_state; 5 library dart_style.src.line_splitting.solve_state;
6 6
7 import '../debug.dart' as debug; 7 import '../debug.dart' as debug;
8 import '../rule/rule.dart'; 8 import '../rule/rule.dart';
9 import '../whitespace.dart'; 9 import '../whitespace.dart';
10 import 'line_splitter.dart'; 10 import 'line_splitter.dart';
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 /// invalid constraints on the currently bound values. 90 /// invalid constraints on the currently bound values.
91 /// 91 ///
92 /// For example, say rule A is bound to 1 and B is unbound. If B has value 92 /// For example, say rule A is bound to 1 and B is unbound. If B has value
93 /// 1, it constrains A to be 1. Likewise, if B is 2, it constrains A to be 93 /// 1, it constrains A to be 1. Likewise, if B is 2, it constrains A to be
94 /// 2 as well. Since we already know A is 1, that means we know B cannot be 94 /// 2 as well. Since we already know A is 1, that means we know B cannot be
95 /// bound to value 2. This means B is more limited in this state than it 95 /// bound to value 2. This means B is more limited in this state than it
96 /// might be in another state that binds A to a different value. 96 /// might be in another state that binds A to a different value.
97 /// 97 ///
98 /// It's important to track this, because we can't allow to states to overlap 98 /// It's important to track this, because we can't allow to states to overlap
99 /// if one permits more values for some unbound rule than the other does. 99 /// if one permits more values for some unbound rule than the other does.
100 Map<Rule, List<int>> _unboundConstraints; 100 Map<Rule, Set<int>> _unboundConstraints;
101 101
102 /// The bound rules that appear inside lines also containing unbound rules. 102 /// The bound rules that appear inside lines also containing unbound rules.
103 /// 103 ///
104 /// By appearing in the same line, it means these bound rules may affect the 104 /// By appearing in the same line, it means these bound rules may affect the
105 /// results of binding those unbound rules. This is used to tell if two 105 /// results of binding those unbound rules. This is used to tell if two
106 /// states may diverge by binding unbound rules or not. 106 /// states may diverge by binding unbound rules or not.
107 Set<Rule> _boundRulesInUnboundLines; 107 Set<Rule> _boundRulesInUnboundLines;
108 108
109 SolveState(this._splitter, this._ruleValues) { 109 SolveState(this._splitter, this._ruleValues) {
110 _calculateSplits(); 110 _calculateSplits();
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 585
586 buffer.write(" \$${splits.cost}"); 586 buffer.write(" \$${splits.cost}");
587 587
588 if (overflowChars > 0) buffer.write(" (${overflowChars} over)"); 588 if (overflowChars > 0) buffer.write(" (${overflowChars} over)");
589 if (!_isComplete) buffer.write(" (incomplete)"); 589 if (!_isComplete) buffer.write(" (incomplete)");
590 if (splits == null) buffer.write(" invalid"); 590 if (splits == null) buffer.write(" invalid");
591 591
592 return buffer.toString(); 592 return buffer.toString();
593 } 593 }
594 } 594 }
OLDNEW
« no previous file with comments | « lib/src/debug.dart ('k') | lib/src/rule/argument.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698