Fixed #4316 (False positive: (constStatement) Redundant code)
This commit is contained in:
parent
e7aa1ec396
commit
4d085dd3fd
|
@ -6599,7 +6599,9 @@ bool Tokenizer::simplifyRedundantParenthesis()
|
|||
}
|
||||
}
|
||||
|
||||
while (Token::Match(tok->previous(), "[{([,:] ( !!{") && Token::Match(tok->link(), ") [;,])]")) {
|
||||
while (Token::Match(tok->previous(), "[{([,:] ( !!{") &&
|
||||
Token::Match(tok->link(), ") [;,])]") &&
|
||||
!Token::findmatch(tok, ",",tok->link())) {
|
||||
// We have "( ... )", remove the parenthesis
|
||||
tok->link()->deleteThis();
|
||||
tok->deleteThis();
|
||||
|
|
|
@ -4942,6 +4942,9 @@ private:
|
|||
ASSERT_EQUALS("a = b ? c : 123 ;", tokenizeAndStringify("a = b ? c : (123);", false));
|
||||
ASSERT_EQUALS("a = b ? c : 579 ;", tokenizeAndStringify("a = b ? c : ((123)+(456));", false));
|
||||
ASSERT_EQUALS("a = b ? 123 : c ;", tokenizeAndStringify("a = b ? (123) : c;", false));
|
||||
|
||||
// #4316
|
||||
ASSERT_EQUALS("a = b ? c : ( d = 1 , 0 ) ;", tokenizeAndStringify("a = b ? c : (d=1,0);", false));
|
||||
}
|
||||
|
||||
void tokenize_double() {
|
||||
|
|
Loading…
Reference in New Issue