Browse Source

fix forcetype for template instantiations

David Rose 16 years ago
parent
commit
882b544805

+ 4 - 0
dtool/src/cppparser/cppType.cxx

@@ -34,6 +34,10 @@ CPPType(const CPPFile &file) :
   CPPDeclaration(file)
 {
   _declaration = (CPPTypeDeclaration *)NULL;
+
+  // This is set true by interrogate when the "forcetype" keyword is
+  // used.
+  _forcetype = false;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
dtool/src/cppparser/cppType.h

@@ -77,6 +77,7 @@ public:
   static string get_preferred_name_for(const CPPType *type);
 
   CPPTypeDeclaration *_declaration;
+  bool _forcetype;
 
 protected:
   typedef set<CPPType *, CPPTypeCompare> Types;

+ 1 - 0
dtool/src/interrogate/interrogateBuilder.cxx

@@ -145,6 +145,7 @@ do_command(const string &command, const string &params) {
       nout << "Unknown type: forcetype " << params << "\n";
     } else {
       type = type->resolve_type(&parser, &parser);
+      type->_forcetype = true;
       _forcetype.insert(type->get_local_name(&parser));
     }
 

+ 7 - 3
dtool/src/interrogate/typeManager.cxx

@@ -1704,11 +1704,15 @@ bool TypeManager::IsLocal(CPPType *in_type)
     // A local means it was compiled in this scope of work..
     // IE a should actualy generate code for this objects....
    CPPType *base_type = resolve_type(unwrap(in_type));
+   if (base_type->_forcetype) {
+     return true;
+   }
 
-   if(base_type->_file._source == CPPFile::S_local && !base_type->is_incomplete())
-       return true;
+   if (base_type->_file._source == CPPFile::S_local && !base_type->is_incomplete()) {
+     return true;
+   }
 
-    return false;
+   return false;
 
     /*