diff options
-rw-r--r-- | compiler/parser.nim | 5 | ||||
-rw-r--r-- | tests/parser/t19430.nim | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index c9b30204c..e921bf1f4 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -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: diff --git a/tests/parser/t19430.nim b/tests/parser/t19430.nim new file mode 100644 index 000000000..c1aa6a92d --- /dev/null +++ b/tests/parser/t19430.nim @@ -0,0 +1,3 @@ +let x = proc() = ## abc +let y = 3 #[tt.Error +^ invalid indentation]# |