Commit d7294d6c authored by Sergio Costas's avatar Sergio Costas

Now accepts functions without parameters

parent 4755a935
......@@ -433,9 +433,10 @@ class crusty(object):
continue
if (node.type == "FUNCTION_DECLARATION") or (node.type == "FUNCTION_DEFINITION"):
counter = 0
for parameter in node.function_params:
if parameter.t_crusty_recycle:
counter += 1
if node.function_params is not None:
for parameter in node.function_params:
if parameter.t_crusty_recycle:
counter += 1
if counter > 1:
self._add_error(self.MSG_CRITICAL,"The function '{:s}', at line {:d}, has more than one RECYCLE parameter.",node.name,node.line)
if (counter != 0) and (not node.t_crusty):
......@@ -443,8 +444,9 @@ class crusty(object):
if not node.t_typedef:
# the first parameter is the return value
parameters = [self._get_variable_properties(node,False,True)]
for parameter in node.function_params:
parameters.append( self._get_variable_properties(parameter,True) )
if node.function_params is not None:
for parameter in node.function_params:
parameters.append( self._get_variable_properties(parameter,True) )
function_container[node.name] = parameters
continue
if node.type == "CRUSTY_DEBUG":
......@@ -460,8 +462,9 @@ class crusty(object):
if node.type == "FUNCTION_DEFINITION":
tmpvars = self._copy_container(var_container)
tmpvars.insert(0,{})
for element in node.function_params:
tmpvars[0][element.name] = {"properties":self._get_variable_properties(element,True), "status":crusty.STATUS_NOT_NULL_OR_NULL, "init_line": element.line, "pointer": element.pointer }
if node.function_params is not None:
for element in node.function_params:
tmpvars[0][element.name] = {"properties":self._get_variable_properties(element,True), "status":crusty.STATUS_NOT_NULL_OR_NULL, "init_line": element.line, "pointer": element.pointer }
self._process_block(node.child1,tmpvars, function_container)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment