Tokenizer::setVarIdNew: Better handling of function calls

This commit is contained in:
Daniel Marjamäki 2012-04-15 17:44:51 +02:00
parent 31f8a71f84
commit 46bfe27831
2 changed files with 5 additions and 5 deletions

View File

@ -2903,8 +2903,8 @@ void Tokenizer::setVarIdNew()
}
}
if (tok == _tokens || Token::Match(tok, "[;{},]") ||
(tok->str()=="(" && (!executableScope.top() || Token::simpleMatch(tok->link(), ") {")))) {
if (tok == _tokens || Token::Match(tok, "[;{}]") ||
(Token::Match(tok,"[(,]") && (!executableScope.top() || Token::simpleMatch(tok->link(), ") {")))) {
// locate the variable name..
const Token *tok2 = (tok->isName()) ? tok : tok->next();
if (!tok2)

View File

@ -3289,7 +3289,7 @@ private:
"2: x ( a * b");
const std::string expected2(" , 10 ) ;\n"
"3: }\n");
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code));
ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code,false,"test.c"));
}
void varidFunctionCall3() {
@ -3313,11 +3313,11 @@ private:
const std::string code1("void f() { int x; fun(a,b*x); }");
ASSERT_EQUALS("\n\n##file 0\n"
"1: void f ( ) { int x@1 ; fun ( a , b * x@1 ) ; }\n",
tokenizeDebugListing(code1));
tokenizeDebugListing(code1,false,"test.c"));
const std::string code2("void f(int a) { int x; fun(a,b*x); }");
ASSERT_EQUALS("\n\n##file 0\n"
"1: void f ( int a@1 ) { int x@2 ; fun ( a@1 , b * x@2 ) ; }\n",
tokenizeDebugListing(code2));
tokenizeDebugListing(code2,false,"test.c"));
}