public override int ItemMatches(string itemToMatch) { // cache referenced items as long as the expander does not change // reference equality works for now since the expander cannot mutate its item state (hopefully it stays that way) if (_itemValueFragments == null || _expander != _containingItemSpec.Expander) { _expander = _containingItemSpec.Expander; IList <Tuple <string, I> > itemsFromCapture; bool throwaway; _expander.ExpandExpressionCapture(Capture, _containingItemSpec.ItemSpecLocation, ExpanderOptions.ExpandItems, false /* do not include null expansion results */, out throwaway, out itemsFromCapture); _itemValueFragments = itemsFromCapture.Select(i => new ValueFragment(i.Item1, ProjectPath)).ToList(); } return(_itemValueFragments.Count(v => v.ItemMatches(itemToMatch) > 0)); }
private bool InitReferencedItemsIfNecessary() { // cache referenced items as long as the expander does not change // reference equality works for now since the expander cannot mutate its item state (hopefully it stays that way) if (_referencedItems == null || _expander != _containingItemSpec.Expander) { _expander = _containingItemSpec.Expander; _expander.ExpandExpressionCapture( Capture, _containingItemSpec.ItemSpecLocation, ExpanderOptions.ExpandItems, includeNullEntries: false, isTransformExpression: out _, itemsFromCapture: out var itemsFromCapture); _referencedItems = itemsFromCapture.Select(i => new ReferencedItem(i.Value, new ValueFragment(i.Key, ProjectDirectory))).ToList(); return(true); } return(false); }
private bool InitReferencedItemsIfNecessary() { // cache referenced items as long as the expander does not change // reference equality works for now since the expander cannot mutate its item state (hopefully it stays that way) if (_referencedItems == null || _expander != _containingItemSpec.Expander) { _expander = _containingItemSpec.Expander; List <Tuple <string, I> > itemsFromCapture; bool throwaway; _expander.ExpandExpressionCapture( Capture, _containingItemSpec.ItemSpecLocation, ExpanderOptions.ExpandItems, false /* do not include null expansion results */, out throwaway, out itemsFromCapture); _referencedItems = itemsFromCapture.Select(i => new ValueFragment(i.Item1, ProjectPath)).ToList(); return(true); } return(false); }