From f7063bed7cf7f103a396ba7d786e071c4057cfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 23 Aug 2010 20:15:02 +0200 Subject: [PATCH] Fixed #1967 (Tokenizer::setVarid doesn't set variable value (list of function pointers)) --- lib/tokenize.cpp | 7 +++++++ test/testtokenize.cpp | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 35731a2bb..bebe1bf9a 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2832,6 +2832,13 @@ void Tokenizer::setVarId() { while (tok2 && (tok2->isName() || tok2->isNumber() || tok2->str() == "*" || tok2->str() == "&" || tok2->str() == ",")) tok2 = tok2->next(); + if (tok2->str() == "(") + { + tok2 = tok2->link()->next(); + if (tok2->str() == "(") + tok2 = tok2->link()->next(); + again = true; + } } } while (again); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 7b2481a76..1d22d55b8 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -148,6 +148,7 @@ private: TEST_CASE(varid23); TEST_CASE(varid24); TEST_CASE(varid25); + TEST_CASE(varid26); // ticket #1967 (list of function pointers) TEST_CASE(varidStl); TEST_CASE(varid_delete); TEST_CASE(varid_functions); @@ -2395,6 +2396,16 @@ private: ASSERT_EQUALS(expected, tokenizeDebugListing(code)); } + void varid26() + { + const std::string code("list functions;\n"); + + const std::string expected("\n\n##file 0\n" + "1: list < int ( * ) ( ) > functions@1 ;\n"); + + ASSERT_EQUALS(expected, tokenizeDebugListing(code)); + } + void varidStl() {