simple program works with --newruntime
This commit is contained in:
parent
b707790519
commit
0b96b135f8
3 changed files with 14 additions and 12 deletions
|
|
@ -1145,7 +1145,8 @@ proc genReset(p: BProc, n: PNode) =
|
||||||
genTypeInfo(p.module, skipTypes(a.t, {tyVar}), n.info))
|
genTypeInfo(p.module, skipTypes(a.t, {tyVar}), n.info))
|
||||||
|
|
||||||
proc genDefault(p: BProc; n: PNode; d: var TLoc) =
|
proc genDefault(p: BProc; n: PNode; d: var TLoc) =
|
||||||
resetLoc(p, d)
|
if d.k == locNone: getTemp(p, n.typ, d, needsInit=true)
|
||||||
|
else: resetLoc(p, d)
|
||||||
|
|
||||||
proc rawGenNew(p: BProc, a: TLoc, sizeExpr: Rope) =
|
proc rawGenNew(p: BProc, a: TLoc, sizeExpr: Rope) =
|
||||||
var sizeExpr = sizeExpr
|
var sizeExpr = sizeExpr
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,7 @@ proc resetLoc(p: BProc, loc: var TLoc) =
|
||||||
let typ = skipTypes(loc.t, abstractVarRange)
|
let typ = skipTypes(loc.t, abstractVarRange)
|
||||||
if isImportedCppType(typ): return
|
if isImportedCppType(typ): return
|
||||||
if p.config.selectedGc == gcDestructors and typ.kind in {tyString, tySequence}:
|
if p.config.selectedGc == gcDestructors and typ.kind in {tyString, tySequence}:
|
||||||
|
assert rdLoc(loc) != nil
|
||||||
linefmt(p, cpsStmts, "$1.len = 0; $1.p = NIM_NIL;$n", rdLoc(loc))
|
linefmt(p, cpsStmts, "$1.len = 0; $1.p = NIM_NIL;$n", rdLoc(loc))
|
||||||
elif not isComplexValueType(typ):
|
elif not isComplexValueType(typ):
|
||||||
if containsGcRef:
|
if containsGcRef:
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
discard """
|
discard """
|
||||||
disabled: true
|
cmd: '''nim c --newruntime $file'''
|
||||||
cmd: '''nim c --gc:destructors $file'''
|
|
||||||
output: '''hi
|
output: '''hi
|
||||||
ho
|
ho
|
||||||
ha
|
ha
|
||||||
7 7'''
|
1 1'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import allocators
|
import allocators
|
||||||
|
|
@ -76,6 +75,7 @@ iterator interpolatedFragments*(s: string): tuple[kind: InterpolatedKind,
|
||||||
break
|
break
|
||||||
i = j
|
i = j
|
||||||
|
|
||||||
|
when false:
|
||||||
let input = "$test{} $this is ${an{ example}} "
|
let input = "$test{} $this is ${an{ example}} "
|
||||||
let expected = @[(ikVar, "test"), (ikStr, "{} "), (ikVar, "this"),
|
let expected = @[(ikVar, "test"), (ikStr, "{} "), (ikVar, "this"),
|
||||||
(ikStr, " is "), (ikExpr, "an{ example}"), (ikStr, " ")]
|
(ikStr, " is "), (ikExpr, "an{ example}"), (ikStr, " ")]
|
||||||
|
|
@ -87,4 +87,4 @@ for s in interpolatedFragments(input):
|
||||||
|
|
||||||
#echo s
|
#echo s
|
||||||
let (a, d) = allocCounters()
|
let (a, d) = allocCounters()
|
||||||
cprintf("%ld %ld\n", a, d)
|
discard cprintf("%ld %ld\n", a, d)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue