- Enhancement: Better type induction for auto in foreach loop of maps.

This commit is contained in:
Roy Qu 2023-11-26 16:30:22 +08:00
parent 5516065fb3
commit ce678c64e8
2 changed files with 4 additions and 4 deletions

View File

@ -4113,8 +4113,8 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
// as
// unsigned short bAppReturnCode,reserved,fBusy,fAck
if (mIndex+1<tokenCount
&& isIdentifier(mTokenizer[mIndex+1]->text)
&& isIdentChar(mTokenizer[mIndex+1]->text.back())
&& isIdentChar(mTokenizer[mIndex+1]->text.front())
&& (isIdentChar(mTokenizer[mIndex+1]->text.back()) || isDigitChar(mTokenizer[mIndex+1]->text.back()))
&& addedVar
&& !(addedVar->properties & StatementProperty::spFunctionPointer)
&& AutoTypes.contains(addedVar->type)) {
@ -5875,6 +5875,7 @@ PStatement CppParser::doParseEvalTypeInfo(
} else if (token == ">") {
templateLevel--;
}
baseType += token;
}
syntaxer.next();
}

View File

@ -781,8 +781,7 @@ void CodeCompletionPopup::getCompletionFor(
if (!classTypeStatement)
return;
} else if (STLMaps.contains(parentScope->fullName)) {
QString typeName=mParser->findTemplateParamOf(fileName,ownerStatement->templateParams,1,parentScope);
// qDebug()<<"typeName"<<typeName<<lastResult->baseStatement->type<<lastResult->baseStatement->command;
QString typeName="std::pair";
classTypeStatement=mParser->findTypeDefinitionOf(fileName, typeName,parentScope);
if (!classTypeStatement)
return;