fix NimNode comment repr() regression [backport: 1.2] (#19726)
This commit is contained in:
parent
465fd06d50
commit
15ae9323e8
2 changed files with 21 additions and 0 deletions
|
|
@ -165,6 +165,7 @@ proc putNL(g: var TSrcGen) =
|
||||||
proc optNL(g: var TSrcGen, indent: int) =
|
proc optNL(g: var TSrcGen, indent: int) =
|
||||||
g.pendingNL = indent
|
g.pendingNL = indent
|
||||||
g.lineLen = indent
|
g.lineLen = indent
|
||||||
|
g.col = g.indent
|
||||||
when defined(nimpretty): g.pendingNewlineCount = 0
|
when defined(nimpretty): g.pendingNewlineCount = 0
|
||||||
|
|
||||||
proc optNL(g: var TSrcGen) =
|
proc optNL(g: var TSrcGen) =
|
||||||
|
|
@ -173,6 +174,7 @@ proc optNL(g: var TSrcGen) =
|
||||||
proc optNL(g: var TSrcGen; a, b: PNode) =
|
proc optNL(g: var TSrcGen; a, b: PNode) =
|
||||||
g.pendingNL = g.indent
|
g.pendingNL = g.indent
|
||||||
g.lineLen = g.indent
|
g.lineLen = g.indent
|
||||||
|
g.col = g.indent
|
||||||
when defined(nimpretty): g.pendingNewlineCount = lineDiff(a, b)
|
when defined(nimpretty): g.pendingNewlineCount = lineDiff(a, b)
|
||||||
|
|
||||||
proc indentNL(g: var TSrcGen) =
|
proc indentNL(g: var TSrcGen) =
|
||||||
|
|
|
||||||
|
|
@ -60,3 +60,22 @@ macro foo(t: static Tuple): untyped =
|
||||||
doAssert t.b == 12345
|
doAssert t.b == 12345
|
||||||
|
|
||||||
foo((a: "foo", b: 12345))
|
foo((a: "foo", b: 12345))
|
||||||
|
|
||||||
|
|
||||||
|
# bug #16307
|
||||||
|
|
||||||
|
macro bug(x: untyped): string =
|
||||||
|
newLit repr(x)
|
||||||
|
|
||||||
|
let res = bug:
|
||||||
|
block:
|
||||||
|
## one
|
||||||
|
## two
|
||||||
|
## three
|
||||||
|
|
||||||
|
doAssert res == """
|
||||||
|
|
||||||
|
block:
|
||||||
|
## one
|
||||||
|
## two
|
||||||
|
## three"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue