提交 ee5b16aa 编写于 作者: C CyrusNajmabadi

Extract type into its own file.

上级 d97d5c10
......@@ -120,6 +120,7 @@
<Compile Include="Navigation\NavigableItemFactory.DeclaredSymbolNavigableItem.cs" />
<Compile Include="Navigation\NavigableItemFactory.SymbolLocationNavigableItem.cs" />
<Compile Include="AddImport\CodeActions\PackageReference.ParentCodeAction.cs" />
<Compile Include="Shared\Utilities\PatternMatches.cs" />
<Compile Include="Remote\RemoteArguments.cs" />
<Compile Include="Structure\BlockStructureOptions.cs" />
<Compile Include="AddImport\CodeActions\SymbolReference.SymbolReferenceCodeAction.cs" />
......
......@@ -10,33 +10,6 @@
namespace Microsoft.CodeAnalysis.Shared.Utilities
{
internal struct PatternMatches
{
public static readonly PatternMatches Empty = new PatternMatches(
ImmutableArray<PatternMatch>.Empty, ImmutableArray<PatternMatch>.Empty);
public readonly ImmutableArray<PatternMatch> CandidateMatches;
public readonly ImmutableArray<PatternMatch> ContainerMatches;
public PatternMatches(ImmutableArray<PatternMatch> candidateMatches,
ImmutableArray<PatternMatch> containerMatches = default(ImmutableArray<PatternMatch>))
{
CandidateMatches = candidateMatches.NullToEmpty();
ContainerMatches = containerMatches.NullToEmpty();
}
public bool IsEmpty => CandidateMatches.IsEmpty && ContainerMatches.IsEmpty;
internal bool All(Func<PatternMatch, bool> predicate)
{
return CandidateMatches.All(predicate) && ContainerMatches.All(predicate);
}
internal bool Any(Func<PatternMatch, bool> predicate)
{
return CandidateMatches.Any(predicate) || ContainerMatches.Any(predicate);
}
}
/// <summary>
/// The pattern matcher is thread-safe. However, it maintains an internal cache of
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Immutable;
using System.Linq;
namespace Microsoft.CodeAnalysis.Shared.Utilities
{
internal struct PatternMatches
{
public static readonly PatternMatches Empty = new PatternMatches(
ImmutableArray<PatternMatch>.Empty, ImmutableArray<PatternMatch>.Empty);
public readonly ImmutableArray<PatternMatch> CandidateMatches;
public readonly ImmutableArray<PatternMatch> ContainerMatches;
public PatternMatches(ImmutableArray<PatternMatch> candidateMatches,
ImmutableArray<PatternMatch> containerMatches = default(ImmutableArray<PatternMatch>))
{
CandidateMatches = candidateMatches.NullToEmpty();
ContainerMatches = containerMatches.NullToEmpty();
}
public bool IsEmpty => CandidateMatches.IsEmpty && ContainerMatches.IsEmpty;
internal bool All(Func<PatternMatch, bool> predicate)
{
return CandidateMatches.All(predicate) && ContainerMatches.All(predicate);
}
internal bool Any(Func<PatternMatch, bool> predicate)
{
return CandidateMatches.Any(predicate) || ContainerMatches.Any(predicate);
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册