def visit_FunctionDef(self, node):
name = node.name
args = self.visit(node.args)
body = [self.visit(x) for x in node.body]
docstring = ast.get_docstring(node)
if docstring:
body = body[1:]
if hasattr(node, "returns"):
returns = self.visit(node.returns)
else:
returns = None
# TODO: decorator_list
return cpp.FunctionDef(name=name, args=args, body=body, docstring=docstring, returns=returns)
评论列表
文章目录