array B_nextFree190 integer B_firstFree172 integer B_maxIndex328 array B_typeId545 integer B_firstFree172 = 0 integer B_maxIndex328 = 0 function initGlobals174() { B_firstFree_172 = 0; B_maxIndex_328 = 0; } function main273() { initGlobals174(); init_test194(); } function config381() { } function init_test194() { local integer x1962 local integer x2138 local integer x3194 local integer x4280 x1_962 = new_C115(); x2_138 = new_D136(); x3_194 = new_C115(); x4_280 = new_D136(); if (dispatch_A_test_A_foo510(x1_962) != 1) { testFail584("1"); } else { }; if (dispatch_A_test_A_foo510(x2_138) != 2) { testFail584("2"); } else { }; if (dispatch_B_test_B_bar802(x3_194) != 3) { testFail584("3"); } else { }; if (dispatch_B_test_B_bar802(x4_280) != 4) { testFail584("4"); } else { }; testSuccess127(); } IS_NATIVE function testFail584(string s184) { } IS_NATIVE function testSuccess127() { } function C_foo167(integer this888) returns integer { return 1; } function C_bar154(integer this143) returns integer { return 3; } function C_init539(integer this164) { } function new_C115() returns integer { local integer this198 this_198 = alloc_C175(); construct_C867(this_198); return this_198; } function construct_C867(integer this135) { C_init539(this_135); } function D_foo197(integer this288) returns integer { return 2; } function D_bar156(integer this211) returns integer { return 4; } function D_init893(integer this367) { } function new_D136() returns integer { local integer this164 this_164 = alloc_D630(); construct_D829(this_164); return this_164; } function construct_D829(integer this169) { D_init893(this_169); } function error463(string msg139) { $debugPrint195((msg_139 + (" " + #getStackTrace()))); } function alloc_C175() returns integer { local integer this607 if (B_firstFree_172 == 0) { if (B_maxIndex_328 < 32768) { B_maxIndex_328 = (B_maxIndex_328 + 1); this_607 = B_maxIndex_328; B_typeId_545[this_607] = 2; } else { error463("Out of memory: Could not create C."); this_607 = 0; }; } else { B_firstFree_172 = (B_firstFree_172 - 1); this_607 = B_nextFree_190[B_firstFree_172]; B_typeId_545[this_607] = 2; }; return this_607; } function alloc_D630() returns integer { local integer this160 if (B_firstFree_172 == 0) { if (B_maxIndex_328 < 32768) { B_maxIndex_328 = (B_maxIndex_328 + 1); this_160 = B_maxIndex_328; B_typeId_545[this_160] = 3; } else { error463("Out of memory: Could not create D."); this_160 = 0; }; } else { B_firstFree_172 = (B_firstFree_172 - 1); this_160 = B_nextFree_190[B_firstFree_172]; B_typeId_545[this_160] = 3; }; return this_160; } function dispatch_A_test_A_foo510(integer this189) returns integer { local integer test_A_foo_result535 if (B_typeId_545[this_189] == 0) { if (this_189 == 0) { error463("Nullpointer exception when calling A.foo"); } else { error463("Called A.foo on invalid object."); }; } else { }; if (B_typeId_545[this_189] <= 2) { test_A_foo_result_535 = C_foo167(this_189); } else { test_A_foo_result_535 = D_foo197(this_189); }; return test_A_foo_result_535; } function dispatch_B_test_B_bar802(integer this996) returns integer { local integer test_B_bar_result494 if (B_typeId_545[this_996] == 0) { if (this_996 == 0) { error463("Nullpointer exception when calling B.bar"); } else { error463("Called B.bar on invalid object."); }; } else { }; if (B_typeId_545[this_996] <= 2) { test_B_bar_result_494 = C_bar154(this_996); } else { test_B_bar_result_494 = D_bar156(this_996); }; return test_B_bar_result_494; }