Fixed #1290 (1.40: Internal error)

This commit is contained in:
Daniel Marjamäki 2010-01-21 20:05:32 +01:00
parent 2e707974d0
commit d4b13eee9f
2 changed files with 17 additions and 0 deletions

View File

@ -3210,6 +3210,9 @@ void Tokenizer::simplifyFunctionParameters()
{
// We have found old style function, now we need to change it
// backup pointer to the '(' token
Token * const tok1 = tok->next();
// Get list of argument names
std::map<std::string, Token*> argumentNames;
bool bailOut = false;
@ -3239,6 +3242,9 @@ void Tokenizer::simplifyFunctionParameters()
if (bailOut)
{
tok = tok1->link();
if (!tok)
return;
continue;
}

View File

@ -43,6 +43,9 @@ private:
TEST_CASE(tokenize2);
TEST_CASE(tokenize3);
// don't freak out when the syntax is wrong
TEST_CASE(wrong_syntax);
TEST_CASE(minus);
TEST_CASE(longtok);
@ -255,6 +258,14 @@ private:
ASSERT_EQUALS("", errout.str());
}
void wrong_syntax()
{
errout.str("");
const std::string code("TR(kvmpio, PROTO(int rw), ARGS(rw), TP_(aa->rw;))");
ASSERT_EQUALS("TR ( kvmpio , PROTO ( int rw ) , ARGS ( rw ) , TP_ ( aa . rw ; ) )", tokenizeAndStringify(code.c_str(), true));
ASSERT_EQUALS("", errout.str());
}
void minus()
{
ASSERT_EQUALS("i = -12", tokenizeAndStringify("i = -12"));