This commit is contained in:
ringabout
2023-08-25 12:48:08 +08:00
committed by GitHub
parent fc6a388780
commit d677ed31e5
4 changed files with 7 additions and 4 deletions

View File

@@ -573,4 +573,4 @@ proc maskBytes*(arg: Int128, numbytes: int): Int128 {.noinit.} =
of 8:
return maskUInt64(arg)
else:
assert(false, "masking only implemented for 1, 2, 4 and 8 bytes")
raiseAssert "masking only implemented for 1, 2, 4 and 8 bytes"

View File

@@ -252,6 +252,7 @@ proc hasCommand(n: PNode): bool =
of nkStmtList, nkStmtListExpr, nkWhenStmt, nkElifBranch, nkElse,
nkStaticStmt, nkLetSection, nkConstSection, nkVarSection,
nkIdentDefs:
result = false
for a in n:
if a.hasCommand:
return true

View File

@@ -356,12 +356,13 @@ proc useVar(a: PEffects, n: PNode) =
type
TIntersection = seq[tuple[id, count: int]] # a simple count table
proc addToIntersection(inter: var TIntersection, s: int, zeroInit: bool) =
proc addToIntersection(inter: var TIntersection, s: int, initOnly: bool) =
for j in 0..<inter.len:
if s == inter[j].id:
inc inter[j].count
if not initOnly:
inc inter[j].count
return
if zeroInit:
if initOnly:
inter.add((id: s, count: 0))
else:
inter.add((id: s, count: 1))

View File

@@ -1753,6 +1753,7 @@ proc isTupleRecursive(t: PType, cycleDetector: var IntSet): bool =
return true
case t.kind
of tyTuple:
result = false
var cycleDetectorCopy: IntSet
for i in 0..<t.len:
cycleDetectorCopy = cycleDetector