/** * Static method to typecheck a set of with-param elements * * @param params the set of parameters to be checked * @param visitor the expression visitor * @param contextItemType static information about the context item type and existence * @throws XPathException if a static error is found */ public static void typeCheck(WithParam[] params, ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { if (params != null) { for (WithParam param : params) { param.selectOp.typeCheck(visitor, contextItemType); } } }
/** * Type-check the expression. */ @Override public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. Default implementation for unary operators that accept * any kind of operand */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. Default implementation for unary operators that accept * any kind of operand */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. Default implementation for unary operators that accept * any kind of operand */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. Default implementation for unary operators that accept * any kind of operand */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. Default implementation for unary operators that accept * any kind of operand */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. */ @Override public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
/** * Type-check the expression. Default implementation for unary operators that accept * any kind of operand */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); return this; }
public Expression typeCheck(ExpressionVisitor visitor, /*@Nullable*/ ContextItemStaticInfo contextInfo) throws XPathException { for (int i=0; i<getSize(); i++) { operanda.getOperand(i).typeCheck(visitor, contextInfo); } return this; }
public Expression typeCheck(ExpressionVisitor visitor, /*@Nullable*/ ContextItemStaticInfo contextInfo) throws XPathException { for (int i=0; i<getSize(); i++) { operanda.getOperand(i).typeCheck(visitor, contextInfo); } return this; }
/** * Type-check the expression */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); Expression base = getBaseExpression(); if (requiredCardinality == StaticProperty.ALLOWS_ZERO_OR_MORE || Cardinality.subsumes(requiredCardinality, base.getCardinality())) { return base; } return this; }
/** * Type-check the expression */ /*@NotNull*/ public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getOperand().typeCheck(visitor, contextInfo); Expression base = getBaseExpression(); if (requiredCardinality == StaticProperty.ALLOWS_ZERO_OR_MORE || Cardinality.subsumes(requiredCardinality, base.getCardinality())) { return base; } return this; }
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { WithParam.optimize(visitor, actualParams, contextInfo); WithParam.optimize(visitor, tunnelParams, contextInfo); selectOp.typeCheck(visitor, contextInfo); // More info available second time around selectOp.optimize(visitor, contextInfo); if (Literal.isEmptySequence(getSelect())) { return getSelect(); } return this; }
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { WithParam.optimize(visitor, actualParams, contextInfo); WithParam.optimize(visitor, tunnelParams, contextInfo); selectOp.typeCheck(visitor, contextInfo); // More info available second time around selectOp.optimize(visitor, contextInfo); if (Literal.isEmptySequence(getSelect())) { return getSelect(); } return this; }
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { selectOp.typeCheck(visitor, contextInfo); ItemType selectType = getSelect().getItemType(); if (selectType == ErrorType.getInstance()) { return Literal.makeEmptySequence(); } ContextItemStaticInfo cit = visitor.getConfiguration().makeContextItemStaticInfo(getSelect().getItemType(), false); cit.setContextSettingExpression(getSelect()); actionOp.typeCheck(visitor, cit); if (!Cardinality.allowsMany(getSelect().getCardinality())) { actionOp.setOperandRole(actionOp.getOperandRole().modifyProperty(OperandRole.SINGLETON, true)); } return this; }
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { selectOp.typeCheck(visitor, contextInfo); ItemType selectType = getSelect().getItemType(); if (selectType == ErrorType.getInstance()) { return Literal.makeEmptySequence(); } ContextItemStaticInfo cit = visitor.getConfiguration().makeContextItemStaticInfo(getSelect().getItemType(), false); cit.setContextSettingExpression(getSelect()); actionOp.typeCheck(visitor, cit); if (!Cardinality.allowsMany(getSelect().getCardinality())) { actionOp.setOperandRole(actionOp.getOperandRole().modifyProperty(OperandRole.SINGLETON, true)); } return this; }
public void localTypeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException { StaticContext env = visitor.getStaticContext(); nameOp.typeCheck(visitor, contextItemType); RoleDiagnostic role = new RoleDiagnostic(RoleDiagnostic.INSTRUCTION, "namespace/name", 0); // See bug 2110. XQuery does not use the function conversion rules here, and disallows xs:anyURI. // In XSLT the name is an AVT so we automatically get a string; in XQuery we'll use the standard // mechanism to get an atomic value, and then check the type "by hand" at run time. setNameExp(env.getConfiguration().getTypeChecker(false).staticTypeCheck( getNameExp(), SequenceType.OPTIONAL_ATOMIC, role, visitor)); adoptChildExpression(getNameExp()); // Do early checking of name if known statically if (getNameExp() instanceof Literal) { evaluatePrefix(env.makeEarlyEvaluationContext()); } }