From: David Kerkeslager Date: Thu, 14 Sep 2017 23:23:06 +0000 (-0400) Subject: Reuse normalize_basic_infix_operation in implementation of normalize_comparison_expre... X-Git-Url: https://code.kerkeslager.com/?a=commitdiff_plain;h=a7d494789ae5f65c635b4a31e0468b2c17acdd34;p=fur Reuse normalize_basic_infix_operation in implementation of normalize_comparison_expression --- diff --git a/normalization.py b/normalization.py index 5b5bd94..3b492a3 100644 --- a/normalization.py +++ b/normalization.py @@ -481,37 +481,7 @@ def normalize_comparison_expression(counter, expression): if isinstance(expression.left, parsing.FurInfixExpression) and expression.order == 'comparison_level': return desugar_ternary_comparison(counter, expression) - counter, left_prestatements, left_expression = normalize_expression(counter, expression.left) - counter, right_prestatements, right_expression = normalize_expression(counter, expression.right) - - left_variable = '${}'.format(counter) - counter += 1 - right_variable = '${}'.format(counter) - counter += 1 - - root_prestatements = ( - NormalVariableInitializationStatement( - variable=left_variable, - expression=left_expression, - ), - NormalVariableInitializationStatement( - variable=right_variable, - expression=right_expression, - ), - ) - - counter, result_prestatements, result_expression = ( - counter, - left_prestatements + right_prestatements + root_prestatements, - NormalInfixExpression( - order=expression.order, - operator=expression.operator, - left=NormalVariableExpression(variable=left_variable), - right=NormalVariableExpression(variable=right_variable), - ), - ) - - return (counter, result_prestatements, result_expression) + return normalize_basic_infix_operation(counter, expression) def normalize_boolean_expression(counter, expression): counter, left_prestatements, left_expression = normalize_expression(counter, expression.left)