fix syntax error for a.operator++() ? a.operator--() : 0 (#2382)
This commit is contained in:
parent
98488790a1
commit
df952926f8
|
@ -10815,7 +10815,7 @@ void Tokenizer::deleteSymbolDatabase()
|
|||
bool Tokenizer::operatorEnd(const Token * tok) const
|
||||
{
|
||||
if (tok && tok->str() == ")") {
|
||||
if (isFunctionHead(tok, "{|;"))
|
||||
if (isFunctionHead(tok, "{|;|?|:"))
|
||||
return true;
|
||||
|
||||
tok = tok->next();
|
||||
|
|
|
@ -408,6 +408,7 @@ private:
|
|||
TEST_CASE(simplifyOperatorName21);
|
||||
TEST_CASE(simplifyOperatorName22);
|
||||
TEST_CASE(simplifyOperatorName23);
|
||||
TEST_CASE(simplifyOperatorName24);
|
||||
|
||||
TEST_CASE(simplifyNullArray);
|
||||
|
||||
|
@ -6547,6 +6548,19 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void simplifyOperatorName24() {
|
||||
{
|
||||
const char code[] = "void foo() { int i = a.operator++() ? a.operator--() : 0; }";
|
||||
ASSERT_EQUALS("void foo ( ) { int i ; i = a . operator++ ( ) ? a . operator-- ( ) : 0 ; }",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
{
|
||||
const char code[] = "void foo() { int i = a.operator++(0) ? a.operator--(0) : 0; }";
|
||||
ASSERT_EQUALS("void foo ( ) { int i ; i = a . operator++ ( 0 ) ? a . operator-- ( 0 ) : 0 ; }",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyNullArray() {
|
||||
ASSERT_EQUALS("* ( foo . bar [ 5 ] ) = x ;", tokenizeAndStringify("0[foo.bar[5]] = x;"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue