I only want to know if there’s a break between two cases (or between a case and default). I dump a CastStmt AST, but not found a BreakStmt. That’s why i asked for help here.
------------------ Original ------------------
I only want to know if there’s a break between two cases (or between a case and default). I dump a CastStmt AST, but not found a BreakStmt. That’s why i asked for help here.
------------------ Original ------------------
You do realize that if someone used a “return” or a “throw” then you will miss this ?
– Matthieu
I was under the impression that he’s trying to verify that every case has an explicit break in order to enforce a coding standard that forbids fall-through. But I might be wrong.
I was under the impression that he’s trying to verify that every case has an explicit break in order to enforce a coding standard that forbids fall-through. But I might be wrong.
I suppose so too, and I can assure you that return
does not allow a fall-through to ensue.
– Matthieu