/** * Type-check the expression */ public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) 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. sequence = visitor.typeCheck(sequence, contextItemType); RoleLocator role = new RoleLocator(RoleLocator.VARIABLE, getVariableQName(), 0); //role.setSourceLocator(this); sequence = TypeChecker.strictTypeCheck( sequence, requiredType, role, visitor.getStaticContext()); final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); final ItemType actualItemType = sequence.getItemType(th); refineTypeInformation(actualItemType, sequence.getCardinality(), (sequence instanceof Literal ? ((Literal) sequence).getValue() : null), sequence.getSpecialProperties(), visitor, this); action = visitor.typeCheck(action, contextItemType); return this; }
/** * Type-check the expression */ public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { // TODO: avoid repeated work if done again // 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. sequence = visitor.typeCheck(sequence, contextItemType); RoleLocator role = new RoleLocator(RoleLocator.VARIABLE, getVariableQName(), 0, visitor.getConfiguration().getNamePool()); role.setSourceLocator(this); sequence = TypeChecker.strictTypeCheck( sequence, requiredType, role, visitor.getStaticContext()); final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); final ItemType actualItemType = sequence.getItemType(th); refineTypeInformation(actualItemType, sequence.getCardinality(), (sequence instanceof Literal ? ((Literal) sequence).getValue() : null), sequence.getSpecialProperties(), visitor, this); action = visitor.typeCheck(action, contextItemType); return this; }
/** * Type-check the expression */ public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { // TODO: avoid repeated work if done again // 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. sequence = visitor.typeCheck(sequence, contextItemType); RoleLocator role = new RoleLocator(RoleLocator.VARIABLE, getVariableQName(), 0, visitor.getConfiguration().getNamePool()); role.setSourceLocator(this); sequence = TypeChecker.strictTypeCheck( sequence, requiredType, role, visitor.getStaticContext()); final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); final ItemType actualItemType = sequence.getItemType(th); refineTypeInformation(actualItemType, sequence.getCardinality(), (sequence instanceof Literal ? ((Literal) sequence).getValue() : null), sequence.getSpecialProperties(), visitor, this); action = visitor.typeCheck(action, contextItemType); 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; }
/** * 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; }
requiredType = SequenceType.SINGLE_UNTYPED_ATOMIC; adoptChildExpression(getSequence()); refineTypeInformation(requiredType.getPrimaryType(), requiredType.getCardinality(), null, 0, this);
requiredType = SequenceType.SINGLE_UNTYPED_ATOMIC; adoptChildExpression(getSequence()); refineTypeInformation(requiredType.getPrimaryType(), requiredType.getCardinality(), null, 0, this);