diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 532566a184..28a97068bf 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1775,6 +1775,13 @@ proc setMs(n: PNode, s: PSym): PNode = n.sons[0] = newSymNode(s) n.sons[0].info = n.info +proc extractImports(n: PNode; result: PNode) = + if n.kind in {nkImportStmt, nkImportExceptStmt, nkFromStmt}: + result.add copyTree(n) + n.kind = nkEmpty + return + for i in 0..