@@ -376,19 +376,32 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
376376 << " }" << std::endl << std::endl;
377377
378378 /* GetLoadDependencies */
379- m_Header << " \t " << " const std::unordered_set<Type*>& GetLoadDependencies() const override;" << std::endl;
379+ if (!klass.LoadDependencies .empty ()) {
380+ m_Header << " \t const std::unordered_set<Type*>& GetLoadDependencies() const override;" << std::endl;
380381
381- m_Impl << " const std::unordered_set<Type*>& TypeImpl<" << klass.Name << " >::GetLoadDependencies() const" << std::endl
382- << " {" << std::endl
383- << " \t " << " static const std::unordered_set<Type*> deps ({" << std::endl;
382+ m_Impl << " const std::unordered_set<Type*>& TypeImpl<" << klass.Name << " >::GetLoadDependencies() const" << std::endl
383+ << " {" << std::endl
384+ << " \t static const auto deps ([] {" << std::endl;
384385
385- for (const std::string & dep : klass.LoadDependencies )
386- m_Impl << " \t\t " << " GetByName(\" " << dep << " \" ).get(), " << std::endl;
386+ for (auto & dep : klass.LoadDependencies )
387+ m_Impl << " \t\t auto type " << dep << " ( GetByName(\" " << dep << " \" ).get()); " << std::endl;
387388
388- m_Impl << " \t " << " }); " << std::endl;
389+ m_Impl << std::endl;
389390
390- m_Impl << " \t " << " return deps;" << std::endl
391- << " }" << std::endl << std::endl;
391+ for (auto & dep : klass.LoadDependencies )
392+ m_Impl << " \t\t VERIFY(type" << dep << " );" << std::endl;
393+
394+ m_Impl << std::endl
395+ << " \t\t return std::unordered_set<Type*>{" ;
396+
397+ for (const std::string& dep : klass.LoadDependencies )
398+ m_Impl << " type" << dep << " ," ;
399+
400+ m_Impl << " };" << std::endl
401+ << " \t }());" << std::endl << std::endl
402+ << " \t return deps;" << std::endl
403+ << " }" << std::endl << std::endl;
404+ }
392405
393406 /* GetActivationPriority */
394407 m_Header << " \t " << " int GetActivationPriority() const override;" << std::endl;
@@ -1463,6 +1476,7 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
14631476 << " #include \" base/objectlock.hpp\" " << std::endl
14641477 << " #include \" base/utility.hpp\" " << std::endl
14651478 << " #include \" base/convert.hpp\" " << std::endl
1479+ << " #include \" base/debug.hpp\" " << std::endl
14661480 << " #include \" base/dependencygraph.hpp\" " << std::endl
14671481 << " #include \" base/logger.hpp\" " << std::endl
14681482 << " #include \" base/function.hpp\" " << std::endl
0 commit comments