Skip to content

Commit

Permalink
Type#GetLoadDependencies(): VERIFY() that no nullptr is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Sep 19, 2024
1 parent 36742c2 commit 3a77ff8
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tools/mkclass/classcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,25 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)

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

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

m_Impl << std::endl;

for (auto& dep : klass.LoadDependencies)
m_Impl << "\t\tVERIFY(type" << dep << ");" << std::endl;

m_Impl << "\t});" << std::endl;
m_Impl << std::endl
<< "\t\treturn std::unordered_set{";

for (const std::string& dep : klass.LoadDependencies)
m_Impl << " type" << dep << ",";

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

Expand Down Expand Up @@ -1465,6 +1476,7 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
<< "#include \"base/objectlock.hpp\"" << std::endl
<< "#include \"base/utility.hpp\"" << std::endl
<< "#include \"base/convert.hpp\"" << std::endl
<< "#include \"base/debug.hpp\"" << std::endl
<< "#include \"base/dependencygraph.hpp\"" << std::endl
<< "#include \"base/logger.hpp\"" << std::endl
<< "#include \"base/function.hpp\"" << std::endl
Expand Down

0 comments on commit 3a77ff8

Please sign in to comment.