Assign the result of the native call to the result variable.
authorMs2ger <ms2ger@gmail.com>
Sun, 12 Feb 2012 18:44:30 +0100
changeset 86764 389754ef0554763a7191cea2da15e1bf876a34f1
parent 86763 e1bd74e88ad2d4b5e369113a633fe2ebc5fbbce9
child 86765 2420d45e5be97eb8a22e193b56fb94d316227bc5
push id111
push userMs2ger@gmail.com
push dateSun, 12 Feb 2012 17:52:41 +0000
milestone13.0a1
Assign the result of the native call to the result variable.
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -874,31 +874,40 @@ class PerSignatureCall():
                 resultDeclaration = "  Nullable<%s> result;\n" % builtinNames[self.returnType.tag()]
             else:
                 resultDeclaration = "  %s result = 0;\n" % builtinNames[self.returnType.tag()]
         elif self.returnType.isString():
             resultDeclaration = "  nsAutoString result;\n"
         else:
             resultDeclaration = "  // XXX need to declare |result| for type %s.\n" % self.returnType
 
+        if self.returnType is None or self.returnType.isVoid():
+            resultAssignment = ""
+        else:
+            resultAssignment = "result = "
+
         if self.isFallible():
             rvDeclaration =  '  nsresult rv = NS_OK;\n'
             errorCheckClause = '  if (NS_FAILED(rv)) {\n    %s\n  }\n' \
                                % self.getErrorReport()
         else:
             rvDeclaration = ''
             errorCheckClause = ''
 
-        return """
-%s%s  // XXXbz need to actually make those methods exist!
+        return string.Template("""
+${rv}${resultDecl}  // XXXbz need to actually make those methods exist!
 #if 0
-  self->%s(%s);
+  ${resultAssign}self->${method}(${args});
 #endif
-%s""" % (rvDeclaration, resultDeclaration, self.nativeMethodName,
-         ', '.join(nativeArgs), errorCheckClause)
+${errorCheck}""").substitute({ "rv": rvDeclaration,
+                               "resultDecl": resultDeclaration,
+                               "resultAssign": resultAssignment,
+                               "method": self.nativeMethodName,
+                               "args": ', '.join(nativeArgs),
+                               "errorCheck": errorCheckClause })
 
     def wrap_return_value(self):
         resultTemplateValues = {'jsvalRef': '*vp', 'jsvalPtr': 'vp'}
         return string.Template(
             getWrapTemplateForType(self.returnType)
             ).substitute(resultTemplateValues)
 
     def getErrorReport(self):