diff options
author | cooldome <cdome@bk.ru> | 2019-03-13 09:23:06 +0000 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-13 10:23:06 +0100 |
commit | d8c3df268371c5d749e4c4b5fe8f5a08d593ac64 (patch) | |
tree | b2c47e604b98190ea4005ae645bd82c24f810177 /compiler/renderer.nim | |
parent | ab872be476f255ea339aa203157462e9700450a6 (diff) | |
download | Nim-d8c3df268371c5d749e4c4b5fe8f5a08d593ac64.tar.gz |
fixes #10805 (#10806)
Diffstat (limited to 'compiler/renderer.nim')
-rw-r--r-- | compiler/renderer.nim | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim index cc1af7f75..2fef1234a 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -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) |