Account for arguments with only a type and no parameter name

Previously, the code was parsing the type into the argname variable and then
when it found something (not "," or ")") following the type it swapped the name
into the type and parsed next part as the name.

However, when no name is provided, as it allowed in c++, if you're not planning
on using the parameter, or it is in a function declaration, then the actual
type was being left in the name variable and the type variable was empty.

As a result function signatures for references were being generated without
knowledge of the type, which is the important factor in disambiguating
overloaded functions.
This commit is contained in:
Michael Jones 2010-11-18 08:56:39 +13:00
parent d04182b85c
commit 71660ccdf1

View File

@ -693,14 +693,13 @@ class DefinitionParser(object):
self.fail('expected comma between arguments')
self.skip_ws()
argname = self._parse_type()
argtype = default = None
argtype = self._parse_type()
argname = default = None
self.skip_ws()
if self.skip_string('='):
self.pos += 1
default = self._parse_default_expr()
elif self.current_char not in ',)':
argtype = argname
argname = self._parse_name()
self.skip_ws()
if self.skip_string('='):