Open zamtmn opened 8 months ago
Hi, I just added a commit that should help.
if Compiler.Compile() then
begin
States := Compiler.getVarStates(); // once compiled, store global variable values
RunCode(Compiler.Emitter);
Compiler.setVarStates(states); // now restore var states before re-running
RunCode(Compiler.Emitter);
Compiler.freeVarStates(states);
end;
Beware that variable states are gathered with assign operator so multidimensional arrays would not be restored correctly.
Thank you, this will suit me already, but I'll ask if a complete solution for arrays is planned?
Yes, I will add deep copy for arrays shortly
Is it possible? If you just do it like this
it save prev variables and print
How to make reuse right?