cfg_generator.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Lyra 作者: caterinaurban 项目源码 文件源码
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!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号