Open blickly opened 10 years ago
I threw together a simple patch for this one that just checked for a break/return/throw at the end of a case
, and it warned on a few cases like this:
switch (foo) {
case 1:
if (bar) {
return x;
} else {
return y;
}
default: ...
}
I think to do this properly we probably want to look at the control flow graph.
I think we need to do this CFG analysis when optimizing switch statements, you might want to take a look there.
This issue was imported from Closure Compiler's previous home at http://closure-compiler.googlecode.com
The original discussion is archived at: http://blickly.github.io/closure-compiler-issues/#1104