Fix detection of SEF in assignments with vector/rot fields as LHS.

This commit is contained in:
Sei Lisa 2014-08-08 04:03:37 +02:00
parent 7a4a6d221e
commit c080f4b596

View file

@ -485,8 +485,13 @@ class optimizer(renamer, deadcode):
# We have a regular assignment either way now. Simplify the RHS.
self.FoldTree(node['ch'], 1)
if child[1]['nt'] == 'IDENT' and child[1]['name'] == child[0]['name'] \
and child[1]['scope'] == child[0]['scope']:
if child[0]['nt'] == child[1]['nt'] == 'IDENT' \
and child[1]['name'] == child[0]['name'] \
and child[1]['scope'] == child[0]['scope'] \
or child[0]['nt'] == child[1]['nt'] == 'FLD' \
and child[1]['ch'][0]['name'] == child[0]['ch'][0]['name'] \
and child[1]['ch'][0]['scope'] == child[0]['ch'][0]['scope'] \
and child[1]['fld'] == child[0]['fld']:
node['SEF'] = True
self.FoldStmt(parent, index)
return