Пример #1
0
        private QilNode MatchPatterns(QilIterator it, XmlQueryType xt, PatternBag patternBag, QilNode otherwise)
        {
            if (patternBag.FixedNamePatternsNames.Count == 0)
            {
                return(MatchPatterns(it, xt, patternBag.NonFixedNamePatterns, otherwise));
            }

            QilNode matcher = _f.Int32(NoMatch);

            foreach (QilName qname in patternBag.FixedNamePatternsNames)
            {
                matcher = _f.Conditional(_f.Eq(_f.NameOf(it), qname.ShallowClone(_f.BaseFactory)),
                                         MatchPatterns(it, patternBag.FixedNamePatterns[qname]),
                                         matcher
                                         );
            }

            matcher = MatchPatternsWhosePriorityGreater(it, patternBag.NonFixedNamePatterns, matcher);
            return(_f.Conditional(_f.IsType(it, xt), matcher, otherwise));
        }