public QilNode XPathNamespace(QilNode expr) { return(f.XPathNamespace(expr)); }
/// <summary> /// Called when all replacements have already been made and all annotations are complete. /// </summary> protected virtual QilNode NoReplace(QilNode node) { return(node); }
//----------------------------------------------- // QilScopedVisitor overrides //----------------------------------------------- /// <summary> /// Annotate this iterator or function with a generated name. /// </summary> protected override void BeginScope(QilNode node) { this.ngen.NameOf(node); }
protected override QilNode VisitUnknown(QilNode n) { return(NoReplace(n)); }
protected override QilNode VisitXmlContext(QilNode n) { return(NoReplace(n)); }
//----------------------------------------------- // Constructor //----------------------------------------------- /// <summary> /// Construct a new node /// </summary> public QilTernary(QilNodeType nodeType, QilNode left, QilNode center, QilNode right) : base(nodeType) { _left = left; _center = center; _right = right; }
public static void Validate(QilNode node) { Debug.Assert(node != null); new QilValidationVisitor().VisitAssumeReference(node); }
/// <summary> /// If a cloned reference is in scope, replace "oldNode". Otherwise, return "oldNode". /// </summary> protected override QilNode VisitReference(QilNode oldNode) { QilNode newNode = FindClonedReference(oldNode); return(base.VisitReference(newNode == null ? oldNode : newNode)); }
//----------------------------------------------- // QilScopedVisitor methods //----------------------------------------------- /// <summary> /// Push node and its shallow clone onto the substitution list. /// </summary> protected override void BeginScope(QilNode node) { _subs.AddSubstitutionPair(node, node.ShallowClone(_fac)); }
public QilNode XsltCopyOf(QilNode expr) { return(f.XsltCopyOf(expr)); }
public QilNode XsltConvert(QilNode expr, XmlQueryType t) { return(f.XsltConvert(expr, t)); }
public QilNode XsltCopy(QilNode expr, QilNode content) { return(f.XsltCopy(expr, content)); }
//----------------------------------------------- // XSLT //----------------------------------------------- public QilNode XsltGenerateId(QilNode expr) { return(f.XsltGenerateId(expr)); }
public QilNode XPathPreceding(QilNode expr) { return(f.XPathPreceding(expr)); }
//----------------------------------------------- // Constructor //----------------------------------------------- /// <summary> /// Construct a new node /// </summary> public QilDataSource(QilNodeType nodeType, QilNode name, QilNode baseUri) : base(nodeType, name, baseUri) { }
/// <summary> /// Pop entry from substitution list. /// </summary> protected override void EndScope(QilNode node) { _subs.RemoveLastSubstitutionPair(); }
//----------------------------------------------- // Constructor //----------------------------------------------- /// <summary> /// Construct a new node /// </summary> public QilTargetType(QilNodeType nodeType, QilNode expr, QilNode targetType) : base(nodeType, expr, targetType) { }
//----------------------------------------------- // QilCloneVisitor methods //----------------------------------------------- /// <summary> /// Find the clone of an in-scope reference. /// </summary> protected QilNode FindClonedReference(QilNode node) { return(_subs.FindReplacement(node)); }
/// <summary> /// Pop scope. /// </summary> protected override void EndScope(QilNode node) { this.scope.Remove(node); }
//----------------------------------------------- // Entry //----------------------------------------------- public QilNode Clone(QilNode node) { QilDepthChecker.Check(node); // Assume that iterator nodes at the top-level are references rather than definitions return(VisitAssumeReference(node)); }
//----------------------------------------------- // QilVisitor overrides //----------------------------------------------- protected override QilNode VisitChildren(QilNode parent) { if (this.parents.Contains(parent)) { // We have already visited the node that starts the infinite loop, but don't visit its children SetError(parent, "Infinite loop"); } else if (AddNode(parent)) { if (parent.XmlType == null) { SetError(parent, "Type information missing"); } else { XmlQueryType type = this.typeCheck.Check(parent); // BUGBUG: Hack to account for Xslt compiler type fixups if (!type.IsSubtypeOf(parent.XmlType)) { SetError(parent, "Type information was not correctly inferred"); } } this.parents.Add(parent, parent); for (int i = 0; i < parent.Count; i++) { if (parent[i] == null) { // Allow parameter name and default value to be null if (parent.NodeType == QilNodeType.Parameter) { continue; } // Do not allow null anywhere else in the graph else { SetError(parent, "Child " + i + " must not be null"); } } if (parent.NodeType == QilNodeType.GlobalVariableList || parent.NodeType == QilNodeType.GlobalParameterList || parent.NodeType == QilNodeType.FunctionList) { if (((QilReference)parent[i]).DebugName == null) { SetError(parent[i], "DebugName must not be null"); } } // If child is a reference, then call VisitReference instead of Visit in order to avoid circular visits. if (IsReference(parent, i)) { VisitReference(parent[i]); } else { Visit(parent[i]); } } this.parents.Remove(parent); } return(parent); }
public QilSortKey(QilNodeType nodeType, QilNode key, QilNode collation) : base(nodeType, key, collation) { }
protected override QilNode VisitFalse(QilNode n) { return(NoReplace(n)); }
public void AddSubstitutionPair(QilNode find, QilNode replace) { _s.Add(find); _s.Add(replace); }
/// <summary> /// Called when a pattern has matched and after replacement code is executed. /// </summary> protected virtual QilNode Replace(int pattern, QilNode original, QilNode replacement) { replacement.SourceLine = original.SourceLine; return(replacement); }
public QilStrConcat(QilNodeType nodeType, QilNode delimiter, QilNode values) : base(nodeType, delimiter, values) { }
/// <summary> /// Called in order to write out the xml type of a node. /// </summary> protected virtual void WriteXmlType(QilNode node) { this.writer.WriteAttributeString("xmlType", node.XmlType.ToString((this.options & Options.RoundTripTypeInfo) != 0 ? "S" : "G")); }
//----------------------------------------------- // Constructor //----------------------------------------------- /// <summary> /// Construct an iterator /// </summary> public QilIterator(QilNodeType nodeType, QilNode binding) : base(nodeType) { Binding = binding; }
/// <summary> /// Clear the name annotation on this iterator or function. /// </summary> protected override void EndScope(QilNode node) { this.ngen.ClearName(node); }
public QilNode XPathFollowing(QilNode expr) { return(f.XPathFollowing(expr)); }