private void AnalyzePriority(Compiler compiler) { if (!double.IsNaN(_priority) || _matchKey == Compiler.InvalidQueryKey) { return; } // Split Unions: TheQuery theQuery = (TheQuery)compiler.QueryStore ![this.MatchKey] !;
internal Query GetCompiledQuery(int key) { Debug.Assert(key != Compiler.InvalidQueryKey); TheQuery theQuery = this.queryStore[key]; theQuery.CompiledQuery.CheckErrors(); Query expr = Query.Clone(this.queryList[key]); expr.SetXsltContext(new XsltCompileContext(theQuery._ScopeManager, this)); return(expr); }
internal Query GetValueQuery(int key, XsltCompileContext context) { Debug.Assert(key != Compiler.InvalidQueryKey); TheQuery theQuery = this.queryStore[key]; theQuery.CompiledQuery.CheckErrors(); Query expr = this.queryList[key]; if (context == null) { context = new XsltCompileContext(theQuery._ScopeManager, this); } else { context.Reinitialize(theQuery._ScopeManager, this); } expr.SetXsltContext(context); return(expr); }
private void AnalyzePriority(Compiler compiler) { NavigatorInput input = compiler.Input; if (!Double.IsNaN(this.priority) || this.matchKey == Compiler.InvalidQueryKey) { return; } // Split Unions: TheQuery theQuery = (TheQuery)compiler.QueryStore[this.MatchKey]; CompiledXpathExpr expr = (CompiledXpathExpr)theQuery.CompiledQuery; Query query = expr.QueryTree; UnionExpr union; while ((union = query as UnionExpr) != null) { Debug.Assert(!(union.qy2 is UnionExpr), "only qy1 can be union"); TemplateAction copy = this.CloneWithoutName(); compiler.QueryStore.Add(new TheQuery( new CompiledXpathExpr(union.qy2, expr.Expression, false), theQuery._ScopeManager )); copy.matchKey = compiler.QueryStore.Count - 1; copy.priority = union.qy2.XsltDefaultPriority; compiler.AddTemplate(copy); query = union.qy1; } if (expr.QueryTree != query) { // query was splitted and we need create new TheQuery for this template compiler.QueryStore[this.MatchKey] = new TheQuery( new CompiledXpathExpr(query, expr.Expression, false), theQuery._ScopeManager ); } this.priority = query.XsltDefaultPriority; }