Project

Profile

Help

Revision ac0407a1

Added by Michael Kay over 9 years ago

Fix bug 3448231 boolean() optimized incorrectly

View differences:

latest9.3/hej/net/sf/saxon/functions/BooleanFn.java
85 85
//            }
86 86
            if (operation == BOOLEAN) {
87 87
                Expression ebv = rewriteEffectiveBooleanValue(argument[0], visitor, contextItemType);
88
                return (ebv == null ? this : ebv.optimize(visitor, contextItemType));
88
                if (ebv != null) {
89
                    ebv = ebv.optimize(visitor, contextItemType);
90
                    if (ebv.getItemType(visitor.getConfiguration().getTypeHierarchy()) == BuiltInAtomicType.BOOLEAN &&
91
                            ebv.getCardinality() == StaticProperty.EXACTLY_ONE) {
92
                        return ebv;
93
                    } else {
94
                        argument[0] = ebv;
95
                        adoptChildExpression(ebv);
96
                        return this;
97
                    }
98
                }
89 99
            } else if (operation == NOT) {
90 100
                Expression ebv = rewriteEffectiveBooleanValue(argument[0], visitor, contextItemType);
91 101
                if (ebv != null) {

Also available in: Unified diff