Remove 'Local' from symbol table; add note about an unimplemented feature; improve symbol table documentation; rename a helper variable.

This commit is contained in:
Sei Lisa 2015-03-27 02:12:32 +01:00
parent 921955f321
commit edbc240408
2 changed files with 25 additions and 10 deletions

View file

@ -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: