Dechenjm / crack-language

Automatically exported from code.google.com/p/crack-language
Other
0 stars 0 forks source link

Cleanup is broken for assignment (reference counting bug) #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
import crack.io cout;

class A {
    A other = null;
    String name;
    oper init(A other0, String name0) : other = other0, name = name0 {} 
    oper del() { cout `deleting $name\n`; }
}

A a = A(null, 'first');
a = A(a, 'second');
cout `done\n`;

Should print "done", "first" and "second".  Instead, "first" gets cleaned up 
during the assignment.

Cleanups for assignments need to happen after the value is bound. 

Original issue reported on code.google.com by mind...@gmail.com on 27 Jul 2010 at 3:11

GoogleCodeExporter commented 9 years ago

Original comment by mind...@gmail.com on 29 Jul 2010 at 2:11