Skip to content

Commit ff654c5

Browse files
committed
modulegraphs: add an assertion to getBody
Error nodes with their corresponding diagnostic erroneously swallowed somewhere that propagate up to the procedure AST boundary would previously cause a crash with a stacktrace that provides little to no relevant context. The assertion makes sure that at least some context is present.
1 parent 142571f commit ff654c5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/modules/modulegraphs.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ proc getBody*(g: ModuleGraph; s: PSym): PNode {.inline.} =
652652
assert result != nil and result.kind == nkError,
653653
"assume we've populated the nkError here"
654654
else:
655+
internalAssert(g.config, s.ast.kind != nkError, s.info)
655656
result = s.ast[bodyPos]
656657
if result == nil and g.config.symbolFiles in {readOnlySf, v2Sf, stressTest}:
657658
result = loadProcBody(g.config, g.cache, g.packed, s)

0 commit comments

Comments
 (0)