Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions InterfaceReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,18 @@ CancellationToken cancellationToken
)
{
if ((reference.Node.Parent?.Parent is not InvocationExpressionSyntax invocationExpression) ||
(reference.Symbol is not INamedTypeSymbol interfaceSymbol))
(reference.Symbol is not INamedTypeSymbol interfaceSymbol) ||
(reference.SemanticModel.GetOperation(invocationExpression, cancellationToken) is not
IInvocationOperation methodInvocation))
{
return null;
}
var semanticModel = reference.SemanticModel!;
var methodInvocation = semanticModel
.GetOperation(invocationExpression, cancellationToken) as IInvocationOperation;
if (methodInvocation is not null)
{
var isInterfaceOrMethodOpenGeneric = !reference.IsSyntaxReferenceClosedTypeOrMethod ||
methodInvocation.TargetMethod.TypeArguments.Any(static x => x is not INamedTypeSymbol);
return new InterfaceReference
(
interfaceSymbol,
methodInvocation,
isInterfaceOrMethodOpenGeneric
);
}
return null;
return new InterfaceReference
(
interfaceSymbol,
methodInvocation,
!reference.IsSyntaxReferenceClosedTypeOrMethod
);
}

public static InterfaceReference? GetReference(IInvocationOperation invocation)
Expand Down
2 changes: 1 addition & 1 deletion Monkeymoto.NativeGenericDelegates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Monkeymoto.GeneratorUtils.GenericSymbolReferenceTree" Version="2.0.1">
<PackageReference Include="Monkeymoto.GeneratorUtils.GenericSymbolReferenceTree" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<GeneratePathProperty>true</GeneratePathProperty>
</PackageReference>
Expand Down