From: Jack Jansen Date: Thu, 30 Jun 2005 15:00:13 +0000 (+0000) Subject: More factorization: added a method getrvforcallit(). This allows a C++ X-Git-Tag: v2.5a0~1630 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62cc1233f9796222cce9638333546357920c6d3d;p=thirdparty%2FPython%2Fcpython.git More factorization: added a method getrvforcallit(). This allows a C++ bridge to combine declaration and assignment to the return value temporary, allowing us to handle functions returning const values. --- diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py index 03e8b45debc4..83ff552b0cb6 100644 --- a/Tools/bgen/bgen/bgenGenerator.py +++ b/Tools/bgen/bgen/bgenGenerator.py @@ -213,10 +213,7 @@ class FunctionGenerator(BaseFunctionGenerator): def callit(self): args = "" - if self.rv: - s = "%s = %s(" % (self.rv.name, self.callname) - else: - s = "%s(" % self.name + s = "%s%s(" % (self.getrvforcallit(), self.callname) sep = ",\n" + ' '*len(s) for arg in self.argumentList: if arg is self.rv: @@ -224,12 +221,15 @@ class FunctionGenerator(BaseFunctionGenerator): s = arg.passArgument() if args: s = sep + s args = args + s + Output("%s%s(%s);", + self.getrvforcallit(), self.callname, args) + + def getrvforcallit(self): if self.rv: - Output("%s = %s(%s);", - self.rv.name, self.callname, args) + return "%s = " % self.rv.name else: - Output("%s(%s);", self.callname, args) - + return "" + def checkit(self): for arg in self.argumentList: arg.errorCheck()