System.Xml.Xsl.IlGen.XmlILOptimizerVisitor.VisitReference C# (CSharp) Method

VisitReference() protected method

Override the VisitReference method in order to possibly substitute.
protected VisitReference ( QilNode oldNode ) : QilNode
oldNode QilNode
return QilNode
        protected override QilNode VisitReference(QilNode oldNode) {
            QilNode newNode = this.subs.FindReplacement(oldNode);

            if (newNode == null)
                newNode = oldNode;

            // Fold reference to constant value
            // This is done here because "p" currently cannot match references
            if (this[XmlILOptimization.FoldConstant] && newNode != null) {
                if (newNode.NodeType == QilNodeType.Let || newNode.NodeType == QilNodeType.For) {
                    QilNode binding = ((QilIterator) oldNode).Binding;

                    if (IsLiteral(binding))
                        return Replace(XmlILOptimization.FoldConstant, newNode, binding.ShallowClone(f));
                }
            }

            return base.VisitReference(newNode);
        }
XmlILOptimizerVisitor