Re: [pygccxml-development] Question about calldef_wrapper_t.argument_name()
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-09-15 12:35:39
|
Roman Yakovenko wrote: >> So the name can only be empty if gccxml reports it as such. I don't know >> if this can ever happen or not, but even if it can happen, why is the >> test from calldef_wrapper_t not moved to the scanner? For example: >> >> if not argument.name: >> argument.name = 'arg%d' % len(self.__inst.arguments) >> >> Then an argument_t object read from a C++ file would always have a valid >> name and the method argument_name() wouldn't be required anymore (and >> other parts of the code would actually also be able to know the name of >> an argument). > > You can not do it. If you set argument names from the scanner, than Py++ > will generate wrong code - keyword arguments. Take a look on > code_creators.calldef_t.keywords_args method. Now the answer to your > question should be clear. Uhm, well, sorry, it didn't get clear. What part of keywords_args() depends on gccxml producing empty strings? This method just uses the 'name' attribute without checking if it is empty or not: result.append( '("%s")' % arg.name ) But if arg.name is empty, the wrapper code creator replaces it with p0,p1,p2, etc. So shouldn't keywords_args() do the same thing instead of leaving the string empty? (which is not a valid name for a keyword argument anyway) - Matthias - |