if (LOG.isDebugEnabled())
{
LOG.debug("Resolved function name to : " + resolvedFunctionName);
}
Function function =
executionState.getFunctions().get(resolvedFunctionName);
if (function == null)
{
function = getFunctionFromRegistry(
resolvedFunctionName,
functionArguments,
registry,
optimiser,
executionState);
if (function == null)
{
throw new UndefinedFunctionException(
resolvedFunctionName, functionArguments);
}
}
LOG.debug("Executing function call : " + resolvedFunctionName);
Map<String, Variable> paramVariables = assignParameters(
function,
functionArguments,
executionState);
DispelExecutionState functionExecutionState =
SimpleDispelExecutionState.makeFunctionScope(
executionState,
paramVariables,
function.getNamespaceManager());
RootStrategy body = new RootStrategy(
registry,
optimiser,
functionExecutionState);
DISPELRequestBuilder old = compiler.getRequestBuilder();
DISPELGraphBuilder builder = new DISPELGraphBuilder(body);
builder.setCompiler(compiler);
compiler.handleChild(function.getBody(), builder);
Object result = body.getFunctionResult();
LOG.debug("result of function call : " + result);
// add submitted and registered objects to the original request builder
// do we need a better way of doing this?