mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-04 12:14:36 -07:00
Remove 'Scope' from functions in symbol table. Function scope is always 0.
This commit is contained in:
parent
4f8d2979aa
commit
39b6036671
1 changed files with 4 additions and 7 deletions
|
@ -220,7 +220,7 @@ class parser(object):
|
||||||
|
|
||||||
def AddSymbol(self, kind, scope, name, **values):
|
def AddSymbol(self, kind, scope, name, **values):
|
||||||
values['Kind'] = kind
|
values['Kind'] = kind
|
||||||
if kind in 'vlf':
|
if kind in 'vl':
|
||||||
values['Scope'] = scope
|
values['Scope'] = scope
|
||||||
self.symtab[scope][name] = values
|
self.symtab[scope][name] = values
|
||||||
|
|
||||||
|
@ -736,10 +736,7 @@ class parser(object):
|
||||||
args = self.Parse_optional_expression_list(sym['ParamTypes'])
|
args = self.Parse_optional_expression_list(sym['ParamTypes'])
|
||||||
self.expect(')')
|
self.expect(')')
|
||||||
self.NextToken()
|
self.NextToken()
|
||||||
ret = {'nt':'FNCALL', 't':sym['Type'], 'name':name, 'ch':args}
|
return {'nt':'FNCALL', 't':sym['Type'], 'name':name, 'ch':args}
|
||||||
if 'Scope' in sym:
|
|
||||||
ret['scope'] = sym['Scope']
|
|
||||||
return ret
|
|
||||||
if sym['Kind'] != 'v':
|
if sym['Kind'] != 'v':
|
||||||
raise EParseTypeMismatch(self)
|
raise EParseTypeMismatch(self)
|
||||||
typ = sym['Type']
|
typ = sym['Type']
|
||||||
|
@ -2125,7 +2122,7 @@ list lazy_list_set(list L, integer i, list v)
|
||||||
elif self.tok[0] == '}':
|
elif self.tok[0] == '}':
|
||||||
bracelevel -= 1
|
bracelevel -= 1
|
||||||
self.NextToken()
|
self.NextToken()
|
||||||
ret[name] = {'Kind':'f','Type':typ,'ParamTypes':params,'Scope':0}
|
ret[name] = {'Kind':'f','Type':typ,'ParamTypes':params}
|
||||||
|
|
||||||
elif typ is None:
|
elif typ is None:
|
||||||
return ret # A variable needs a type
|
return ret # A variable needs a type
|
||||||
|
@ -2246,7 +2243,7 @@ list lazy_list_set(list L, integer i, list v)
|
||||||
# 'v' for variable, 'f' for function, 'l' for label, 's' for state,
|
# 'v' for variable, 'f' for function, 'l' for label, 's' for state,
|
||||||
# or 'e' for event.
|
# or 'e' for event.
|
||||||
# Variables have 'Scope', 'Type', 'Loc' (if global), 'Local' (if local).
|
# Variables have 'Scope', 'Type', 'Loc' (if global), 'Local' (if local).
|
||||||
# Functions have 'Type', 'Loc', 'ParamTypes' and 'ParamNames'.
|
# Functions have 'Type' and 'ParamTypes'; UDFs also have 'Loc' and'ParamNames'.
|
||||||
# Labels only have 'Scope'.
|
# Labels only have 'Scope'.
|
||||||
# States only have 'Loc'.
|
# States only have 'Loc'.
|
||||||
# Events have 'ParamTypes' and 'ParamNames'.
|
# Events have 'ParamTypes' and 'ParamNames'.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue