public void Visit(IMSBuildGlob glob) { var msbuildGlob = glob as MSBuildGlob; if (msbuildGlob != null) { VisitMSBuildGlob(msbuildGlob); } var compositGlob = glob as CompositeGlob; if (compositGlob != null) { VisitCompositeGlob(compositGlob); foreach (var globPart in compositGlob.Globs) { Visit(globPart); } } var globWithGaps = glob as MSBuildGlobWithGaps; if (globWithGaps != null) { VisitGlobWithGaps(globWithGaps); Visit(globWithGaps.MainGlob); } }
/// <summary> /// Constructor /// </summary> /// <param name="mainGlob">The main glob</param> /// <param name="gaps">The gap glob</param> public MSBuildGlobWithGaps(IMSBuildGlob mainGlob, IEnumerable <IMSBuildGlob> gaps) { ErrorUtilities.VerifyThrowArgumentNull(mainGlob, nameof(mainGlob)); ErrorUtilities.VerifyThrowArgumentNull(gaps, nameof(gaps)); MainGlob = mainGlob; Gaps = new CompositeGlob(gaps); }
public static IEnumerable <MSBuildGlob> GetParsedGlobs(this IMSBuildGlob glob) { var parsedGlobVisitor = new ParsedGlobCollector(); parsedGlobVisitor.Visit(glob); return(parsedGlobVisitor.CollectedGlobs); }
internal MSBuildGlobWithGaps(IMSBuildGlob mainGlob, IMSBuildGlob gaps) { ErrorUtilities.VerifyThrowArgumentNull(mainGlob, nameof(mainGlob)); ErrorUtilities.VerifyThrowArgumentNull(gaps, nameof(gaps)); MainGlob = mainGlob; Gaps = gaps; }
public void CreateShouldReturnSingleChildUnchanged() { var glob = MSBuildGlob.Parse(""); IMSBuildGlob composite = CompositeGlob.Create(new[] { glob }); Assert.Same(glob, composite); }
public void CreateShouldReturnNewCompositeWhenMultipleProvided() { var glob1 = MSBuildGlob.Parse(""); var glob2 = MSBuildGlob.Parse(""); IMSBuildGlob result = CompositeGlob.Create(new[] { glob1, glob2 }); var composite = Assert.IsType <CompositeGlob>(result); Assert.Same(glob1, composite.Globs.First()); Assert.Same(glob2, composite.Globs.Skip(1).First()); Assert.Equal(2, composite.Globs.Count()); }
public void Visit(IMSBuildGlob glob) { if (glob is MSBuildGlob msbuildGlob) { VisitMSBuildGlob(msbuildGlob); } if (glob is CompositeGlob compositeGlob) { VisitCompositeGlob(compositeGlob); foreach (var globPart in compositeGlob.Globs) { Visit(globPart); } } if (glob is MSBuildGlobWithGaps globWithGaps) { VisitGlobWithGaps(globWithGaps); Visit(globWithGaps.MainGlob); } }
/// <summary> /// Constructor /// </summary> /// <param name="glob1">First child glob.</param> /// <param name="glob2">Second child glob.</param> internal CompositeGlob(IMSBuildGlob glob1, IMSBuildGlob glob2) : this(ImmutableArray.Create(glob1, glob2)) { }
/// <summary> /// Constructor /// </summary> /// <param name="mainGlob">The main glob</param> /// <param name="gaps">The gap glob</param> public MSBuildGlobWithGaps(IMSBuildGlob mainGlob, params IMSBuildGlob[] gaps) : this(mainGlob, gaps.AsEnumerable()) { }
public void CreateShouldHandleZeroChildren() { IMSBuildGlob composite = CompositeGlob.Create(Enumerable.Empty <IMSBuildGlob>()); Assert.False(composite.IsMatch("")); }