- fix: parse error for definition of functions whose return type is pointer
This commit is contained in:
parent
5743991152
commit
56c71f321f
1
NEWS.md
1
NEWS.md
|
@ -15,6 +15,7 @@ Red Panda C++ Version 1.0.4
|
|||
- enhancement: add Traditional Chinese translation
|
||||
- fix: index of the longest line not correctly updated ( which will cause selection errors)
|
||||
- fix: scroll bar not correctly updated when collapse/uncollapse folders
|
||||
- fix: parse error for definition of functions whose return type is pointer
|
||||
|
||||
Red Panda C++ Version 1.0.3
|
||||
- fix: when oj problem grabbed by competitive companion received,
|
||||
|
|
|
@ -1158,27 +1158,30 @@ PStatement CppParser::addStatement(const PStatement& parent,
|
|||
if (kind == StatementKind::skConstructor
|
||||
|| kind == StatementKind::skFunction
|
||||
|| kind == StatementKind::skDestructor
|
||||
|| kind == StatementKind::skVariable) {
|
||||
|| kind == StatementKind::skVariable
|
||||
) {
|
||||
noNameArgs = removeArgNames(args);
|
||||
//find
|
||||
PStatement oldStatement = findStatementInScope(command,noNameArgs,kind,parent);
|
||||
if (oldStatement && isDefinition && !oldStatement->hasDefinition) {
|
||||
oldStatement->hasDefinition = true;
|
||||
if (oldStatement->fileName!=fileName) {
|
||||
PFileIncludes fileIncludes1=mPreprocessor.includesList().value(fileName);
|
||||
if (fileIncludes1) {
|
||||
fileIncludes1->statements.insert(oldStatement->fullName,
|
||||
oldStatement);
|
||||
fileIncludes1->dependingFiles.insert(oldStatement->fileName);
|
||||
PFileIncludes fileIncludes2=mPreprocessor.includesList().value(oldStatement->fileName);
|
||||
if (fileIncludes2) {
|
||||
fileIncludes2->dependedFiles.insert(fileName);
|
||||
if (isDefinition) {
|
||||
PStatement oldStatement = findStatementInScope(newCommand,noNameArgs,kind,parent);
|
||||
if (oldStatement && !oldStatement->hasDefinition) {
|
||||
oldStatement->hasDefinition = true;
|
||||
if (oldStatement->fileName!=fileName) {
|
||||
PFileIncludes fileIncludes1=mPreprocessor.includesList().value(fileName);
|
||||
if (fileIncludes1) {
|
||||
fileIncludes1->statements.insert(oldStatement->fullName,
|
||||
oldStatement);
|
||||
fileIncludes1->dependingFiles.insert(oldStatement->fileName);
|
||||
PFileIncludes fileIncludes2=mPreprocessor.includesList().value(oldStatement->fileName);
|
||||
if (fileIncludes2) {
|
||||
fileIncludes2->dependedFiles.insert(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
oldStatement->definitionLine = line;
|
||||
oldStatement->definitionFileName = fileName;
|
||||
return oldStatement;
|
||||
}
|
||||
oldStatement->definitionLine = line;
|
||||
oldStatement->definitionFileName = fileName;
|
||||
return oldStatement;
|
||||
}
|
||||
}
|
||||
PStatement result = std::make_shared<Statement>();
|
||||
|
@ -3246,9 +3249,9 @@ void CppParser::internalParse(const QString &fileName)
|
|||
//reduce memory usage
|
||||
internalClear();
|
||||
#ifdef QT_DEBUG
|
||||
// mTokenizer.dumpTokens("r:\\tokens.txt");
|
||||
// mStatementList.dump("r:\\stats.txt");
|
||||
// mStatementList.dumpAll("r:\\all-stats.txt");
|
||||
// mTokenizer.dumpTokens("z:\\tokens.txt");
|
||||
//
|
||||
// mStatementList.dumpAll("r:\\all-stats.txt");
|
||||
#endif
|
||||
//reduce memory usage
|
||||
mTokenizer.reset();
|
||||
|
|
|
@ -138,12 +138,15 @@ void StatementModel::dumpStatementMap(StatementMap &map, QTextStream &out, int l
|
|||
out<<indent<<QString("%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12")
|
||||
.arg(statement->command).arg(int(statement->kind))
|
||||
.arg(statement->type,statement->fullName)
|
||||
.arg(statement->noNameArgs)
|
||||
.arg(statement->args)
|
||||
.arg((size_t)(statement->parentScope.lock().get()))
|
||||
.arg((int)statement->classScope)
|
||||
.arg(statement->fileName)
|
||||
.arg(statement->line)
|
||||
.arg(statement->definitionFileName)
|
||||
.arg(statement->definitionLine);
|
||||
out<<endl;
|
||||
if (statement->children.isEmpty())
|
||||
continue;
|
||||
out<<indent<<statement->command<<" {"<<endl;
|
||||
|
|
Loading…
Reference in New Issue