mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Remove 'Local' from symbol table; add note about an unimplemented feature; improve symbol table documentation; rename a helper variable.
This commit is contained in:
parent
921955f321
commit
edbc240408
2 changed files with 25 additions and 10 deletions
|
@ -23,6 +23,11 @@ from lslparse import warning
|
|||
|
||||
class foldconst(object):
|
||||
|
||||
def isLocalVar(self, node):
|
||||
name = node['name']
|
||||
scope = node['scope']
|
||||
return self.symtab[scope][name]['Kind'] == 'v' \
|
||||
and 'Loc' not in self.symtab[scope][name]
|
||||
def FoldAndRemoveEmptyStmts(self, lst):
|
||||
"""Utility function for elimination of useless expressions in FOR"""
|
||||
idx = 0
|
||||
|
@ -596,7 +601,7 @@ class foldconst(object):
|
|||
node['SEF'] = True
|
||||
return
|
||||
# only -2, 2 remain
|
||||
if child[a]['nt'] == 'IDENT' and 'Local' in self.symtab[child[a]['scope']][child[a]['name']]:
|
||||
if child[a]['nt'] == 'IDENT' and self.isLocalVar(child[a]):
|
||||
child[b] = child[a].copy()
|
||||
node['nt'] = '+'
|
||||
if val == -2:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue