diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 18be4be6..3a4d2462 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -145,6 +145,28 @@ QList CppParser::getListOfFunctions(const QString &fileName, const Q return result; } +PStatement CppParser::findAndScanBlockAt(const QString &filename, int line) +{ + QMutexLocker locker(&mMutex); + if (mParsing) { + return PStatement(); + } + PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename); + if (!fileIncludes) + return PStatement(); + + PStatement statement = fileIncludes->scopes.findScopeAtLine(line); + return statement; +} + +PFileIncludes CppParser::findFileIncludes(const QString &filename, bool deleteIt) +{ + QMutexLocker locker(&mMutex); + PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename,PFileIncludes()); + if (deleteIt && fileIncludes) + mPreprocessor.includesList().remove(filename); + return fileIncludes; +} QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope) { QMutexLocker locker(&mMutex); @@ -3380,6 +3402,16 @@ PStatement CppParser::findStatementInScope(const QString &name, const QString &n return PStatement(); } +PStatement CppParser::findStatementInScope(const QString &name, const PStatement &scope) +{ + if (!scope) + return findMemberOfStatement(name,scope); + if (scope->kind == StatementKind::skNamespace) { + return findStatementInNamespace(name, scope->fullName); + } else { + return findMemberOfStatement(name,scope); + } +} PStatement CppParser::findStatementInNamespace(const QString &name, const QString &namespaceName) { diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h index 8a1bff61..83570384 100644 --- a/RedPandaIDE/parser/cppparser.h +++ b/RedPandaIDE/parser/cppparser.h @@ -44,25 +44,8 @@ public: QList getListOfFunctions(const QString& fileName, const QString& phrase, int line); - PStatement findAndScanBlockAt(const QString& filename, int line) { - QMutexLocker locker(&mMutex); - if (mParsing) { - return PStatement(); - } - PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename); - if (!fileIncludes) - return PStatement(); - - PStatement statement = fileIncludes->scopes.findScopeAtLine(line); - return statement; - } - PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false) { - QMutexLocker locker(&mMutex); - PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename,PFileIncludes()); - if (deleteIt && fileIncludes) - mPreprocessor.includesList().remove(filename); - return fileIncludes; - } + PStatement findAndScanBlockAt(const QString& filename, int line); + PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false); QString findFirstTemplateParamOf(const QString& fileName, const QString& phrase, const PStatement& currentScope); @@ -237,15 +220,7 @@ private: const PStatement& scope); PStatement findStatementInScope( const QString& name, - const PStatement& scope) { - if (!scope) - return findMemberOfStatement(name,scope); - if (scope->kind == StatementKind::skNamespace) { - return findStatementInNamespace(name, scope->fullName); - } else { - return findMemberOfStatement(name,scope); - } - } + const PStatement& scope); PStatement findStatementInNamespace( const QString& name, const QString& namespaceName); @@ -255,7 +230,6 @@ private: const QString& phrase, const PStatement& startScope); - /** * @brief evaluate the expression (starting from pos) in the scope * @param fileName diff --git a/RedPandaIDE/parser/parserutils.h b/RedPandaIDE/parser/parserutils.h index 83b3a2d0..08712004 100644 --- a/RedPandaIDE/parser/parserutils.h +++ b/RedPandaIDE/parser/parserutils.h @@ -151,7 +151,6 @@ struct Statement { StatementClassScope classScope; // protected/private/public bool hasDefinition; // definiton line/filename is valid int line; // declaration - int endLine; int definitionLine; // definition int definitionEndLine; QString fileName; // declaration @@ -203,7 +202,6 @@ struct UsingNamespace { QStringList namespaces; // List['std','foo'] for using namespace std::foo; QString filename; int line; - int endLine; bool fromHeader; }; using PUsingNamespace = std::shared_ptr; diff --git a/RedPandaIDE/parser/statementmodel.cpp b/RedPandaIDE/parser/statementmodel.cpp index cb960a90..e12f7027 100644 --- a/RedPandaIDE/parser/statementmodel.cpp +++ b/RedPandaIDE/parser/statementmodel.cpp @@ -104,7 +104,6 @@ void StatementModel::dumpAll(const QString &logFile) .arg((int)statement->classScope) .arg(statement->fileName) .arg(statement->line) - .arg(statement->endLine) .arg(statement->definitionFileName) .arg(statement->definitionLine) .arg(statement->definitionEndLine)<classScope) .arg(statement->fileName) .arg(statement->line) - .arg(statement->endLine) .arg(statement->definitionFileName) .arg(statement->definitionLine) .arg(statement->definitionEndLine)<