diff options
author | metagn <metagngn@gmail.com> | 2023-04-06 14:36:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-06 13:36:21 +0200 |
commit | 814d3e6818b6c4ed976818ecf525a599502e080e (patch) | |
tree | 3a2a2bf1745f6ff4f74e4f257270d1a2bc84a69c | |
parent | 4898b054ce3b538193fb1bda9052cebc4a588f2f (diff) | |
download | Nim-814d3e6818b6c4ed976818ecf525a599502e080e.tar.gz |
fix #19430 (#21603)
-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]# |