Skip to content

Swift: Model property getters, setters and observers as callables #10155

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

Merged
merged 2 commits into from
Aug 24, 2022

Conversation

MathiasVP
Copy link
Contributor

@MathiasVP MathiasVP commented Aug 24, 2022

(Part of https://github.com/github/codeql-c-team/issues/903.)

This is the first of two dataflow PRs for field flow for Swift. It models property getters, setters, and observers as callables in the dataflow library. At the moment, this doesn't give us any field flow, but once we add read and store steps the dataflow library will see these getters and setters as read and writes steps.

Note that there's a slight error in the way we model the arguments to a didSet observer: we're passing the new value as an argument to the didSet observer, but the didSet observer actually takes the old value as an argument. I plan on fixing this in a later PR.

Finally, this PR also fixes an issue with multiple toStrings. The toString predicate had multiple results because NormalParameterNode was extending SsaDefinitionNode instead of SsaDefinitionNodeImpl.

@MathiasVP MathiasVP requested a review from a team as a code owner August 24, 2022 12:00
@github-actions github-actions bot added the Swift label Aug 24, 2022
@MathiasVP MathiasVP force-pushed the swift-properties-as-callables branch from c1d2da4 to edb29b4 Compare August 24, 2022 12:10
@MathiasVP MathiasVP merged commit 436fe65 into github:main Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants