Introduce property on statement to check whether it affects assertions
@@ -213,6 +213,15 @@ class Statement(metaclass=ABCMeta):
def assertions(self, assertions: OrderedSet[ass.Assertion]) -> None:
self._assertions = assertions
+ @property
+ def affects_assertions(self) -> bool:
+ """Does the execution of this statement possibly affects assertions.
+
+ Returns:
+ Whether the execution of this statement possibly affect assertions.
+ """
+ return False
+
@abstractmethod
def structural_eq(
self, other: Statement, memo: Dict[vr.VariableReference, vr.VariableReference]
@@ -1160,6 +1169,10 @@ class ParametrizedStatement(
return list(parameters.values())[arg]
return parameters[arg]
+ @property
+ def affects_assertions(self) -> bool:
+ return True
+
def structural_hash(self) -> int:
return (
31
