System.Xml.Xsl.IlGen.XmlILVisitor.VisitAttributeCtor C# (CSharp) Method

VisitAttributeCtor() protected method

Generate code for QilNodeType.AttributeCtor.
protected VisitAttributeCtor ( QilBinary ndAttr ) : QilNode
ndAttr System.Xml.Xsl.Qil.QilBinary
return QilNode
        protected override QilNode VisitAttributeCtor(QilBinary ndAttr) {
            XmlILConstructInfo info = XmlILConstructInfo.Read(ndAttr);
            bool callChk;
            GenerateNameType nameType;
            Debug.Assert(XmlILConstructInfo.Read(ndAttr).PushToWriterFirst, "Attribute construction should always be pushed to writer.");

            // Runtime checks must be made in the following cases:
            //   1. Xml state is not known at compile-time, or is illegal
            //   2. Attribute's namespace must be declared
            callChk = CheckEnumAttrs(info) || !info.IsNamespaceInScope;

            // If WriteStartAttributeChk will *not* be called, then code must be generated to ensure well-formedness
            // and track namespace scope.
            if (!callChk)
                BeforeStartChecks(ndAttr);

            // Generate call to WriteStartAttribute
            nameType = LoadNameAndType(XPathNodeType.Attribute, ndAttr.Left, true, callChk);
            this.helper.CallWriteStartAttribute(nameType, callChk);

            // Recursively construct content
            NestedVisit(ndAttr.Right);

            // Generate call to WriteEndAttribute
            this.helper.CallWriteEndAttribute(callChk);

            if (!callChk)
                AfterEndChecks(ndAttr);

            this.iterCurr.Storage = StorageDescriptor.None();
            return ndAttr;
        }
XmlILVisitor