Commit e871e864 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Add __hash__ and __eq__ to CustomCodeNode

parent 6aeab41e
...@@ -132,6 +132,12 @@ class CustomCodeNode(Node): ...@@ -132,6 +132,12 @@ class CustomCodeNode(Node):
def undefined_symbols(self): def undefined_symbols(self):
return self._symbols_read - self._symbols_defined return self._symbols_read - self._symbols_defined
def __eq___(self, other):
return self._code == other._code
def __hash__(self):
return hash(self._code)
class PrintNode(CustomCodeNode): class PrintNode(CustomCodeNode):
# noinspection SpellCheckingInspection # noinspection SpellCheckingInspection
...@@ -434,6 +440,7 @@ class CustomSympyPrinter(CCodePrinter): ...@@ -434,6 +440,7 @@ class CustomSympyPrinter(CCodePrinter):
condition=self._print(var) + ' <= ' + self._print(end) # if start < end else '>=' condition=self._print(var) + ' <= ' + self._print(end) # if start < end else '>='
) )
return code return code
_print_Max = C89CodePrinter._print_Max _print_Max = C89CodePrinter._print_Max
_print_Min = C89CodePrinter._print_Min _print_Min = C89CodePrinter._print_Min
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment