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

◆ PrecompileProtoTemplatesHeaders()

void System.Xml.Xsl.Xslt.QilGenerator.PrecompileProtoTemplatesHeaders ( )
inlineprivate

Definition at line 454 of file QilGenerator.cs.

455 {
456 List<VarPar> list = null;
459 foreach (ProtoTemplate allTemplate in _compiler.AllTemplates)
460 {
462 XslFlags xslFlags = ((!IsDebug) ? allTemplate.Flags : XslFlags.FocusFilter);
464 if ((xslFlags & XslFlags.Current) != 0)
465 {
466 qilList.Add(CreateXslParam(CloneName(_nameCurrent), XmlQueryTypeFactory.NodeNotRtf));
467 }
468 if ((xslFlags & XslFlags.Position) != 0)
469 {
470 qilList.Add(CreateXslParam(CloneName(_namePosition), XmlQueryTypeFactory.DoubleX));
471 }
472 if ((xslFlags & XslFlags.Last) != 0)
473 {
474 qilList.Add(CreateXslParam(CloneName(_nameLast), XmlQueryTypeFactory.DoubleX));
475 }
476 if (IsDebug && qilList2 != null)
477 {
478 QilParameter qilParameter = CreateXslParam(CloneName(_nameNamespaces), XmlQueryTypeFactory.NamespaceS);
481 }
482 if (allTemplate is Template template)
483 {
485 for (int i = 0; i < allTemplate.Content.Count; i++)
486 {
487 XslNode xslNode = allTemplate.Content[i];
488 if (xslNode.NodeType == XslNodeType.Text)
489 {
490 continue;
491 }
492 if (xslNode.NodeType != XslNodeType.Param)
493 {
494 break;
495 }
496 VarPar varPar = (VarPar)xslNode;
498 if (_scope.IsLocalVariable(varPar.Name.LocalName, varPar.Name.NamespaceUri))
499 {
500 ReportError(System.SR.Xslt_DupLocalVariable, varPar.Name.QualifiedName);
501 }
503 if (IsDebug)
504 {
506 }
507 else if ((varPar.DefValueFlags & XslFlags.HasCalls) == 0)
508 {
510 }
511 else
512 {
515 for (int j = 0; j < qilList.Count; j++)
516 {
520 SetLineInfo(qilParameter3, qilList[j].SourceLine);
523 }
524 varPar.Flags |= template.Flags & XslFlags.FocusFilter;
525 QilFunction qilFunction = _f.Function(qilList3, _f.Boolean((varPar.DefValueFlags & XslFlags.SideEffects) != 0), ChooseBestType(varPar));
526 qilFunction.SourceLine = SourceLineInfo.NoSource;
527 qilFunction.DebugName = "<xsl:param name=\"" + varPar.Name.QualifiedName + "\">";
529 if (list == null)
530 {
531 list = new List<VarPar>();
534 }
535 list.Add(varPar);
536 dictionary.Add(varPar, template);
538 }
539 SetLineInfo(qilParameter2, varPar.SourceLine);
540 ExitScope();
543 }
545 }
546 ExitScope();
547 allTemplate.Function = _f.Function(qilList, _f.Boolean((allTemplate.Flags & XslFlags.SideEffects) != 0), (allTemplate is AttributeSet) ? XmlQueryTypeFactory.AttributeS : XmlQueryTypeFactory.NodeNotRtfS);
549 SetLineInfo(allTemplate.Function, allTemplate.SourceLine ?? SourceLineInfo.NoSource);
550 _functions.Add(allTemplate.Function);
551 }
552 if (list == null)
553 {
554 return;
555 }
556 foreach (VarPar item in list)
557 {
560 _funcFocus.StartFocus(qilFunction2.Arguments, item.Flags);
563 foreach (QilParameter argument in qilFunction2.Arguments)
564 {
566 }
568 SetLineInfo(qilFunction2.Definition, item.SourceLine);
569 ExitScope();
570 ExitScope();
573 }
574 }
void Add(TKey key, TValue value)
static string Xslt_DupLocalVariable
Definition SR.cs:1906
Definition SR.cs:7
virtual void Add(QilNode node)
Definition QilNode.cs:121
QilNode Invoke(QilFunction func, QilList args)
QilParameter Parameter(XmlQueryType t)
QilFunction Function(QilList args, QilNode sideEffects, XmlQueryType resultType)
void AddVariable(QilName varName, V value)
bool IsLocalVariable(string localName, string uri)
List< ProtoTemplate > AllTemplates
Definition Compiler.cs:93
QilIterator GetNsVar(QilList nsList)
readonly CompilerScopeManager< QilIterator > _scope
void ReportError(string res, params string[] args)
readonly XsltQilFactory _f
XmlQueryType ChooseBestType(VarPar var)
static QilNode SetLineInfo(QilNode n, ISourceLineInfo lineInfo)
QilName CloneName(QilName name)
QilNode CompileVarParValue(XslNode node)
QilList EnterScope(XslNode node)
QilParameter CreateXslParam(QilName name, XmlQueryType xt)
void StartFocus(IList< QilNode > args, XslFlags flags)

References System.Xml.Xsl.Xslt.QilGenerator._compiler, System.Xml.Xsl.Xslt.QilGenerator._f, System.Xml.Xsl.Xslt.QilGenerator._funcFocus, System.Xml.Xsl.Xslt.QilGenerator._functions, System.Xml.Xsl.Xslt.QilGenerator._nameCurrent, System.Xml.Xsl.Xslt.QilGenerator._nameLast, System.Xml.Xsl.Xslt.QilGenerator._nameNamespaces, System.Xml.Xsl.Xslt.QilGenerator._namePosition, System.Xml.Xsl.Xslt.QilGenerator._scope, System.Xml.Xsl.Qil.QilPatternFactory.ActualParameterList(), System.Xml.Xsl.Qil.QilNode.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Xml.Xsl.Xslt.CompilerScopeManager< V >.AddVariable(), System.Xml.Xsl.Xslt.Compiler.AllTemplates, System.Xml.Xsl.XmlQueryTypeFactory.AttributeS, System.Xml.Xsl.Qil.QilPatternFactory.Boolean(), System.Xml.Xsl.Xslt.QilGenerator.ChooseBestType(), System.Xml.Xsl.Xslt.QilGenerator.CloneName(), System.Xml.Xsl.Xslt.QilGenerator.CompileVarParValue(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Xsl.Xslt.QilGenerator.CreateXslParam(), System.Xml.Xsl.Qil.QilReference.DebugName, System.dictionary, System.Xml.Dictionary, System.Xml.Xsl.XmlQueryTypeFactory.DoubleX, System.Xml.Xsl.Xslt.QilGenerator.EnterScope(), System.Xml.Xsl.Xslt.QilGenerator.ExitScope(), System.Xml.Xsl.Qil.QilPatternFactory.FormalParameterList(), System.Xml.Xsl.Qil.QilPatternFactory.Function(), System.Xml.Xsl.Xslt.QilGenerator.GetNsVar(), System.Xml.Xsl.Qil.QilPatternFactory.Invoke(), System.Xml.Xsl.Xslt.QilGenerator.IsDebug, System.Xml.Xsl.Xslt.CompilerScopeManager< V >.IsLocalVariable(), System.item, System.list, System.Xml.Name, System.Xml.Xsl.XmlQueryTypeFactory.NamespaceS, System.Xml.Xsl.XmlQueryTypeFactory.NodeNotRtf, System.Xml.Xsl.XmlQueryTypeFactory.NodeNotRtfS, System.Xml.Xsl.SourceLineInfo.NoSource, System.Xml.Xsl.Qil.QilPatternFactory.Parameter(), System.Xml.Xsl.Xslt.QilGenerator.ReportError(), System.Xml.Xsl.Xslt.QilGenerator.SetLineInfo(), System.Xml.Xsl.Xslt.FunctionFocus.StartFocus(), System.Xml.Xsl.Xslt.FunctionFocus.StopFocus(), and System.SR.Xslt_DupLocalVariable.

Referenced by System.Xml.Xsl.Xslt.QilGenerator.Compile().