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

Return statements in sync methods need to be "yield break;" instead of "return;" #40

Open
JeroMiya opened this issue Jul 19, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@JeroMiya
Copy link
Owner

JeroMiya commented Jul 19, 2020

In sync functions in Dart, you can just return; without yielding a value to break the function. In C# the equivalent is yield break.

https://github.com/JeroMiya/xamarin.flutter/blob/master/FlutterSDK/src/Foundation/Diagnostics.cs#L1097-L1098

{
if (message.Length+startOffset<width){
yield message;
return ;
}

Note: Implementing this implies that the code outputting the return statement can be aware of whether the return statement is within a sync function or a regular function. That is not currently the case - so part of solving this issue is to pass down the method and/or function context (or some stripped down version of same) into the entity processing functions that need it.

@JeroMiya JeroMiya added the bug Something isn't working label Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant