- enhancement: differenciate -> and . when displaying completion suggestion infos.
This commit is contained in:
parent
950d4fd102
commit
1928783cbd
|
@ -3018,14 +3018,20 @@ void CppParser::handleOtherTypedefs()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString oldType;
|
QString oldType;
|
||||||
|
QString tempType;
|
||||||
// Walk up to first new word (before first comma or ;)
|
// Walk up to first new word (before first comma or ;)
|
||||||
while(true) {
|
while(true) {
|
||||||
if (oldType.endsWith("::"))
|
if (oldType.endsWith("::"))
|
||||||
oldType += mTokenizer[mIndex]->text;
|
oldType += mTokenizer[mIndex]->text;
|
||||||
else if (mTokenizer[mIndex]->text=="::")
|
else if (mTokenizer[mIndex]->text=="::")
|
||||||
oldType += "::";
|
oldType += "::";
|
||||||
else
|
else if (mTokenizer[mIndex]->text=="*"
|
||||||
oldType += ' ' + mTokenizer[mIndex]->text;
|
|| mTokenizer[mIndex]->text=="&")
|
||||||
|
tempType += mTokenizer[mIndex]->text;
|
||||||
|
else {
|
||||||
|
oldType += tempType + ' ' + mTokenizer[mIndex]->text;
|
||||||
|
tempType="";
|
||||||
|
}
|
||||||
mIndex++;
|
mIndex++;
|
||||||
if (mIndex+1>=tokenCount) {
|
if (mIndex+1>=tokenCount) {
|
||||||
//not valid, just exit
|
//not valid, just exit
|
||||||
|
@ -3066,7 +3072,7 @@ void CppParser::handleOtherTypedefs()
|
||||||
addStatement(
|
addStatement(
|
||||||
getCurrentScope(),
|
getCurrentScope(),
|
||||||
mCurrentFile,
|
mCurrentFile,
|
||||||
oldType,
|
oldType+tempType,
|
||||||
newType,
|
newType,
|
||||||
mergeArgs(paramStart,mTokenizer[paramStart]->matchIndex),
|
mergeArgs(paramStart,mTokenizer[paramStart]->matchIndex),
|
||||||
"",
|
"",
|
||||||
|
@ -3076,6 +3082,7 @@ void CppParser::handleOtherTypedefs()
|
||||||
getScope(),
|
getScope(),
|
||||||
mCurrentMemberAccessibility,
|
mCurrentMemberAccessibility,
|
||||||
StatementProperty::spHasDefinition);
|
StatementProperty::spHasDefinition);
|
||||||
|
tempType="";
|
||||||
}
|
}
|
||||||
mIndex = mTokenizer[paramStart]->matchIndex+1;
|
mIndex = mTokenizer[paramStart]->matchIndex+1;
|
||||||
} else if (mTokenizer[mIndex+1]->text.front() ==','
|
} else if (mTokenizer[mIndex+1]->text.front() ==','
|
||||||
|
@ -3088,7 +3095,7 @@ void CppParser::handleOtherTypedefs()
|
||||||
addStatement(
|
addStatement(
|
||||||
getCurrentScope(),
|
getCurrentScope(),
|
||||||
mCurrentFile,
|
mCurrentFile,
|
||||||
oldType+suffix,
|
oldType+tempType+suffix,
|
||||||
newType,
|
newType,
|
||||||
args,
|
args,
|
||||||
"",
|
"",
|
||||||
|
@ -3098,6 +3105,7 @@ void CppParser::handleOtherTypedefs()
|
||||||
getScope(),
|
getScope(),
|
||||||
mCurrentMemberAccessibility,
|
mCurrentMemberAccessibility,
|
||||||
StatementProperty::spHasDefinition);
|
StatementProperty::spHasDefinition);
|
||||||
|
tempType="";
|
||||||
newType = "";
|
newType = "";
|
||||||
mIndex++;
|
mIndex++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -3514,6 +3522,8 @@ void CppParser::handleStructs(bool isTypedef)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command = command.trimmed();
|
command = command.trimmed();
|
||||||
|
QString suffix,tempArgs;
|
||||||
|
parseCommandTypeAndArgs(command,suffix,tempArgs);
|
||||||
if (!command.isEmpty() &&
|
if (!command.isEmpty() &&
|
||||||
( !firstSynonym
|
( !firstSynonym
|
||||||
|| command!=firstSynonym->command )) {
|
|| command!=firstSynonym->command )) {
|
||||||
|
@ -3539,9 +3549,9 @@ void CppParser::handleStructs(bool isTypedef)
|
||||||
addStatement(
|
addStatement(
|
||||||
getCurrentScope(),
|
getCurrentScope(),
|
||||||
mCurrentFile,
|
mCurrentFile,
|
||||||
firstSynonym->command,
|
firstSynonym->command+suffix,
|
||||||
command,
|
command,
|
||||||
"",
|
args+tempArgs,
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
mTokenizer[mIndex]->line,
|
mTokenizer[mIndex]->line,
|
||||||
|
@ -3554,9 +3564,9 @@ void CppParser::handleStructs(bool isTypedef)
|
||||||
addStatement(
|
addStatement(
|
||||||
getCurrentScope(),
|
getCurrentScope(),
|
||||||
mCurrentFile,
|
mCurrentFile,
|
||||||
firstSynonym->command,
|
firstSynonym->command+suffix,
|
||||||
command,
|
command,
|
||||||
args,
|
args+tempArgs,
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
mTokenizer[i]->line,
|
mTokenizer[i]->line,
|
||||||
|
@ -3733,6 +3743,10 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
|
||||||
|
|
||||||
QString tempType;
|
QString tempType;
|
||||||
int tokenCount = mTokenizer.tokenCount();
|
int tokenCount = mTokenizer.tokenCount();
|
||||||
|
while (lastType.endsWith("*") || lastType.endsWith("&")) {
|
||||||
|
tempType = (lastType.back()+tempType);
|
||||||
|
lastType.truncate(lastType.length()-2);
|
||||||
|
}
|
||||||
|
|
||||||
while(mIndex<tokenCount) {
|
while(mIndex<tokenCount) {
|
||||||
switch(mTokenizer[mIndex]->text[0].unicode()) {
|
switch(mTokenizer[mIndex]->text[0].unicode()) {
|
||||||
|
@ -5311,7 +5325,55 @@ PStatement CppParser::doParseEvalTypeInfo(
|
||||||
position--;
|
position--;
|
||||||
}
|
}
|
||||||
typeStatement = doFindStatementOf(fileName,baseType,scope);
|
typeStatement = doFindStatementOf(fileName,baseType,scope);
|
||||||
return getTypeDef(typeStatement,fileName,baseType);
|
int level=0;
|
||||||
|
while (typeStatement && (typeStatement->kind == StatementKind::skTypedef
|
||||||
|
|| typeStatement->kind == StatementKind::skPreprocessor)) {
|
||||||
|
if (level >20) // prevent infinite loop
|
||||||
|
break;
|
||||||
|
level++;
|
||||||
|
baseType="";
|
||||||
|
syntaxer.resetState();
|
||||||
|
syntaxer.setLine(typeStatement->type,0);
|
||||||
|
int bracketLevel = 0;
|
||||||
|
int templateLevel = 0;
|
||||||
|
while(!syntaxer.eol()) {
|
||||||
|
QString token = syntaxer.getToken();
|
||||||
|
if (bracketLevel == 0 && templateLevel ==0) {
|
||||||
|
if (token == "*")
|
||||||
|
pointerLevel++;
|
||||||
|
else if (token == "&")
|
||||||
|
pointerLevel--;
|
||||||
|
else if (syntaxer.getTokenAttribute()->tokenType() == QSynedit::TokenType::Identifier) {
|
||||||
|
baseType += token;
|
||||||
|
} else if (token == "[") {
|
||||||
|
pointerLevel++;
|
||||||
|
bracketLevel++;
|
||||||
|
} else if (token == "<") {
|
||||||
|
templateLevel++;
|
||||||
|
templateParams += token;
|
||||||
|
} else if (token == "::") {
|
||||||
|
baseType += token;
|
||||||
|
}
|
||||||
|
} else if (bracketLevel > 0) {
|
||||||
|
if (token == "[") {
|
||||||
|
bracketLevel++;
|
||||||
|
} else if (token == "]") {
|
||||||
|
bracketLevel--;
|
||||||
|
}
|
||||||
|
} else if (templateLevel > 0) {
|
||||||
|
if (token == "<") {
|
||||||
|
templateLevel++;
|
||||||
|
} else if (token == ">") {
|
||||||
|
templateLevel--;
|
||||||
|
}
|
||||||
|
templateParams += token;
|
||||||
|
}
|
||||||
|
syntaxer.next();
|
||||||
|
}
|
||||||
|
typeStatement = doFindStatementOf(fileName,baseType, typeStatement->parentScope.lock());
|
||||||
|
}
|
||||||
|
typeStatement = getTypeDef(typeStatement,fileName,baseType);
|
||||||
|
return typeStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CppParser::getBracketEnd(const QString &s, int startAt) const
|
int CppParser::getBracketEnd(const QString &s, int startAt) const
|
||||||
|
|
|
@ -793,6 +793,10 @@ void CodeCompletionPopup::getCompletionFor(
|
||||||
if (!isIncluded(classTypeStatement->fileName) &&
|
if (!isIncluded(classTypeStatement->fileName) &&
|
||||||
!isIncluded(classTypeStatement->definitionFileName))
|
!isIncluded(classTypeStatement->definitionFileName))
|
||||||
return;
|
return;
|
||||||
|
if (memberOperator=="." && ownerStatement->pointerLevel !=0)
|
||||||
|
return;
|
||||||
|
if (memberOperator=="->" && ownerStatement->pointerLevel!=1)
|
||||||
|
return;
|
||||||
if ((classTypeStatement == scopeTypeStatement) || (ownerStatement->effectiveTypeStatement->command == "this")) {
|
if ((classTypeStatement == scopeTypeStatement) || (ownerStatement->effectiveTypeStatement->command == "this")) {
|
||||||
//we can use all members
|
//we can use all members
|
||||||
addChildren(classTypeStatement,fileName,-1);
|
addChildren(classTypeStatement,fileName,-1);
|
||||||
|
|
Loading…
Reference in New Issue