ast: printer fix index node printing

pull/5574/head
Daniel Mensinger 5 years ago
parent 3fb0e917aa
commit 35b4ae5d61
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 3
      mesonbuild/ast/printer.py
  2. 1
      mesonbuild/ast/visitor.py

@ -118,6 +118,7 @@ class AstPrinter(AstVisitor):
self.newline()
def visit_IndexNode(self, node: mparser.IndexNode):
node.iobject.accept(self)
self.append('[', node)
node.index.accept(self)
self.append(']', node)
@ -181,7 +182,7 @@ class AstPrinter(AstVisitor):
def visit_ArgumentNode(self, node: mparser.ArgumentNode):
break_args = (len(node.arguments) + len(node.kwargs)) > self.arg_newline_cutoff
for i in node.arguments + list(node.kwargs.values()):
if not isinstance(i, mparser.ElementaryNode):
if not isinstance(i, (mparser.ElementaryNode, mparser.IndexNode)):
break_args = True
if break_args:
self.newline()

@ -84,6 +84,7 @@ class AstVisitor:
def visit_IndexNode(self, node: mparser.IndexNode):
self.visit_default_func(node)
node.iobject.accept(self)
node.index.accept(self)
def visit_MethodNode(self, node: mparser.MethodNode):

Loading…
Cancel
Save