array B_nextFree133 integer B_firstFree342 integer B_maxIndex124 array B_typeId178 integer B_firstFree342 = 0 integer B_maxIndex124 = 0 function initGlobals912() { B_firstFree_342 = 0; B_maxIndex_124 = 0; } function main102() { initGlobals912(); init_test238(); } function config884() { } function init_test238() { local integer x1372 local integer x2103 local integer x3154 local integer x4994 x1_372 = new_C166(); x2_103 = new_D182(); x3_154 = new_C166(); x4_994 = new_D182(); if (dispatch_A_test_A_foo136(x1_372) != 1) { testFail186("1"); } else { }; if (dispatch_A_test_A_foo136(x2_103) != 2) { testFail186("2"); } else { }; if (dispatch_B_test_B_bar753(x3_154) != 3) { testFail186("3"); } else { }; if (dispatch_B_test_B_bar753(x4_994) != 4) { testFail186("4"); } else { }; testSuccess828(); } IS_NATIVE function testFail186(string s692) { } IS_NATIVE function testSuccess828() { } function C_foo202(integer this205) returns integer { return 1; } function C_bar154(integer this172) returns integer { return 3; } function C_init304(integer this428) { } function new_C166() returns integer { local integer this178 this_178 = alloc_C121(); construct_C269(this_178); return this_178; } function construct_C269(integer this192) { C_init304(this_192); } function D_foo316(integer this697) returns integer { return 2; } function D_bar735(integer this178) returns integer { return 4; } function D_init349(integer this131) { } function new_D182() returns integer { local integer this769 this_769 = alloc_D110(); construct_D199(this_769); return this_769; } function construct_D199(integer this188) { D_init349(this_188); } function error101(string msg201) { $debugPrint213((msg_201 + (" " + #getStackTrace()))); } function alloc_C121() returns integer { local integer this224 if (B_firstFree_342 == 0) { if (B_maxIndex_124 < 32768) { B_maxIndex_124 = (B_maxIndex_124 + 1); this_224 = B_maxIndex_124; B_typeId_178[this_224] = 2; } else { error101("Out of memory: Could not create C."); this_224 = 0; }; } else { B_firstFree_342 = (B_firstFree_342 - 1); this_224 = B_nextFree_133[B_firstFree_342]; B_typeId_178[this_224] = 2; }; return this_224; } function alloc_D110() returns integer { local integer this819 if (B_firstFree_342 == 0) { if (B_maxIndex_124 < 32768) { B_maxIndex_124 = (B_maxIndex_124 + 1); this_819 = B_maxIndex_124; B_typeId_178[this_819] = 3; } else { error101("Out of memory: Could not create D."); this_819 = 0; }; } else { B_firstFree_342 = (B_firstFree_342 - 1); this_819 = B_nextFree_133[B_firstFree_342]; B_typeId_178[this_819] = 3; }; return this_819; } function dispatch_A_test_A_foo136(integer this135) returns integer { local integer test_A_foo_result172 if (B_typeId_178[this_135] == 0) { if (this_135 == 0) { error101("Nullpointer exception when calling A.foo"); } else { error101("Called A.foo on invalid object."); }; } else { }; if (B_typeId_178[this_135] <= 2) { test_A_foo_result_172 = C_foo202(this_135); } else { test_A_foo_result_172 = D_foo316(this_135); }; return test_A_foo_result_172; } function dispatch_B_test_B_bar753(integer this180) returns integer { local integer test_B_bar_result109 if (B_typeId_178[this_180] == 0) { if (this_180 == 0) { error101("Nullpointer exception when calling B.bar"); } else { error101("Called B.bar on invalid object."); }; } else { }; if (B_typeId_178[this_180] <= 2) { test_B_bar_result_109 = C_bar154(this_180); } else { test_B_bar_result_109 = D_bar735(this_180); }; return test_B_bar_result_109; }