Esempio n. 1
0
        private void  InitBlock()
        {
            if (expr is XPathPathExpr)
            {
                return(((XPathPathExpr)expr).eval(model, evalContext).getReferences());
            }
            else
            {
                throw new FatalException("evalNodeset: must be path expression");
            }

            Set <TreeReference> triggers = new HashSet <TreeReference>();

            getTriggers(expr, triggers, contextRef);
            return(triggers);

            if (x is XPathPathExpr)
            {
                TreeReference ref_Renamed    = ((XPathPathExpr)x).getReference();
                TreeReference contextualized = ref_Renamed;
                if (contextRef != null)
                {
                    contextualized = ref_Renamed.contextualize(contextRef);
                }

                //TODO: It's possible we should just handle this the same way as "genericize". Not entirely clear.
                if (contextualized.hasPredicates())
                {
                    contextualized = contextualized.removePredicates();
                }

                v.add(contextualized);

                for (int i = 0; i < ref_Renamed.size(); i++)
                {
                    if (predicates == null)
                    {
                        continue;
                    }

                    //we can't generate this properly without an absolute reference
                    if (!ref_Renamed.Absolute)
                    {
                        throw new System.ArgumentException("can't get triggers for relative references");
                    }
                    TreeReference predicateContext = ref_Renamed.getSubReference(i);


                    for (XPathExpression predicate: predicates)
                    {
                        getTriggers(predicate, v, predicateContext);
                    }
                }
            }
            else if (x is XPathBinaryOpExpr)
            {
                getTriggers(((XPathBinaryOpExpr)x).a, v, contextRef);
                getTriggers(((XPathBinaryOpExpr)x).b, v, contextRef);
            }
            else if (x is XPathUnaryOpExpr)
            {
                getTriggers(((XPathUnaryOpExpr)x).a, v, contextRef);
            }
            else if (x is XPathFuncExpr)
            {
                XPathFuncExpr fx = (XPathFuncExpr)x;
                for (int i = 0; i < fx.args.Length; i++)
                {
                    getTriggers(fx.args[i], v, contextRef);
                }
            }
            return(expr.pivot(model, evalContext));
        }