@@ -451,7 +451,11 @@ proc lsub(g: TSrcGen; n: PNode): int =
451451 result = lcomma (g, n, 0 , - 3 )
452452 if n[^ 2 ].kind != nkEmpty: result = result + lsub (g, n[^ 2 ]) + 2
453453 if n[^ 1 ].kind != nkEmpty: result = result + lsub (g, n[^ 1 ]) + 3
454- of nkVarTuple: result = lcomma (g, n, 0 , - 3 ) + len (" () = " ) + lsub (g, lastSon (n))
454+ of nkVarTuple:
455+ if n[^ 1 ].kind == nkEmpty:
456+ result = lcomma (g, n, 0 , - 2 ) + len (" ()" )
457+ else :
458+ result = lcomma (g, n, 0 , - 3 ) + len (" () = " ) + lsub (g, lastSon (n))
455459 of nkChckRangeF: result = len (" chckRangeF" ) + 2 + lcomma (g, n)
456460 of nkChckRange64: result = len (" chckRange64" ) + 2 + lcomma (g, n)
457461 of nkChckRange: result = len (" chckRange" ) + 2 + lcomma (g, n)
@@ -1119,12 +1123,17 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
11191123 putWithSpace (g, tkEquals, " =" )
11201124 gsub (g, n[^ 1 ], c)
11211125 of nkVarTuple:
1122- put (g, tkParLe, " (" )
1123- gcomma (g, n, 0 , - 3 )
1124- put (g, tkParRi, " )" )
1125- put (g, tkSpaces, Space )
1126- putWithSpace (g, tkEquals, " =" )
1127- gsub (g, lastSon (n), c)
1126+ if n[^ 1 ].kind == nkEmpty:
1127+ put (g, tkParLe, " (" )
1128+ gcomma (g, n, 0 , - 2 )
1129+ put (g, tkParRi, " )" )
1130+ else :
1131+ put (g, tkParLe, " (" )
1132+ gcomma (g, n, 0 , - 3 )
1133+ put (g, tkParRi, " )" )
1134+ put (g, tkSpaces, Space )
1135+ putWithSpace (g, tkEquals, " =" )
1136+ gsub (g, lastSon (n), c)
11281137 of nkExprColonExpr:
11291138 gsub (g, n, 0 )
11301139 putWithSpace (g, tkColon, " :" )
0 commit comments