array B_nextFree161 integer B_firstFree149 integer B_maxIndex586 array B_typeId214 integer B_firstFree149 = 0 integer B_maxIndex586 = 0 function initGlobals179() { } function main157() { initGlobals179(); init_test455(); } function config209() { } function init_test455() { local integer x1307 local integer x2107 local integer x3163 local integer x4116 x1_307 = new_C195(); x2_107 = new_D610(); x3_163 = new_C195(); x4_116 = new_D610(); if (dispatch_A_test_A_foo128(x1_307) != 1) { testFail188("1"); } else { }; if (dispatch_A_test_A_foo128(x2_107) != 2) { testFail188("2"); } else { }; if (dispatch_B_test_B_bar210(x3_163) != 3) { testFail188("3"); } else { }; if (dispatch_B_test_B_bar210(x4_116) != 4) { testFail188("4"); } else { }; testSuccess201(); } IS_NATIVE function testFail188(string s329) { } IS_NATIVE function testSuccess201() { } function C_foo152(integer this670) returns integer { return 1; } function C_bar205(integer this200) returns integer { return 3; } function C_init192(integer this127) { } function new_C195() returns integer { local integer this150 this_150 = alloc_C228(); construct_C186(this_150); return this_150; } function construct_C186(integer this719) { C_init192(this_719); } function D_foo499(integer this963) returns integer { return 2; } function D_bar663(integer this188) returns integer { return 4; } function D_init468(integer this314) { } function new_D610() returns integer { local integer this128 this_128 = alloc_D283(); construct_D140(this_128); return this_128; } function construct_D140(integer this150) { D_init468(this_150); } function error108(string msg686) { $debugPrint196((msg_686 + (" " + #getStackTrace()))); } function alloc_C228() returns integer { local integer this912 if (B_firstFree_149 == 0) { if (B_maxIndex_586 < 32768) { B_maxIndex_586 = (B_maxIndex_586 + 1); this_912 = B_maxIndex_586; B_typeId_214[this_912] = 2; } else { error108("Out of memory: Could not create C."); this_912 = 0; }; } else { B_firstFree_149 = (B_firstFree_149 - 1); this_912 = B_nextFree_161[B_firstFree_149]; B_typeId_214[this_912] = 2; }; return this_912; } function alloc_D283() returns integer { local integer this509 if (B_firstFree_149 == 0) { if (B_maxIndex_586 < 32768) { B_maxIndex_586 = (B_maxIndex_586 + 1); this_509 = B_maxIndex_586; B_typeId_214[this_509] = 3; } else { error108("Out of memory: Could not create D."); this_509 = 0; }; } else { B_firstFree_149 = (B_firstFree_149 - 1); this_509 = B_nextFree_161[B_firstFree_149]; B_typeId_214[this_509] = 3; }; return this_509; } function dispatch_A_test_A_foo128(integer this113) returns integer { if (B_typeId_214[this_113] == 0) { if (this_113 == 0) { error108("Nullpointer exception when calling A.foo"); } else { error108("Called A.foo on invalid object."); }; } else { }; if (B_typeId_214[this_113] <= 2) { this_113 = C_foo152(this_113); } else { this_113 = D_foo499(this_113); }; return this_113; } function dispatch_B_test_B_bar210(integer this178) returns integer { if (B_typeId_214[this_178] == 0) { if (this_178 == 0) { error108("Nullpointer exception when calling B.bar"); } else { error108("Called B.bar on invalid object."); }; } else { }; if (B_typeId_214[this_178] <= 2) { this_178 = C_bar205(this_178); } else { this_178 = D_bar663(this_178); }; return this_178; }