예제 #1
0
        public bool TrySelector(string name)
        {
            name = ResourceHelper.GetId(Source.File.ModuleName, name);
            if (TargetObject == null || Pipeline == null || !Pipeline.Selector.TryGetValue(name, out SelectorVisitor selector))
            {
                return(false);
            }

            var annotation = TargetObject.GetAnnotation <SelectorTargetAnnotation>();

            if (annotation.TryGetSelectorResult(selector, out bool result))
            {
                return(result);
            }

            result = selector.Match(TargetObject.Value);
            annotation.SetSelectorResult(selector, result);
            return(result);
        }