Merge branch 'araq-strings-v1' into devel
This commit is contained in:
commit
1a3b35603c
4 changed files with 15 additions and 5 deletions
|
|
@ -909,9 +909,14 @@ proc genSeqElem(p: BProc, n, x, y: PNode, d: var TLoc) =
|
||||||
if ty.kind in {tyRef, tyPtr}:
|
if ty.kind in {tyRef, tyPtr}:
|
||||||
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
||||||
if optBoundsCheck in p.options:
|
if optBoundsCheck in p.options:
|
||||||
linefmt(p, cpsStmts,
|
if ty.kind == tyString and not defined(nimNoZeroTerminator):
|
||||||
"if (!$2 || (NU)($1) >= (NU)($2->$3)) #raiseIndexError();$n",
|
linefmt(p, cpsStmts,
|
||||||
rdLoc(b), rdLoc(a), lenField(p))
|
"if (!$2 || (NU)($1) > (NU)($2->$3)) #raiseIndexError();$n",
|
||||||
|
rdLoc(b), rdLoc(a), lenField(p))
|
||||||
|
else:
|
||||||
|
linefmt(p, cpsStmts,
|
||||||
|
"if (!$2 || (NU)($1) >= (NU)($2->$3)) #raiseIndexError();$n",
|
||||||
|
rdLoc(b), rdLoc(a), lenField(p))
|
||||||
if d.k == locNone: d.storage = OnHeap
|
if d.k == locNone: d.storage = OnHeap
|
||||||
if skipTypes(a.t, abstractVar).kind in {tyRef, tyPtr}:
|
if skipTypes(a.t, abstractVar).kind in {tyRef, tyPtr}:
|
||||||
a.r = rfmt(nil, "(*$1)", a.r)
|
a.r = rfmt(nil, "(*$1)", a.r)
|
||||||
|
|
|
||||||
|
|
@ -188,11 +188,11 @@ proc processSpecificNote*(arg: string, state: TSpecialWord, pass: TCmdLinePass,
|
||||||
if i < len(arg) and (arg[i] in {':', '='}): inc(i)
|
if i < len(arg) and (arg[i] in {':', '='}): inc(i)
|
||||||
else: invalidCmdLineOption(pass, orig, info)
|
else: invalidCmdLineOption(pass, orig, info)
|
||||||
if state == wHint:
|
if state == wHint:
|
||||||
var x = findStr(msgs.HintsToStr, id)
|
let x = findStr(msgs.HintsToStr, id)
|
||||||
if x >= 0: n = TNoteKind(x + ord(hintMin))
|
if x >= 0: n = TNoteKind(x + ord(hintMin))
|
||||||
else: localError(info, "unknown hint: " & id)
|
else: localError(info, "unknown hint: " & id)
|
||||||
else:
|
else:
|
||||||
var x = findStr(msgs.WarningsToStr, id)
|
let x = findStr(msgs.WarningsToStr, id)
|
||||||
if x >= 0: n = TNoteKind(x + ord(warnMin))
|
if x >= 0: n = TNoteKind(x + ord(warnMin))
|
||||||
else: localError(info, "unknown warning: " & id)
|
else: localError(info, "unknown warning: " & id)
|
||||||
case substr(arg, i).normalize
|
case substr(arg, i).normalize
|
||||||
|
|
|
||||||
|
|
@ -115,3 +115,4 @@ proc initDefines*() =
|
||||||
defineSymbol("nimSymKind")
|
defineSymbol("nimSymKind")
|
||||||
defineSymbol("nimVmEqIdent")
|
defineSymbol("nimVmEqIdent")
|
||||||
defineSymbol("nimNoNil")
|
defineSymbol("nimNoNil")
|
||||||
|
defineSymbol("nimNoZeroTerminator")
|
||||||
|
|
|
||||||
|
|
@ -474,6 +474,10 @@ const
|
||||||
hintMin* = hintSuccess
|
hintMin* = hintSuccess
|
||||||
hintMax* = high(TMsgKind)
|
hintMax* = high(TMsgKind)
|
||||||
|
|
||||||
|
static:
|
||||||
|
doAssert HintsToStr.len == ord(hintMax) - ord(hintMin) + 1
|
||||||
|
doAssert WarningsToStr.len == ord(warnMax) - ord(warnMin) + 1
|
||||||
|
|
||||||
type
|
type
|
||||||
TNoteKind* = range[warnMin..hintMax] # "notes" are warnings or hints
|
TNoteKind* = range[warnMin..hintMax] # "notes" are warnings or hints
|
||||||
TNoteKinds* = set[TNoteKind]
|
TNoteKinds* = set[TNoteKind]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue