compilerArgs -> nimArgs, fix multi decl comments

This commit is contained in:
Joey Yakimowich-Payne 2020-05-03 18:40:49 -06:00
commit 42fbaf4c4f
3 changed files with 19 additions and 4 deletions

View file

@ -25,7 +25,7 @@ proc execTest(test: string, flags = "", runDocs = true) =
let docPath = "build/html_" & test.extractFileName.changeFileExt("") & "_docs"
rmDir docPath
mkDir docPath
buildDocs(@[test], docPath, compilerArgs = flags)
buildDocs(@[test], docPath, nimArgs = flags)
task buildToast, "build toast":
execCmd("nim c --hints:off nimterop/toast.nim")

View file

@ -1640,16 +1640,31 @@ proc addDecl(gState: State, node: TSNode) =
let
start = getStartAtom(node)
commentNodes = gState.getCommentNodes(node)
var
firstDecl = true
commentNodes: seq[TSNode]
for i in start+1 ..< node.len:
if not node[i].firstChildInTree("function_declarator").isNil:
# Proc declaration - var or actual proc
if node[i].getAtom().getPxName(1) == "pointer_declarator":
# proc var
if firstDecl:
# If
commentNodes = gState.getCommentNodes(node)
firstDecl = false
else:
commentNodes = gState.getCommentNodes(node[i])
gState.addProcVar(node[i], node[start], commentNodes)
else:
# proc
if firstDecl:
# If
commentNodes = gState.getCommentNodes(node)
firstDecl = false
else:
commentNodes = gState.getCommentNodes(node[i])
gState.addProc(node[i], node[start], commentNodes)
else:
# Regular var

View file

@ -36,7 +36,7 @@ proc execAction(cmd: string): string =
doAssert ret == 0, "Command failed: " & $ret & "\ncmd: " & ccmd & "\nresult:\n" & result
proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath() & $DirSep,
defines: openArray[string] = @[], compilerArgs = "") =
defines: openArray[string] = @[], nimArgs = "") =
## Generate docs for all specified nim `files` to the specified `path`
##
## `baseDir` is the project path by default and `files` and `path` are relative
@ -70,7 +70,7 @@ proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath
defStr
nim = getCurrentCompilerExe()
for file in files:
echo execAction(&"{nim} doc {defStr} {compilerArgs} -o:{path} --project --index:on {baseDir & file}")
echo execAction(&"{nim} doc {defStr} {nimArgs} -o:{path} --project --index:on {baseDir & file}")
echo execAction(&"{nim} buildIndex -o:{path}/theindex.html {path}")
when declared(getNimRootDir):