simplifyTemplates: assert that braces and parantheses are handled correctly

This commit is contained in:
Daniel Marjamäki 2009-09-13 15:00:48 +02:00
parent d16a0b7a80
commit 62bdf032ac
1 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <list> #include <list>
#include <cassert>
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
#include <stack> #include <stack>
@ -793,6 +794,7 @@ void Tokenizer::simplifyTemplates()
} }
else if (tok3->str() == "}") else if (tok3->str() == "}")
{ {
assert(braces.empty() == false);
Token::createMutualLinks(braces.top(), _tokensBack); Token::createMutualLinks(braces.top(), _tokensBack);
braces.pop(); braces.pop();
} }
@ -802,12 +804,16 @@ void Tokenizer::simplifyTemplates()
} }
else if (tok3->str() == ")") else if (tok3->str() == ")")
{ {
assert(brackets.empty() == false);
Token::createMutualLinks(brackets.top(), _tokensBack); Token::createMutualLinks(brackets.top(), _tokensBack);
brackets.pop(); brackets.pop();
} }
} }
} }
} }
assert(braces.empty());
assert(brackets.empty());
} }
// Replace all these template usages.. // Replace all these template usages..