System.Xml.Xsl.IlGen.XmlILStateAnalyzer.AnalyzeContent C# (CSharp) Method

AnalyzeContent() protected method

Recursively analyze content. Return "nd" or a replacement for it.
protected AnalyzeContent ( QilNode nd ) : QilNode
nd QilNode
return QilNode
        protected virtual QilNode AnalyzeContent(QilNode nd) {
            XmlILConstructInfo info;
            QilNode ndChild;

            // Handle special node-types that are replaced
            switch (nd.NodeType) {
                case QilNodeType.For:
                case QilNodeType.Let:
                case QilNodeType.Parameter:
                    // Iterator references are shared and cannot be annotated directly with ConstructInfo,
                    // so wrap them with Nop node.
                    nd = this.fac.Nop(nd);
                    break;
            }

            // Get node's ConstructInfo annotation
            info = XmlILConstructInfo.Write(nd);

            // Set node's guaranteed parent constructor
            info.ParentInfo = this.parentInfo;

            // Construct all content using the Writer
            info.PushToWriterLast = true;

            // Set states that are possible before expression is constructed
            info.InitialStates = this.xstates;

            switch (nd.NodeType) {
                case QilNodeType.Loop: AnalyzeLoop(nd as QilLoop, info); break;
                case QilNodeType.Sequence: AnalyzeSequence(nd as QilList, info); break;
                case QilNodeType.Conditional: AnalyzeConditional(nd as QilTernary, info); break;
                case QilNodeType.Choice: AnalyzeChoice(nd as QilChoice, info); break;

                case QilNodeType.Error:
                case QilNodeType.Warning:
                    // Ensure that construct method is Writer
                    info.ConstructMethod = XmlILConstructMethod.Writer;
                    break;

                case QilNodeType.Nop:
                    ndChild = (nd as QilUnary).Child;
                    switch (ndChild.NodeType) {
                        case QilNodeType.For:
                        case QilNodeType.Let:
                        case QilNodeType.Parameter:
                            // Copy iterator items as content
                            AnalyzeCopy(nd, info);
                            break;

                        default:
                            // Ensure that construct method is Writer and recursively analyze content
                            info.ConstructMethod = XmlILConstructMethod.Writer;
                            AnalyzeContent(ndChild);
                            break;
                    }
                    break;

                default:
                    AnalyzeCopy(nd, info);
                    break;
            }

            // Set states that are possible after expression is constructed
            info.FinalStates = this.xstates;

            return nd;
        }