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
Optimization: Unreachable break added when throwing in switch cases #4020
Comments
Why are you linting the generated javascript? |
Because the tooling for JavaScript surpasses the tooling for CoffeeScript. We use a combination of coffeelint and jshint for this reason. That said, I don't think our choice of linting tools is entirely relevant. CoffeeScript already omits the |
Seems like checking for |
Same thing happens when the return value is either assigned, or the return value of the switch statement is also the return of a function. b = switch
when a > 10
"greater than 10"
when a < 10
if a > 5
"greater than five"
else
"less than five"
else
"is 10" var b;
b = (function() {
switch (false) {
case !(a > 10):
return "greater than 10";
case !(a < 10):
if (a > 5) {
return "greater than five";
} else {
return "less than five";
}
break;
default:
return "is 10";
}
})(); |
Example Coffee:
Compiles to:
Which, while valid, throws off some linters because the
break
statement is unreachable.The text was updated successfully, but these errors were encountered: