Bläddra i källkod

*** empty log message ***

Joe Shochet 25 år sedan
förälder
incheckning
d212027cf1
2 ändrade filer med 17 tillägg och 1 borttagningar
  1. 15 0
      direct/src/ffi/FFIOverload.py
  2. 2 1
      direct/src/ffi/FFISpecs.py

+ 15 - 0
direct/src/ffi/FFIOverload.py

@@ -267,6 +267,8 @@ class FFIMethodArgumentTreeCollection:
 
         self.outputOverloadedMethodFooter(file, nesting)
 
+    
+
 class FFIMethodArgumentTree:
     """
     Tree is made from nested dictionaries.
@@ -369,3 +371,16 @@ class FFIMethodArgumentTree:
                 indent(file, 0, ('<' + name + '> '))
             indent(file, 0, "'\n")
 
+    def isSinglePath(self):
+        if (len(self.tree.keys()) > 1):
+            # More than one child, return false
+            return 0
+        else:
+            # Only have one child, see if he only has one child
+            key = self.tree.keys()[0]
+            tree = self.tree[key][0]
+            if tree:
+                return tree.isSinglePath()
+            else:
+                return self.tree[key][1]
+

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

@@ -332,7 +332,8 @@ class MethodSpecification(FunctionSpecification):
         # The method body will look something like
         #     panda.Class_destructor(self.this)
         self.outputCFunctionComment(file, nesting+2)
-        indent(file, nesting+2, self.typeDescriptor.moduleName + '.'
+        indent(file, nesting+2, 'if ' + self.typeDescriptor.moduleName + ':\n')
+        indent(file, nesting+3, self.typeDescriptor.moduleName + '.'
                    + self.typeDescriptor.wrapperName + '(self.this)\n')
 
     def outputDestructorFooter(self, methodClass, file, nesting):