def visit_Subscript(self, node, types=None, typ=None):
pp = ProgramPoint(node.lineno, node.col_offset)
if isinstance(node.slice, ast.Index):
target = self.visit(node.value, types, typ)
key = self.visit(node.slice.value, types, typ)
return SubscriptionAccess(pp, target, key)
elif isinstance(node.slice, ast.Slice):
return SliceStmt(pp, self._ensure_stmt_visit(node.value, pp, *args, **kwargs),
self._ensure_stmt_visit(node.slice.lower, pp, *args, **kwargs),
self._ensure_stmt_visit(node.slice.step, pp, *args, **kwargs) if node.slice.step else None,
self._ensure_stmt_visit(node.slice.upper, pp, *args, **kwargs))
else:
raise NotImplementedError(f"The statement {str(type(node.slice))} is not yet translatable to CFG!")
评论列表
文章目录