Skip to content

Commit

Permalink
fix: correct syntax in nameof clause of throw null exceptions (#1263)
Browse files Browse the repository at this point in the history
  • Loading branch information
latonz authored Apr 30, 2024
1 parent 3dad4c0 commit 3d43a6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Riok.Mapperly/Emit/Syntax/SyntaxFactoryHelper.Null.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ _ when argument is ElementAccessExpressionSyntax memberAccess
$"Sequence {NameOf(memberAccess.Expression)}, contained a null value at index {memberAccess.ArgumentList.Arguments[0].Expression}."
)
),
_ => ThrowArgumentNullException(argument),
_ when argument is MemberAccessExpressionSyntax or SimpleNameSyntax => ThrowArgumentNullException(argument),
_ when argument is InvocationExpressionSyntax invocation
=> ThrowNullReferenceException(StringLiteral(invocation.Expression + " returned null")),
_ => ThrowNullReferenceException(StringLiteral(argument + " is null")),
};
}

Expand Down

0 comments on commit 3d43a6f

Please sign in to comment.