Switched generated methods to explicit interface implementations

このコミットが含まれているのは:
Sergio Pedri committed 2021-07-21 14:09:22 +02:00
1 親 56b326a6e4
コミット bbb42e5367
6ファイル変更
+37 -34

検索条件に一致するファイルはありません

+6 -2
ファイルの表示
@@ -2,11 +2,14 @@
using System.Collections.Immutable;
using System.Diagnostics.Contracts;
using System.Linq;
using ComputeSharp.__Internals;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
#pragma warning disable CS0618
namespace ComputeSharp.SourceGenerators
{
/// <inheritdoc/>
@@ -17,7 +20,7 @@ namespace ComputeSharp.SourceGenerators
{
// This code produces a method declaration as follows:
//
// public readonly int GetDispatchId()
// readonly int IShader.GetDispatchId()
// {
// <BODY>
// }
@@ -25,7 +28,8 @@ namespace ComputeSharp.SourceGenerators
MethodDeclaration(
PredefinedType(Token(SyntaxKind.IntKeyword)),
Identifier("GetDispatchId"))
.AddModifiers(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.ReadOnlyKeyword))
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName(nameof(IShader))))
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
.WithBody(GetShaderHashCodeBody(structDeclarationSymbol));
}