/** * Replace all references to the variable bound by this let expression, * that occur within the action expression, with the given expression * * @param opt The optimizer * @param seq the expression * @throws XPathException */ private void replaceVariable(Optimizer opt, Expression seq) throws XPathException { PromotionOffer offer2 = new PromotionOffer(opt); offer2.action = PromotionOffer.INLINE_VARIABLE_REFERENCES; offer2.bindingList = new Binding[] {this}; offer2.containingExpression = seq; action = doPromotion(action, offer2); if (offer2.accepted) { // there might be further references to the variable offer2.accepted = false; replaceVariable(opt, seq); } if (isIndexedVariable()) { Binding newBinding = ((VariableReference) seq).getBinding(); if (newBinding instanceof LetExpression) { ((LetExpression) newBinding).setIndexedVariable(); } } }
/** * Replace all references to the variable bound by this let expression, * that occur within the action expression, with the given expression * * @param opt The optimizer * @param seq the expression * @throws XPathException */ private void replaceVariable(Optimizer opt, Expression seq) throws XPathException { PromotionOffer offer2 = new PromotionOffer(opt); offer2.action = PromotionOffer.INLINE_VARIABLE_REFERENCES; offer2.bindingList = new Binding[] {this}; offer2.containingExpression = seq; action = doPromotion(action, offer2); if (offer2.accepted) { // there might be further references to the variable offer2.accepted = false; replaceVariable(opt, seq); } if (isIndexedVariable()) { Binding newBinding = ((VariableReference) seq).getBinding(); if (newBinding instanceof LetExpression) { ((LetExpression) newBinding).setIndexedVariable(); } } }
offer2.bindingList = new Binding[] {this}; offer2.containingExpression = seq; action = doPromotion(action, offer2); if (offer2.accepted) {
} else { Expression seq2 = doPromotion(sequence, offer); if (seq2 != sequence) { offer.action == PromotionOffer.REPLACE_CURRENT || offer.action == PromotionOffer.EXTRACT_GLOBAL_VARIABLES) { action = doPromotion(action, offer); } else if (offer.action == PromotionOffer.RANGE_INDEPENDENT || offer.action == PromotionOffer.FOCUS_INDEPENDENT) { action = doPromotion(action, offer); offer.bindingList = savedBindingList;
} else { Expression seq2 = doPromotion(sequence, offer); if (seq2 != sequence) { offer.action == PromotionOffer.REPLACE_CURRENT || offer.action == PromotionOffer.EXTRACT_GLOBAL_VARIABLES) { action = doPromotion(action, offer); } else if (offer.action == PromotionOffer.RANGE_INDEPENDENT || offer.action == PromotionOffer.FOCUS_INDEPENDENT) { action = doPromotion(action, offer); offer.bindingList = savedBindingList;
} else { Expression seq2 = doPromotion(sequence, offer); if (seq2 != sequence) { offer.action == PromotionOffer.REPLACE_CURRENT || offer.action == PromotionOffer.EXTRACT_GLOBAL_VARIABLES) { action = doPromotion(action, offer); } else if (offer.action == PromotionOffer.RANGE_INDEPENDENT || offer.action == PromotionOffer.FOCUS_INDEPENDENT) { action = doPromotion(action, offer); offer.bindingList = savedBindingList;