コード例 #1
0
            public bool IsMatching(DeclarationCondition dc, ResolutionContext ctxt)
            {
                if (ctxt.CancelOperation)
                {
                    return(true);
                }
                var r = true;

                if (dc is NegatedDeclarationCondition)
                {
                    var ng = (NegatedDeclarationCondition)dc;
                    if (ng.FirstCondition is StaticIfCondition)
                    {
                        if (!conditionsBeingChecked.Contains(ng.FirstCondition))
                        {
                            conditionsBeingChecked.Add(ng.FirstCondition);
                        }
                        else
                        {
                            return(false);
                        }

                        r = !GlobalFlags.IsMatching((StaticIfCondition)ng.FirstCondition, ctxt);

                        conditionsBeingChecked.Remove(ng.FirstCondition);
                    }
                    else
                    {
                        r = ((GlobalFlags == null || GlobalFlags.IsMatching(dc, ctxt)) &&
                             (LocalFlags == null || LocalFlags.IsMatching(dc, ctxt)));
                    }
                }
                else
                {
                    if (dc is StaticIfCondition)
                    {
                        if (!conditionsBeingChecked.Contains(dc))
                        {
                            conditionsBeingChecked.Add(dc);
                        }
                        else
                        {
                            return(false);
                        }

                        r = GlobalFlags.IsMatching((StaticIfCondition)dc, ctxt);

                        conditionsBeingChecked.Remove(dc);
                    }
                    else
                    {
                        r = (GlobalFlags.IsMatching(dc, ctxt) || LocalFlags.IsMatching(dc, ctxt));
                    }
                }
                return(r);
            }