From b8010925d91086e63952e4a53439db7eaf7c2bd3 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Mon, 20 May 2024 14:41:14 -0700 Subject: [PATCH] Add public API --- .../Portable/Symbols/PublicModel/PropertySymbol.cs | 6 ++++++ .../Core/Portable/PublicAPI.Unshipped.txt | 2 ++ .../Core/Portable/Symbols/IPropertySymbol.cs | 12 ++++++++++++ .../VisualBasic/Portable/Symbols/PropertySymbol.vb | 14 ++++++++++++++ ...etadataAsSourceService.WrappedPropertySymbol.cs | 4 ++++ .../Symbols/CodeGenerationPropertySymbol.cs | 4 ++++ 6 files changed, 42 insertions(+) diff --git a/src/Compilers/CSharp/Portable/Symbols/PublicModel/PropertySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/PublicModel/PropertySymbol.cs index 90182156c74f3..6f969a9dae145 100644 --- a/src/Compilers/CSharp/Portable/Symbols/PublicModel/PropertySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/PublicModel/PropertySymbol.cs @@ -109,6 +109,12 @@ ImmutableArray IPropertySymbol.RefCustomModifiers RefKind IPropertySymbol.RefKind => _underlying.RefKind; +#nullable enable + IPropertySymbol? IPropertySymbol.PartialDefinitionPart => (_underlying as SourcePropertySymbol)?.PartialDefinitionPart.GetPublicSymbol(); + + IPropertySymbol? IPropertySymbol.PartialImplementationPart => (_underlying as SourcePropertySymbol)?.PartialImplementationPart.GetPublicSymbol(); +#nullable disable + #region ISymbol Members protected override void Accept(SymbolVisitor visitor) diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index e5fe82d74f013..1f8ef22613f47 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -1,5 +1,7 @@ Microsoft.CodeAnalysis.IParameterSymbol.IsParamsCollection.get -> bool Microsoft.CodeAnalysis.IParameterSymbol.IsParamsArray.get -> bool +Microsoft.CodeAnalysis.IPropertySymbol.PartialDefinitionPart.get -> Microsoft.CodeAnalysis.IPropertySymbol? +Microsoft.CodeAnalysis.IPropertySymbol.PartialImplementationPart.get -> Microsoft.CodeAnalysis.IMethodSymbol? Microsoft.CodeAnalysis.Operations.ArgumentKind.ParamCollection = 4 -> Microsoft.CodeAnalysis.Operations.ArgumentKind Microsoft.CodeAnalysis.Diagnostics.SuppressionInfo.ProgrammaticSuppressions.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Emit.InstrumentationKind.ModuleCancellation = 3 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind diff --git a/src/Compilers/Core/Portable/Symbols/IPropertySymbol.cs b/src/Compilers/Core/Portable/Symbols/IPropertySymbol.cs index 177e264f5aaa6..df699e7e8efe1 100644 --- a/src/Compilers/Core/Portable/Symbols/IPropertySymbol.cs +++ b/src/Compilers/Core/Portable/Symbols/IPropertySymbol.cs @@ -110,5 +110,17 @@ public interface IPropertySymbol : ISymbol /// The list of custom modifiers, if any, associated with the type of the property. /// ImmutableArray TypeCustomModifiers { get; } + + /// + /// If this is a partial property implementation part, returns the corresponding + /// definition part. Otherwise null. + /// + IPropertySymbol? PartialDefinitionPart { get; } + + /// + /// If this is a partial property definition part, returns the corresponding + /// implementation part. Otherwise null. + /// + IPropertySymbol? PartialImplementationPart { get; } } } diff --git a/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb index 22cdc43eb0c50..8fc082a76b298 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/PropertySymbol.vb @@ -621,6 +621,20 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property + Private ReadOnly Property IPropertySymbol_PartialDefinitionPart As IPropertySymbol Implements IPropertySymbol.PartialDefinitionPart + Get + ' Feature not supported in VB + Return Nothing + End Get + End Property + + Private ReadOnly Property IPropertySymbol_PartialImplementationPart As IPropertySymbol Implements IPropertySymbol.PartialImplementationPart + Get + ' Feature not supported in VB + Return Nothing + End Get + End Property + Public Overrides Sub Accept(visitor As SymbolVisitor) visitor.VisitProperty(Me) End Sub diff --git a/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.WrappedPropertySymbol.cs b/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.WrappedPropertySymbol.cs index b29838a199da9..26909af1aed0e 100644 --- a/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.WrappedPropertySymbol.cs +++ b/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.WrappedPropertySymbol.cs @@ -66,5 +66,9 @@ public ImmutableArray ExplicitInterfaceImplementations return this; } } + + public IPropertySymbol PartialDefinitionPart => _symbol.PartialDefinitionPart; + + public IPropertySymbol PartialImplementationPart => _symbol.PartialImplementationPart; } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs index 242f6901f374b..13fbe0c46657b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs @@ -85,4 +85,8 @@ public override TResult Accept(SymbolVisitor RefCustomModifiers => []; public ImmutableArray TypeCustomModifiers => []; + + public IPropertySymbol PartialImplementationPart => null; + + public IPropertySymbol PartialDefinitionPart => null; }