Project

Profile

Help

Revision 638cf787

Added by Michael Kay about 12 years ago

Fix bug 2859247 Internal Error when variable used with Unary Minus operator

View differences:

latest9.1/bj/net/sf/saxon/expr/NegateExpression.java
39 39
    }
40 40

  
41 41
    public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
42
        // always called from ArithmeticExpression.typeCheck, so the operand has already been checked.
43
        // Now need to ensure that it's numeric
44 42
        Expression oldop = operand;
45 43
        RoleLocator role = new RoleLocator(RoleLocator.UNARY_EXPR, "-", 0);
46
        //role.setSourceLocator(this);
47 44
        operand = TypeChecker.staticTypeCheck(operand, SequenceType.OPTIONAL_NUMERIC, backwardsCompatible,
48 45
                role, visitor);
46
        operand = visitor.typeCheck(operand, contextItemType);
49 47
        if (operand != oldop) {
50 48
            adoptChildExpression(operand);
51 49
        }

Also available in: Unified diff