Skip to content

Commit

Permalink
System.Void -> void
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r committed Nov 2, 2019
1 parent fabfb46 commit d760546
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/PublicApiGenerator/CSharpTypeKeyword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public static string Get(string typeName)
return "string";
case "System.Boolean":
return "bool";
case "System.Void":
return "void";
default:
return typeName;
}
Expand Down
5 changes: 5 additions & 0 deletions src/PublicApiGenerator/CodeTypeReferenceBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ static string GetTypeNameCore(TypeReference type, IEnumerator<bool?> nullability
return GetTypeName(array.ElementType, nullabilityMap, NullableMode.Default, disableNested) + "[]";
}

if (type is PointerType pointer)
{
return CSharpTypeKeyword.Get(GetTypeName(pointer.ElementType, nullabilityMap, NullableMode.Default, disableNested)) + "*";
}

if (!type.IsNested || disableNested)
{
var name = type is RequiredModifierType modType ? modType.ElementType.Name : type.Name;
Expand Down
4 changes: 2 additions & 2 deletions src/PublicApiGeneratorTests/Field_modifiers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public void Include_unsafe_fields()
{
public class ClassWithUnsafeFields
{
protected unsafe System.Void* UnsafeProtectedField;
public unsafe System.Void* UnsafePublicField;
protected unsafe void* UnsafeProtectedField;
public unsafe void* UnsafePublicField;
public ClassWithUnsafeFields() { }
}
}");
Expand Down
6 changes: 3 additions & 3 deletions src/PublicApiGeneratorTests/Method_modifiers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PublicApiGeneratorTests.Examples;
using PublicApiGeneratorTests.Examples;
using Xunit;

namespace PublicApiGeneratorTests
Expand Down Expand Up @@ -98,7 +98,7 @@ public void Should_output_unsafe_modifier()
public class ClassWithUnsafeMethod
{
public ClassWithUnsafeMethod() { }
public unsafe System.Void* DoSomething() { }
public unsafe void* DoSomething() { }
}
}");
}
Expand Down Expand Up @@ -175,4 +175,4 @@ public class ClassWithUnsafeMethod
// ReSharper restore UnusedMemberHierarchy.Global
// ReSharper restore UnusedMember.Global
// ReSharper restore ClassNeverInstantiated.Global
}
}

0 comments on commit d760546

Please sign in to comment.