From 0c869eaa475caab9558aaf5b39b8e3519388f811 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Mon, 13 May 2019 08:28:33 +0200 Subject: Fix destructor injections for global variables (#11230) * attach global destructors at end of mainModule * Add testcase * Minor cleanup * Inject topLevelVar temporaries' destructors early * Fix megatest --- tests/destructor/objFile.nim | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/destructor/objFile.nim (limited to 'tests/destructor/objFile.nim') diff --git a/tests/destructor/objFile.nim b/tests/destructor/objFile.nim new file mode 100644 index 000000000..436c090d1 --- /dev/null +++ b/tests/destructor/objFile.nim @@ -0,0 +1,8 @@ +type Obj* = object + v*: int + +proc `=destroy`(this: var Obj) = + echo "igotdestroyed" + this.v = -1 + +var test* = Obj(v: 42) -- cgit 1.4.1-2-gfad0