From a7d494789ae5f65c635b4a31e0468b2c17acdd34 Mon Sep 17 00:00:00 2001 From: David Kerkeslager Date: Thu, 14 Sep 2017 19:23:06 -0400 Subject: [PATCH] Reuse normalize_basic_infix_operation in implementation of normalize_comparison_expression --- normalization.py | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) 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) -- 2.20.1