- enhancement: slightly reduce memory usage for code parser

This commit is contained in:
Roy Qu 2022-03-23 14:45:10 +08:00
parent 4e15e24f31
commit a211992256
2 changed files with 2 additions and 6 deletions

View File

@ -140,7 +140,6 @@ using PStatementList = std::shared_ptr<StatementList>;
using StatementMap = QMultiMap<QString, PStatement>;
struct Statement {
std::weak_ptr<Statement> parentScope; // parent class/struct/namespace scope, don't use auto pointer to prevent circular reference
QString hintText; // text to force display when using PrettyPrintStatement
QString type; // type "int"
QString command; // identifier/name of statement "foo"
QString args; // args "(int a,float b)"
@ -152,7 +151,6 @@ struct Statement {
bool hasDefinition; // definiton line/filename is valid
int line; // declaration
int definitionLine; // definition
int definitionEndLine;
QString fileName; // declaration
QString definitionFileName; // definition
bool inProject; // statement in project

View File

@ -105,8 +105,7 @@ void StatementModel::dumpAll(const QString &logFile)
.arg(statement->fileName)
.arg(statement->line)
.arg(statement->definitionFileName)
.arg(statement->definitionLine)
.arg(statement->definitionEndLine)<<endl;
.arg(statement->definitionLine)<<endl;
}
}
}
@ -144,8 +143,7 @@ void StatementModel::dumpStatementMap(StatementMap &map, QTextStream &out, int l
.arg(statement->fileName)
.arg(statement->line)
.arg(statement->definitionFileName)
.arg(statement->definitionLine)
.arg(statement->definitionEndLine)<<endl;
.arg(statement->definitionLine);
if (statement->children.isEmpty())
continue;
out<<indent<<statement->command<<" {"<<endl;