From 4b20121dcf3c556c35c67e79d79c2affa171163f Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 20 Sep 2024 14:30:40 +0200 Subject: [PATCH 1/2] Type#GetLoadDependencies(): group operations by type --- tools/mkclass/classcompiler.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index f85719ac5..0499b4a97 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -384,15 +384,10 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) << "\tstatic const auto deps ([] {" << std::endl; for (auto& dep : klass.LoadDependencies) - m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; + m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl + << "\t\tVERIFY(type" << dep << ");" << std::endl << std::endl; - m_Impl << std::endl; - - for (auto& dep : klass.LoadDependencies) - m_Impl << "\t\tVERIFY(type" << dep << ");" << std::endl; - - m_Impl << std::endl - << "\t\treturn std::unordered_set{"; + m_Impl << "\t\treturn std::unordered_set{"; for (const std::string& dep : klass.LoadDependencies) m_Impl << " type" << dep << ","; From b6517c69732bdbeb79ca9eafba350f93a991103d Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 20 Sep 2024 14:34:16 +0200 Subject: [PATCH 2/2] Type#GetLoadDependencies(): VERIFY() that only config object types are returned --- tools/mkclass/classcompiler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index 0499b4a97..6082cbed6 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -385,7 +385,8 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) for (auto& dep : klass.LoadDependencies) m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl - << "\t\tVERIFY(type" << dep << ");" << std::endl << std::endl; + << "\t\tVERIFY(type" << dep << ");" << std::endl + << "\t\tVERIFY(ConfigObject::TypeInstance->IsAssignableFrom(type" << dep << "));" << std::endl << std::endl; m_Impl << "\t\treturn std::unordered_set{"; @@ -1475,6 +1476,7 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input, << "#include \"base/dependencygraph.hpp\"" << std::endl << "#include \"base/logger.hpp\"" << std::endl << "#include \"base/function.hpp\"" << std::endl + << "#include \"base/configobject.hpp\"" << std::endl << "#include \"base/configtype.hpp\"" << std::endl << "#ifdef _MSC_VER" << std::endl << "#pragma warning( push )" << std::endl