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)
评论列表
文章目录