From 46bfe278313531f06c5f3fdc499407d1fd576526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 15 Apr 2012 17:44:51 +0200 Subject: [PATCH] Tokenizer::setVarIdNew: Better handling of function calls --- lib/tokenize.cpp | 4 ++-- test/testtokenize.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index f2912141f..aa66657b4 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index d49c00a4f..751a71072 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -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")); }