From 9327e74980ac3ff62e94407dbd1ee9c1f9439647 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 9 Oct 2018 20:48:11 -0700 Subject: [PATCH] We already have method.argsString, no need to regenerate from the ParamDefs --- etgtools/tweaker_tools.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index b6b4d93e..324e337f 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -1275,14 +1275,6 @@ def generateStubs(cppFlag, module, excludes=[], typeValMap={}): Generate C++ stubs for all items in the module, except those that are in the optional excludes list. """ - import copy - typeValMap = copy.copy(typeValMap) - typeValMap.update({ - 'int': '0', - 'bool': 'false', - #'wxWindow*': 'NULL', - }) - # First add a define for the cppFlag (like wxUSE_SOME_FEATURE) so the user # code has a way to check if an optional classis available before using it # and getting an exception. @@ -1291,6 +1283,15 @@ def generateStubs(cppFlag, module, excludes=[], typeValMap={}): module.addItem(extractors.DefineDef(name=cppFlag, value='0')) excludes.append(cppFlag) + # copy incoming typeValMap so it can be updated with some stock types + import copy + typeValMap = copy.copy(typeValMap) + typeValMap.update({ + 'int': '0', + 'bool': 'false', + #'wxWindow*': 'NULL', + }) + # Generate the stub code to a list of strings, which will be joined later code = [] code.append('#if !{}'.format(cppFlag)) @@ -1358,15 +1359,10 @@ def _generateMethodStub(code, method, typeValMap): if method.isStatic: decl += 'static ' if method.isCtor or method.isDtor: - decl += '{}('.format(method.name) + decl += '{}'.format(method.name) else: - decl += '{} {}('.format(method.type, method.name) - - params = [param.type for param in method] - if params: - decl += ', '.join(params) - - decl += ')' + decl += '{} {}'.format(method.type, method.name) + decl += method.argsString if method.isPureVirtual: decl += ' = 0;' code.append(decl)