X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=normalization.py;h=2fa57fc5365cb3c864fde0f91d9536c1c848b750;hp=dcbe9dd2d459fbdc83da79a28193f059ff6ab20c;hb=8d6f07b43d8b41473fb7d8779bbc7a5843adcd7b;hpb=cfb4e75abc7682119ab133e0d1e5a8cfb4068ee9 diff --git a/normalization.py b/normalization.py index dcbe9dd..2fa57fc 100644 --- a/normalization.py +++ b/normalization.py @@ -56,12 +56,18 @@ NormalInfixExpression = collections.namedtuple( ], ) +NormalPushStatement = collections.namedtuple( + 'NormalPushStatement', + ( + 'expression', + ), +) + NormalFunctionCallExpression = collections.namedtuple( 'NormalFunctionCallExpression', [ 'function_expression', 'argument_count', - 'argument_items', ], ) @@ -326,7 +332,6 @@ def normalize_function_call_expression(counter, expression): assert isinstance(expression, parsing.FurFunctionCallExpression) prestatements = [] - arguments = [] for argument in expression.arguments: counter, argument_prestatements, normalized_argument = normalize_expression(counter, argument) @@ -341,19 +346,15 @@ def normalize_function_call_expression(counter, expression): expression=normalized_argument, ) ) - arguments.append(NormalVariableExpression( - variable=variable, - )) + prestatements.append( + NormalPushStatement( + expression=NormalVariableExpression( + variable=variable, + ), + ), + ) counter += 1 - arguments_variable = '${}'.format(counter) - counter += 1 - - prestatements.append(NormalArrayVariableInitializationStatement( - variable=arguments_variable, - items=tuple(arguments), - )) - counter, function_prestatements, function_expression = normalize_expression( counter, expression.function, @@ -382,8 +383,7 @@ def normalize_function_call_expression(counter, expression): variable=result_variable, expression=NormalFunctionCallExpression( function_expression=function_expression, - argument_count=len(arguments), - argument_items=NormalVariableExpression(variable=arguments_variable), + argument_count=len(expression.arguments), ), ) )