Skip to content

Commit

Permalink
Removed (almost all) lifetimes from generic signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
Boddlnagg committed Jul 10, 2016
1 parent 96918bb commit a9c7eb8
Show file tree
Hide file tree
Showing 3 changed files with 1,442 additions and 1,443 deletions.
13 changes: 6 additions & 7 deletions Generator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ static string GetTypeName(TypeReference t, TypeUsage usage)
switch (usage)
{
case TypeUsage.Raw: return t.Name + "::Abi";
case TypeUsage.In: return t.Name + "::In";
case TypeUsage.In: return "&" + t.Name + "::In";
case TypeUsage.Out: return t.Name + "::Out";
case TypeUsage.GenericArg:
case TypeUsage.GenericArgWithLifetime:
Expand Down Expand Up @@ -716,8 +716,8 @@ static string GetElementTypeName(TypeReference t, TypeUsage usage)
switch (usage)
{
case TypeUsage.Raw: return "*mut IInspectable";
case TypeUsage.GenericArg: return "&IInspectable";
case TypeUsage.GenericArgWithLifetime: return "&'a IInspectable";
case TypeUsage.GenericArg: return "IInspectable";
case TypeUsage.GenericArgWithLifetime: return "IInspectable";
case TypeUsage.Define: throw new NotSupportedException();
case TypeUsage.In: return "&IInspectable";
case TypeUsage.Out: return "ComPtr<IInspectable>";
Expand Down Expand Up @@ -796,14 +796,13 @@ static string GetElementTypeName(TypeReference t, TypeUsage usage)

if (!t.IsValueType)
{

if (usage == TypeUsage.GenericArg || usage == TypeUsage.In)
if (usage == TypeUsage.In)
{
name = "&" + name;
}
else if (usage == TypeUsage.GenericArgWithLifetime)
else if (usage == TypeUsage.GenericArg || usage == TypeUsage.GenericArgWithLifetime)
{
name = "&'a " + name;
// leave name unchanged
}
else if (usage == TypeUsage.Raw)
{
Expand Down
Loading

0 comments on commit a9c7eb8

Please sign in to comment.