diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-02-01 11:53:36 +0000 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-02-13 14:08:58 +0000 |
commit | 6d2529632bae545ff7564501cac14316d5ea9204 (patch) | |
tree | cfcb11c01f1ddd4806a24469687a1ebc18bd41f4 /astroid/tree/treeabc.py | |
parent | 18fa724c04c2393b134d57d4fe4cebe38472bad8 (diff) | |
download | astroid-git-6d2529632bae545ff7564501cac14316d5ea9204.tar.gz |
Changed the way how parameters are being built
The old way consisted in having the parameter names, their
defaults and their annotations separated in different components
of the Arguments node. We introduced a new Param node, which holds
the name of a parameter, its default value and its annotation.
If any of the last two values are missing, then that slot will be
filled with a new node kind, Empty, which is used for specifying the
lack of something (None could have been used instead, but that means having
non-AST nodes in the Arguments node).
We're also having support for positional only arguments, for the moment
only in raw_building.
Close #215
Diffstat (limited to 'astroid/tree/treeabc.py')
-rw-r--r-- | astroid/tree/treeabc.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/astroid/tree/treeabc.py b/astroid/tree/treeabc.py index 6ad96ba8..5c008255 100644 --- a/astroid/tree/treeabc.py +++ b/astroid/tree/treeabc.py @@ -67,6 +67,10 @@ class Name(NodeNG): """Class representing a Name node""" +class Parameter(NodeNG): + """Class representing a parameter node.""" + + class Arguments(NodeNG): """Class representing an Arguments node""" @@ -339,3 +343,12 @@ class ReservedName(NodeNG): class Unknown(NodeNG): pass + + +class Empty(NodeNG): + """Empty nodes represents the lack of something + + For instance, they can be used to represent missing annotations + or defaults for arguments or anything where None is a valid + value. + """ |