aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/qtpy2cpp_lib/visitor.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/qtpy2cpp_lib/visitor.py b/tools/qtpy2cpp_lib/visitor.py
index 688e8ae3d..367d8679f 100644
--- a/tools/qtpy2cpp_lib/visitor.py
+++ b/tools/qtpy2cpp_lib/visitor.py
@@ -337,6 +337,11 @@ class ConvertVisitor(ast.NodeVisitor, CppFormatter):
# Return type annotation or decorator call
return node == parent.returns or node in parent.decorator_list
+ def visit_Index(self, node):
+ self._output_file.write("[")
+ self.generic_visit(node)
+ self._output_file.write("]")
+
def visit_Name(self, node):
"""Format a variable reference (cf visit_Attribute)"""
# Skip Context manager variables, return or argument type annotation
@@ -374,6 +379,11 @@ class ConvertVisitor(ast.NodeVisitor, CppFormatter):
self.generic_visit(node)
self._output_file.write(";\n")
+ def visit_Slice(self, node):
+ self._output_file.write("[")
+ self.generic_visit(node)
+ self._output_file.write("]")
+
def visit_Str(self, node):
self.generic_visit(node)
self._output_file.write(format_literal(node))