// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1367 globals integer array SimpleFunc_nextFree integer SimpleFunc_firstFree=0 integer SimpleFunc_maxIndex=0 integer array SimpleFunc_typeId endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function dispatch_SimpleFunc_test_SimpleFunc_apply takes integer this, integer x, integer y returns integer local integer test_SimpleFunc_apply_result local integer x_1 local integer y_1 local integer x_2 local integer y_2 if SimpleFunc_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling SimpleFunc.apply") else call error("Called SimpleFunc.apply on invalid object.") endif endif if SimpleFunc_typeId[this] <= 2 then set x_1 = x set y_1 = y set test_SimpleFunc_apply_result = x_1 + y_1 else set x_2 = x set y_2 = y set test_SimpleFunc_apply_result = x_2 * y_2 endif return test_SimpleFunc_apply_result endfunction function new_Test takes nothing returns integer local integer this local integer this_1 if SimpleFunc_firstFree == 0 then if SimpleFunc_maxIndex < 32768 then set SimpleFunc_maxIndex = SimpleFunc_maxIndex + 1 set this_1 = SimpleFunc_maxIndex set SimpleFunc_typeId[this_1] = 3 else call error("Out of memory: Could not create Test.") set this_1 = 0 endif else set SimpleFunc_firstFree = SimpleFunc_firstFree - 1 set this_1 = SimpleFunc_nextFree[SimpleFunc_firstFree] set SimpleFunc_typeId[this_1] = 3 endif set this = this_1 return this endfunction function init_test takes nothing returns nothing local integer f local integer clVar local integer g local integer this if SimpleFunc_firstFree == 0 then if SimpleFunc_maxIndex < 32768 then set SimpleFunc_maxIndex = SimpleFunc_maxIndex + 1 set this = SimpleFunc_maxIndex set SimpleFunc_typeId[this] = 2 else call error("Out of memory: Could not create SimpleFunc_test.") set this = 0 endif else set SimpleFunc_firstFree = SimpleFunc_firstFree - 1 set this = SimpleFunc_nextFree[SimpleFunc_firstFree] set SimpleFunc_typeId[this] = 2 endif set clVar = this set f = clVar set g = new_Test() if dispatch_SimpleFunc_test_SimpleFunc_apply(f, 3, 4) == 7 and dispatch_SimpleFunc_test_SimpleFunc_apply(g, 3, 4) == 12 then call testSuccess() endif endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction