Skip to content

Commit 807d815

Browse files
Timur KelmanTimur Kelman
authored andcommitted
actually recognize ref return properties when processing ByRef arguments
1 parent 4575a35 commit 807d815

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,16 @@ RefConversion GetRefConversion(VBSyntax.ExpressionSyntax expression)
18601860
bool IsRefArrayAcces(VBSyntax.ExpressionSyntax expression)
18611861
{
18621862
if (!(expression is VBSyntax.InvocationExpressionSyntax ies)) return false;
1863-
return _semanticModel.GetOperation(ies).IsArrayElementAccess() && GetRefConversion(ies.Expression) == RefConversion.Inline;
1863+
var op = _semanticModel.GetOperation(ies);
1864+
return (op.IsArrayElementAccess() || IsReturnsByRefPropertyElementAccess(op))
1865+
&& GetRefConversion(ies.Expression) == RefConversion.Inline;
1866+
1867+
static bool IsReturnsByRefPropertyElementAccess(IOperation op)
1868+
{
1869+
return op.IsPropertyElementAccess()
1870+
&& op is IPropertyReferenceOperation { Property: { } prop }
1871+
&& (prop.ReturnsByRef || prop.ReturnsByRefReadonly);
1872+
}
18641873
}
18651874
}
18661875

0 commit comments

Comments
 (0)