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

Avoid excess breaks within switch (fix #5344) #5348

Closed
wants to merge 1 commit into from

Conversation

edemaine
Copy link
Contributor

  • Fix switch generates unneeded breaks #5344: no longer generate break when the case body exits on its own, typically by a forced return being pushed within if blocks.
  • Add new alwaysJumps node method to detect when a switch case can
    safely drop its break. Similar to jumps but ANDing instead of OR.
  • Fix some documentation describing jumps, which ignores throw; it turns out x = (throw 1) is valid CoffeeScript.

Add new `alwaysJumps` node method to detect when a switch case can
safely drop its `break`.  Similar to `jumps` but ANDing instead of OR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

switch generates unneeded breaks
2 participants