public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getLhs().typeCheck(visitor, contextInfo); getRhs().typeCheck(visitor, contextInfo); TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); XPathException err0 = TypeChecker.ebvError(getLhsExpression(), th); if (err0 != null) { err0.setLocator(getLocation()); throw err0; } XPathException err1 = TypeChecker.ebvError(getRhsExpression(), th); if (err1 != null) { err1.setLocator(getLocation()); throw err1; } // Precompute the EBV of any constant operand if (getLhsExpression() instanceof Literal && !(((Literal) getLhsExpression()).getValue() instanceof BooleanValue)) { setLhsExpression(Literal.makeLiteral( BooleanValue.get(getLhsExpression().effectiveBooleanValue(visitor.makeDynamicContext())), this)); } if (getRhsExpression() instanceof Literal && !(((Literal) getRhsExpression()).getValue() instanceof BooleanValue)) { setRhsExpression(Literal.makeLiteral( BooleanValue.get(getRhsExpression().effectiveBooleanValue(visitor.makeDynamicContext())), this)); } return preEvaluate(); }
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException { getLhs().typeCheck(visitor, contextInfo); getRhs().typeCheck(visitor, contextInfo); TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy(); XPathException err0 = TypeChecker.ebvError(getLhsExpression(), th); if (err0 != null) { err0.setLocator(getLocation()); throw err0; } XPathException err1 = TypeChecker.ebvError(getRhsExpression(), th); if (err1 != null) { err1.setLocator(getLocation()); throw err1; } // Precompute the EBV of any constant operand if (getLhsExpression() instanceof Literal && !(((Literal) getLhsExpression()).getValue() instanceof BooleanValue)) { setLhsExpression(Literal.makeLiteral( BooleanValue.get(getLhsExpression().effectiveBooleanValue(visitor.makeDynamicContext())), this)); } if (getRhsExpression() instanceof Literal && !(((Literal) getRhsExpression()).getValue() instanceof BooleanValue)) { setRhsExpression(Literal.makeLiteral( BooleanValue.get(getRhsExpression().effectiveBooleanValue(visitor.makeDynamicContext())), this)); } return preEvaluate(); }