mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Reduce the scope of the try...except block to only cover the call.
Major indentation changes, but minor actual changes.
This commit is contained in:
parent
44a9c9a40c
commit
a8231586c1
1 changed files with 38 additions and 38 deletions
|
@ -940,7 +940,6 @@ class foldconst(object):
|
|||
if CONSTargs:
|
||||
# Call it
|
||||
fn = sym['Fn']
|
||||
try:
|
||||
args = [arg['value'] for arg in child]
|
||||
argtypes = sym['ParamTypes']
|
||||
assert(len(args) == len(argtypes))
|
||||
|
@ -968,10 +967,14 @@ class foldconst(object):
|
|||
elif type(args[argnum][i]) == lslcommon.Vector:
|
||||
args[argnum][i] = lslfuncs.v2f(args[argnum][i])
|
||||
del argtypes
|
||||
try:
|
||||
if node['name'][:10] == 'llDetected':
|
||||
value = fn(*args, event=self.CurEvent)
|
||||
else:
|
||||
value = fn(*args)
|
||||
except lslfuncs.ELSLCantCompute:
|
||||
# Don't transform the tree if function is not computable
|
||||
pass
|
||||
del args
|
||||
if not self.foldtabs:
|
||||
generatesTabs = (
|
||||
|
@ -983,9 +986,6 @@ class foldconst(object):
|
|||
warning(u"Can't optimize call to %s because it would generate a tab character (you can force the optimization with the 'foldtabs' option, or disable this warning by disabling the 'warntabs' option)." % node['name'].decode('utf8'))
|
||||
return
|
||||
parent[index] = {'nt':'CONST', 't':node['t'], 'value':value}
|
||||
except lslfuncs.ELSLCantCompute:
|
||||
# Don't transform the tree if function is not computable
|
||||
pass
|
||||
elif node['name'] == 'llGetListLength':
|
||||
# Convert llGetListLength(expr) to (expr != [])
|
||||
node = {'nt':'CONST', 't':'list', 'value':[]}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue