public Object call(Object ctx, Object thisValue, VariableResolverFactory factory, Object[] parms) { if (parms != null && parms.length != 0) { // detect tail recursion if (factory instanceof FunctionVariableResolverFactory && ((FunctionVariableResolverFactory) factory).getIndexedVariableResolvers().length == parms.length) { FunctionVariableResolverFactory fvrf = (FunctionVariableResolverFactory) factory; if (fvrf.getFunction().equals(this)) { VariableResolver[] swapVR = fvrf.getIndexedVariableResolvers(); fvrf.updateParameters(parms); try { return compiledBlock.getValue(ctx, thisValue, fvrf); } finally { fvrf.setIndexedVariableResolvers(swapVR); } } } return compiledBlock.getValue(thisValue, new StackDemarcResolverFactory(new FunctionVariableResolverFactory(this, factory, parameters, parms))); } else if (compiledMode) { return compiledBlock.getValue(thisValue, new StackDemarcResolverFactory(new DefaultLocalVariableResolverFactory(factory, parameters))); } else { return compiledBlock.getValue(thisValue, new StackDemarcResolverFactory(new DefaultLocalVariableResolverFactory(factory, parameters))); } }
public Object call(Object ctx, Object thisValue, VariableResolverFactory factory, Object[] parms) { if (parms != null && parms.length != 0) { // detect tail recursion if (factory instanceof FunctionVariableResolverFactory && ((FunctionVariableResolverFactory) factory).getIndexedVariableResolvers().length == parms.length) { FunctionVariableResolverFactory fvrf = (FunctionVariableResolverFactory) factory; if (fvrf.getFunction().equals(this)) { VariableResolver[] swapVR = fvrf.getIndexedVariableResolvers(); fvrf.updateParameters(parms); try { return compiledBlock.getValue(ctx, thisValue, fvrf); } finally { fvrf.setIndexedVariableResolvers(swapVR); } } } return compiledBlock.getValue(thisValue, new StackDemarcResolverFactory(new FunctionVariableResolverFactory(this, factory, parameters, parms))); } else if (compiledMode) { return compiledBlock.getValue(thisValue, new StackDemarcResolverFactory(new DefaultLocalVariableResolverFactory(factory, parameters))); } else { return compiledBlock.getValue(thisValue, new StackDemarcResolverFactory(new DefaultLocalVariableResolverFactory(factory, parameters))); } }
public Object call(Object ctx, Object thisValue, VariableResolverFactory factory, Object[] parms) { try { if (parms != null && parms.length != 0) { // detect tail recursion if (factory instanceof FunctionVariableResolverFactory && ((FunctionVariableResolverFactory) factory).getIndexedVariableResolvers().length == parms.length) { FunctionVariableResolverFactory fvrf = (FunctionVariableResolverFactory) factory; if (fvrf.getFunction().equals(this)) { VariableResolver[] swapVR = fvrf.getIndexedVariableResolvers(); fvrf.updateParameters(parms); try { return compiledBlock.getValue(ctx, thisValue, fvrf); } finally { fvrf.setIndexedVariableResolvers(swapVR); } } } return compiledBlock.getValue(ctx, thisValue, new FunctionVariableResolverFactory(this, factory, parameters, parms)); } else { return compiledBlock.getValue(ctx, thisValue, new DefaultLocalVariableResolverFactory(factory)); } } catch (EndWithValue end) { return end.getValue(); } }