mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Simplify (type)sametype_expr -> sametype_expr.
This commit is contained in:
parent
2e09a3a986
commit
9a820a62d0
1 changed files with 10 additions and 0 deletions
|
@ -344,6 +344,16 @@ class foldconst(object):
|
|||
parent[index] = {'nt':'CONST', 't':node['t'], 'SEF':True,
|
||||
'value':lslfuncs.typecast(
|
||||
child[0]['value'], self.LSL2PythonType[node['t']])}
|
||||
|
||||
# Remove casts of a type to the same type (NOP in Mono)
|
||||
# This is not an optimization by itself, but it simplifies the job,
|
||||
# by not needing to look into nested casts like (key)((key)...)
|
||||
while node['nt'] == 'CAST' and child[0]['t'] == node['t']:
|
||||
parent[index] = node = child[0]
|
||||
if 'ch' not in node:
|
||||
break
|
||||
child = node['ch']
|
||||
|
||||
return
|
||||
|
||||
if nt == 'NEG':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue