mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fix lslparse.DoesSomething.
It was non-funcional because of a copy/paste error.
This commit is contained in:
parent
c71b0eea2f
commit
9f8441bc65
1 changed files with 6 additions and 2 deletions
|
@ -46,11 +46,15 @@ class foldconst(object):
|
||||||
def DoesSomething(self, node):
|
def DoesSomething(self, node):
|
||||||
"""Tell if a subtree does something or is just empty statements
|
"""Tell if a subtree does something or is just empty statements
|
||||||
(a pure combination of ';' and '{}')
|
(a pure combination of ';' and '{}')
|
||||||
|
|
||||||
|
Not to be confused with lslparse.does_something which includes labels,
|
||||||
|
and applies to a block's statement list, not to a node.
|
||||||
"""
|
"""
|
||||||
if node['nt'] != ';':
|
if node['nt'] != ';':
|
||||||
if node['nt'] == '{}':
|
if node['nt'] == '{}':
|
||||||
if self.does_something(node['ch']):
|
for subnode in node['ch']:
|
||||||
return True
|
if self.DoesSomething(subnode):
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue