ARC: ported the GC tests over to --gc:arc

This commit is contained in:
Araq 2019-11-25 15:29:41 +01:00 • committed by Andreas Rumpf
commit 72237e2bcf
14 changed files with 79 additions and 29 deletions

View file

@ -2,11 +2,11 @@ discard """
outputsub: "no leak: "
"""
when defined(GC_setMaxPause):
when declared(GC_setMaxPause):
GC_setMaxPause 2_000
type
TExpr = object {.inheritable.} ## abstract base class for an expression
TExpr {.inheritable.} = object ## abstract base class for an expression
PLiteral = ref TLiteral
TLiteral = object of TExpr
x: int
@ -15,7 +15,7 @@ type
a, b: ref TExpr
op2: string
method eval(e: ref TExpr): int =
method eval(e: ref TExpr): int {.base.} =
# override this base method
quit "to override!"
@ -30,7 +30,7 @@ proc newLit(x: int): ref TLiteral =
result.x = x
result.op1 = $getOccupiedMem()
proc newPlus(a, b: ref TExpr): ref TPlusExpr =
proc newPlus(a, b: sink(ref TExpr)): ref TPlusExpr =
new(result)
result.a = a
result.b = b