diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2019-06-01 21:47:49 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-06-01 21:47:49 +0200 |
commit | a63f18dfa7e15f8243409bd121011b7c01707582 (patch) | |
tree | fc7538300fb21cdcb4abe9d73e51c8acbe6c3cb1 /astroid/rebuilder.py | |
parent | b58d4628b7b40e0af882166ffe945f7cb9d2dbda (diff) | |
download | astroid-git-a63f18dfa7e15f8243409bd121011b7c01707582.tar.gz |
Add support for Python 3.8's `NamedExpr` nodes, which is part of assignment expressions.
Close #674
Diffstat (limited to 'astroid/rebuilder.py')
-rw-r--r-- | astroid/rebuilder.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py index c18893d8..a60785c4 100644 --- a/astroid/rebuilder.py +++ b/astroid/rebuilder.py @@ -1063,6 +1063,13 @@ class TreeRebuilder3(TreeRebuilder): ) return newnode + def visit_namedexpr(self, node, parent): + newnode = nodes.NamedExpr(node.lineno, node.col_offset, parent) + newnode.postinit( + self.visit(node.target, newnode), self.visit(node.value, newnode) + ) + return newnode + if sys.version_info >= (3, 0): TreeRebuilder = TreeRebuilder3 |