nim doc --backend:js, nim doc --doccmd:-d:foo, nim r --backend:js, --doccmd:skip + other improvements (#14278)

* `nim doc --backend:js|cpp...`
`nim doc --doccmd:'-d:foo --threads:on'`
`nim r --backend:cpp...` (implies --run --usenimcache)
* --usenimcache works with all targets
* --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
This commit is contained in:
Timothee Cour 2020-05-11 03:01:18 -07:00 • committed by GitHub
commit 9502e39b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 213 additions and 99 deletions

View file

@ -411,7 +411,7 @@ proc transformYield(c: PTransf, n: PNode): PNode =
proc transformAddrDeref(c: PTransf, n: PNode, a, b: TNodeKind): PNode =
result = transformSons(c, n)
if c.graph.config.cmd == cmdCompileToCpp or sfCompileToCpp in c.module.flags: return
if c.graph.config.backend == backendCpp or sfCompileToCpp in c.module.flags: return
var n = result
case n[0].kind
of nkObjUpConv, nkObjDownConv, nkChckRange, nkChckRangeF, nkChckRange64:
@ -447,7 +447,7 @@ proc generateThunk(c: PTransf; prc: PNode, dest: PType): PNode =
# we cannot generate a proper thunk here for GC-safety reasons
# (see internal documentation):
if c.graph.config.cmd == cmdCompileToJS: return prc
if c.graph.config.backend == backendJs: return prc
result = newNodeIT(nkClosure, prc.info, dest)
var conv = newNodeIT(nkHiddenSubConv, prc.info, dest)
conv.add(newNodeI(nkEmpty, prc.info))