mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-02 08:08:20 +00:00
Fix the obnoxious issue with globals propagation in full expressions.
Fixed by backtracking in the parser, and keeping a copy of the original expression if it's a simple_expr, which is used for output in place of the folded one. There's still the potential issue that if a global is optimized away, then it will "come back" during output and cause an error because the definition is missing.
This commit is contained in:
parent
5b401ff9a5
commit
e5714eba25
3 changed files with 43 additions and 10 deletions
|
@ -265,7 +265,10 @@ class outscript(object):
|
|||
if nt == 'DECL':
|
||||
ret = self.dent() + node['t'] + ' ' + node['name']
|
||||
if child:
|
||||
ret += ' = ' + self.OutExpr(child[0])
|
||||
if 'orig' in child[0]:
|
||||
ret += ' = ' + self.OutExpr(child[0]['orig'])
|
||||
else:
|
||||
ret += ' = ' + self.OutExpr(child[0])
|
||||
return ret + ';\n'
|
||||
if nt == ';':
|
||||
return self.dent() + ';\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue