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

Conversation

lrhn
Copy link
Contributor

@lrhn lrhn commented Nov 7, 2019

With the NNBD change to Dart, it's no longer safe to rely on an iterator returning null when it has hit the end (or before calling moveNext the first time). For non-nullable element types, it will have to throw instead.

This PR rewrites code that currently rely on a null value to recognize the end of an iterator.

lib/src/extend/functions.dart Outdated Show resolved Hide resolved
@nex3
Copy link
Contributor

nex3 commented Dec 20, 2019

@lrhn Are you planning to continue working on this?

@lrhn
Copy link
Contributor Author

lrhn commented Dec 20, 2019

Ack, yes. I admit I had forgotten this PR existed. Sorry about that.

With the NNBD change to Dart, it's no longer safe to rely on an iterator returning `null` when it has hit the end (or before calling `moveNext` the first time). For non-nullable element types, it will have to throw instead.

This PR rewrites code that currently rely on a `null` value to recognize the end of an iterator.
}
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 :)

@nex3 nex3 merged commit 31c0960 into sass:master Jan 7, 2020
@nex3
Copy link
Contributor

nex3 commented Jan 7, 2020

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants