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

Support for foreach (HAST-245) #43

Open
Piedone opened this issue Dec 28, 2019 · 0 comments
Open

Support for foreach (HAST-245) #43

Piedone opened this issue Dec 28, 2019 · 0 comments

Comments

@Piedone
Copy link
Member

Piedone commented Dec 28, 2019

If DecompilerSettings.ForEachStatement is set to false then foreach statements are not recreated. So e.g. in ParallelAlgorithn instead of:

for (int i = 0; i < MaxDegreeOfParallelism; i++)
{
    output += tasks[i].Result;
}

We could write:

foreach (var task in tasks)
{
    output += task.Result;
}

This is then decompiled into something like this (after const substitution):

int i = 0;
while (i< 280) {
	Task<int> task;
	task = array[i];
	output = output + task.Result;
	i = i + 1;
}

The Task<int> variable declaration and the .Result access need special support, otherwise, this is already supported.

Jira issue

@github-actions github-actions bot changed the title Support for foreach Support for foreach (HAST-245) Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant