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

Side by Side Diff: packages/petitparser/lib/src/reflection/optimize.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 part of petitparser.reflection;
2
3 /// Returns a copy of [parser] with all settable parsers removed.
4 Parser removeSettables(Parser parser) {
5 return transformParser(parser, (each) {
6 while (each is SettableParser) {
7 each = each.children.first;
8 }
9 return each;
10 });
11 }
12
13 /// Returns a copy of [parser] with all duplicates parsers collapsed.
14 Parser removeDuplicates(Parser parser) {
15 var uniques = new Set();
16 return transformParser(parser, (source) {
17 var target = uniques.firstWhere((each) {
18 return source != each && source.isEqualTo(each);
19 }, orElse: () => null);
20 if (target == null) {
21 uniques.add(source);
22 return source;
23 } else {
24 return target;
25 }
26 });
27 }
OLDNEW
« no previous file with comments | « packages/petitparser/lib/src/reflection/iterable.dart ('k') | packages/petitparser/lib/src/reflection/transform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698