-
-
Notifications
You must be signed in to change notification settings - Fork 777
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
Inline variable code action #3935
Comments
The compiler could also perform this optimisation automatically |
Not sure what you mean, sorry. What optimisation? |
Inlining variables. It's not much of an optimisation by itself, but it allows for further optimisations (just like function inlining). let a = 1
a + 2 Becomes: 1 + 2 Which the compiler should be able to infer as (although it doesn't currently): 3 |
Yeah but I think it's also very much a stylistic choice so having a code action to do it would be really nice |
Certainly |
I'm not sure what the motivation is there. An optimising compiler may perform that action if it expects that structure to be able to apply later optimisations, but we don't implement any optimisations, and if we did it may not benefit from this. |
Yeah perhaps it isn't useful right now |
An action that inlines a variable that is used once
The text was updated successfully, but these errors were encountered: