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