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

Fix: optimising switches could change variable scope #179

Merged
merged 1 commit into from Feb 6, 2021

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Dec 24, 2020

When optimising switches are optimised as expression, a different scope may be used as an expression implies the creation of a return action in the referencing scope.
For switches it's easy to just rewrite them so they are like a return action, but in the correct scope.
For random switches it's not so simple, so just don't optimise them if they return expressions.

@glx22 glx22 merged commit 597685d into OpenTTD:master Feb 6, 2021
@glx22 glx22 deleted the switch_optimisation branch February 6, 2021 15:26
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.

None yet

2 participants