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

Unified Diff: lib/src/line_splitting/line_splitter.dart

Issue 1418483008: Optimize splitting lines with many rules. (Closed) Base URL: https://github.com/dart-lang/dart_style.git@master
Patch Set: Created 5 years, 1 month 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
Index: lib/src/line_splitting/line_splitter.dart
diff --git a/lib/src/line_splitting/line_splitter.dart b/lib/src/line_splitting/line_splitter.dart
index f562ca40dc699dc45f96e404f1b4ae7c2b66d207..78aa54dc7d17078382643c894d62eac2ecd2af6e 100644
--- a/lib/src/line_splitting/line_splitter.dart
+++ b/lib/src/line_splitting/line_splitter.dart
@@ -145,6 +145,12 @@ class LineSplitter {
for (var i = 0; i < rules.length; i++) {
rules[i].index = i;
}
+
+ // Now that every used rule has an index, tell the rules to discard any
+ // constraints on unindexed rules.
+ for (var rule in rules) {
+ rule.forgetUnusedRules();
+ }
}
/// Determine the best way to split the chunks into lines that fit in the

Powered by Google App Engine
This is Rietveld 408576698