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

Handle nested if statements with alternates in printer #3180

Merged
merged 1 commit into from
Dec 18, 2015
Merged

Conversation

amasad
Copy link
Member

@amasad amasad commented Dec 18, 2015

Previously we saw a bug that when we have nested if statements
and an alternate then the generated code may confuse which
if statement the alternate belongs to.

e.g.

if (foo) if (bar) bar(); else baz();

But this was handled by looking at the consequent
and if it's an if we add a block. However we didn't
handle situations where it's not an if but the last
recursive statement is an if:

if (foo) while (bar) if (baz) baz(); else shoosh()

This handles it by recurring until we get the last
statement.

Previously we saw a bug that when we have nested if statements
and an alternate then the generated code may confuse which
if statement the alternate belongs to.

e.g.

```
if (foo) if (bar) bar(); else baz();
```

But this was handled by looking at the consequent
and if it's an if we add a block. However we didn't
handle situations where it's not an if but the last
recursive statement is an if:

```
if (foo) while (bar) if (baz) baz(); else shoosh()
```

This handles it by recurring until we get the last
statement.
@codecov-io
Copy link

Current coverage is 85.02%

Merging #3180 into master will decrease coverage by -0.01% as of b72ad70

@@            master   #3180   diff @@
======================================
  Files          215     215       
  Stmts        15628   15637     +9
  Branches      3338    3341     +3
  Methods          0       0       
======================================
+ Hit          13290   13295     +5
- Partial        683     687     +4
  Missed        1655    1655       

Review entire Coverage Diff as of b72ad70

Powered by Codecov. Updated on successful CI builds.

amasad added a commit that referenced this pull request Dec 18, 2015
Handle nested if statements with alternates in printer
@amasad amasad merged commit 4c69308 into master Dec 18, 2015
@amasad amasad deleted the needsblock branch December 18, 2015 07:06
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants