Skip to content

Commit

Permalink
handle ReturnsByRef methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Kelman authored and Timur Kelman committed Jul 24, 2024
1 parent 41bda28 commit 151526a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CodeConverter/CSharp/ExpressionNodeVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,14 +1884,14 @@ private RefConversion NeedsVariableForArgument(VBasic.Syntax.ArgumentSyntax node
RefConversion GetRefConversion(VBSyntax.ExpressionSyntax expression)
{
var symbolInfo = GetSymbolInfoInDocument<ISymbol>(expression);
if (symbolInfo is IPropertySymbol propertySymbol
// a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
&& !propertySymbol.ReturnsByRef && !propertySymbol.ReturnsByRefReadonly) {
if (symbolInfo is IPropertySymbol { ReturnsByRef: false, ReturnsByRefReadonly: false } propertySymbol) {
// a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
return propertySymbol.IsReadOnly ? RefConversion.PreAssigment : RefConversion.PreAndPostAssignment;
}
else if (symbolInfo is IFieldSymbol { IsConst: true } or ILocalSymbol { IsConst: true }) {
return RefConversion.PreAssigment;
} else if (symbolInfo is IMethodSymbol) {
} else if (symbolInfo is IMethodSymbol { ReturnsByRef: false, ReturnsByRefReadonly: false }) {
// a method in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
return RefConversion.PreAssigment;
}

Expand Down

0 comments on commit 151526a

Please sign in to comment.