nitg & lib: intro `Finalizable` to be called when an object is freed
[nit.git] / src / global_compiler.nit
index 322fcda..3f8b422 100644 (file)
@@ -244,6 +244,7 @@ class GlobalCompiler
                v.add("{res}->classid = {self.classid(mtype)};")
 
                self.generate_init_attr(v, res, mtype)
+               v.set_finalizer res
                v.add("return {res};")
                v.add("\}")
        end