Fix a bug when the only parameter of a function is a 'body' parameter

This commit is contained in:
Christophe de Vienne 2013-02-15 15:35:37 +01:00
parent d71b762ae3
commit daec0a54f1

View File

@ -118,13 +118,17 @@ class FunctionDefinition(object):
if not mandatory: if not mandatory:
default = defaults[i - (len(args) - len(defaults))] default = defaults[i - (len(args) - len(defaults))]
self.arguments.append(FunctionArgument(argname, datatype, self.arguments.append(FunctionArgument(argname, datatype,
mandatory, default)) mandatory, default))
class signature(object): class signature(object):
def __init__(self, *types, **options): def __init__(self, *types, **options):
self.return_type = types[0] if types else None self.return_type = types[0] if types else None
self.arg_types = types[1:] if len(types) > 1 else None self.arg_types = []
if len(types) > 1:
self.arg_types.extend(types[1:])
if 'body' in options:
self.arg_types.append(options['body'])
self.wrap = options.pop('wrap', False) self.wrap = options.pop('wrap', False)
self.options = options self.options = options