Skip to content

Commit

Permalink
consider OperationKind.PropertyReference assignable if ReturnsByRef
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Kelman authored and Timur Kelman committed Jul 19, 2024
1 parent 79d6f8a commit b5ac515
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CodeConverter/CSharp/OperationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ public static bool IsAssignableExpression(this IOperation operation)
case OperationKind.DynamicMemberReference:
return true;

//Just documenting since it's the only one mentioning reference that can't necessarily be assigned to AFAIK
case OperationKind.PropertyReference:
return false;
//a property might be RefReturn, if it's defined in a referenced C# assembly
var prop = ((IPropertyReferenceOperation)operation).Property;
return prop.ReturnsByRef || prop.ReturnsByRefReadonly;
}

return false;
Expand Down

0 comments on commit b5ac515

Please sign in to comment.