Skip to content

Commit

Permalink
fix extra lamda indent
Browse files Browse the repository at this point in the history
Use proc-renderer for lambdas also (fixes parameter format as well)
  • Loading branch information
arnetheduck committed Feb 2, 2024
1 parent 1f4c491 commit 5b67c1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
10 changes: 2 additions & 8 deletions src/phrenderer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ proc gproc(g: var TOutput, n: PNode) =
if reorderPostfix(n):
gpostfixes(g, n)

gstmts(g, n[bodyPos], flags)
gstmts(g, n[bodyPos])
else:
withIndent(g):
gmids(g, n)
Expand Down Expand Up @@ -1632,14 +1632,8 @@ proc gsub(g: var TOutput, n: PNode, flags: SubFlags, extra: int) =
putWithSpace(g, tkBind, "bind")
gsub(g, n[0])
of nkLambda:
gprefixes(g, n[paramsPos])
put(g, tkProc, "proc")
gsub(g, n[paramsPos], flags = {sfSkipPrefix})
gsub(g, n[pragmasPos])
optSpace(g)
putWithSpace(g, tkEquals, "=")
gmids(g, n, true, true)
gsubOptNL(g, n[bodyPos], strict = true)
gproc(g, n)
of nkDo:
optSpace(g)
put(g, tkDo, $tkDo)
Expand Down
6 changes: 3 additions & 3 deletions tests/after/comments.nim
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ block: # block colon line

let x =
proc(): int = # lambda eq line
# lambda first line
discard
discard
# lambda first line
discard
discard
while false: # while colon line
# while first line
discard
Expand Down
2 changes: 1 addition & 1 deletion tests/after/procs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type Fp =
aaaaaaaaaaaaaaaaa: int,
bbbbbbbbbbbbbbb =
proc() =
discard
discard
,
cccccccccccccccccc = 30,
)
Expand Down

0 comments on commit 5b67c1c

Please sign in to comment.