Closed dedmen closed 3 years ago
params ["_unit", "_pos", ["_target", objNull], ["_buildings", []]]; _buildings pushBack [1,2,3];
Compiles fine. But after first run, assembly prints this
push ["_unit","_pos",["_target",<NULL-object>],["_buildings",[[1,2,3]]]] callFunction params;
pushBack modified the reference inside the compiled script. Need to insert + operator call between the const array and params call, if the default values contain an array because otherwise the array will leak into the script.
+
https://github.com/dedmen/ArmaScriptCompiler/blob/master/src/optimizer/optimizerModuleConstantFold.cpp#L230
Fixed in https://github.com/dedmen/ArmaScriptCompiler/commit/b2d55a67aeedec2eb896c223a9333fdcb3d0126e
Compiles fine. But after first run, assembly prints this
pushBack modified the reference inside the compiled script. Need to insert
+
operator call between the const array and params call, if the default values contain an array because otherwise the array will leak into the script.https://github.com/dedmen/ArmaScriptCompiler/blob/master/src/optimizer/optimizerModuleConstantFold.cpp#L230