Browse Source

Fix 'ref readonly' delegates

pull/1515/head
Daniel Grunwald 6 years ago
parent
commit
04ffdb6da4
  1. 3
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/RefLocalsAndReturns.cs
  2. 3
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

3
ICSharpCode.Decompiler.Tests/TestCases/Pretty/RefLocalsAndReturns.cs

@ -4,6 +4,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -4,6 +4,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
{
internal class RefLocalsAndReturns
{
public delegate ref T RefFunc<T>();
public delegate ref readonly T ReadOnlyRefFunc<T>();
public ref struct RefStruct
{
private int dummy;

3
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -1440,6 +1440,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -1440,6 +1440,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
decl.AddAnnotation(new TypeResolveResult(d));
}
decl.ReturnType = ConvertType(invokeMethod.ReturnType);
if (invokeMethod.ReturnTypeIsRefReadOnly && decl.ReturnType is ComposedType ct && ct.HasRefSpecifier) {
ct.HasReadOnlySpecifier = true;
}
decl.Name = d.Name;
int outerTypeParameterCount = (d.DeclaringTypeDefinition == null) ? 0 : d.DeclaringTypeDefinition.TypeParameterCount;

Loading…
Cancel
Save