Skip to content

Commit 151526a

Browse files
Timur KelmanTimur Kelman
authored andcommitted
handle ReturnsByRef methods
1 parent 41bda28 commit 151526a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,14 +1884,14 @@ private RefConversion NeedsVariableForArgument(VBasic.Syntax.ArgumentSyntax node
18841884
RefConversion GetRefConversion(VBSyntax.ExpressionSyntax expression)
18851885
{
18861886
var symbolInfo = GetSymbolInfoInDocument<ISymbol>(expression);
1887-
if (symbolInfo is IPropertySymbol propertySymbol
1888-
// a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
1889-
&& !propertySymbol.ReturnsByRef && !propertySymbol.ReturnsByRefReadonly) {
1887+
if (symbolInfo is IPropertySymbol { ReturnsByRef: false, ReturnsByRefReadonly: false } propertySymbol) {
1888+
// a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
18901889
return propertySymbol.IsReadOnly ? RefConversion.PreAssigment : RefConversion.PreAndPostAssignment;
18911890
}
18921891
else if (symbolInfo is IFieldSymbol { IsConst: true } or ILocalSymbol { IsConst: true }) {
18931892
return RefConversion.PreAssigment;
1894-
} else if (symbolInfo is IMethodSymbol) {
1893+
} else if (symbolInfo is IMethodSymbol { ReturnsByRef: false, ReturnsByRefReadonly: false }) {
1894+
// a method in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references
18951895
return RefConversion.PreAssigment;
18961896
}
18971897

0 commit comments

Comments
 (0)