styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error

This commit is contained in:
Araq 2019-07-10 12:42:23 +02:00
commit c94647aeca
90 changed files with 680 additions and 652 deletions

View file

@ -499,7 +499,7 @@ type
filename*: string
line*,column*: int
proc `$`*(arg: Lineinfo): string =
proc `$`*(arg: LineInfo): string =
# BUG: without `result = `, gives compile error
result = arg.filename & "(" & $arg.line & ", " & $arg.column & ")"
@ -988,16 +988,16 @@ proc newBlockStmt*(label, body: NimNode): NimNode {.compileTime.} =
## Create a new block statement with label
return newNimNode(nnkBlockStmt).add(label, body)
proc newBlockStmt*(body: NimNode): NimNode {.compiletime.} =
proc newBlockStmt*(body: NimNode): NimNode {.compileTime.} =
## Create a new block: stmt
return newNimNode(nnkBlockStmt).add(newEmptyNode(), body)
proc newVarStmt*(name, value: NimNode): NimNode {.compiletime.} =
proc newVarStmt*(name, value: NimNode): NimNode {.compileTime.} =
## Create a new var stmt
return newNimNode(nnkVarSection).add(
newNimNode(nnkIdentDefs).add(name, newNimNode(nnkEmpty), value))
proc newLetStmt*(name, value: NimNode): NimNode {.compiletime.} =
proc newLetStmt*(name, value: NimNode): NimNode {.compileTime.} =
## Create a new let stmt
return newNimNode(nnkLetSection).add(
newNimNode(nnkIdentDefs).add(name, newNimNode(nnkEmpty), value))
@ -1095,7 +1095,7 @@ proc newProc*(name = newEmptyNode();
body)
proc newIfStmt*(branches: varargs[tuple[cond, body: NimNode]]):
NimNode {.compiletime.} =
NimNode {.compileTime.} =
## Constructor for ``if`` statements.
##
## .. code-block:: nim
@ -1233,7 +1233,7 @@ proc `body=`*(someProc: NimNode, val: NimNode) {.compileTime.} =
else:
badNodeKind someProc, "body="
proc basename*(a: NimNode): NimNode {.compiletime, benign.}
proc basename*(a: NimNode): NimNode {.compileTime, benign.}
proc `$`*(node: NimNode): string {.compileTime.} =
## Get the string of an identifier node
@ -1396,7 +1396,7 @@ else:
else:
result = false
proc hasArgOfName*(params: NimNode; name: string): bool {.compiletime.}=
proc hasArgOfName*(params: NimNode; name: string): bool {.compileTime.}=
## Search nnkFormalParams for an argument.
expectKind(params, nnkFormalParams)
for i in 1 ..< params.len:
@ -1404,7 +1404,7 @@ proc hasArgOfName*(params: NimNode; name: string): bool {.compiletime.}=
if name.eqIdent( $ node[0]):
return true
proc addIdentIfAbsent*(dest: NimNode, ident: string) {.compiletime.} =
proc addIdentIfAbsent*(dest: NimNode, ident: string) {.compileTime.} =
## Add ident to dest if it is not present. This is intended for use
## with pragmas.
for node in dest.children: