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"))
{
@@ -9,13 +9,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Basic.Reference.Assemblies.Net80" Version="1.7.2" />
<PackageReference Include="Basic.Reference.Assemblies.Net80" Version="1.7.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
</ItemGroup>
<ItemGroup>