From: Evgeny G. <gaz...@gm...> - 2010-09-04 11:31:10
|
I'm not sure that this is right solution. But so expression.reset() phase for recursive functions calls not depending from number of calls. Index: src/org/exist/xquery/FunctionCall.java =================================================================== --- src/org/exist/xquery/FunctionCall.java (revision 12630) +++ src/org/exist/xquery/FunctionCall.java (working copy) @@ -124,6 +124,7 @@ super.analyze(newContextInfo); if (context.tailRecursiveCall(functionDef.getSignature())) { isRecursive = true; + functionDef.inRecursion = true; } context.functionStart(functionDef.getSignature()); try { Index: src/org/exist/xquery/UserDefinedFunction.java =================================================================== --- src/org/exist/xquery/UserDefinedFunction.java (revision 12630) +++ src/org/exist/xquery/UserDefinedFunction.java (working copy) @@ -44,7 +44,7 @@ private DocumentSet[] contextDocs = null; - private boolean inRecursion = false; + protected boolean inRecursion = false; private boolean bodyAnalyzed = false; @@ -192,10 +192,10 @@ // Question: understand this test. Why not reset even is not in recursion ? // Answer: would lead to an infinite loop if the function is recursive. if(!inRecursion) { - inRecursion = true; - bodyAnalyzed = false; + //inRecursion = true; + //bodyAnalyzed = false; body.resetState(postOptimization); - inRecursion = false; + //inRecursion = false; } if (!postOptimization) { currentArguments = null; =================================================================== -- Evgeny |