Skip to content

Commit

Permalink
Add comments and asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson committed Apr 30, 2024
1 parent 67ae809 commit e2862e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ internal static bool IsExplicitInterfaceImplementation(this Symbol member)

internal static bool IsPartialMember(this Symbol member)
{
Debug.Assert(member.IsDefinition);
return member
is SourceOrdinaryMethodSymbol { IsPartial: true }
or SourcePropertySymbol { IsPartial: true }
Expand All @@ -555,6 +556,7 @@ internal static bool IsPartialMember(this Symbol member)

internal static bool IsPartialImplementation(this Symbol member)
{
Debug.Assert(member.IsDefinition);
return member
is SourceOrdinaryMethodSymbol { IsPartialImplementation: true }
or SourcePropertySymbol { IsPartialImplementation: true }
Expand All @@ -563,6 +565,7 @@ internal static bool IsPartialImplementation(this Symbol member)

internal static bool IsPartialDefinition(this Symbol member)
{
Debug.Assert(member.IsDefinition);
return member
is SourceOrdinaryMethodSymbol { IsPartialDefinition: true }
or SourcePropertySymbol { IsPartialDefinition: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ protected sealed override void PartialMethodChecks(BindingDiagnosticBag diagnost
/// parts of a partial method. Diagnostics are reported on the
/// implementing part, matching Dev10 behavior.
/// </summary>
/// <remarks>
/// This method is analogous to <see cref="SourcePropertySymbol.PartialPropertyChecks" />.
/// Whenever new checks are added to this method, the other method should also have those checks added, if applicable.
/// </remarks>
private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)
{
Debug.Assert(!ReferenceEquals(definition, implementation));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ internal override void AfterAddingTypeMembersChecks(ConversionsBase conversions,
}
}

/// <remarks>
/// This method is analogous to <see cref="SourceOrdinaryMethodSymbol.PartialMethodChecks(SourceOrdinaryMethodSymbol, SourceOrdinaryMethodSymbol, BindingDiagnosticBag)" />.
/// Whenever new checks are added to this method, the other method should also have those checks added, if applicable.
/// </remarks>
private void PartialPropertyChecks(SourcePropertySymbol implementation, BindingDiagnosticBag diagnostics)
{
Debug.Assert(this.IsPartialDefinition);
Expand Down

0 comments on commit e2862e2

Please sign in to comment.