Get rid of StSw craziness and use lsllastpass to make another pass.

This has been a TODO item for long. Now that we have lsllastpass, it's actually easy to implement.

Adds an LSLTypeDefaults dictionary to lslcommon, just in case the state-changing function returns a value and we need to insert a return statement.

We've also added subtree-local info to lsllastpass (lost when we return to the parent after visiting a subtree).

This fixes a bug where naked switch statements could appear as a result of optimization, and cause the compilation to fail.
This commit is contained in:
Sei Lisa 2017-11-02 16:39:12 +01:00
parent e4eaab9e84
commit a87022b73f
4 changed files with 77 additions and 29 deletions

View file

@ -272,7 +272,7 @@ class Test03_Optimizer(UnitTestCase):
vector vvvv2=vvvv;
float ffff3 = v.z;
integer fn(){
if (1) state default; else return 2;
if (1) state default;
return fn();}
default{touch(integer n){