* close #16844 * better * comment * Update compiler/renderer.nim
This commit is contained in:
parent
6e267d28b3
commit
f09d97d6d3
1 changed files with 14 additions and 0 deletions
|
|
@ -820,14 +820,28 @@ proc gTypeClassTy(g: var TSrcGen, n: PNode) =
|
||||||
dedent(g)
|
dedent(g)
|
||||||
|
|
||||||
proc gblock(g: var TSrcGen, n: PNode) =
|
proc gblock(g: var TSrcGen, n: PNode) =
|
||||||
|
# you shouldn't simplify it to `n.len < 2`
|
||||||
|
# because the following codes should be executed
|
||||||
|
# even when block stmt has only one child for getting
|
||||||
|
# better error messages.
|
||||||
|
if n.len == 0:
|
||||||
|
return
|
||||||
|
|
||||||
var c: TContext
|
var c: TContext
|
||||||
initContext(c)
|
initContext(c)
|
||||||
|
|
||||||
if n[0].kind != nkEmpty:
|
if n[0].kind != nkEmpty:
|
||||||
putWithSpace(g, tkBlock, "block")
|
putWithSpace(g, tkBlock, "block")
|
||||||
gsub(g, n[0])
|
gsub(g, n[0])
|
||||||
else:
|
else:
|
||||||
put(g, tkBlock, "block")
|
put(g, tkBlock, "block")
|
||||||
|
|
||||||
|
# block stmt should have two children
|
||||||
|
if n.len == 1:
|
||||||
|
return
|
||||||
|
|
||||||
putWithSpace(g, tkColon, ":")
|
putWithSpace(g, tkColon, ":")
|
||||||
|
|
||||||
if longMode(g, n) or (lsub(g, n[1]) + g.lineLen > MaxLineLen):
|
if longMode(g, n) or (lsub(g, n[1]) + g.lineLen > MaxLineLen):
|
||||||
incl(c.flags, rfLongMode)
|
incl(c.flags, rfLongMode)
|
||||||
gcoms(g)
|
gcoms(g)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue