Skip to content

Commit ca97abc

Browse files
committed
Remove unused
1 parent b951adc commit ca97abc

1 file changed

Lines changed: 0 additions & 70 deletions

File tree

  • ReflectionAnalyzers/Helpers/Reflection

ReflectionAnalyzers/Helpers/Reflection/GetX.cs

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace ReflectionAnalyzers
22
{
3-
using System.Diagnostics.CodeAnalysis;
43
using System.Threading;
54

65
using Gu.Roslyn.AnalyzerExtensions;
@@ -14,51 +13,6 @@
1413
/// </summary>
1514
internal static class GetX
1615
{
17-
internal static bool TryGetNestedType(ExpressionSyntax expression, SemanticModel semanticModel, CancellationToken cancellationToken, [NotNullWhen(true)] out INamedTypeSymbol? type)
18-
{
19-
if (expression is MemberAccessExpressionSyntax memberAccess &&
20-
TryFindInvocation(memberAccess, KnownSymbol.Type.GetNestedType, semanticModel, cancellationToken, out var invocation) &&
21-
TryMatchGetNestedType(invocation, semanticModel, cancellationToken, out var nestedType, out _, out _) &&
22-
nestedType is { Match: FilterMatch.Single, Symbol: INamedTypeSymbol namedNested })
23-
{
24-
type = namedNested;
25-
return true;
26-
}
27-
28-
type = null;
29-
return false;
30-
}
31-
32-
/// <summary>
33-
/// Check if <paramref name="invocation"/> is a call to Type.GetMethod.
34-
/// </summary>
35-
internal static bool TryMatchGetConstructor(InvocationExpressionSyntax invocation, SemanticModel semanticModel, CancellationToken cancellationToken, out ReflectedMember member, out Flags flags, out Types types)
36-
{
37-
if (invocation.TryGetTarget(KnownSymbol.Type.GetConstructor, semanticModel, cancellationToken, out var getX))
38-
{
39-
if (ReflectedMember.TryGetType(invocation, semanticModel, cancellationToken, out var type, out var typeSource) &&
40-
IsKnownSignature(invocation, getX) &&
41-
Flags.TryCreate(invocation, getX, semanticModel, cancellationToken, out flags) &&
42-
Types.TryCreate(invocation, getX, semanticModel, cancellationToken, out types))
43-
{
44-
return ReflectedMember.TryCreate(getX, invocation, type, typeSource, Name.Ctor, flags.Effective, types, semanticModel.Compilation, out member);
45-
}
46-
47-
if (Flags.TryCreate(invocation, getX, semanticModel, cancellationToken, out flags) &&
48-
flags.AreInSufficient)
49-
{
50-
member = new ReflectedMember(type, typeSource, null, getX, invocation, FilterMatch.InSufficientFlags);
51-
_ = Types.TryCreate(invocation, getX, semanticModel, cancellationToken, out types);
52-
return true;
53-
}
54-
}
55-
56-
member = default;
57-
flags = default;
58-
types = default;
59-
return false;
60-
}
61-
6216
/// <summary>
6317
/// Check if <paramref name="invocation"/> is a call to Type.GetEvent.
6418
/// </summary>
@@ -116,30 +70,6 @@ internal static bool TryMatchGetProperty(InvocationExpressionSyntax invocation,
11670
return false;
11771
}
11872

119-
private static bool TryFindInvocation(MemberAccessExpressionSyntax memberAccess, QualifiedMethod expected, SemanticModel semanticModel, CancellationToken cancellationToken, [NotNullWhen(true)] out InvocationExpressionSyntax? invocation)
120-
{
121-
switch (memberAccess.Expression)
122-
{
123-
case PostfixUnaryExpressionSyntax { RawKind: (int)SyntaxKind.SuppressNullableWarningExpression, Operand: InvocationExpressionSyntax candidate }
124-
when candidate.TryGetTarget(expected, semanticModel, cancellationToken, out _):
125-
invocation = candidate;
126-
return true;
127-
case InvocationExpressionSyntax candidate
128-
when candidate.TryGetTarget(expected, semanticModel, cancellationToken, out _):
129-
invocation = candidate;
130-
return true;
131-
case IdentifierNameSyntax identifierName
132-
when semanticModel.TryGetSymbol(identifierName, cancellationToken, out ILocalSymbol? local) &&
133-
AssignedValue.FindSingle(local, semanticModel, cancellationToken) is InvocationExpressionSyntax candidate &&
134-
candidate.TryGetTarget(expected, semanticModel, cancellationToken, out _):
135-
invocation = candidate;
136-
return true;
137-
}
138-
139-
invocation = null;
140-
return false;
141-
}
142-
14373
/// <summary>
14474
/// Defensive check to only handle known cases. Don't know how the binder works.
14575
/// </summary>

0 commit comments

Comments
 (0)