keep the imports in runnableExamples visible in generated html doc (#8354)
This commit is contained in:
parent
a651809411
commit
143834ba4e
1 changed files with 3 additions and 2 deletions
|
|
@ -2031,9 +2031,10 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
|
||||||
c.runnableExamples = newTree(nkStmtList,
|
c.runnableExamples = newTree(nkStmtList,
|
||||||
newTree(nkImportStmt, newStrNode(nkStrLit, expandFilename(inp))))
|
newTree(nkImportStmt, newStrNode(nkStrLit, expandFilename(inp))))
|
||||||
let imports = newTree(nkStmtList)
|
let imports = newTree(nkStmtList)
|
||||||
extractImports(n.lastSon, imports)
|
var saved_lastSon = copyTree n.lastSon
|
||||||
|
extractImports(saved_lastSon, imports)
|
||||||
for imp in imports: c.runnableExamples.add imp
|
for imp in imports: c.runnableExamples.add imp
|
||||||
c.runnableExamples.add newTree(nkBlockStmt, c.graph.emptyNode, copyTree n.lastSon)
|
c.runnableExamples.add newTree(nkBlockStmt, c.graph.emptyNode, copyTree saved_lastSon)
|
||||||
result = setMs(n, s)
|
result = setMs(n, s)
|
||||||
else:
|
else:
|
||||||
result = c.graph.emptyNode
|
result = c.graph.emptyNode
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue