Skip to content

Commit

Permalink
fix #19430 (#21603)
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn authored Apr 6, 2023
1 parent 4898b05 commit 814d3e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/parser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1197,10 +1197,11 @@ proc parseProcExpr(p: var Parser; isExpr: bool; kind: TNodeKind): PNode =
let pragmas = optPragmas(p)
if p.tok.tokType == tkEquals and isExpr:
getTok(p)
skipComment(p, result)
result = newProcNode(kind, info, body = parseStmt(p),
result = newProcNode(kind, info, body = p.emptyNode,
params = params, name = p.emptyNode, pattern = p.emptyNode,
genericParams = p.emptyNode, pragmas = pragmas, exceptions = p.emptyNode)
skipComment(p, result)
result[bodyPos] = parseStmt(p)
else:
result = newNodeI(if kind == nkIteratorDef: nkIteratorTy else: nkProcTy, info)
if hasSignature:
Expand Down
3 changes: 3 additions & 0 deletions tests/parser/t19430.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let x = proc() = ## abc
let y = 3 #[tt.Error
^ invalid indentation]#

0 comments on commit 814d3e6

Please sign in to comment.