I can only understand a little about the FindAIMatches() function.
For example, your test code:
typedef unsigned int wwwww;
wwww|
You will see in the symbol tree, the "wwwww" is a global "typedef". which is quite different if your code is like below:
typedef class qq
{
int x;
int y;
}eeee;
then, "eeee" in the symbol tree is of type "class".
The piece of code in FindAIMatches()
if (local_result.size() == 1)
{
int id = *local_result.begin();
Token* token = tree->at(id);
if (token->m_TokenKind == tkTypedef)
{
std::queue<ParserComponent> type_components;
BreakUpComponents(parser, token->m_ActualType, type_components);
while(!components.empty())
{
ParserComponent comp = components.front();
components.pop();
type_components.push(comp);
}
#if DEBUG_CC_AI
if (s_DebugSmartSense)
#if wxCHECK_VERSION(2, 9, 0)
Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
#else
Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
#endif
#endif
return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
}
}
this means, when you only get one match in the current context, then for example, you are entering
This time, the only matched string is "wwwww" will be replace with "unsigned int" and the total line will be reparsed. (which means the FindAIMatches will be called iteratively).
But I think at this test code, this typedef replacement is useless. I can't find a test case that this replacement is meaningful.
Can someone explain more about this? Thanks.