Check partial property syntax in generator

このコミットが含まれているのは:
Sergio Pedri committed 2024-10-17 21:41:43 -07:00
1 親 012d1b9d10
コミット bbb0134494
3ファイル変更
+15 -3

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

+7 -1
ファイルの表示
@@ -25,7 +25,13 @@ partial class CanvasEffectPropertyGenerator
public static bool IsCandidatePropertyDeclaration(SyntaxNode node, CancellationToken token)
{
// The node must be a property declaration with two accessors
if (node is not PropertyDeclarationSyntax { AccessorList.Accessors: { Count: 2 } accessors })
if (node is not PropertyDeclarationSyntax { AccessorList.Accessors: { Count: 2 } accessors } property)
{
return false;
}
// The property must be partial (we'll check that it's a declaration from its symbol)
if (!property.Modifiers.Any(SyntaxKind.PartialKeyword))
{
return false;
}
+6
ファイルの表示
@@ -35,6 +35,12 @@ public sealed partial class CanvasEffectPropertyGenerator : IIncrementalGenerato
return default;
}
// Ensure that the property declaration is a partial definition with no implementation
if (propertySymbol is not { IsPartialDefinition: true, PartialImplementationPart: null })
{
return default;
}
// Ensure that the containing type derives from CanvasEffect
if (!typeSymbol.InheritsFromFullyQualifiedMetadataName("ComputeSharp.D2D1.WinUI.CanvasEffect"))
{