Project

Profile

Help

Revision 7e679354

Added by Michael Kay over 12 years ago

2791790 - NPE compiling reference to global variable

View differences:

latest9.1/bj/net/sf/saxon/expr/LetExpression.java
460 460
            // if this results in the expression (let $x := $y return Z), replace all references to
461 461
            // to $x by references to $y in the Z part, and eliminate this LetExpression by
462 462
            // returning the action part.
463
            if (sequence instanceof VariableReference && !((VariableReference)sequence).getBinding().isAssignable()) {
464
                replaceVariable(offer.getOptimizer(), sequence);
465
                return action;
466
            }                       
463
            if (sequence instanceof VariableReference) {
464
                Binding b = ((VariableReference)sequence).getBinding();
465
                if (b != null && !b.isAssignable()) {
466
                    replaceVariable(offer.getOptimizer(), sequence);
467
                    return action;
468
                }
469
            }
467 470
            // similarly, for (let $x := lazy($y) return Z)
468 471
            if (sequence instanceof LazyExpression &&
469 472
                    ((LazyExpression) sequence).getBaseExpression() instanceof VariableReference &&

Also available in: Unified diff