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

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

Issue 1255643002: New, simpler and faster line splitter. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Optimize nesting. Reformat. Created 5 years, 5 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 | « lib/src/nesting_level.dart ('k') | lib/src/rule_set.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/rule/rule.dart
diff --git a/lib/src/rule/rule.dart b/lib/src/rule/rule.dart
index 1fdadefdf26fd02e272012b6b824499e2b73fbee..43a7f6aae2c14119d5c198a80997627560d981cd 100644
--- a/lib/src/rule/rule.dart
+++ b/lib/src/rule/rule.dart
@@ -25,17 +25,9 @@ abstract class Rule extends FastHash {
int get cost => Cost.normal;
- /// The span of [Chunk]s that were written while this rule was still in
- /// effect.
- ///
- /// This is used to tell which rules should be pre-emptively split if their
- /// contents are too long. This may be a wider range than the set of chunks
- /// enclosed by chunks whose rule is this one. A rule may still be on the
- /// list of open rules for a while after its last chunk is written.
- // TODO(rnystrom): These are only used by preemption which is kind of hacky.
- // Remove this if preemption is redone.
- int start;
- int end;
+ /// During line splitting [LineSplitter] sets this to the index of this
+ /// rule in its list of rules.
+ int index;
/// The other [Rule]s that "surround" this one (and care about that fact).
///
@@ -86,19 +78,6 @@ abstract class Rule extends FastHash {
return null;
}
- /// Like [constrain], but in the other direction.
- ///
- /// If [other] has [otherValue], returns the constrained value this rule may
- /// have, or `null` if any value is allowed.
- int reverseConstrain(int otherValue, Rule other) {
- // If [other] did not fully split, then we can't split either if us
- // splitting implies that it should have.
- if (otherValue == other.fullySplitValue) return null;
- if (_outerRules.contains(other)) return 0;
-
- return null;
- }
-
String toString() => "$id";
}
« no previous file with comments | « lib/src/nesting_level.dart ('k') | lib/src/rule_set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698