mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
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:
parent
e4eaab9e84
commit
a87022b73f
4 changed files with 77 additions and 29 deletions
|
@ -67,6 +67,10 @@ LSLType2Python = {'integer':int, 'float':float,
|
|||
'string':unicode, 'key':Key, 'vector':Vector,
|
||||
'rotation':Quaternion, 'list':list}
|
||||
|
||||
LSLTypeDefaults = {'integer':0, 'float':0.0, 'string':u'', 'key':Key(u''),
|
||||
'vector':Vector((0.,0.,0.)), 'rotation':Quaternion((0.,0.,0.,1.)),
|
||||
'list':[]}
|
||||
|
||||
def warning(txt):
|
||||
assert type(txt) == unicode
|
||||
sys.stderr.write(u"WARNING: " + txt + u"\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue