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

Don't show 'Empty block' warnings for non-existent await branches #2596

Merged
merged 1 commit into from
May 4, 2019
Merged

Don't show 'Empty block' warnings for non-existent await branches #2596

merged 1 commit into from
May 4, 2019

Conversation

EmilTholin
Copy link
Member

@EmilTholin EmilTholin commented Apr 27, 2019

This PR removes the Empty block warnings from non-existent await branches and closes #1716.

The warnings are currently generated because a PendingBlock, ThenBlock, and CatchBlock are always created for every AwaitBlock. By introducing a skip boolean in the node info of these blocks and setting it to false only when the branch is used, we can use skip to conditionally call warn_if_empty_block.

I first started experimenting with only adding pending, then, and catch to the await block if they were used, but that had ripples throughout the codebase, so I'm not sure if that's desired for such a small fix as this one.

@Rich-Harris
Copy link
Member

That seems like a reasonable approach to me, we can optimise the empty blocks away another time

@Rich-Harris Rich-Harris merged commit 006509a into sveltejs:master May 4, 2019
@EmilTholin EmilTholin deleted the await-empty-block-warnings branch May 4, 2019 15:06
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.

Erroneous empty block warnings for compact await blocks
2 participants