if(!clauses.isEmpty()) {
Binding firstClause = clauses.get(0);
BindingVariable bindingVar = firstClause.getVariable();
XQExpression bindingExpr = bindingVar.getValue();
if(bindingExpr instanceof DirectFunctionCall) {
DirectFunctionCall funcall = (DirectFunctionCall) bindingExpr;
if(FnCollection.FUNC_NAME.equals(funcall.getFuncName())) {
List<XQExpression> params = funcall.getParams();
final String colpath;
if(params.isEmpty()) {
colpath = "/";
} else {
XQExpression argExpr = params.get(0);
colpath = argExpr.eval(null, DynamicContext.DUMMY).toString();
}
MapExpr mapExpr = new MapExpr(colpath, bindingVar, flwrExpr);
return mapExpr.staticAnalysis(statEnv);
}
}
}
} else if(expr instanceof PathExpr) {
PathExpr pathExpr = (PathExpr) expr;
List<XQExpression> steps = pathExpr.getSteps();
if(steps.size() > 1) {
XQExpression firstStep = steps.get(0);
if(firstStep instanceof DirectFunctionCall) {
DirectFunctionCall funcall = (DirectFunctionCall) firstStep;
if(FnCollection.FUNC_NAME.equals(funcall.getFuncName())) {
List<XQExpression> params = funcall.getParams();
final String colpath;
if(params.isEmpty()) {
colpath = "/";
} else {
XQExpression argExpr = params.get(0);