mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Make parentheses no longer explicit in the AST (Beta).
The output module adds parentheses where necessary, depending on the evaluation order in the tree. Or that's the idea. Prone to bugs, let's see how it bodes.
This commit is contained in:
parent
59451b90e5
commit
1dea1bd12c
5 changed files with 75 additions and 113 deletions
|
@ -31,13 +31,6 @@ class optimizer(foldconst, renamer, deadcode):
|
|||
# value unchanged
|
||||
if value['t'] == newtype:
|
||||
return value
|
||||
if value not in ('CONST','()','FLD','IDENT','FNCALL','V++','V--',
|
||||
'VECTOR','ROTATION','LIST'):
|
||||
value = {'nt':'()', 't':newtype, 'ch':[value]}
|
||||
if 'SEF' in value['ch'][0]:
|
||||
value['SEF'] = True
|
||||
if 'X' in value['ch'][0]:
|
||||
value['X'] = value['ch'][0]['X']
|
||||
ret = {'nt':'CAST', 't':newtype, 'ch':[value]}
|
||||
if 'SEF' in value:
|
||||
ret['SEF'] = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue