parent
f25384adc8
commit
38d82795da
5 changed files with 75 additions and 36 deletions
|
|
@ -4,7 +4,10 @@ discard """
|
|||
Section: local
|
||||
Param: Str
|
||||
Param: Bool
|
||||
Param: Floats2'''
|
||||
Param: Floats2
|
||||
destroy Foo
|
||||
destroy Foo
|
||||
'''
|
||||
cmd: '''nim c --gc:arc $file'''
|
||||
"""
|
||||
|
||||
|
|
@ -123,4 +126,36 @@ when isMainModule:
|
|||
for p in cfg.params(s):
|
||||
echo " Param: " & p
|
||||
|
||||
# bug #16437
|
||||
|
||||
type
|
||||
Foo = object
|
||||
FooRef = ref Foo
|
||||
|
||||
Bar = ref object
|
||||
f: FooRef
|
||||
|
||||
proc `=destroy`(o: var Foo) =
|
||||
echo "destroy Foo"
|
||||
|
||||
proc testMe(x: Bar) =
|
||||
var c = (if x != nil: x.f else: nil)
|
||||
assert c != nil
|
||||
|
||||
proc main =
|
||||
var b = Bar(f: FooRef())
|
||||
testMe(b)
|
||||
|
||||
main()
|
||||
|
||||
proc testMe2(x: Bar) =
|
||||
var c: FooRef
|
||||
c = (if x != nil: x.f else: nil)
|
||||
assert c != nil
|
||||
|
||||
proc main2 =
|
||||
var b = Bar(f: FooRef())
|
||||
testMe2(b)
|
||||
|
||||
main2()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,21 +4,18 @@ discard """
|
|||
nimout: '''--expandArc: main
|
||||
|
||||
var
|
||||
x_cursor
|
||||
:tmpD
|
||||
:tmpD_1
|
||||
:tmpD_2
|
||||
try:
|
||||
var x_cursor = ("hi", 5)
|
||||
x_cursor = if cond:
|
||||
:tmpD = ("different", 54)
|
||||
:tmpD else:
|
||||
:tmpD_1 = ("string here", 80)
|
||||
:tmpD_1
|
||||
x_cursor = ("hi", 5)
|
||||
if cond:
|
||||
x_cursor = ("different", 54) else:
|
||||
x_cursor = ("string here", 80)
|
||||
echo [
|
||||
:tmpD_2 = `$`(x_cursor)
|
||||
:tmpD_2]
|
||||
:tmpD = `$`(x_cursor)
|
||||
:tmpD]
|
||||
finally:
|
||||
`=destroy`(:tmpD_2)
|
||||
`=destroy`(:tmpD)
|
||||
-- end of expandArc ------------------------
|
||||
--expandArc: sio
|
||||
|
||||
|
|
|
|||
|
|
@ -63,12 +63,13 @@ result.value = move lvalue
|
|||
--expandArc: tt
|
||||
|
||||
var
|
||||
it_cursor
|
||||
a
|
||||
:tmpD
|
||||
:tmpD_1
|
||||
:tmpD_2
|
||||
try:
|
||||
var it_cursor = x
|
||||
it_cursor = x
|
||||
a = (
|
||||
wasMoved(:tmpD)
|
||||
`=copy`(:tmpD, it_cursor.key)
|
||||
|
|
|
|||
|
|
@ -3,17 +3,21 @@ discard """
|
|||
cmd: '''nim c --gc:arc --expandArc:traverse --hint:Performance:off $file'''
|
||||
nimout: '''--expandArc: traverse
|
||||
|
||||
var it_cursor = root
|
||||
var
|
||||
it_cursor
|
||||
jt_cursor
|
||||
it_cursor = root
|
||||
block :tmp:
|
||||
while (
|
||||
not (it_cursor == nil)):
|
||||
echo [it_cursor.s]
|
||||
it_cursor = it_cursor.ri
|
||||
var jt_cursor = root
|
||||
jt_cursor = root
|
||||
block :tmp_1:
|
||||
while (
|
||||
not (jt_cursor == nil)):
|
||||
let ri_1_cursor = jt_cursor.ri
|
||||
var ri_1_cursor
|
||||
ri_1_cursor = jt_cursor.ri
|
||||
echo [jt_cursor.s]
|
||||
jt_cursor = ri_1_cursor
|
||||
-- end of expandArc ------------------------'''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue