moved exception handler, fixes #861

This commit is contained in:
gnembon committed 2021-05-14 03:34:19 -03:00
1 parent 5da6c2837a
commit fd492f334c
1 file changed
+14 -12
+14 -12
View File
@@ -166,19 +166,26 @@ public abstract class Fluff
@Override @Override
public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Tokenizer.Token t, final List<LazyValue> lazyParams) public LazyValue lazyEval(Context cc, Context.Type type, Expression e, Tokenizer.Token t, final List<LazyValue> lazyParams)
{ {
try
{
return new LazyValue() return new LazyValue()
{ // eager evaluation always ignores the required type and evals params by none default { // eager evaluation always ignores the required type and evals params by none default
private List<Value> params; private List<Value> params;
public Value evalValue(Context c, Context.Type type)
public Value evalValue(Context c, Context.Type type) { {
ILazyFunction.checkInterrupts(); ILazyFunction.checkInterrupts();
try
{
return AbstractFunction.this.eval(getParams(c)); return AbstractFunction.this.eval(getParams(c));
} }
catch (RuntimeException exc)
private List<Value> getParams(Context c) { {
if (params == null) { throw Expression.handleCodeException(cc, exc, e, t);
}
}
private List<Value> getParams(Context c)
{
if (params == null)
{
// very likely needs to be dynamic, so not static like here, or remember if it was. // very likely needs to be dynamic, so not static like here, or remember if it was.
params = unpackArgs(lazyParams, c, Context.Type.NONE); params = unpackArgs(lazyParams, c, Context.Type.NONE);
} }
@@ -190,11 +197,6 @@ public abstract class Fluff
} }
}; };
} }
catch (RuntimeException exc)
{
throw Expression.handleCodeException(cc, exc, e, t);
}
}
} }
public abstract static class AbstractLazyOperator implements ILazyOperator public abstract static class AbstractLazyOperator implements ILazyOperator