View over a Qil node which is the target of a reference (functions, variables, parameters).
Inheritance: QilNode
Exemplo n.º 1
0
 public QilNode Replace(QilNode expr, QilReference lookFor, QilReference replaceBy)
 {
     QilDepthChecker.Check(expr);
     _lookFor = lookFor;
     _replaceBy = replaceBy;
     return VisitAssumeReference(expr);
 }
Exemplo n.º 2
0
        //-----------------------------------------------
        // QilVisitor overrides
        //-----------------------------------------------
        /// <summary>
        /// Override certain node types in order to add additional attributes, suppress children, etc.
        /// </summary>
        protected override QilNode VisitChildren(QilNode node)
        {
            if (node is QilLiteral)
            {
                // If literal is not handled elsewhere, print its string value
                this.writer.WriteValue(Convert.ToString(((QilLiteral)node).Value, CultureInfo.InvariantCulture));
                return node;
            }
            else if (node is QilReference)
            {
                QilReference reference = (QilReference)node;

                // Write the generated identifier for this iterator
                this.writer.WriteAttributeString("id", _ngen.NameOf(node));

                // Write the debug name of this reference (if it's defined) as a "name" attribute
                if (reference.DebugName != null)
                    this.writer.WriteAttributeString("name", reference.DebugName.ToString());

                if (node.NodeType == QilNodeType.Parameter)
                {
                    // Don't visit parameter's name, or its default value if it is null
                    QilParameter param = (QilParameter)node;

                    if (param.DefaultValue != null)
                        VisitAssumeReference(param.DefaultValue);

                    return node;
                }
            }

            return base.VisitChildren(node);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Write references to functions or iterators like this: <RefTo id="$a"/>.
        /// </summary>
        protected override QilNode VisitReference(QilNode node)
        {
            QilReference reference = (QilReference)node;
            string name = _ngen.NameOf(node);
            if (name == null)
                name = "OUT-OF-SCOPE REFERENCE";

            this.writer.WriteStartElement("RefTo");
            this.writer.WriteAttributeString("id", name);
            if (reference.DebugName != null)
                this.writer.WriteAttributeString("name", reference.DebugName.ToString());
            this.writer.WriteEndElement();

            return node;
        }
 public QilNode Replace(QilNode expr, QilReference lookFor, QilReference replaceBy) {
     this.lookFor = lookFor;
     this.replaceBy = replaceBy;
     return VisitAssumeReference(expr);
 }