/** * Type-check the expression. This also has the side-effect of counting the number of references * to the variable (treating references that occur within a loop specially) */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { // The order of events is critical here. First we ensure that the type of the // sequence expression is established. This is used to establish the type of the variable, // which in turn is required when type-checking the action part. getSequenceOp().typeCheck(visitor, contextInfo); RoleDiagnostic role = new RoleDiagnostic(RoleDiagnostic.VARIABLE, getVariableQName().getDisplayName(), 0); //role.setSourceLocator(this); setSequence(TypeChecker.strictTypeCheck( getSequence(), requiredType, role, visitor.getStaticContext())); final ItemType actualItemType = getSequence().getItemType(); refineTypeInformation(actualItemType, getSequence().getCardinality(), getSequence() instanceof Literal ? ((Literal) getSequence()).getValue() : null, getSequence().getSpecialProperties(), this); getActionOp().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. This also has the side-effect of counting the number of references * to the variable (treating references that occur within a loop specially) */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { // The order of events is critical here. First we ensure that the type of the // sequence expression is established. This is used to establish the type of the variable, // which in turn is required when type-checking the action part. getSequenceOp().typeCheck(visitor, contextInfo); RoleDiagnostic role = new RoleDiagnostic(RoleDiagnostic.VARIABLE, getVariableQName().getDisplayName(), 0); //role.setSourceLocator(this); setSequence(TypeChecker.strictTypeCheck( getSequence(), requiredType, role, visitor.getStaticContext())); final ItemType actualItemType = getSequence().getItemType(); refineTypeInformation(actualItemType, getSequence().getCardinality(), getSequence() instanceof Literal ? ((Literal) getSequence()).getValue() : null, getSequence().getSpecialProperties(), this); getActionOp().typeCheck(visitor, contextInfo); return this; }
getActionOp().optimize(visitor, contextItemType); opt.trace("Eliminated unused variable " + getVariableName(), getAction()); return getAction(); while (tries++ < 5) { Expression act0 = getAction(); getActionOp().optimize(visitor, contextItemType); if (act0 == getAction()) { break;
getActionOp().optimize(visitor, contextItemType); opt.trace("Eliminated unused variable " + getVariableName(), getAction()); return getAction(); while (tries++ < 5) { Expression act0 = getAction(); getActionOp().optimize(visitor, contextItemType); if (act0 == getAction()) { break;