Skip to content

C#: Extract underlying methods of foreach statements#4628

Merged
tamasvajk merged 8 commits intogithub:mainfrom
tamasvajk:feature/csharp9-foreach
Feb 12, 2021
Merged

C#: Extract underlying methods of foreach statements#4628
tamasvajk merged 8 commits intogithub:mainfrom
tamasvajk:feature/csharp9-foreach

Conversation

@tamasvajk
Copy link
Copy Markdown
Contributor

@tamasvajk tamasvajk commented Nov 6, 2020

C#9 extends the foreach statement to allow using GetEnumerator extension methods. To extract these calls, this PR improves the extraction and stores all symbols related to foreach statements, such as GetEnumerator, MoveNext, Dispose methods, Current property, and element type.

TODO:

@github-actions github-actions bot added the C# label Nov 6, 2020
@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch 2 times, most recently from 1796341 to fe16a62 Compare November 19, 2020 09:36
@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch from fe16a62 to 2bd06c8 Compare December 8, 2020 08:47
@tamasvajk tamasvajk marked this pull request as ready for review December 8, 2020 10:24
@tamasvajk tamasvajk requested a review from a team as a code owner December 8, 2020 10:24
@tamasvajk

This comment has been minimized.

@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch 2 times, most recently from cfd8592 to 58447d4 Compare February 4, 2021 08:21
@tamasvajk

This comment has been minimized.

@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch from 2c7a143 to 6de5691 Compare February 4, 2021 10:37
@tamasvajk

This comment has been minimized.

@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch 2 times, most recently from e543711 to 1a9f76c Compare February 5, 2021 08:31
@tamasvajk

This comment has been minimized.

@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch from d88023a to ef55ca1 Compare February 7, 2021 08:07
Copy link
Copy Markdown
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

LGTM, minor comments.

@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch from e5f83be to 1bd154e Compare February 9, 2021 07:51
@tamasvajk tamasvajk force-pushed the feature/csharp9-foreach branch from 1bd154e to 9854b95 Compare February 9, 2021 13:45
@tamasvajk
Copy link
Copy Markdown
Contributor Author

@hvitved Can you have a look at the diff job? The performance got slightly better than before, but it's still not great. Shall we merge this PR with these perf changes?

}

private predicate hasChild(Stmt outer, Element child) {
outer = child.getParent()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add

and
(outer instanceof ForStmt or outer = any(ForStmt f).getBody())

that way the relation will be much smaller.

@tamasvajk tamasvajk merged commit 77af7ed into github:main Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants