public XQExpression visit(AttributeConstructor constructor, XQueryContext ctxt)
throws XQueryException {
boolean isLoopInvariant = true;
QualifiedName name = constructor.getName();
if(name == null) {
XQExpression nameExpr = constructor.getNameExpr();
XQExpression nameExpr2 = nameExpr.visit(this, ctxt);
if(nameExpr2 != nameExpr) {
constructor.setNameExpr(nameExpr2);
}
isLoopInvariant &= nameExpr.isLoopInvariant();
}
for(XQExpression ve : constructor.getValueExprs()) {
ve.visit(this, ctxt);
isLoopInvariant &= ve.isLoopInvariant();
}
if(isLoopInvariant) {
if(name == null) {
XQExpression nameExpr = constructor.getNameExpr();
removeInvariants(nameExpr);
}
for(XQExpression ve : constructor.getValueExprs()) {
removeInvariants(ve);
}