Skip to content

Commit

Permalink
Remove unused
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichardson committed Aug 23, 2023
1 parent 8d50f9e commit 6074079
Showing 1 changed file with 0 additions and 75 deletions.
75 changes: 0 additions & 75 deletions ffcx/codegeneration/C/cnodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6074079

Please sign in to comment.