Execute prepareTernaryOpForAST earlier (#7048)
This commit is contained in:
parent
600641c4c5
commit
46bfa62aad
|
@ -1713,8 +1713,6 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
|
|
||||||
if (simplifyTokenList1(FileName)) {
|
if (simplifyTokenList1(FileName)) {
|
||||||
if (!noSymbolDB_AST) {
|
if (!noSymbolDB_AST) {
|
||||||
prepareTernaryOpForAST();
|
|
||||||
|
|
||||||
createSymbolDatabase();
|
createSymbolDatabase();
|
||||||
|
|
||||||
// Use symbol database to identify rvalue references. Split && to & &. This is safe, since it doesn't delete any tokens (which might be referenced by symbol database)
|
// Use symbol database to identify rvalue references. Split && to & &. This is safe, since it doesn't delete any tokens (which might be referenced by symbol database)
|
||||||
|
@ -3402,6 +3400,9 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
|
||||||
// Remove __asm..
|
// Remove __asm..
|
||||||
simplifyAsm();
|
simplifyAsm();
|
||||||
|
|
||||||
|
// Add parantheses to ternary operator where necessary
|
||||||
|
prepareTernaryOpForAST();
|
||||||
|
|
||||||
// Change initialisation of variable to assignment
|
// Change initialisation of variable to assignment
|
||||||
simplifyInitVar();
|
simplifyInitVar();
|
||||||
|
|
||||||
|
|
|
@ -255,6 +255,7 @@ private:
|
||||||
TEST_CASE(vardecl2);
|
TEST_CASE(vardecl2);
|
||||||
TEST_CASE(vardecl3);
|
TEST_CASE(vardecl3);
|
||||||
TEST_CASE(vardecl4);
|
TEST_CASE(vardecl4);
|
||||||
|
TEST_CASE(vardecl5); // #7048
|
||||||
TEST_CASE(vardec_static);
|
TEST_CASE(vardec_static);
|
||||||
TEST_CASE(vardecl6);
|
TEST_CASE(vardecl6);
|
||||||
TEST_CASE(vardecl7);
|
TEST_CASE(vardecl7);
|
||||||
|
@ -3507,6 +3508,14 @@ private:
|
||||||
ASSERT_EQUALS(res4, tokenizeAndStringify(code4));
|
ASSERT_EQUALS(res4, tokenizeAndStringify(code4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vardecl5() {
|
||||||
|
ASSERT_EQUALS("void foo ( int nX ) {\n"
|
||||||
|
"int addI ; addI = frontPoint == 2 || frontPoint == 1 ? ( i = 0 , 1 ) : ( i = nX - 2 , -1 ) ;\n"
|
||||||
|
"}", tokenizeAndStringify("void foo(int nX) {\n"
|
||||||
|
" int addI = frontPoint == 2 || frontPoint == 1 ? i = 0, 1 : (i = nX - 2, -1);\n"
|
||||||
|
"}"));
|
||||||
|
}
|
||||||
|
|
||||||
void vardecl_stl_1() {
|
void vardecl_stl_1() {
|
||||||
// ticket #520
|
// ticket #520
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue