-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ID2D1Shader.EffectDisplayName property
- Loading branch information
1 parent
86dc363
commit 1feec3a
Showing
4 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.EffectDisplayName.Syntax.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using ComputeSharp.D2D1.__Internals; | ||
using ComputeSharp.SourceGeneration.Models; | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; | ||
|
||
#pragma warning disable CS0618 | ||
|
||
namespace ComputeSharp.D2D1.SourceGenerators; | ||
|
||
/// <inheritdoc/> | ||
partial class ID2D1ShaderGenerator | ||
{ | ||
/// <inheritdoc/> | ||
partial class EffectDisplayName | ||
{ | ||
/// <summary> | ||
/// Creates a <see cref="PropertyDeclarationSyntax"/> instance for the <c>EffectDisplayName</c> property. | ||
/// </summary> | ||
/// <param name="info">The input <see cref="HierarchyInfo"/> instance.</param> | ||
/// <returns>The resulting <see cref="PropertyDeclarationSyntax"/> instance for the <c>EffectDisplayName</c> property.</returns> | ||
public static PropertyDeclarationSyntax GetSyntax(HierarchyInfo info) | ||
{ | ||
// This code produces a method declaration as follows: | ||
// | ||
// readonly string global::ComputeSharp.D2D1.__Internals.ID2D1Shader.EffectDisplayName => "<FULLY_QUALIFIED_NAME>"; | ||
return | ||
PropertyDeclaration(PredefinedType(Token(SyntaxKind.StringKeyword)), Identifier(nameof(EffectDisplayName))) | ||
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}"))) | ||
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword)) | ||
.WithExpressionBody(ArrowExpressionClause(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(info.FullyQualifiedMetadataName)))) | ||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters