@@ -112,18 +112,6 @@ public FunHigherOrderFun(XQueryContext context, FunctionSignature signature) {
112
112
super (context , signature );
113
113
}
114
114
115
- @ Override
116
- protected void checkArgument (final Expression arg , @ Nullable final SequenceType argType ,
117
- final AnalyzeContextInfo argContextInfo , final int argPosition ) throws XPathException {
118
- // hack: order of parameters for filter and other functions has changed
119
- // in final XQ3 spec. This would cause some core apps (dashboard) to stop
120
- // working. We thus switch parameters dynamically until all users can be expected to
121
- // have updated to 2.2.
122
- if (!isCalledAs ("filter" )) {
123
- super .checkArgument (arg , argType , argContextInfo , argPosition );
124
- }
125
- }
126
-
127
115
@ Override
128
116
public void analyze (AnalyzeContextInfo contextInfo ) throws XPathException {
129
117
cachedContextInfo = new AnalyzeContextInfo (contextInfo );
@@ -149,24 +137,14 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence)
149
137
}
150
138
}
151
139
} else if (isCalledAs ("filter" )) {
152
- final FunctionReference refParam ;
153
- final Sequence seq ;
154
- // Hack: switch parameters for backwards compatibility
155
- if (Type .subTypeOf (args [1 ].getItemType (), Type .FUNCTION_REFERENCE )) {
156
- refParam = (FunctionReference ) args [1 ].itemAt (0 );
157
- seq = args [0 ];
158
- } else {
159
- refParam = (FunctionReference ) args [0 ].itemAt (0 );
160
- seq = args [1 ];
161
- }
162
-
163
- try (final FunctionReference ref = refParam ) {
140
+ try (final FunctionReference ref = (FunctionReference ) args [1 ].itemAt (0 )) {
164
141
ref .analyze (cachedContextInfo );
165
142
if (funcRefHasDifferentArity (ref , 1 )) {
166
143
throw new XPathException (this , ErrorCodes .XPTY0004 ,
167
144
"The supplied function (" + ref .getStringValue () + ") has " + ref .getSignature ().getArgumentCount () + " arguments - expected 1" );
168
145
}
169
146
147
+ final Sequence seq = args [0 ];
170
148
for (final SequenceIterator i = seq .iterate (); i .hasNext (); ) {
171
149
final Item item = i .nextItem ();
172
150
final Sequence r = ref .evalFunction (null , null , new Sequence []{item .toSequence ()});
0 commit comments