Skip to content

Commit

Permalink
Assert non-null return values from MethodSymbol.Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Jun 17, 2021
1 parent b17b219 commit 856df7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public sealed override ImmutableArray<ParameterSymbol> Parameters
{
get
{
return _parameters;
Debug.Assert(!_parameters.IsDefault, $"Expected {nameof(InitializeParameters)} prior to accessing this property.");
return _parameters.NullToEmpty();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ public override ImmutableArray<ParameterSymbol> Parameters
{
get
{
if (_parameters.IsEmpty)
Debug.Assert(!_parameters.IsDefault, $"Expected {nameof(SetParameters)} prior to accessing this property.");
if (_parameters.IsDefault)
{
return ImmutableArray<ParameterSymbol>.Empty;
}
Expand Down

0 comments on commit 856df7f

Please sign in to comment.