mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-07 20:34:21 +00:00
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user