string test_s194 array T_nextFree196 integer T_firstFree137 integer T_maxIndex185 array T_typeId175 string test_s194 = "" integer T_firstFree137 = 0 integer T_maxIndex185 = 0 function initGlobals192() { } function main817() { initGlobals192(); init_test782(); } function config192() { } function init_test782() { test_s_194 = ""; dispatch_T_destroyT109(new_A131()); if (test_s_194 == "") { testSuccess822(); } else { }; } IS_NATIVE function testSuccess822() { } function A_init138(integer this831) { } function new_A131() returns integer { local integer this777 this_777 = alloc_A177(); construct_A104(this_777); return this_777; } function construct_A104(integer this154) { A_init138(this_154); } function A_onDestroy179(integer this109) { } function destroyA147(integer this159) { A_onDestroy179(this_159); dealloc_A223(this_159); } function B_onDestroy158(integer this174) { test_s_194 = (test_s_194 + "B"); } function destroyB122(integer this859) { B_onDestroy158(this_859); dealloc_B148(this_859); } function destroyT142(integer this322) { dealloc_T487(this_322); } function alloc_A177() returns integer { local integer this126 if (T_firstFree_137 == 0) { if (T_maxIndex_185 < 32768) { T_maxIndex_185 = (T_maxIndex_185 + 1); this_126 = T_maxIndex_185; T_typeId_175[this_126] = 2; } else { error157("Out of memory: Could not create A."); this_126 = 0; }; } else { T_firstFree_137 = (T_firstFree_137 - 1); this_126 = T_nextFree_196[T_firstFree_137]; T_typeId_175[this_126] = 2; }; return this_126; } function error157(string msg199) { $debugPrint919((msg_199 + (" " + #getStackTrace()))); } function dealloc_A223(integer obj435) { if (T_typeId_175[obj_435] == 0) { error157("Double free: object of type A"); } else { T_nextFree_196[T_firstFree_137] = obj_435; T_firstFree_137 = (T_firstFree_137 + 1); T_typeId_175[obj_435] = 0; }; } function dealloc_B148(integer obj161) { if (T_typeId_175[obj_161] == 0) { error157("Double free: object of type B"); } else { T_nextFree_196[T_firstFree_137] = obj_161; T_firstFree_137 = (T_firstFree_137 + 1); T_typeId_175[obj_161] = 0; }; } function dealloc_T487(integer obj166) { if (T_typeId_175[obj_166] == 0) { error157("Double free: object of type T"); } else { T_nextFree_196[T_firstFree_137] = obj_166; T_firstFree_137 = (T_firstFree_137 + 1); T_typeId_175[obj_166] = 0; }; } function dispatch_T_destroyT109(integer this324) { if (T_typeId_175[this_324] == 0) { if (this_324 == 0) { error157("Nullpointer exception when calling T.T"); } else { error157("Called T.T on invalid object."); }; } else { }; if (T_typeId_175[this_324] <= 2) { if (T_typeId_175[this_324] <= 1) { destroyT142(this_324); } else { destroyA147(this_324); }; } else { destroyB122(this_324); }; }