Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed May 14, 2024
1 parent b02a3f4 commit 780ebde
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ protected SourceParameterSymbol? PartialDefinitionPart
}
}

internal override SyntaxList<AttributeListSyntax> AttributeDeclarationList
internal sealed override SyntaxList<AttributeListSyntax> AttributeDeclarationList
{
get
{
Expand All @@ -520,7 +520,6 @@ internal override SyntaxList<AttributeListSyntax> AttributeDeclarationList
/// </summary>
internal virtual OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations()
{
// TODO2: should this be non-virtual and subtypes override 'AttributeDeclarationList' instead?
Debug.Assert(PartialImplementationPart is null);
if (PartialDefinitionPart is { } definitionPart)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,19 @@ public sealed override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementat

internal sealed override OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations()
{
Debug.Assert(PartialDefinitionPart is null);
if (PartialImplementationPart is { } implementation)
{
return OneOrMany.Create(AttributeDeclarationList, ((SourcePropertyAccessorSymbol)implementation).AttributeDeclarationList);
}

// If we are asking this question on a partial implementation symbol,
// it must be from a context which prefers to order implementation attributes before definition attributes.
// For example, the 'value' parameter of a set accessor.
if (PartialDefinitionPart is { } definition)
{
return OneOrMany.Create(AttributeDeclarationList, ((SourcePropertyAccessorSymbol)definition).AttributeDeclarationList);
}

return OneOrMany.Create(AttributeDeclarationList);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ protected override IAttributeTargetSymbol AttributeOwner
get { return (SourceMemberMethodSymbol)this.ContainingSymbol; }
}

internal sealed override SyntaxList<AttributeListSyntax> AttributeDeclarationList
internal override OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations()
{
get
{
var accessor = (SourcePropertyAccessorSymbol)this.ContainingSymbol;
return accessor.AttributeDeclarationList;
}
// Bind the attributes on the accessor's attribute syntax list with "param" target specifier.
var accessor = (SourceMemberMethodSymbol)this.ContainingSymbol;
return accessor.GetAttributeDeclarations();
}

internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder<SynthesizedAttributeData> attributes)
Expand Down

0 comments on commit 780ebde

Please sign in to comment.