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

[c#] lower get accessor declarations to get_* methods #5265

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

xavierpinho
Copy link
Contributor

Reworks get; accessors to become METHODs instead of MEMBERs. At this point, we already have special logic for rewriting e.g. Console.Out into Console.get_Out() (as that's its real name, coming from DotNetAstGen), but we are still missing the same lowering for properties declared in the source-code, which are currently represented as MEMBERs. This PR turns them into get_* METHODs.

I had to ignore 3 unit-tests related to MemberBindingExpression + ConditionalAccessExpression: the original test samples for these were using getters, though they didn't have to, as can be seen by their adapted variants using traditional fields. Thus, we didn't lose on the amount of tests, only adapted them for now. Fixing all that in the same PR would make it considerably more noisy, hence the split.

@xavierpinho xavierpinho added the c# Relates to csharpsrc2cpg label Jan 28, 2025
@xavierpinho xavierpinho merged commit 21f2bc7 into master Jan 28, 2025
5 checks passed
@xavierpinho xavierpinho deleted the xavierp/c#-get-properties-lowering branch January 28, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c# Relates to csharpsrc2cpg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants