def slicing_access_semantics(self, stmt: SlicingAccess, state: State) -> State:
"""Semantics of a slicing access.
:param stmt: slicing access statement to be executed
:param state: state before executing the slicing access
:return: state modified by the slicing access
"""
target = self.semantics(stmt.target, state).result
lower = self.semantics(stmt.lower, state).result
upper = self.semantics(stmt.upper, state).result
stride = self.semantics(stmt.stride, state).result if stmt.stride else {None}
result = set()
for primary, start, stop, step in itertools.product(target, lower, upper, stride):
slicing = Slicing(primary.typ, primary, start, stop, step)
result.add(slicing)
state.result = result
return state
评论列表
文章目录