Skip to content

Commit

Permalink
Don't override Type#GetLoadDependencies() if latter is sufficient
Browse files Browse the repository at this point in the history
If a specific type shall return no deps, the base method already does that.
  • Loading branch information
Al2Klimov committed Sep 19, 2024
1 parent e678f09 commit 36742c2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tools/mkclass/classcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,19 +376,21 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
<< "}" << std::endl << std::endl;

/* GetLoadDependencies */
m_Header << "\t" << "const std::unordered_set<Type*>& GetLoadDependencies() const override;" << std::endl;
if (!klass.LoadDependencies.empty()) {
m_Header << "\tconst std::unordered_set<Type*>& GetLoadDependencies() const override;" << std::endl;

m_Impl << "const std::unordered_set<Type*>& TypeImpl<" << klass.Name << ">::GetLoadDependencies() const" << std::endl
<< "{" << std::endl
<< "\t" << "static const std::unordered_set<Type*> deps ({" << std::endl;
m_Impl << "const std::unordered_set<Type*>& TypeImpl<" << klass.Name << ">::GetLoadDependencies() const" << std::endl
<< "{" << std::endl
<< "\tstatic const std::unordered_set deps ({" << std::endl;

for (const std::string& dep : klass.LoadDependencies)
m_Impl << "\t\t" << "GetByName(\"" << dep << "\").get()," << std::endl;
for (const std::string& dep : klass.LoadDependencies)
m_Impl << "\t\tGetByName(\"" << dep << "\").get()," << std::endl;

m_Impl << "\t" << "});" << std::endl;
m_Impl << "\t});" << std::endl;

m_Impl << "\t" << "return deps;" << std::endl
<< "}" << std::endl << std::endl;
m_Impl << "\treturn deps;" << std::endl
<< "}" << std::endl << std::endl;
}

/* GetActivationPriority */
m_Header << "\t" << "int GetActivationPriority() const override;" << std::endl;
Expand Down

0 comments on commit 36742c2

Please sign in to comment.