-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkfuncpred.py
executable file
·39 lines (37 loc) · 948 Bytes
/
mkfuncpred.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python3
print('// CAUTION: This file is generated. Do not edit it!')
print()
print('package gotest')
for args in range(11):
for rets in range(5):
atpl = alst = rtpl = rlst = ''
for aidx in range(args):
if len(atpl) > 0:
atpl += ', '
if len(alst) > 0:
alst += ', '
aname = 'Argument' + str(aidx) + 'T'
atpl += aname + ' any'
alst += aname
for ridx in range(rets):
if len(rtpl) > 0:
rtpl += ', '
if len(rlst) > 0:
rlst += ', '
rname = 'Return' + str(ridx) + 'T'
rtpl += rname + ' any'
rlst += rname
alltpl = atpl
if len(atpl) > 0 and len(rtpl) > 0:
alltpl += ', '
alltpl += rtpl
if len(alltpl) > 0:
alltpl = '[' + alltpl + ']'
if len(rlst) == 0:
allrlst = ''
else:
allrlst = ' (' + rlst + ')'
print()
print('func IsFuncNil' + str(args) + 'to' + str(rets) + alltpl + '(f func(' + alst + ')' + allrlst + ') bool {')
print('\treturn f == nil')
print('}')