This commit is contained in:
cooldome
2018-07-18 14:54:44 +02:00
committed by Andreas Rumpf
parent 6eedac3207
commit a651809411
2 changed files with 19 additions and 6 deletions

View File

@@ -627,11 +627,12 @@ proc gstmts(g: var TSrcGen, n: PNode, c: TContext, doIndent=true) =
gcoms(g)
if doIndent: dedent(g)
else:
if rfLongMode in c.flags: indentNL(g)
indentNL(g)
gsub(g, n)
gcoms(g)
dedent(g)
optNL(g)
if rfLongMode in c.flags: dedent(g)
proc gif(g: var TSrcGen, n: PNode) =
var c: TContext
@@ -785,10 +786,7 @@ proc gblock(g: var TSrcGen, n: PNode) =
if longMode(g, n) or (lsub(g, n.sons[1]) + g.lineLen > MaxLineLen):
incl(c.flags, rfLongMode)
gcoms(g)
# XXX I don't get why this is needed here! gstmts should already handle this!
indentNL(g)
gstmts(g, n.sons[1], c)
dedent(g)
proc gstaticStmt(g: var TSrcGen, n: PNode) =
var c: TContext

View File

@@ -43,4 +43,19 @@ macro repr_and_parse(fn: typed): typed =
echo fn_impl.repr
result = parseStmt(fn_impl.repr)
repr_and_parse(f)
repr_and_parse(f)
#------------------------------------
# bugs #8343 and #8344
proc one_if_proc(x, y : int): int =
if x < y: result = x
else: result = y
proc test_block(x, y : int): int =
block label:
result = x
result = y
repr_and_parse(one_if_proc)
repr_and_parse(test_block)