本文整理汇总了C#中QilNode类的典型用法代码示例。如果您正苦于以下问题:C# QilNode类的具体用法?C# QilNode怎么用?C# QilNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QilNode类属于命名空间,在下文中一共展示了QilNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Visit
/// <summary>
/// Override the Visit method in order to scan for redundant namespaces and compute side-effect bit.
/// </summary>
protected override QilNode Visit(QilNode nd) {
if (nd != null) {
if (this[XmlILOptimization.EliminateNamespaceDecl]) {
// Eliminate redundant namespaces in the tree. Don't perform the scan on an ElementCtor which
// has already been marked as having a redundant namespace.
switch (nd.NodeType) {
case QilNodeType.QilExpression:
// Perform namespace analysis on root expression (xmlns="" is in-scope for this expression)
this.nmspAnalyzer.Analyze(((QilExpression) nd).Root, true);
break;
case QilNodeType.ElementCtor:
if (!XmlILConstructInfo.Read(nd).IsNamespaceInScope)
this.nmspAnalyzer.Analyze(nd, false);
break;
case QilNodeType.DocumentCtor:
this.nmspAnalyzer.Analyze(nd, true);
break;
}
}
}
// Continue visitation
return base.Visit(nd);
}
开发者ID:uQr,项目名称:referencesource,代码行数:29,代码来源:XmlILOptimizerVisitor.cs
示例2: QilExpression
//-----------------------------------------------
// Convenience methods
//-----------------------------------------------
public QilExpression QilExpression(QilNode root, QilFactory factory)
{
QilExpression n = new QilExpression(QilNodeType.QilExpression, root, factory);
n.XmlType = _typeCheck.CheckQilExpression(n);
TraceNode(n);
return n;
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:11,代码来源:QilFactory.cs
示例3: InvokeElementAvailable
public QilNode InvokeElementAvailable(QilNode n)
{
CheckQName(n);
return XsltInvokeEarlyBound(QName("element-available"),
XsltMethods.ElementAvailable, T.BooleanX, new QilNode[] { n }
);
}
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:XsltQilFactory.cs
示例4: ConvertReletive2Absolute
public QilNode ConvertReletive2Absolute(QilNode node, QilNode fixup) {
QilDepthChecker.Check(node);
Debug.Assert(node != null);
Debug.Assert(fixup != null);
this.fixup = fixup;
return this.Visit(node);
}
开发者ID:uQr,项目名称:referencesource,代码行数:7,代码来源:KeyMatchBuilder.cs
示例5: InvokeIsSameNodeSort
public QilNode InvokeIsSameNodeSort(QilNode n1, QilNode n2) {
CheckNodeNotRtf(n1);
CheckNodeNotRtf(n2);
return XsltInvokeEarlyBound(QName("is-same-node-sort"),
XsltMethods.IsSameNodeSort, T.BooleanX, new QilNode[] { n1, n2 }
);
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:XsltQilFactory.cs
示例6: VisitAssumeReference
//-----------------------------------------------
// QilVisitor methods (manually generated)
//-----------------------------------------------
/// <summary>
/// If a reference is passed to the Visit() method, it is assumed to be the definition.
/// This method assumes it is a reference to a definition.
/// For example, if a Let node is visited, is it the Let definition or a reference to the
/// the Let definition? Without context, it is ambiguous. This method allows a caller
/// to disambiguate.
/// </summary>
protected virtual QilNode VisitAssumeReference(QilNode expr)
{
if (expr is QilReference)
return VisitReference(expr);
return Visit(expr);
}
开发者ID:Corillian,项目名称:corefx,代码行数:18,代码来源:QilVisitor.cs
示例7: VisitChildren
/// <summary>
/// Visit all children of "parent", replacing each child with a copy of each child.
/// </summary>
protected override QilNode VisitChildren(QilNode parent)
{
// Visit children
for (int i = 0; i < parent.Count; i++)
{
QilNode child = parent[i];
// If child is a reference,
if (IsReference(parent, i))
{
// Visit the reference and substitute its copy
parent[i] = VisitReference(child);
// If no substutition found, then use original child
if (parent[i] == null)
parent[i] = child;
}
else
{
// Otherwise, visit the node and substitute its copy
parent[i] = Visit(child);
}
}
return parent;
}
开发者ID:Corillian,项目名称:corefx,代码行数:29,代码来源:QilCloneVisitor.cs
示例8: IsReference
/// <summary>
/// Visit all children of "parent". Take care to avoid circular visits.
/// </summary>
protected virtual bool IsReference(QilNode parent, int childNum) {
QilNode child = parent[childNum];
if (child != null) {
switch (child.NodeType) {
case QilNodeType.For:
case QilNodeType.Let:
case QilNodeType.Parameter:
// Is this a reference or a definition?
switch (parent.NodeType) {
case QilNodeType.Loop:
case QilNodeType.Filter:
case QilNodeType.Sort:
// Second child of these node types is a reference; first child is a definition
return childNum == 1;
case QilNodeType.GlobalVariableList:
case QilNodeType.GlobalParameterList:
case QilNodeType.FormalParameterList:
// All children of definition lists are definitions
return false;
}
// All other cases are references
return true;
case QilNodeType.Function:
// If parent is an Invoke node, then visit a reference to the function
return parent.NodeType == QilNodeType.Invoke;
}
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:37,代码来源:QilVisitor.cs
示例9: VisitChildren
//-----------------------------------------------
// QilVisitor overrides
//-----------------------------------------------
/// <summary>
/// Visit all children of "parent", replacing each child with a copy of each child.
/// </summary>
protected override QilNode VisitChildren(QilNode parent) {
XmlQueryType oldParentType = parent.XmlType;
bool recalcType = false;
// Visit children
for (int i = 0; i < parent.Count; i++) {
QilNode oldChild = parent[i], newChild;
XmlQueryType oldChildType = oldChild != null ? oldChild.XmlType : null;
// Visit child
if (IsReference(parent, i))
newChild = VisitReference(oldChild);
else
newChild = Visit(oldChild);
// Only replace child and recalculate type if oldChild != newChild or oldChild.XmlType != newChild.XmlType
if ((object) oldChild != (object) newChild || (newChild != null && (object) oldChildType != (object) newChild.XmlType)) {
recalcType = true;
parent[i] = newChild;
}
}
if (recalcType)
RecalculateType(parent, oldParentType);
return parent;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:QilReplaceVisitor.cs
示例10: Replace
public QilNode Replace(QilNode expr, QilReference lookFor, QilReference replaceBy)
{
QilDepthChecker.Check(expr);
_lookFor = lookFor;
_replaceBy = replaceBy;
return VisitAssumeReference(expr);
}
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:QilGenerator.cs
示例11: InvokeSystemProperty
public QilNode InvokeSystemProperty(QilNode n)
{
CheckQName(n);
return XsltInvokeEarlyBound(QName("system-property"),
XsltMethods.SystemProperty, T.Choice(T.DoubleX, T.StringX), new QilNode[] { n }
);
}
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:XsltQilFactory.cs
示例12: IsAnyType
public bool IsAnyType(QilNode n)
{
XmlQueryType xt = n.XmlType;
bool result = !(xt.IsStrict || xt.IsNode);
Debug.Assert(result == (xt.TypeCode == XmlTypeCode.Item || xt.TypeCode == XmlTypeCode.AnyAtomicType), "What else can it be?");
return result;
}
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:XPathQilFactory.cs
示例13: FindReplacement
/// <summary>
/// Find the replacement for a node
/// </summary>
/// <param name="n">the node to replace</param>
/// <returns>null if no replacement is found</returns>
public QilNode FindReplacement(QilNode n) {
Debug.Assert(s.Count % 2 == 0);
for (int i = s.Count-2; i >= 0; i-=2)
if (s[i] == n)
return (QilNode)s[i+1];
return null;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:12,代码来源:substitutionlist.cs
示例14: AfterVisit
/// <summary>
/// Called at the end of Visit().
/// </summary>
protected virtual void AfterVisit(QilNode node) {
QilExpression qil;
switch (node.NodeType) {
case QilNodeType.QilExpression:
// Remove all global functions, variables, and parameters from scope
qil = (QilExpression) node;
foreach (QilNode func in qil.FunctionList) EndScope(func);
foreach (QilNode var in qil.GlobalVariableList) EndScope(var);
foreach (QilNode param in qil.GlobalParameterList) EndScope(param);
break;
case QilNodeType.Function:
// Remove all formal arguments from scope
foreach (QilNode arg in ((QilFunction) node).Arguments) EndScope(arg);
break;
case QilNodeType.Loop:
case QilNodeType.Filter:
case QilNodeType.Sort:
// Remove loop iterator in scope
EndScope(((QilLoop) node).Variable);
break;
}
}
开发者ID:uQr,项目名称:referencesource,代码行数:28,代码来源:QilScopedVisitor.cs
示例15: QilFunction
//-----------------------------------------------
// Constructor
//-----------------------------------------------
/// <summary>
/// Construct a node
/// </summary>
public QilFunction(QilNodeType nodeType, QilNode arguments, QilNode definition, QilNode sideEffects, XmlQueryType resultType)
: base(nodeType) {
this.arguments = arguments;
this.definition = definition;
this.sideEffects = sideEffects;
this.xmlType = resultType;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:QilFunction.cs
示例16: EndBuild
public virtual QilNode EndBuild(QilNode result) {
Debug.Assert(inTheBuild, "StartBuild() wasn't called");
if (result == null) {
// Special door to clean builder state in exception handlers
}
inTheBuild = false;
return result;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:xpathpatternbuilder.cs
示例17: Read
/// <summary>
/// Get OptimizerPatterns annotation for the specified node. Lazily create if necessary.
/// </summary>
public static OptimizerPatterns Read(QilNode nd)
{
XmlILAnnotation ann = nd.Annotation as XmlILAnnotation;
OptimizerPatterns optPatt = (ann != null) ? ann.Patterns : null;
if (optPatt == null)
{
if (!nd.XmlType.MaybeMany)
{
// Expressions with ZeroOrOne cardinality should always report IsDocOrderDistinct and NoContainedNodes
if (s_zeroOrOneDefault == null)
{
optPatt = new OptimizerPatterns();
optPatt.AddPattern(OptimizerPatternName.IsDocOrderDistinct);
optPatt.AddPattern(OptimizerPatternName.SameDepth);
optPatt._isReadOnly = true;
s_zeroOrOneDefault = optPatt;
}
else
{
optPatt = s_zeroOrOneDefault;
}
}
else if (nd.XmlType.IsDod)
{
if (s_dodDefault == null)
{
optPatt = new OptimizerPatterns();
optPatt.AddPattern(OptimizerPatternName.IsDocOrderDistinct);
optPatt._isReadOnly = true;
s_dodDefault = optPatt;
}
else
{
optPatt = s_dodDefault;
}
}
else
{
if (s_maybeManyDefault == null)
{
optPatt = new OptimizerPatterns();
optPatt._isReadOnly = true;
s_maybeManyDefault = optPatt;
}
else
{
optPatt = s_maybeManyDefault;
}
}
}
return optPatt;
}
开发者ID:geoffkizer,项目名称:corefx,代码行数:60,代码来源:OptimizerPatterns.cs
示例18: AnalyzeDefinition
/// <summary>
/// Recursively analyze the definition of a function.
/// </summary>
private static void AnalyzeDefinition(QilNode nd)
{
Debug.Assert(XmlILConstructInfo.Read(nd).PushToWriterLast,
"Only need to analyze expressions which will be compiled in push mode.");
switch (nd.NodeType)
{
case QilNodeType.Invoke:
// Invoke node can either be compiled as IteratorThenWriter, or Writer.
// Since IteratorThenWriter involves caching the results of the function call
// and iterating over them, .tailcall cannot be used
if (XmlILConstructInfo.Read(nd).ConstructMethod == XmlILConstructMethod.Writer)
OptimizerPatterns.Write(nd).AddPattern(OptimizerPatternName.TailCall);
break;
case QilNodeType.Loop:
{
// Recursively analyze Loop return value
QilLoop ndLoop = (QilLoop)nd;
if (ndLoop.Variable.NodeType == QilNodeType.Let || !ndLoop.Variable.Binding.XmlType.MaybeMany)
AnalyzeDefinition(ndLoop.Body);
break;
}
case QilNodeType.Sequence:
{
// Recursively analyze last expression in Sequence
QilList ndSeq = (QilList)nd;
if (ndSeq.Count > 0)
AnalyzeDefinition(ndSeq[ndSeq.Count - 1]);
break;
}
case QilNodeType.Choice:
{
// Recursively analyze Choice branches
QilChoice ndChoice = (QilChoice)nd;
for (int i = 0; i < ndChoice.Branches.Count; i++)
AnalyzeDefinition(ndChoice.Branches[i]);
break;
}
case QilNodeType.Conditional:
{
// Recursively analyze Conditional branches
QilTernary ndCond = (QilTernary)nd;
AnalyzeDefinition(ndCond.Center);
AnalyzeDefinition(ndCond.Right);
break;
}
case QilNodeType.Nop:
AnalyzeDefinition(((QilUnary)nd).Child);
break;
}
}
开发者ID:Corillian,项目名称:corefx,代码行数:59,代码来源:TailCallAnalyzer.cs
示例19: VisitChildren
/// <summary>
/// Visit all children of "parent". By default, take care to avoid circular visits.
/// </summary>
protected virtual QilNode VisitChildren(QilNode parent) {
for (int i = 0; i < parent.Count; i++) {
// 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]);
}
return parent;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:QilVisitor.cs
示例20: Visit
// transparantly passing through Union and DocOrder
protected override QilNode Visit(QilNode n) {
if (
n.NodeType == QilNodeType.Union ||
n.NodeType == QilNodeType.DocOrderDistinct ||
n.NodeType == QilNodeType.Filter ||
n.NodeType == QilNodeType.Loop
) {
return base.Visit(n);
}
return n;
}
开发者ID:uQr,项目名称:referencesource,代码行数:12,代码来源:KeyMatchBuilder.cs
注:本文中的QilNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论