bugfix: rendering of typ|typ2
This commit is contained in:
parent
139562cc64
commit
83876b1b81
3 changed files with 17 additions and 10 deletions
|
|
@ -33,6 +33,7 @@ type
|
||||||
# indentation value
|
# indentation value
|
||||||
comStack*: seq[PNode] # comment stack
|
comStack*: seq[PNode] # comment stack
|
||||||
flags*: TRenderFlags
|
flags*: TRenderFlags
|
||||||
|
checkAnon: bool # we're in a context that can contain sfAnon
|
||||||
|
|
||||||
|
|
||||||
proc renderModule*(n: PNode, filename: string, renderFlags: TRenderFlags = {})
|
proc renderModule*(n: PNode, filename: string, renderFlags: TRenderFlags = {})
|
||||||
|
|
@ -71,6 +72,7 @@ proc InitSrcGen(g: var TSrcGen, renderFlags: TRenderFlags) =
|
||||||
g.buf = ""
|
g.buf = ""
|
||||||
g.flags = renderFlags
|
g.flags = renderFlags
|
||||||
g.pendingNL = -1
|
g.pendingNL = -1
|
||||||
|
g.checkAnon = false
|
||||||
|
|
||||||
proc addTok(g: var TSrcGen, kind: TTokType, s: string) =
|
proc addTok(g: var TSrcGen, kind: TTokType, s: string) =
|
||||||
var length = len(g.tokens)
|
var length = len(g.tokens)
|
||||||
|
|
@ -497,8 +499,10 @@ proc gcommaAux(g: var TSrcGen, n: PNode, ind: int, start: int = 0,
|
||||||
var c = i < sonsLen(n) + theEnd
|
var c = i < sonsLen(n) + theEnd
|
||||||
var sublen = lsub(n.sons[i]) + ord(c)
|
var sublen = lsub(n.sons[i]) + ord(c)
|
||||||
if not fits(g, sublen) and (ind + sublen < maxLineLen): optNL(g, ind)
|
if not fits(g, sublen) and (ind + sublen < maxLineLen): optNL(g, ind)
|
||||||
|
let oldLen = g.tokens.len
|
||||||
gsub(g, n.sons[i])
|
gsub(g, n.sons[i])
|
||||||
if c:
|
if c:
|
||||||
|
if g.tokens.len > oldLen:
|
||||||
putWithSpace(g, separator, TokTypeToStr[separator])
|
putWithSpace(g, separator, TokTypeToStr[separator])
|
||||||
if hasCom(n.sons[i]):
|
if hasCom(n.sons[i]):
|
||||||
gcoms(g)
|
gcoms(g)
|
||||||
|
|
@ -673,7 +677,10 @@ proc gproc(g: var TSrcGen, n: PNode) =
|
||||||
|
|
||||||
if n.sons[patternPos].kind != nkEmpty:
|
if n.sons[patternPos].kind != nkEmpty:
|
||||||
gpattern(g, n.sons[patternPos])
|
gpattern(g, n.sons[patternPos])
|
||||||
|
let oldCheckAnon = g.checkAnon
|
||||||
|
g.checkAnon = true
|
||||||
gsub(g, n.sons[genericParamsPos])
|
gsub(g, n.sons[genericParamsPos])
|
||||||
|
g.checkAnon = oldCheckAnon
|
||||||
gsub(g, n.sons[paramsPos])
|
gsub(g, n.sons[paramsPos])
|
||||||
gsub(g, n.sons[pragmasPos])
|
gsub(g, n.sons[pragmasPos])
|
||||||
if renderNoBody notin g.flags:
|
if renderNoBody notin g.flags:
|
||||||
|
|
@ -725,6 +732,7 @@ proc gasm(g: var TSrcGen, n: PNode) =
|
||||||
gsub(g, n.sons[1])
|
gsub(g, n.sons[1])
|
||||||
|
|
||||||
proc gident(g: var TSrcGen, n: PNode) =
|
proc gident(g: var TSrcGen, n: PNode) =
|
||||||
|
if g.checkAnon and n.kind == nkSym and sfAnon in n.sym.flags: return
|
||||||
var t: TTokType
|
var t: TTokType
|
||||||
var s = atom(n)
|
var s = atom(n)
|
||||||
if (s[0] in lexer.SymChars):
|
if (s[0] in lexer.SymChars):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod's Runtime Library
|
# Nimrod's Runtime Library
|
||||||
# (c) Copyright 2012 Andreas Rumpf
|
# (c) Copyright 2013 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -16,7 +16,6 @@ Bugs
|
||||||
====
|
====
|
||||||
|
|
||||||
- simple closure iterator doesn't work
|
- simple closure iterator doesn't work
|
||||||
- sfAnon is not respected in renderer
|
|
||||||
- docgen: sometimes effects are listed twice
|
- docgen: sometimes effects are listed twice
|
||||||
- 'result' is not properly cleaned for NRVO --> use uninit checking instead
|
- 'result' is not properly cleaned for NRVO --> use uninit checking instead
|
||||||
- sneaking with qualifiedLookup() is really broken!
|
- sneaking with qualifiedLookup() is really broken!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue