From 6237be888fe97046be6244759fae7b354124eb1d Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Mon, 5 Mar 2001 22:39:56 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/ffi/FFISpecs.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/direct/src/ffi/FFISpecs.py b/direct/src/ffi/FFISpecs.py index 8e21d5d421..b9f5147865 100644 --- a/direct/src/ffi/FFISpecs.py +++ b/direct/src/ffi/FFISpecs.py @@ -140,7 +140,7 @@ class GlobalFunctionSpecification(FunctionSpecification): # Use generateCode when creating a global (non-class) function def generateGlobalDowncastCode(self, file): self.outputHeader(file) - self.outputBody(file, 0) # no downcast + self.outputBody(file, 0, 0) # no downcast, no type checking self.outputFooter(file) # Use generateMethodCode when creating a global->class function @@ -161,7 +161,7 @@ class GlobalFunctionSpecification(FunctionSpecification): file.write(', ') file.write('):\n') - def outputBody(self, file, needsDowncast=1): + def outputBody(self, file, needsDowncast=1, typeChecking=1): # The method body will look something like # returnValue = PandaGlobal.method(arg) # returnObject = NodePath() @@ -170,7 +170,13 @@ class GlobalFunctionSpecification(FunctionSpecification): # return returnObject self.outputCFunctionComment(file, 1) argTypes = self.typeDescriptor.argumentTypes - self.outputTypeChecking(None, argTypes, file, 1) + # The global downcast functions do not need type checking, and + # in fact have a problem where they assert you are downcasting + # from the immediate superclass when in fact you may be downcasting + # from a class way up the chain as long as their is single + # inheritance up to it + if typeChecking: + self.outputTypeChecking(None, argTypes, file, 1) indent(file, 1, 'returnValue = ' + self.typeDescriptor.moduleName + '.' + self.typeDescriptor.wrapperName + '(') for i in range(len(argTypes)):