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

Parentheses omitted when IF THEN ELSE optimization is applied #152

Closed
chrispcampbell opened this issue Oct 23, 2021 · 0 comments · Fixed by #153 or #190
Closed

Parentheses omitted when IF THEN ELSE optimization is applied #152

chrispcampbell opened this issue Oct 23, 2021 · 0 comments · Fixed by #153 or #190
Assignees
Labels
Milestone

Comments

@chrispcampbell
Copy link
Contributor

I found an issue with the IF THEN ELSE optimization that was implemented for #102. When the optimization is applied, the code gen failed to preserve the parentheses, which are sometimes critical.

Example that demonstrates the problem:

constant = 1 ~~|
a = IF THEN ELSE(constant, b + c, d - e) * 10 ~~|

In this case, SDE currently generates incorrect code:

_a = _b + _c * 10;

It should instead preserve the parentheses:

_a = (_b + _c) * 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment