X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=normalization.py;h=a41eb8df0e9211d09f3191d12b8977ca54189bbd;hp=1da656958bd91b78ea41a7017257f1584af4f03e;hb=ab984279c92601b321db123984c753aa862daad8;hpb=1852539af30c364a11d2e2a0bb7944102293dcf6 diff --git a/normalization.py b/normalization.py index 1da6569..a41eb8d 100644 --- a/normalization.py +++ b/normalization.py @@ -30,7 +30,16 @@ NormalFunctionCallExpression = collections.namedtuple( 'NormalFunctionCallExpression', [ 'function', - 'arguments', + 'argument_count', + 'argument_items', + ], +) + +NormalArrayVariableInitializationStatement = collections.namedtuple( + 'NormalArrayVariableInitializationStatement', + [ + 'variable', + 'items', ], ) @@ -98,12 +107,21 @@ def normalize_function_call_expression(counter, expression): )) counter += 1 + arguments_variable = '${}'.format(counter) + counter += 1 + + prestatements.append(NormalArrayVariableInitializationStatement( + variable=arguments_variable, + items=tuple(arguments), + )) + return ( counter, tuple(prestatements), NormalFunctionCallExpression( - expression.function, # TODO Normalize the function - arguments=tuple(arguments), + function=expression.function, # TODO Normalize the function + argument_count=len(arguments), + argument_items=NormalVariableExpression(variable=arguments_variable), ), )