aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast/printer.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-12-07 14:42:23 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-03-02 10:34:55 +0100
commitc14aea2812fd2be94998bdb174e9a4681aeea394 (patch)
tree7f8532528ea3d84db5491f5d766415649592bcd1 /mesonbuild/ast/printer.py
parent200738a3e6b48671aac2865c304dded96179e4ac (diff)
downloadmeson-c14aea2812fd2be94998bdb174e9a4681aeea394.zip
meson-c14aea2812fd2be94998bdb174e9a4681aeea394.tar.gz
meson-c14aea2812fd2be94998bdb174e9a4681aeea394.tar.bz2
types: Annotate mparser.py
This also fixes that the keys in ArgumentNode.kwargs are all of the type BaseNode now. Before this commit, it was possible that both strings and Nodes where used as keys.
Diffstat (limited to 'mesonbuild/ast/printer.py')
-rw-r--r--mesonbuild/ast/printer.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/mesonbuild/ast/printer.py b/mesonbuild/ast/printer.py
index f245a36..033b1d5 100644
--- a/mesonbuild/ast/printer.py
+++ b/mesonbuild/ast/printer.py
@@ -143,7 +143,7 @@ class AstPrinter(AstVisitor):
node.value.accept(self)
def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode):
- varnames = [x.value for x in node.varnames]
+ varnames = [x for x in node.varnames]
self.append_padded('foreach', node)
self.append_padded(', '.join(varnames), node)
self.append_padded(':', node)
@@ -192,10 +192,7 @@ class AstPrinter(AstVisitor):
if break_args:
self.newline()
for key, val in node.kwargs.items():
- if isinstance(key, str):
- self.append(key, node)
- else:
- key.accept(self)
+ key.accept(self)
self.append_padded(':', node)
val.accept(self)
self.append(', ', node)