Skip to content

Commit d8efae6

Browse files
committed
Fixed some slided type output support.
1 parent fa739c0 commit d8efae6

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

transpyle/cpp/unparser.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ def dispatch_type(self, type_hint):
102102
unparsed = horast.unparse(type_hint.value).strip()
103103
self.write(unparsed)
104104
self.write('<')
105-
self.write(horast.unparse(type_hint.slice).strip())
106-
self.write('>')
105+
if isinstance(type_hint.slice, typed_ast3.Subscript):
106+
self.dispatch_type(type_hint.slice)
107+
else:
108+
self.write(horast.unparse(type_hint.slice).strip())
109+
self.write(' >')
107110
if isinstance(type_hint.slice, typed_ast3.Index):
108111
self.write('&')
109112
return
@@ -159,7 +162,10 @@ def _AnnAssign(self, t):
159162
self._unsupported_syntax(t, ' which is not simple')
160163
self.dispatch_type(t.annotation)
161164
self.write(' ')
162-
self.dispatch(t.target)
165+
try:
166+
self.dispatch(t.target)
167+
except AttributeError as e:
168+
print(e)
163169
if t.value:
164170
self.write(' = ')
165171
self.dispatch(t.value)

0 commit comments

Comments
 (0)