mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
bpo-29463: Add docstring field to some AST nodes. (#46)
* bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
This commit is contained in:
parent
1bc156430b
commit
cb41b2766d
15 changed files with 3153 additions and 3048 deletions
|
@ -71,6 +71,8 @@ class Unparser:
|
|||
########################################################
|
||||
|
||||
def _Module(self, tree):
|
||||
if tree.docstring is not None:
|
||||
self.fill(repr(tree.docstring))
|
||||
for stmt in tree.body:
|
||||
self.dispatch(stmt)
|
||||
|
||||
|
@ -235,6 +237,8 @@ class Unparser:
|
|||
self.write(")")
|
||||
|
||||
self.enter()
|
||||
if t.docstring is not None:
|
||||
self.fill(repr(t.docstring))
|
||||
self.dispatch(t.body)
|
||||
self.leave()
|
||||
|
||||
|
@ -257,6 +261,8 @@ class Unparser:
|
|||
self.write(" -> ")
|
||||
self.dispatch(t.returns)
|
||||
self.enter()
|
||||
if t.docstring is not None:
|
||||
self.fill(repr(t.docstring))
|
||||
self.dispatch(t.body)
|
||||
self.leave()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue