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,
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):
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(