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

Implement spread operator in list literals. #50

Open
JeroMiya opened this issue Jul 21, 2020 · 0 comments
Open

Implement spread operator in list literals. #50

JeroMiya opened this issue Jul 21, 2020 · 0 comments
Labels
enhancement New feature or request high priority High priority issue causing other unrelated failures.

Comments

@JeroMiya
Copy link
Owner

JeroMiya commented Jul 21, 2020

There's currently a workaround implemented which comments out spread elements in list literal initializers. However, the spread operator is used extensively throughout Flutter and it needs to be fully implemented.

I'm going to hazard a guess that we'll want to implement two versions of the list literal processor - one for list literals without spread and one with spread, in case the C# implementation with spread has some runtime overhead that we could avoid if there's no spread operator in a literal.

I think the C# implementation of the spread will be to use a helper function that constructs the list, instead of a new expression. Something along these lines:

// Original Dart code: return <string>['item 1', ...spreadOperand];
return DartUtils.MakeListWithSpreads<string>(list => {
    list.Add('item 1');
    foreach(var i in spreadOperand) {
        list.Add(i);
    }
});
@JeroMiya JeroMiya added enhancement New feature or request high priority High priority issue causing other unrelated failures. labels Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority High priority issue causing other unrelated failures.
Projects
None yet
Development

No branches or pull requests

1 participant