makes --styleCheck:error the default for the Nim compiler itself
This commit is contained in:
parent
fab70e4fe3
commit
e06046ab51
2 changed files with 16 additions and 5 deletions
|
|
@ -72,11 +72,20 @@ proc beautifyName(s: string, k: TSymKind): string =
|
||||||
inc i
|
inc i
|
||||||
|
|
||||||
proc differ*(line: string, a, b: int, x: string): string =
|
proc differ*(line: string, a, b: int, x: string): string =
|
||||||
let y = line[a..b]
|
proc substrEq(s: string, pos, last: int, substr: string): bool =
|
||||||
if y != x and cmpIgnoreStyle(y, x) == 0:
|
var i = 0
|
||||||
result = y
|
var length = substr.len
|
||||||
else:
|
while i < length and pos+i <= last and s[pos+i] == substr[i]:
|
||||||
|
inc i
|
||||||
|
return i == length
|
||||||
|
|
||||||
|
let last = min(b, line.len)
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
|
if not substrEq(line, a, b, x):
|
||||||
|
let y = line[a..b]
|
||||||
|
if cmpIgnoreStyle(y, x) == 0:
|
||||||
|
result = y
|
||||||
|
|
||||||
proc checkStyle(conf: ConfigRef; cache: IdentCache; info: TLineInfo, s: string, k: TSymKind; sym: PSym) =
|
proc checkStyle(conf: ConfigRef; cache: IdentCache; info: TLineInfo, s: string, k: TSymKind; sym: PSym) =
|
||||||
let beau = beautifyName(s, k)
|
let beau = beautifyName(s, k)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ define:nimcore
|
||||||
define:useStdoutAsStdmsg
|
define:useStdoutAsStdmsg
|
||||||
define:nimOldCaseObjects
|
define:nimOldCaseObjects
|
||||||
|
|
||||||
|
styleCheck:error
|
||||||
|
|
||||||
#define:useNodeIds
|
#define:useNodeIds
|
||||||
#gc:markAndSweep
|
#gc:markAndSweep
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue