Skip to content

Commit 25c1535

Browse files
committed
Fixed unparsing of function calls to subscripts like func<T>(args)
1 parent 0da4030 commit 25c1535

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

transpyle/cpp/unparser.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def _Attribute(self, t):
513513

514514
def _Call(self, t):
515515
func_name = horast.unparse(t.func).strip()
516-
516+
517517
if func_name == 'np.zeros':
518518
self._includes['valarray'] = True
519519
self.write('std::valarray<')
@@ -529,10 +529,10 @@ def _Call(self, t):
529529
comma = True
530530
self.dispatch(arg)
531531
return
532-
532+
533533
if t.keywords:
534534
self._unsupported_syntax(t, 'with keyword arguments')
535-
535+
536536
if func_name == 'print':
537537
self._includes['iostream'] = True
538538
self.write('std::cout << ')
@@ -545,7 +545,17 @@ def _Call(self, t):
545545
self.dispatch(arg)
546546
return
547547

548-
super()._Call(t)
548+
self.dispatch_type(t.func)
549+
self.write('(')
550+
551+
comma = False
552+
for arg in t.args:
553+
if comma:
554+
self.write(", ")
555+
else:
556+
comma = True
557+
self.dispatch(arg)
558+
self.write(')')
549559

550560
# def _Subscript(self, t):
551561
# super()._Subscript(t)

0 commit comments

Comments
 (0)