- enhancment: Code suggestion for embedded std::vectors.

This commit is contained in:
Roy Qu 2023-10-19 19:32:08 +08:00
parent fd95b49270
commit 8fe15dab8a
3 changed files with 24 additions and 30 deletions

View File

@ -1,3 +1,6 @@
Red Panda C++ Version 2.26
- enhancment: Code suggestion for embedded std::vectors.
Red Panda C++ Version 2.25
- fix: Symbol completion of '(' before selection may fail, if cursor is at the beginning of the selection.

View File

@ -4749,9 +4749,7 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
// qDebug()<<"typeName"<<typeName<<lastResult->baseStatement->type<<lastResult->baseStatement->command;
PStatement typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope, result->baseStatement);
} else {
result = PEvalStatement();
}
@ -4760,9 +4758,7 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
// qDebug()<<"typeName"<<typeName<<lastResult->baseStatement->type<<lastResult->baseStatement->command;
PStatement typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
} else {
result = PEvalStatement();
}
@ -4784,9 +4780,7 @@ PEvalStatement CppParser::doEvalCCast(const QString &fileName,
// qDebug()<<"typeName"<<typeName;
typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
} else {
result = PEvalStatement();
}
@ -4931,9 +4925,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
if (!typeName.isEmpty())
typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString = typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
lastResult = result;
} else {
return PEvalStatement();
@ -4950,9 +4942,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
if (!typeName.isEmpty())
typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString = typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
lastResult = result;
} else {
return PEvalStatement();
@ -4984,9 +4974,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
typeStatement = doFindTypeDefinitionOf(fileName, typeName,
parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
lastResult = result;
} else {
return PEvalStatement();
@ -5001,9 +4989,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
typeStatement = doFindTypeDefinitionOf(fileName, typeName,
parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
lastResult = result;
} else {
return PEvalStatement();
@ -5037,9 +5023,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
// qDebug()<<"typeName"<<typeName<<lastResult->baseStatement->type<<lastResult->baseStatement->command;
PStatement typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
} else {
result = PEvalStatement();
}
@ -5048,9 +5032,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
// qDebug()<<"typeName"<<typeName<<lastResult->baseStatement->type<<lastResult->baseStatement->command;
PStatement typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
} else {
result = PEvalStatement();
}
@ -5071,9 +5053,7 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
// qDebug()<<"typeName"<<typeName;
typeStatement=doFindTypeDefinitionOf(fileName, typeName,parentScope);
if (typeStatement) {
result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result = doCreateTypedEvalVar(fileName,typeName,parentScope,result->baseStatement);
} else {
return PEvalStatement();
}
@ -5512,6 +5492,15 @@ PEvalStatement CppParser::doCreateEvalType(const QString &primitiveType) const
PStatement());
}
PEvalStatement CppParser::doCreateTypedEvalVar(const QString &fileName, const QString &typeName, const PStatement &parentScope, const PStatement &baseStatement) const
{
PEvalStatement result = doCreateEvalType(fileName,typeName,parentScope);
result->definitionString=typeName;
result->kind = EvalStatementKind::Variable;
result->baseStatement = baseStatement;
return result;
}
PEvalStatement CppParser::doCreateEvalVariable(
const QString &fileName,
const PStatement& varStatement,

View File

@ -375,6 +375,8 @@ private:
PEvalStatement doCreateEvalType(const QString& fileName,const PStatement& typeStatement) const;
PEvalStatement doCreateEvalType(const QString& primitiveType) const;
PEvalStatement doCreateTypedEvalVar(const QString& fileName,const QString& typeName, const PStatement& parentScope, const PStatement &baseStatement) const;
PEvalStatement doCreateEvalVariable(
const QString& fileName,
const PStatement& varStatement,