Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid depending on iterator.current != null. #877

Merged
merged 3 commits into from
Jan 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions lib/src/extend/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,17 @@ List<List<T>> paths<T>(Iterable<List<T>> choices) => choices.fold(
QueueList<List<ComplexSelectorComponent>> _groupSelectors(
Iterable<ComplexSelectorComponent> complex) {
var groups = QueueList<List<ComplexSelectorComponent>>();
var iterator = complex.iterator..moveNext();
while (iterator.current != null) {
var group = <ComplexSelectorComponent>[];
do {
var iterator = complex.iterator;
if (!iterator.moveNext()) return groups;
var group = <ComplexSelectorComponent>[iterator.current];
groups.add(group);
while (iterator.moveNext()) {
if (group.last is Combinator || iterator.current is Combinator) {
group.add(iterator.current);
} while (iterator.moveNext() &&
(iterator.current is Combinator || group.last is Combinator));
groups.add(group);
} else {
group = [iterator.current];
groups.add(group);
}
}
return groups;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you lost this return.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, doh. Caught red-handed using the Github editor :)

}
Expand Down