darknesswind / NutCracker

fork from DamianXVI's squirrel decompiler
22 stars 11 forks source link

For loop postprocessing can drop the increment expression (?) #29

Open AdamMil opened 5 years ago

AdamMil commented 5 years ago

It looks like the for loop postprocessing code can drop the increment statement in one case:

StatementPtr incrementStatement = GetForIncrementStatement();
if ((prevStatement->GetType() != Stat_LocalVar) && !incrementStatement)
    return  StatementPtr();

GetForIncrementStatement actually removes the increment statement from the block, and then if it doesn't get used (because GetType() == Stat_LocalVar), I believe it just disappears.