Skip to content

Commit 2b2f198

Browse files
authored
Merge pull request #44 from monkey0506/update-generic-symbol-reference-tree
Update GenericSymbolReferenceTree to v3.0.0
2 parents 9fc4d9b + 21cf03f commit 2b2f198

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

InterfaceReference.cs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,18 @@ CancellationToken cancellationToken
3030
)
3131
{
3232
if ((reference.Node.Parent?.Parent is not InvocationExpressionSyntax invocationExpression) ||
33-
(reference.Symbol is not INamedTypeSymbol interfaceSymbol))
33+
(reference.Symbol is not INamedTypeSymbol interfaceSymbol) ||
34+
(reference.SemanticModel.GetOperation(invocationExpression, cancellationToken) is not
35+
IInvocationOperation methodInvocation))
3436
{
3537
return null;
3638
}
37-
var semanticModel = reference.SemanticModel!;
38-
var methodInvocation = semanticModel
39-
.GetOperation(invocationExpression, cancellationToken) as IInvocationOperation;
40-
if (methodInvocation is not null)
41-
{
42-
var isInterfaceOrMethodOpenGeneric = !reference.IsSyntaxReferenceClosedTypeOrMethod ||
43-
methodInvocation.TargetMethod.TypeArguments.Any(static x => x is not INamedTypeSymbol);
44-
return new InterfaceReference
45-
(
46-
interfaceSymbol,
47-
methodInvocation,
48-
isInterfaceOrMethodOpenGeneric
49-
);
50-
}
51-
return null;
39+
return new InterfaceReference
40+
(
41+
interfaceSymbol,
42+
methodInvocation,
43+
!reference.IsSyntaxReferenceClosedTypeOrMethod
44+
);
5245
}
5346

5447
public static InterfaceReference? GetReference(IInvocationOperation invocation)

Monkeymoto.NativeGenericDelegates.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
</PackageReference>
21-
<PackageReference Include="Monkeymoto.GeneratorUtils.GenericSymbolReferenceTree" Version="2.0.1">
21+
<PackageReference Include="Monkeymoto.GeneratorUtils.GenericSymbolReferenceTree" Version="3.0.0">
2222
<PrivateAssets>all</PrivateAssets>
2323
<GeneratePathProperty>true</GeneratePathProperty>
2424
</PackageReference>

0 commit comments

Comments
 (0)