classes.py 文件源码

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

项目:metapensiero.pj 作者: azazel75 项目源码 文件源码
def _class_guards(t, x):
    t.es6_guard(x, "'class' statement requires ES6")
    t.unsupported(x, len(x.bases) > 1, "Multiple inheritance is not supported")
    body = x.body
    for node in body:
        t.unsupported(x, not (isinstance(node, (ast.FunctionDef,
                                                ast.AsyncFunctionDef,
                                                ast.Assign)) or \
                              _isdoc(node) or isinstance(node, ast.Pass)),
                      "Class' body members must be functions or assignments")
        t.unsupported(x, isinstance(node, ast.Assign) and len(node.targets) > 1,
                      "Assignments must have only one target")
    if len(x.bases) > 0:
        assert len(x.bases) == 1
    assert not x.keywords, "class '{}', args cannot be keywords".format(x.name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号