From: David Kerkeslager Date: Wed, 24 Jul 2019 17:12:30 +0000 (-0400) Subject: Remove unecessary pushing/popping for function calls X-Git-Url: https://code.kerkeslager.com/?a=commitdiff_plain;h=1c6569d51fe16165b0114dfea143d8c6a971777c;p=fur Remove unecessary pushing/popping for function calls --- diff --git a/generation.py b/generation.py index e167f25..d855d07 100644 --- a/generation.py +++ b/generation.py @@ -56,10 +56,10 @@ def generate_expression(expression): def generate_function_call(function_call): # This gets called twice, so we want to be sure it is efficient and without side effects - assert isinstance(function_call.function_expression, transformation.CVariableExpression) + assert isinstance(function_call.function_expression, transformation.CSymbolExpression) # TODO Check the type of the things being called - function_expression = generate_variable_expression(function_call.function_expression) + function_expression = generate_expression(function_call.function_expression) return '{}.instance.closure.call(environmentPool, {}.instance.closure.closed, {}, stack, {}, jump)'.format( function_expression, function_expression, diff --git a/normalization.py b/normalization.py index b55d42c..5eef1db 100644 --- a/normalization.py +++ b/normalization.py @@ -280,16 +280,10 @@ def normalize_structure_literal_expression(counter, expression): def normalize_symbol_expression(counter, expression): - variable = '${}'.format(counter) return ( - counter + 1, - ( - NormalVariableInitializationStatement( - variable=variable, - expression=NormalSymbolExpression(symbol=expression.symbol), - ), - ), - NormalVariableExpression(variable=variable), + counter, + (), + NormalSymbolExpression(symbol=expression.symbol), ) def normalize_function_call_expression(counter, expression): @@ -315,19 +309,6 @@ def normalize_function_call_expression(counter, expression): for ps in function_prestatements: prestatements.append(ps) - if not isinstance(function_expression, NormalVariableExpression): - function_variable = '${}'.format(counter) - - prestatements.append( - NormalVariableInitializationStatement( - variable=function_variable, - expression=function_expression, - ) - ) - - function_expression = NormalVariableExpression(variable=function_variable) - counter += 1 - result_variable = '${}'.format(counter) prestatements.append(