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:
Sei Lisa 2016-12-22 01:24:44 +01:00
parent 44a9c9a40c
commit a8231586c1

View file

@ -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':[]}