Skip to content

Commit

Permalink
Add void primitive (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
HurricanKai committed Aug 13, 2022
1 parent 204c7df commit 46dc2b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public PrimitiveTypeResolver(TypeStore typeStore) : base(typeStore)
{
}

private static ExternalTypeReference CreateExternalTypeRef(string @namespace, string name)
=> new ExternalTypeReference(new IdentifierSymbol(@namespace), new IdentifierSymbol(name));
private static ExternalTypeReference CreateExternalTypeRef(string? @namespace, string name)
=> new ExternalTypeReference(@namespace is not null ? new IdentifierSymbol(@namespace) : null, new IdentifierSymbol(name));
private static readonly Dictionary<string, TypeReference> _typeMap = new Dictionary<string, TypeReference>()
{
["bool"] = CreateExternalTypeRef("System", "Boolean"),
Expand All @@ -35,6 +35,7 @@ private static ExternalTypeReference CreateExternalTypeRef(string @namespace, st
["ulong"] = CreateExternalTypeRef("System", "UInt64"),
["short"] = CreateExternalTypeRef("System", "Int16"),
["ushort"] = CreateExternalTypeRef("System", "UInt16"),
["void"] = CreateExternalTypeRef(null, "void")
};

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public sealed class PrimitiveTypeResolverTests
InlineData("ulong", "System", "UInt64"),
InlineData("short", "System", "Int16"),
InlineData("ushort", "System", "UInt16"),
InlineData("void", null, "void"),
]
public void ShouldResolve(string text, string @namespace, string identifier)
public void ShouldResolve(string text, string? @namespace, string identifier)
{
var symbol = new UnresolvedTypeReference(text);
var output = new PrimitiveTypeResolver(new TypeStore());
Expand Down

0 comments on commit 46dc2b8

Please sign in to comment.