diff --git a/ffcx/codegeneration/C/cnodes.py b/ffcx/codegeneration/C/cnodes.py index 3d6eb7666..c648d3284 100644 --- a/ffcx/codegeneration/C/cnodes.py +++ b/ffcx/codegeneration/C/cnodes.py @@ -1459,81 +1459,6 @@ def flops(self): return 0 -def _is_simple_if_body(body): - if isinstance(body, StatementList): - if len(body.statements) > 1: - return False - (body,) = body.statements - return isinstance(body, (Return, AssignOp)) - - -class If(CStatement): - __slots__ = ("condition", "body") - is_scoped = True - - def __init__(self, condition, body): - self.condition = as_cexpr(condition) - self.body = as_cstatement(body) - - def cs_format(self, precision=None): - statement = "if (" + self.condition.ce_format(precision) + ")" - body_fmt = Indented(self.body.cs_format(precision)) - if _is_simple_if_body(self.body): - return (statement, body_fmt) - else: - return (statement, "{", body_fmt, "}") - - def __eq__(self, other): - return ( - isinstance(other, type(self)) - and self.condition == other.condition - and self.body == other.body - ) - - -class ElseIf(CStatement): - __slots__ = ("condition", "body") - is_scoped = True - - def __init__(self, condition, body): - self.condition = as_cexpr(condition) - self.body = as_cstatement(body) - - def cs_format(self, precision=None): - statement = "else if (" + self.condition.ce_format(precision) + ")" - body_fmt = Indented(self.body.cs_format(precision)) - if _is_simple_if_body(self.body): - return (statement, body_fmt) - else: - return (statement, "{", body_fmt, "}") - - def __eq__(self, other): - return ( - isinstance(other, type(self)) - and self.condition == other.condition - and self.body == other.body - ) - - -class Else(CStatement): - __slots__ = ("body",) - is_scoped = True - - def __init__(self, body): - self.body = as_cstatement(body) - - def cs_format(self, precision=None): - statement = "else" - body_fmt = Indented(self.body.cs_format(precision)) - if _is_simple_if_body(self.body): - return (statement, body_fmt) - else: - return (statement, "{", body_fmt, "}") - - def __eq__(self, other): - return isinstance(other, type(self)) and self.body == other.body - - def is_simple_inner_loop(code): if isinstance(code, ForRange) and is_simple_inner_loop(code.body): return True