Optimize chains of assignments
This allows optimizing, for example: integer a = 1; integer b = a; llOwnerSay((string)b); which wasn't done before. This case is prone to happen with inlined functions, e.g. using the result of an inlined function as a parameter to another.
This commit is contained in:
@@ -318,6 +318,15 @@ class deadcode(object):
|
||||
|
||||
node = sym['W']
|
||||
nt = node.nt
|
||||
|
||||
while nt == 'IDENT':
|
||||
# Follow the chain of identifiers all the way to the original
|
||||
if self.symtab[node.scope][node.name].get('W', False) is False:
|
||||
return sym
|
||||
sym = self.symtab[node.scope][node.name]
|
||||
node = sym['W']
|
||||
nt = node.nt
|
||||
|
||||
if nt == 'CONST':
|
||||
tcurnode = curnode.t
|
||||
if tcurnode in ('integer', 'string', 'key'):
|
||||
|
||||
Reference in New Issue
Block a user