Browse Source

fix upcast to renamed class

David Rose 24 years ago
parent
commit
8f72ae5079
2 changed files with 12 additions and 2 deletions
  1. 7 2
      direct/src/ffi/FFIInterrogateDatabase.py
  2. 5 0
      direct/src/ffi/FFISpecs.py

+ 7 - 2
direct/src/ffi/FFIInterrogateDatabase.py

@@ -490,8 +490,13 @@ class FFIInterrogateDatabase:
                 typeDescs = self.constructFunctionTypeDescriptors(funcIndex)
                 for typeDesc in typeDescs:
                     funcSpec = FFISpecs.MethodSpecification()
-                    funcSpec.name = FFIRename.methodNameFromCppName(
-                        interrogate_function_name(funcIndex))
+                    # We synthesize the upcast function name instead
+                    # of using the name supplied by interrogate, to
+                    # allow for possible renaming of types on this
+                    # side.
+                    funcSpec.name = 'upcastTo' + typeDesc.returnType.typeDescriptor.foreignTypeName
+                    #funcSpec.name = FFIRename.methodNameFromCppName(
+                    #    interrogate_function_name(funcIndex))
                     funcSpec.typeDescriptor = typeDesc
                     funcSpec.index = funcIndex
                     funcSpecs.append(funcSpec)

+ 5 - 0
direct/src/ffi/FFISpecs.py

@@ -473,9 +473,14 @@ class MethodSpecification(FunctionSpecification):
                 childClass = parentList[i-1]
                 if childClass.hasMethodNamed(methodName):
                     indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n')
+                else:
+                    indent(file, nesting+2, '# upcastSelf = upcastSelf.' + methodName + '()\n')
             else:
                 if methodClass.hasMethodNamed(methodName):
                     indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n')
+                else:
+                    indent(file, nesting+2, '# upcastSelf = upcastSelf.' + methodName + '()\n')
+                    
         indent(file, nesting+2, 'returnValue = ' + self.typeDescriptor.moduleName
                + '.' + self.typeDescriptor.wrapperName + '(upcastSelf.this')
         if (len(thislessArgTypes) > 0):