| 977 | } |
| 978 | |
| 979 | static bool isVardeclInSwitch(const Token* tok) |
| 980 | { |
| 981 | if (!tok) |
| 982 | return false; |
| 983 | if (!isNestedInSwitch(tok->scope())) |
| 984 | return false; |
| 985 | if (const Token* end = Token::findsimplematch(tok, ";")) { |
| 986 | for (const Token* tok2 = tok; tok2 != end; tok2 = tok2->next()) { |
| 987 | if (tok2->isKeyword() && tok2->str() == "case") |
| 988 | return false; |
| 989 | if (tok2->variable() && tok2->variable()->nameToken() == tok2) { |
| 990 | end = tok2->scope()->bodyEnd; |
| 991 | for (const Token* tok3 = tok2; tok3 != end; tok3 = tok3->next()) { |
| 992 | if (tok3->isKeyword()) |
| 993 | return tok3->str() == "case"; |
| 994 | } |
| 995 | return false; |
| 996 | } |
| 997 | } |
| 998 | } |
| 999 | return false; |
| 1000 | } |
| 1001 | |
| 1002 | //--------------------------------------------------------------------------- |
| 1003 | // Find consecutive return, break, continue, goto or throw statements. e.g.: |
no test coverage detected