瀏覽代碼

*** empty log message ***

Joe Shochet 25 年之前
父節點
當前提交
82d52e4abc
共有 2 個文件被更改,包括 17 次插入12 次删除
  1. 3 2
      direct/src/ffi/FFISpecs.py
  2. 14 10
      direct/src/ffi/FFITypes.py

+ 3 - 2
direct/src/ffi/FFISpecs.py

@@ -428,6 +428,7 @@ class MethodSpecification(FunctionSpecification):
         argTypes = self.typeDescriptor.argumentTypes
         thislessArgTypes = self.typeDescriptor.thislessArgTypes()
         self.outputTypeChecking(methodClass, thislessArgTypes, file, nesting+2)
+        indent(file, nesting+2, 'upcastSelf = self\n')
         for i in range(len(parentList)):
             # Only output the upcast call if that parent class defines it
             parentClass = parentList[i]
@@ -435,10 +436,10 @@ class MethodSpecification(FunctionSpecification):
             if (i != 0):
                 childClass = parentList[i-1]
                 if childClass.hasMethodNamed(methodName):
-                    indent(file, nesting+2, 'upcastSelf = self.' + methodName + '()\n')
+                    indent(file, nesting+2, 'upcastSelf = upcastSelf.' + methodName + '()\n')
             else:
                 if methodClass.hasMethodNamed(methodName):
-                    indent(file, nesting+2, 'upcastSelf = self.' + methodName + '()\n')
+                    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):

+ 14 - 10
direct/src/ffi/FFITypes.py

@@ -228,6 +228,18 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
         """
         return self.foreignTypeName + '-extensions.py'
 
+    def getCModulesRecursively(self, parent):
+        # Now look at all the methods that we might inherit if we are at
+        # a multiple inheritance node and get their C modules
+        for parentType in parent.parentTypes:
+            for method in parentType.instanceMethods:
+                if (not (method.typeDescriptor.moduleName in self.CModules)):
+                    self.CModules.append(method.typeDescriptor.moduleName)
+            for method in parentType.upcastMethods:
+                if (not (method.typeDescriptor.moduleName in self.CModules)):
+                        self.CModules.append(method.typeDescriptor.moduleName)
+            self.getCModulesRecursively(parentType)
+
     def getCModules(self):
         """
         Return a list of all the C modules this class references
@@ -244,16 +256,8 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
                 if method:
                     if (not (method.typeDescriptor.moduleName in self.CModules)):
                         self.CModules.append(method.typeDescriptor.moduleName)
-                        # Now look at all the methods that we might inherit if we are at
-                        # a multiple inheritance node and get their C modules
-                        if (len(self.parentTypes) >= 2):
-                            for parentType in self.parentTypes:
-                                for method in parentType.instanceMethods:
-                                    if (not (method.typeDescriptor.moduleName in self.CModules)):
-                                        self.CModules.append(method.typeDescriptor.moduleName)
-                                for method in parentType.upcastMethods:
-                                    if (not (method.typeDescriptor.moduleName in self.CModules)):
-                                        self.CModules.append(method.typeDescriptor.moduleName)
+            self.getCModulesRecursively(self)
+
             return self.CModules