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

Swift: restrict field inline to only private variables #618

Merged
merged 5 commits into from
Sep 26, 2023

Conversation

Adarsh-NP
Copy link
Contributor

@Adarsh-NP Adarsh-NP commented Sep 21, 2023

This PR restricts deletion of private variables of a class but here are the regressions it will cause:

  • Things inside init will not be inlined because of the new modifier node we are trying to catch.
  • Why don’t we create a separate rule to clean inside init like we did for variables in function?
    • We get issues because of constructor scope collision resulting in no cleanup
  • Ad-hoc variable declarations inside init will not be cleaned up.

The problem with modifiers can be solved by tweaking ts-grammar again to give the modifiers node always and then have visibility modifier as none to cover the case of declarations of just var a.

Please refer to test changes to understand more.

Land after: #613

@Adarsh-NP Adarsh-NP changed the title Vip restriction Swift: restrict field inline to only private variables Sep 21, 2023
@Adarsh-NP Adarsh-NP merged commit 907aa9a into master Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants