diff options
author | Araq <rumpf_a@web.de> | 2019-07-10 12:42:23 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-07-10 12:42:41 +0200 |
commit | c94647aecad6ed7fd12152800437a6cda11e06e6 (patch) | |
tree | f876ae0ac6379dfd99fd5d5ed7d8903be96b433b /lib/core | |
parent | 96523cdd3e8ada367b804efbd47f4763a1269fa8 (diff) | |
download | Nim-c94647aecad6ed7fd12152800437a6cda11e06e6.tar.gz |
styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/macros.nim | 16 | ||||
-rw-r--r-- | lib/core/seqs.nim | 10 | ||||
-rw-r--r-- | lib/core/strs.nim | 12 |
3 files changed, 19 insertions, 19 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 0e66aad03..0892ad434 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -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: diff --git a/lib/core/seqs.nim b/lib/core/seqs.nim index f8cba889c..bbbcf069e 100644 --- a/lib/core/seqs.nim +++ b/lib/core/seqs.nim @@ -170,14 +170,14 @@ proc add*[T](x: var seq[T]; value: sink T) {.magic: "AppendSeqElem", noSideEffec proc setLen[T](s: var seq[T], newlen: Natural) = {.noSideEffect.}: if newlen < s.len: - shrink(s, newLen) + shrink(s, newlen) else: let oldLen = s.len - if newLen <= oldLen: return + if newlen <= oldLen: return var xu = cast[ptr NimSeqV2[T]](addr s) - if xu.p == nil or xu.p.cap < newLen: - xu.p = cast[typeof(xu.p)](prepareSeqAdd(oldLen, xu.p, newLen - oldLen, sizeof(T))) - xu.len = newLen + if xu.p == nil or xu.p.cap < newlen: + xu.p = cast[typeof(xu.p)](prepareSeqAdd(oldLen, xu.p, newlen - oldLen, sizeof(T))) + xu.len = newlen when false: proc resize[T](s: var NimSeqV2[T]) = diff --git a/lib/core/strs.nim b/lib/core/strs.nim index b00042dc9..677e8731d 100644 --- a/lib/core/strs.nim +++ b/lib/core/strs.nim @@ -12,12 +12,12 @@ when false: # these are to be implemented or changed in the code generator. - #proc rawNewStringNoInit(space: int): NimString {.compilerProc.} + #proc rawNewStringNoInit(space: int): NimString {.compilerproc.} # seems to be unused. proc copyDeepString(src: NimString): NimString {.inline.} # ----------------- sequences ---------------------------------------------- - proc incrSeqV3(s: PGenericSeq, typ: PNimType): PGenericSeq {.compilerProc.} + proc incrSeqV3(s: PGenericSeq, typ: PNimType): PGenericSeq {.compilerproc.} proc setLengthSeqV2(s: PGenericSeq, typ: PNimType, newLen: int): PGenericSeq {. compilerRtl.} proc newSeq(typ: PNimType, len: int): pointer {.compilerRtl.} @@ -109,7 +109,7 @@ proc nimAddCharV1(s: var NimStringV2; c: char) {.compilerRtl.} = s.p.data[s.len+1] = '\0' inc s.len -proc toNimStr(str: cstring, len: int): NimStringV2 {.compilerProc.} = +proc toNimStr(str: cstring, len: int): NimStringV2 {.compilerproc.} = if len <= 0: result = NimStringV2(len: 0, p: nil) else: @@ -126,7 +126,7 @@ proc cstrToNimstr(str: cstring): NimStringV2 {.compilerRtl.} = if str == nil: toNimStr(str, 0) else: toNimStr(str, str.len) -proc nimToCStringConv(s: NimStringV2): cstring {.compilerProc, nonReloadable, inline.} = +proc nimToCStringConv(s: NimStringV2): cstring {.compilerproc, nonReloadable, inline.} = if s.len == 0: result = cstring"" else: result = cstring(unsafeAddr s.p.data) @@ -141,7 +141,7 @@ proc appendChar(dest: var NimStringV2; c: char) {.compilerproc, inline.} = dest.p.data[dest.len+1] = '\0' inc dest.len -proc rawNewString(space: int): NimStringV2 {.compilerProc.} = +proc rawNewString(space: int): NimStringV2 {.compilerproc.} = # this is also 'system.newStringOfCap'. if space <= 0: result = NimStringV2(len: 0, p: nil) @@ -152,7 +152,7 @@ proc rawNewString(space: int): NimStringV2 {.compilerProc.} = p.cap = space result = NimStringV2(len: 0, p: p) -proc mnewString(len: int): NimStringV2 {.compilerProc.} = +proc mnewString(len: int): NimStringV2 {.compilerproc.} = if len <= 0: result = NimStringV2(len: 0, p: nil) else: |