diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 707d91dc4..a6fa3da20 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -423,24 +423,28 @@ void Module::matlab_code(const string& toolboxPath, const string& headerPath) co // Dependency check list vector validTypes = GenerateValidTypes(expandedClasses, forward_declarations); + // Check that all classes have been defined somewhere + BOOST_FOREACH(const Class& cls, expandedClasses) { + // verify all of the function arguments + //TODO:verifyArguments(validTypes, cls.constructor.args_list); + verifyArguments(validTypes, cls.static_methods); + verifyArguments(validTypes, cls.methods); + + // verify function return types + verifyReturnTypes(validTypes, cls.static_methods); + verifyReturnTypes(validTypes, cls.methods); + + // verify parents + if(!cls.qualifiedParent.empty() && std::find(validTypes.begin(), validTypes.end(), wrap::qualifiedName("::", cls.qualifiedParent)) == validTypes.end()) + throw DependencyMissing(wrap::qualifiedName("::", cls.qualifiedParent), cls.qualifiedName("::")); + } + // Create type attributes table and check validity TypeAttributesTable typeAttributes; typeAttributes.addClasses(expandedClasses); typeAttributes.addForwardDeclarations(forward_declarations); typeAttributes.checkValidity(expandedClasses); - // Check that all classes have been defined somewhere - BOOST_FOREACH(const Class& cls, expandedClasses) { - // verify all of the function arguments - //TODO:verifyArguments(validTypes, cls.constructor.args_list); - verifyArguments(validTypes, cls.static_methods); - verifyArguments(validTypes, cls.methods); - - // verify function return types - verifyReturnTypes(validTypes, cls.static_methods); - verifyReturnTypes(validTypes, cls.methods); - } - // Generate includes while avoiding redundant includes generateIncludes(wrapperFile);