Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Refactor()

void System.Xml.Xsl.Xslt.XslAstRewriter.Refactor ( XslNode parent,
int split )
inlineprivate

Definition at line 101 of file XslAstRewriter.cs.

102 {
103 List<XslNode> list = (List<XslNode>)parent.Content;
104 XslNode xslNode = list[split];
105 QilName name = AstFactory.QName("generated", _compiler.CreatePhantomNamespace(), "compiler");
106 XsltInput.ContextInfo contextInfo = new XsltInput.ContextInfo(xslNode.SourceLine);
107 XslNodeEx xslNodeEx = AstFactory.CallTemplate(name, contextInfo);
108 XsltLoader.SetInfo(xslNodeEx, null, contextInfo);
109 Template template = AstFactory.Template(name, null, XsltLoader.nullMode, double.NaN, xslNode.XslVersion);
110 XsltLoader.SetInfo(template, null, contextInfo);
111 _newTemplates.Push(template);
112 template.SetContent(new List<XslNode>(list.Count - split + 8));
113 foreach (CompilerScopeManager<VarPar>.ScopeRecord activeRecord in _scope.GetActiveRecords())
114 {
115 if (!activeRecord.IsVariable)
116 {
117 template.Namespaces = new NsDecl(template.Namespaces, activeRecord.ncName, activeRecord.nsUri);
118 continue;
119 }
120 VarPar value = activeRecord.value;
121 if (!_compiler.IsPhantomNamespace(value.Name.NamespaceUri))
122 {
123 QilName qilName = AstFactory.QName(value.Name.LocalName, value.Name.NamespaceUri, value.Name.Prefix);
124 VarPar varPar = AstFactory.VarPar(XslNodeType.WithParam, qilName, "$" + qilName.QualifiedName, XslVersion.Version10);
125 XsltLoader.SetInfo(varPar, null, contextInfo);
126 varPar.Namespaces = value.Namespaces;
127 xslNodeEx.AddContent(varPar);
128 VarPar varPar2 = AstFactory.VarPar(XslNodeType.Param, qilName, null, XslVersion.Version10);
129 XsltLoader.SetInfo(varPar2, null, contextInfo);
130 varPar2.Namespaces = value.Namespaces;
131 template.AddContent(varPar2);
132 }
133 }
134 for (int i = split; i < list.Count; i++)
135 {
136 template.AddContent(list[i]);
137 }
139 list.RemoveRange(split + 1, list.Count - split - 1);
140 }
bool IsPhantomNamespace(string namespaceName)
Definition Compiler.cs:291
CompilerScopeManager< VarPar > _scope

References System.Xml.Xsl.Xslt.XslAstRewriter._compiler, System.Xml.Xsl.Xslt.XslAstRewriter._newTemplates, System.Xml.Xsl.Xslt.XslAstRewriter._scope, System.Xml.Xsl.Xslt.AstFactory.CallTemplate(), System.Xml.Xsl.Xslt.XslNode.Content, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Xsl.Xslt.Compiler.CreatePhantomNamespace(), System.Xml.Dictionary, System.Xml.Xsl.Xslt.Compiler.IsPhantomNamespace(), System.list, System.Xml.Xsl.Xslt.XsltLoader.nullMode, System.Xml.Xsl.Xslt.AstFactory.QName(), System.Xml.Xsl.Xslt.XsltLoader.SetInfo(), System.Xml.Xsl.Xslt.AstFactory.Template(), System.value, and System.Xml.Xsl.Xslt.AstFactory.VarPar().

Referenced by System.Xml.Xsl.Xslt.XslAstRewriter.CheckNodeCost().