This commit is contained in:
cooldome 2019-03-13 09:23:06 +00:00 • committed by Andreas Rumpf
commit d8c3df2683
2 changed files with 14 additions and 2 deletions

View file

@ -500,7 +500,11 @@ proc lsub(g: TSrcGen; n: PNode): int =
of nkUsingStmt:
if sonsLen(n) > 1: result = MaxLineLen + 1
else: result = lsons(g, n) + len("using_")
of nkReturnStmt: result = lsub(g, n.sons[0]) + len("return_")
of nkReturnStmt:
if n.len > 0 and n[0].kind == nkAsgn:
result = len("return_") + lsub(g, n[0][1])
else:
result = len("return_") + lsub(g, n[0])
of nkRaiseStmt: result = lsub(g, n.sons[0]) + len("raise_")
of nkYieldStmt: result = lsub(g, n.sons[0]) + len("yield_")
of nkDiscardStmt: result = lsub(g, n.sons[0]) + len("discard_")
@ -1335,7 +1339,10 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
gsub(g, n.sons[0])
of nkReturnStmt:
putWithSpace(g, tkReturn, "return")
gsub(g, n, 0)
if n.len > 0 and n[0].kind == nkAsgn:
gsub(g, n[0], 1)
else:
gsub(g, n, 0)
of nkRaiseStmt:
putWithSpace(g, tkRaise, "raise")
gsub(g, n, 0)