int loc = exec.getLocationMap().allocateLocationId(systemId, lineNumber);
var.setLocationId(loc);
var.setContainer(var);
final SequenceType type = getRequiredType();
Iterator iter = references.iterator();
while (iter.hasNext()) {
BindingReference ref = (BindingReference)iter.next();
ref.fixup(var);
Value constantValue = null;
int properties = 0;
Expression select = value;
if (select instanceof Literal && !isParameter) {
// we can't rely on the constant value because it hasn't yet been type-checked,
// which could change it (eg by numeric promotion). Rather than attempt all the type-checking
// now, we do a quick check. See test bug64
int relation = th.relationship(select.getItemType(th), type.getPrimaryType());
if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMED_BY) {
constantValue = ((Literal)select).getValue();
}
}
if (select != null) {