Bug 1177869. Fix example codegen to output the correct return type for WrapObject in the non-wrappercached case. r=peterv

This commit is contained in:
Boris Zbarsky 2015-07-01 14:15:20 -04:00
parent e73189f7da
commit 1744262129

View File

@ -13407,10 +13407,13 @@ class CGBindingImplClass(CGClass):
wrapArgs = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aGivenProto')]
if not descriptor.wrapperCache:
wrapReturnType = "bool"
wrapArgs.append(Argument('JS::MutableHandle<JSObject*>',
'aReflector'))
else:
wrapReturnType = "JSObject*"
self.methodDecls.insert(0,
ClassMethod(wrapMethodName, "JSObject*",
ClassMethod(wrapMethodName, wrapReturnType,
wrapArgs, virtual=descriptor.wrapperCache,
breakAfterReturnDecl=" ",
override=descriptor.wrapperCache,
@ -13529,11 +13532,13 @@ class CGExampleClass(CGBindingImplClass):
if self.descriptor.wrapperCache:
reflectorArg = ""
reflectorPassArg = ""
returnType = "JSObject*"
else:
reflectorArg = ", JS::MutableHandle<JSObject*> aReflector"
reflectorPassArg = ", aReflector"
returnType = "bool"
classImpl = ccImpl + ctordtor + "\n" + dedent("""
JSObject*
${returnType}
${nativeType}::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto${reflectorArg})
{
return ${ifaceName}Binding::Wrap(aCx, this, aGivenProto${reflectorPassArg});
@ -13544,6 +13549,7 @@ class CGExampleClass(CGBindingImplClass):
ifaceName=self.descriptor.name,
nativeType=self.nativeLeafName(self.descriptor),
parentType=self.nativeLeafName(self.parentDesc) if self.parentIface else "",
returnType=returnType,
reflectorArg=reflectorArg,
reflectorPassArg=reflectorPassArg)