@@ -193,29 +193,31 @@ public Function toFunction() throws XPathException {
193
193
final SequenceType argType = new SequenceType (Type .ITEM , Cardinality .EXACTLY_ONE );
194
194
signature .setArgumentTypes (new SequenceType []{argType });
195
195
signature .setReturnType (new SequenceType (CastExpression .this .requiredType , CastExpression .this .cardinality ));
196
- return new FunctionWrapper (context , signature );
196
+ return new FunctionWrapper (this , signature );
197
197
} catch (final QName .IllegalQNameException e ) {
198
198
throw new XPathException (ErrorCodes .XPST0081 , "No namespace defined for prefix " + typeName );
199
199
}
200
200
}
201
201
202
- private class FunctionWrapper extends Function {
202
+ private static class FunctionWrapper extends Function {
203
+ private final CastExpression castExpression ;
203
204
204
- protected FunctionWrapper (XQueryContext context , FunctionSignature signature ) throws XPathException {
205
- super (context , signature );
205
+ protected FunctionWrapper (final CastExpression castExpression , final FunctionSignature signature ) throws XPathException {
206
+ super (castExpression . getContext () , signature );
206
207
final List <Expression > args = new ArrayList <>(1 );
207
- args .add (new Function .Placeholder (context ));
208
+ args .add (new Function .Placeholder (castExpression . getContext () ));
208
209
super .setArguments (args );
210
+ this .castExpression = castExpression ;
209
211
}
210
212
211
213
@ Override
212
- public void setArguments (List <Expression > arguments ) throws XPathException {
213
- CastExpression . this .setExpression (arguments .get (0 ));
214
+ public void setArguments (final List <Expression > arguments ) throws XPathException {
215
+ castExpression .setExpression (arguments .get (0 ));
214
216
}
215
217
216
218
@ Override
217
219
public Sequence eval (Sequence contextSequence , Item contextItem ) throws XPathException {
218
- return CastExpression . this .eval (contextSequence );
220
+ return castExpression .eval (contextSequence );
219
221
}
220
222
}
221
223
}
0 commit comments