[refactoring] refactor the compiler and stdlib to deprecation warnings (#11419)
This commit is contained in:
parent
3d13103443
commit
c7e1c665a1
7 changed files with 52 additions and 44 deletions
|
|
@ -93,26 +93,30 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): Rope =
|
|||
proc genLiteral(p: BProc, n: PNode): Rope =
|
||||
result = genLiteral(p, n, n.typ)
|
||||
|
||||
proc bitSetToWord(s: TBitSet, size: int): BiggestInt =
|
||||
proc bitSetToWord(s: TBitSet, size: int): BiggestUInt =
|
||||
result = 0
|
||||
for j in 0 ..< size:
|
||||
if j < len(s): result = result or (ze64(s[j]) shl (j * 8))
|
||||
if j < len(s): result = result or (BiggestUInt(s[j]) shl (j * 8))
|
||||
|
||||
proc genRawSetData(cs: TBitSet, size: int): Rope =
|
||||
if size > 8:
|
||||
result = "{$n" % []
|
||||
var res = "{\n"
|
||||
for i in 0 ..< size:
|
||||
res.add "0x"
|
||||
res.add "0123456789abcdef"[cs[i] div 16]
|
||||
res.add "0123456789abcdef"[cs[i] mod 16]
|
||||
if i < size - 1:
|
||||
# not last iteration?
|
||||
if (i + 1) mod 8 == 0:
|
||||
addf(result, "0x$1,$n", [rope(toHex(ze64(cs[i]), 2))])
|
||||
# not last iteration
|
||||
if i mod 8 == 7:
|
||||
res.add ",\n"
|
||||
else:
|
||||
addf(result, "0x$1, ", [rope(toHex(ze64(cs[i]), 2))])
|
||||
res.add ", "
|
||||
else:
|
||||
addf(result, "0x$1}$n", [rope(toHex(ze64(cs[i]), 2))])
|
||||
res.add "}\n"
|
||||
|
||||
result = rope(res)
|
||||
else:
|
||||
result = intLiteral(bitSetToWord(cs, size))
|
||||
# result := rope('0x' + ToHex(bitSetToWord(cs, size), size * 2))
|
||||
result = intLiteral(cast[BiggestInt](bitSetToWord(cs, size)))
|
||||
|
||||
proc genSetNode(p: BProc, n: PNode): Rope =
|
||||
var cs: TBitSet
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue